Loading modules/ldap/util_ldap_cache.c +38 −30 Changes for modules/ldap/util_ldap_cache.c: 38 added lines, 30 removed lines. Original line number Diff line number Diff line Loading @@ -33,22 +33,22 @@ unsigned long util_ldap_url_node_hash(void *n) { util_url_node_t *node = (util_url_node_t *)n; util_url_node_t *node = n; return util_ald_hash_string(1, node->url); } int util_ldap_url_node_compare(void *a, void *b) { util_url_node_t *na = (util_url_node_t *)a; util_url_node_t *nb = (util_url_node_t *)b; util_url_node_t *na = a; util_url_node_t *nb = b; return (strcmp(na->url, nb->url) == 0); } void *util_ldap_url_node_copy(util_ald_cache_t *cache, void *c) { util_url_node_t *n = (util_url_node_t *)c; util_url_node_t *node = (util_url_node_t *)util_ald_alloc(cache, sizeof(util_url_node_t)); util_url_node_t *n = c; util_url_node_t *node = util_ald_alloc(cache, sizeof *node); if (node) { if (!(node->url = util_ald_strdup(cache, n->url))) { Loading @@ -67,7 +67,7 @@ void *util_ldap_url_node_copy(util_ald_cache_t *cache, void *c) void util_ldap_url_node_free(util_ald_cache_t *cache, void *n) { util_url_node_t *node = (util_url_node_t *)n; util_url_node_t *node = n; util_ald_free(cache, node->url); util_ald_destroy_cache(node->search_cache); Loading @@ -78,7 +78,7 @@ void util_ldap_url_node_free(util_ald_cache_t *cache, void *n) void util_ldap_url_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_url_node_t *node = (util_url_node_t *)n; util_url_node_t *node = n; char date_str[APR_CTIME_LEN+1]; char *buf; const char *type_str; Loading Loading @@ -135,20 +135,22 @@ void util_ldap_url_node_display(request_rec *r, util_ald_cache_t *cache, void *n /* Cache functions for search nodes */ unsigned long util_ldap_search_node_hash(void *n) { util_search_node_t *node = (util_search_node_t *)n; return util_ald_hash_string(1, ((util_search_node_t *)(node))->username); util_search_node_t *node = n; return util_ald_hash_string(1, node->username); } int util_ldap_search_node_compare(void *a, void *b) { return(strcmp(((util_search_node_t *)a)->username, ((util_search_node_t *)b)->username) == 0); util_search_node_t *na = a; util_search_node_t *nb = b; return (strcmp(na->username, nb->username) == 0); } void *util_ldap_search_node_copy(util_ald_cache_t *cache, void *c) { util_search_node_t *node = (util_search_node_t *)c; util_search_node_t *newnode = util_ald_alloc(cache, sizeof(util_search_node_t)); util_search_node_t *node = c; util_search_node_t *newnode = util_ald_alloc(cache, sizeof *newnode); /* safety check */ if (newnode) { Loading Loading @@ -199,8 +201,9 @@ void *util_ldap_search_node_copy(util_ald_cache_t *cache, void *c) void util_ldap_search_node_free(util_ald_cache_t *cache, void *n) { int i = 0; util_search_node_t *node = (util_search_node_t *)n; util_search_node_t *node = n; int k = node->numvals; if (node->vals) { for (;k;k--,i++) { if (node->vals[i]) { Loading @@ -217,7 +220,7 @@ void util_ldap_search_node_free(util_ald_cache_t *cache, void *n) void util_ldap_search_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_search_node_t *node = (util_search_node_t *)n; util_search_node_t *node = n; char date_str[APR_CTIME_LEN+1]; char *buf; Loading @@ -240,14 +243,15 @@ void util_ldap_search_node_display(request_rec *r, util_ald_cache_t *cache, void unsigned long util_ldap_compare_node_hash(void *n) { util_compare_node_t *node = (util_compare_node_t *)n; util_compare_node_t *node = n; return util_ald_hash_string(3, node->dn, node->attrib, node->value); } int util_ldap_compare_node_compare(void *a, void *b) { util_compare_node_t *na = (util_compare_node_t *)a; util_compare_node_t *nb = (util_compare_node_t *)b; util_compare_node_t *na = a; util_compare_node_t *nb = b; return (strcmp(na->dn, nb->dn) == 0 && strcmp(na->attrib, nb->attrib) == 0 && strcmp(na->value, nb->value) == 0); Loading @@ -255,8 +259,8 @@ int util_ldap_compare_node_compare(void *a, void *b) void *util_ldap_compare_node_copy(util_ald_cache_t *cache, void *c) { util_compare_node_t *n = (util_compare_node_t *)c; util_compare_node_t *node = (util_compare_node_t *)util_ald_alloc(cache, sizeof(util_compare_node_t)); util_compare_node_t *n = c; util_compare_node_t *node = util_ald_alloc(cache, sizeof *node); if (node) { if (!(node->dn = util_ald_strdup(cache, n->dn)) || Loading @@ -276,7 +280,7 @@ void *util_ldap_compare_node_copy(util_ald_cache_t *cache, void *c) void util_ldap_compare_node_free(util_ald_cache_t *cache, void *n) { util_compare_node_t *node = (util_compare_node_t *)n; util_compare_node_t *node = n; util_ald_free(cache, node->dn); util_ald_free(cache, node->attrib); util_ald_free(cache, node->value); Loading @@ -285,7 +289,7 @@ void util_ldap_compare_node_free(util_ald_cache_t *cache, void *n) void util_ldap_compare_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_compare_node_t *node = (util_compare_node_t *)n; util_compare_node_t *node = n; char date_str[APR_CTIME_LEN+1]; char *buf, *cmp_result; Loading Loading @@ -322,19 +326,23 @@ void util_ldap_compare_node_display(request_rec *r, util_ald_cache_t *cache, voi unsigned long util_ldap_dn_compare_node_hash(void *n) { return util_ald_hash_string(1, ((util_dn_compare_node_t *)n)->reqdn); util_dn_compare_node_t *node = n; return util_ald_hash_string(1, node->reqdn); } int util_ldap_dn_compare_node_compare(void *a, void *b) { return (strcmp(((util_dn_compare_node_t *)a)->reqdn, ((util_dn_compare_node_t *)b)->reqdn) == 0); util_dn_compare_node_t *na = a; util_dn_compare_node_t *nb = b; return (strcmp(na->reqdn, nb->reqdn) == 0); } void *util_ldap_dn_compare_node_copy(util_ald_cache_t *cache, void *c) { util_dn_compare_node_t *n = (util_dn_compare_node_t *)c; util_dn_compare_node_t *node = (util_dn_compare_node_t *)util_ald_alloc(cache, sizeof(util_dn_compare_node_t)); util_dn_compare_node_t *n = c; util_dn_compare_node_t *node = util_ald_alloc(cache, sizeof *node); if (node) { if (!(node->reqdn = util_ald_strdup(cache, n->reqdn)) || !(node->dn = util_ald_strdup(cache, n->dn))) { Loading @@ -350,7 +358,7 @@ void *util_ldap_dn_compare_node_copy(util_ald_cache_t *cache, void *c) void util_ldap_dn_compare_node_free(util_ald_cache_t *cache, void *n) { util_dn_compare_node_t *node = (util_dn_compare_node_t *)n; util_dn_compare_node_t *node = n; util_ald_free(cache, node->reqdn); util_ald_free(cache, node->dn); util_ald_free(cache, node); Loading @@ -358,7 +366,7 @@ void util_ldap_dn_compare_node_free(util_ald_cache_t *cache, void *n) void util_ldap_dn_compare_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_dn_compare_node_t *node = (util_dn_compare_node_t *)n; util_dn_compare_node_t *node = n; char *buf; buf = apr_psprintf(r->pool, Loading @@ -376,7 +384,7 @@ void util_ldap_dn_compare_node_display(request_rec *r, util_ald_cache_t *cache, /* ------------------------------------------------------------------ */ static apr_status_t util_ldap_cache_module_kill(void *data) { util_ldap_state_t *st = (util_ldap_state_t *)data; util_ldap_state_t *st = data; util_ald_destroy_cache(st->util_ldap_cache); #if APR_HAS_SHARED_MEMORY Loading Loading
modules/ldap/util_ldap_cache.c +38 −30 Changes for modules/ldap/util_ldap_cache.c: 38 added lines, 30 removed lines. Original line number Diff line number Diff line Loading @@ -33,22 +33,22 @@ unsigned long util_ldap_url_node_hash(void *n) { util_url_node_t *node = (util_url_node_t *)n; util_url_node_t *node = n; return util_ald_hash_string(1, node->url); } int util_ldap_url_node_compare(void *a, void *b) { util_url_node_t *na = (util_url_node_t *)a; util_url_node_t *nb = (util_url_node_t *)b; util_url_node_t *na = a; util_url_node_t *nb = b; return (strcmp(na->url, nb->url) == 0); } void *util_ldap_url_node_copy(util_ald_cache_t *cache, void *c) { util_url_node_t *n = (util_url_node_t *)c; util_url_node_t *node = (util_url_node_t *)util_ald_alloc(cache, sizeof(util_url_node_t)); util_url_node_t *n = c; util_url_node_t *node = util_ald_alloc(cache, sizeof *node); if (node) { if (!(node->url = util_ald_strdup(cache, n->url))) { Loading @@ -67,7 +67,7 @@ void *util_ldap_url_node_copy(util_ald_cache_t *cache, void *c) void util_ldap_url_node_free(util_ald_cache_t *cache, void *n) { util_url_node_t *node = (util_url_node_t *)n; util_url_node_t *node = n; util_ald_free(cache, node->url); util_ald_destroy_cache(node->search_cache); Loading @@ -78,7 +78,7 @@ void util_ldap_url_node_free(util_ald_cache_t *cache, void *n) void util_ldap_url_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_url_node_t *node = (util_url_node_t *)n; util_url_node_t *node = n; char date_str[APR_CTIME_LEN+1]; char *buf; const char *type_str; Loading Loading @@ -135,20 +135,22 @@ void util_ldap_url_node_display(request_rec *r, util_ald_cache_t *cache, void *n /* Cache functions for search nodes */ unsigned long util_ldap_search_node_hash(void *n) { util_search_node_t *node = (util_search_node_t *)n; return util_ald_hash_string(1, ((util_search_node_t *)(node))->username); util_search_node_t *node = n; return util_ald_hash_string(1, node->username); } int util_ldap_search_node_compare(void *a, void *b) { return(strcmp(((util_search_node_t *)a)->username, ((util_search_node_t *)b)->username) == 0); util_search_node_t *na = a; util_search_node_t *nb = b; return (strcmp(na->username, nb->username) == 0); } void *util_ldap_search_node_copy(util_ald_cache_t *cache, void *c) { util_search_node_t *node = (util_search_node_t *)c; util_search_node_t *newnode = util_ald_alloc(cache, sizeof(util_search_node_t)); util_search_node_t *node = c; util_search_node_t *newnode = util_ald_alloc(cache, sizeof *newnode); /* safety check */ if (newnode) { Loading Loading @@ -199,8 +201,9 @@ void *util_ldap_search_node_copy(util_ald_cache_t *cache, void *c) void util_ldap_search_node_free(util_ald_cache_t *cache, void *n) { int i = 0; util_search_node_t *node = (util_search_node_t *)n; util_search_node_t *node = n; int k = node->numvals; if (node->vals) { for (;k;k--,i++) { if (node->vals[i]) { Loading @@ -217,7 +220,7 @@ void util_ldap_search_node_free(util_ald_cache_t *cache, void *n) void util_ldap_search_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_search_node_t *node = (util_search_node_t *)n; util_search_node_t *node = n; char date_str[APR_CTIME_LEN+1]; char *buf; Loading @@ -240,14 +243,15 @@ void util_ldap_search_node_display(request_rec *r, util_ald_cache_t *cache, void unsigned long util_ldap_compare_node_hash(void *n) { util_compare_node_t *node = (util_compare_node_t *)n; util_compare_node_t *node = n; return util_ald_hash_string(3, node->dn, node->attrib, node->value); } int util_ldap_compare_node_compare(void *a, void *b) { util_compare_node_t *na = (util_compare_node_t *)a; util_compare_node_t *nb = (util_compare_node_t *)b; util_compare_node_t *na = a; util_compare_node_t *nb = b; return (strcmp(na->dn, nb->dn) == 0 && strcmp(na->attrib, nb->attrib) == 0 && strcmp(na->value, nb->value) == 0); Loading @@ -255,8 +259,8 @@ int util_ldap_compare_node_compare(void *a, void *b) void *util_ldap_compare_node_copy(util_ald_cache_t *cache, void *c) { util_compare_node_t *n = (util_compare_node_t *)c; util_compare_node_t *node = (util_compare_node_t *)util_ald_alloc(cache, sizeof(util_compare_node_t)); util_compare_node_t *n = c; util_compare_node_t *node = util_ald_alloc(cache, sizeof *node); if (node) { if (!(node->dn = util_ald_strdup(cache, n->dn)) || Loading @@ -276,7 +280,7 @@ void *util_ldap_compare_node_copy(util_ald_cache_t *cache, void *c) void util_ldap_compare_node_free(util_ald_cache_t *cache, void *n) { util_compare_node_t *node = (util_compare_node_t *)n; util_compare_node_t *node = n; util_ald_free(cache, node->dn); util_ald_free(cache, node->attrib); util_ald_free(cache, node->value); Loading @@ -285,7 +289,7 @@ void util_ldap_compare_node_free(util_ald_cache_t *cache, void *n) void util_ldap_compare_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_compare_node_t *node = (util_compare_node_t *)n; util_compare_node_t *node = n; char date_str[APR_CTIME_LEN+1]; char *buf, *cmp_result; Loading Loading @@ -322,19 +326,23 @@ void util_ldap_compare_node_display(request_rec *r, util_ald_cache_t *cache, voi unsigned long util_ldap_dn_compare_node_hash(void *n) { return util_ald_hash_string(1, ((util_dn_compare_node_t *)n)->reqdn); util_dn_compare_node_t *node = n; return util_ald_hash_string(1, node->reqdn); } int util_ldap_dn_compare_node_compare(void *a, void *b) { return (strcmp(((util_dn_compare_node_t *)a)->reqdn, ((util_dn_compare_node_t *)b)->reqdn) == 0); util_dn_compare_node_t *na = a; util_dn_compare_node_t *nb = b; return (strcmp(na->reqdn, nb->reqdn) == 0); } void *util_ldap_dn_compare_node_copy(util_ald_cache_t *cache, void *c) { util_dn_compare_node_t *n = (util_dn_compare_node_t *)c; util_dn_compare_node_t *node = (util_dn_compare_node_t *)util_ald_alloc(cache, sizeof(util_dn_compare_node_t)); util_dn_compare_node_t *n = c; util_dn_compare_node_t *node = util_ald_alloc(cache, sizeof *node); if (node) { if (!(node->reqdn = util_ald_strdup(cache, n->reqdn)) || !(node->dn = util_ald_strdup(cache, n->dn))) { Loading @@ -350,7 +358,7 @@ void *util_ldap_dn_compare_node_copy(util_ald_cache_t *cache, void *c) void util_ldap_dn_compare_node_free(util_ald_cache_t *cache, void *n) { util_dn_compare_node_t *node = (util_dn_compare_node_t *)n; util_dn_compare_node_t *node = n; util_ald_free(cache, node->reqdn); util_ald_free(cache, node->dn); util_ald_free(cache, node); Loading @@ -358,7 +366,7 @@ void util_ldap_dn_compare_node_free(util_ald_cache_t *cache, void *n) void util_ldap_dn_compare_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_dn_compare_node_t *node = (util_dn_compare_node_t *)n; util_dn_compare_node_t *node = n; char *buf; buf = apr_psprintf(r->pool, Loading @@ -376,7 +384,7 @@ void util_ldap_dn_compare_node_display(request_rec *r, util_ald_cache_t *cache, /* ------------------------------------------------------------------ */ static apr_status_t util_ldap_cache_module_kill(void *data) { util_ldap_state_t *st = (util_ldap_state_t *)data; util_ldap_state_t *st = data; util_ald_destroy_cache(st->util_ldap_cache); #if APR_HAS_SHARED_MEMORY Loading