mirror of
https://github.com/apache/httpd.git
synced 2025-08-05 16:55:50 +03:00
Add specified user attributes to the environment when using
mod_auth_ldap. This allows you to use mod_include to embed specified user attributes in a page like so: Hello <!--#echo var="AUTHENTICATE_CN"-->, how are you? PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90775 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -127,16 +127,52 @@ void *util_ldap_search_node_copy(void *c)
|
||||
{
|
||||
util_search_node_t *node = (util_search_node_t *)c;
|
||||
util_search_node_t *newnode = util_ald_alloc(sizeof(util_search_node_t));
|
||||
newnode->username = util_ald_strdup(node->username);
|
||||
newnode->dn = util_ald_strdup(node->dn);
|
||||
newnode->bindpw = util_ald_strdup(node->bindpw);
|
||||
newnode->lastbind = node->lastbind;
|
||||
|
||||
/* safety check */
|
||||
if (newnode) {
|
||||
|
||||
/* copy vals */
|
||||
if (node->vals) {
|
||||
int k = 0;
|
||||
int i = 0;
|
||||
while (node->vals[k++]);
|
||||
if (!(newnode->vals = util_ald_alloc(sizeof(char *) * (k+1)))) {
|
||||
util_ldap_search_node_free(newnode);
|
||||
return NULL;
|
||||
}
|
||||
while (node->vals[i]) {
|
||||
if (!(newnode->vals[i] = util_ald_strdup(node->vals[i]))) {
|
||||
util_ldap_search_node_free(newnode);
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
newnode->vals = NULL;
|
||||
}
|
||||
if (!(newnode->username = util_ald_strdup(node->username)) ||
|
||||
!(newnode->dn = util_ald_strdup(node->dn)) ||
|
||||
!(newnode->bindpw = util_ald_strdup(node->bindpw)) ) {
|
||||
util_ldap_search_node_free(newnode);
|
||||
return NULL;
|
||||
}
|
||||
newnode->lastbind = node->lastbind;
|
||||
|
||||
}
|
||||
return (void *)newnode;
|
||||
}
|
||||
|
||||
void util_ldap_search_node_free(void *n)
|
||||
{
|
||||
int i = 0;
|
||||
util_search_node_t *node = (util_search_node_t *)n;
|
||||
if (node->vals) {
|
||||
while (node->vals[i]) {
|
||||
util_ald_free(node->vals[i++]);
|
||||
}
|
||||
util_ald_free(node->vals);
|
||||
}
|
||||
util_ald_free(node->username);
|
||||
util_ald_free(node->dn);
|
||||
util_ald_free(node->bindpw);
|
||||
|
Reference in New Issue
Block a user