View | Details | Raw Unified | Return to bug 18756
Collapse All | Expand All

(-)include/util_ldap.h (-3 / +15 lines)
Lines 65-70 Link Here
65
#include <apr_thread_rwlock.h>
65
#include <apr_thread_rwlock.h>
66
#include <apr_tables.h>
66
#include <apr_tables.h>
67
#include <apr_time.h>
67
#include <apr_time.h>
68
#include <apr_shm.h>
69
#include <apr_rmm.h>
68
70
69
/* Apache header files */
71
/* Apache header files */
70
#include "ap_config.h"
72
#include "ap_config.h"
Lines 140-145 Link Here
140
    apr_thread_mutex_t *mutex;          /* mutex lock for the connection list */
142
    apr_thread_mutex_t *mutex;          /* mutex lock for the connection list */
141
#endif
143
#endif
142
144
145
/* LDAP shm */
146
#if APR_HAS_SHARED_MEMORY
147
    const char *shm_file;
148
    apr_shm_t *util_ldap_shm;
149
    apr_rmm_t *util_ldap_rmm;
150
#endif
151
152
    /* LDAP cache */      
153
    void *ldap_cache;
154
    
143
    apr_size_t cache_bytes;     /* Size (in bytes) of shared memory cache */
155
    apr_size_t cache_bytes;     /* Size (in bytes) of shared memory cache */
144
    long search_cache_ttl;      /* TTL for search cache */
156
    long search_cache_ttl;      /* TTL for search cache */
145
    long search_cache_size;     /* Size (in entries) of search cache */
157
    long search_cache_size;     /* Size (in entries) of search cache */
Lines 291-297 Link Here
291
 *         apr_smmem_init() call. Regardless of the status, the cache
303
 *         apr_smmem_init() call. Regardless of the status, the cache
292
 *         will be set up at least for in-process or in-thread operation.
304
 *         will be set up at least for in-process or in-thread operation.
293
 */
305
 */
294
apr_status_t util_ldap_cache_init(apr_pool_t *pool, apr_size_t reqsize);
306
apr_status_t util_ldap_cache_init(void *data);
295
307
296
/**
308
/**
297
 * Display formatted stats for cache
309
 * Display formatted stats for cache
Lines 300-306 Link Here
300
 *      various stats about the cache.
312
 *      various stats about the cache.
301
 * @deffunc char *util_ald_cache_display(apr_pool_t *pool)
313
 * @deffunc char *util_ald_cache_display(apr_pool_t *pool)
302
 */
314
 */
303
char *util_ald_cache_display(apr_pool_t *pool);
315
char *util_ald_cache_display(apr_pool_t *pool, void *ldap_cache);
304
316
305
317
306
/* from apr_ldap_cache_mgr.c */
318
/* from apr_ldap_cache_mgr.c */
Lines 312-318 Link Here
312
 *      various stats about the cache.
324
 *      various stats about the cache.
313
 * @deffunc char *util_ald_cache_display(apr_pool_t *pool)
325
 * @deffunc char *util_ald_cache_display(apr_pool_t *pool)
314
 */
326
 */
315
char *util_ald_cache_display(apr_pool_t *pool);
327
char *util_ald_cache_display(apr_pool_t *pool, void *ldap_cache);
316
328
317
#endif /* APU_HAS_LDAP */
329
#endif /* APU_HAS_LDAP */
318
#endif /* UTIL_LDAP_H */
330
#endif /* UTIL_LDAP_H */
(-)modules/experimental/util_ldap.c (-29 / +48 lines)
Lines 141-146 Link Here
141
 */
141
 */
142
int util_ldap_handler(request_rec *r)
142
int util_ldap_handler(request_rec *r)
143
{
143
{
144
    util_ldap_state_t *st = (util_ldap_state_t *)ap_get_module_config(
145
    				r->server->module_config, &ldap_module);
144
146
145
    r->allowed |= (1 << M_GET);
147
    r->allowed |= (1 << M_GET);
146
    if (r->method_number != M_GET)
148
    if (r->method_number != M_GET)
Lines 171-177 Link Here
171
             "</tr>\n", r
173
             "</tr>\n", r
172
            );
174
            );
173
175
174
    ap_rputs(util_ald_cache_display(r->pool), r);
176
    ap_rputs(util_ald_cache_display(r->pool, st->ldap_cache), r);
175
177
176
    ap_rputs("</table>\n</p>\n", r);
178
    ap_rputs("</table>\n</p>\n", r);
177
179
Lines 517-523 Link Here
517
    LDAP_CACHE_WRLOCK();
519
    LDAP_CACHE_WRLOCK();
518
520
519
    curnode.url = url;
521
    curnode.url = url;
520
    curl = util_ald_cache_fetch(util_ldap_cache, &curnode);
522
    curl = util_ald_cache_fetch(st->ldap_cache, &curnode);
521
    if (curl == NULL) {
523
    if (curl == NULL) {
522
        curl = util_ald_create_caches(st, url);
524
        curl = util_ald_create_caches(st, url);
523
    }
525
    }
Lines 596-602 Link Here
596
            LDAP_CACHE_RDLOCK();
598
            LDAP_CACHE_RDLOCK();
597
            newnode.reqdn = (char *)reqdn;
599
            newnode.reqdn = (char *)reqdn;
598
            newnode.dn = (char *)dn;
600
            newnode.dn = (char *)dn;
599
            util_ald_cache_insert(curl->dn_compare_cache, &newnode);
601
            util_ald_cache_insert(st, curl->dn_compare_cache, &newnode);
600
            LDAP_CACHE_UNLOCK();
602
            LDAP_CACHE_UNLOCK();
601
        }
603
        }
602
        ldc->reason = "DN Comparison TRUE (checked on server)";
604
        ldc->reason = "DN Comparison TRUE (checked on server)";
Lines 637-643 Link Here
637
    /* get cache entry (or create one) */
639
    /* get cache entry (or create one) */
638
    LDAP_CACHE_WRLOCK();
640
    LDAP_CACHE_WRLOCK();
639
    curnode.url = url;
641
    curnode.url = url;
640
    curl = util_ald_cache_fetch(util_ldap_cache, &curnode);
642
    curl = util_ald_cache_fetch(st->ldap_cache, &curnode);
641
    if (curl == NULL) {
643
    if (curl == NULL) {
642
        curl = util_ald_create_caches(st, url);
644
        curl = util_ald_create_caches(st, url);
643
    }
645
    }
Lines 659-665 Link Here
659
            /* found it... */
661
            /* found it... */
660
            if (curtime - compare_nodep->lastcompare > st->compare_cache_ttl) {
662
            if (curtime - compare_nodep->lastcompare > st->compare_cache_ttl) {
661
                /* ...but it is too old */
663
                /* ...but it is too old */
662
                util_ald_cache_remove(curl->compare_cache, compare_nodep);
664
                util_ald_cache_remove(st, curl->compare_cache, compare_nodep);
663
            }
665
            }
664
            else {
666
            else {
665
                /* ...and it is good */
667
                /* ...and it is good */
Lines 714-720 Link Here
714
            LDAP_CACHE_WRLOCK();
716
            LDAP_CACHE_WRLOCK();
715
            the_compare_node.lastcompare = curtime;
717
            the_compare_node.lastcompare = curtime;
716
            the_compare_node.result = result;
718
            the_compare_node.result = result;
717
            util_ald_cache_insert(curl->compare_cache, &the_compare_node);
719
            util_ald_cache_insert(st, curl->compare_cache, &the_compare_node);
718
            LDAP_CACHE_UNLOCK();
720
            LDAP_CACHE_UNLOCK();
719
        }
721
        }
720
        if (LDAP_COMPARE_TRUE == result) {
722
        if (LDAP_COMPARE_TRUE == result) {
Lines 760-766 Link Here
760
    /* Get the cache node for this url */
762
    /* Get the cache node for this url */
761
    LDAP_CACHE_WRLOCK();
763
    LDAP_CACHE_WRLOCK();
762
    curnode.url = url;
764
    curnode.url = url;
763
    curl = (util_url_node_t *)util_ald_cache_fetch(util_ldap_cache, &curnode);
765
    curl = (util_url_node_t *)util_ald_cache_fetch(st->ldap_cache, &curnode);
764
    if (curl == NULL) {
766
    if (curl == NULL) {
765
        curl = util_ald_create_caches(st, url);
767
        curl = util_ald_create_caches(st, url);
766
    }
768
    }
Lines 781-791 Link Here
781
             */
783
             */
782
            if ((curtime - search_nodep->lastbind) > st->search_cache_ttl) {
784
            if ((curtime - search_nodep->lastbind) > st->search_cache_ttl) {
783
                /* ...but entry is too old */
785
                /* ...but entry is too old */
784
                util_ald_cache_remove(curl->search_cache, search_nodep);
786
                util_ald_cache_remove(st, curl->search_cache, search_nodep);
785
            }
787
            }
786
            else if (strcmp(search_nodep->bindpw, bindpw) != 0) {
788
            else if (strcmp(search_nodep->bindpw, bindpw) != 0) {
787
    	    /* ...but cached password doesn't match sent password */
789
    	    /* ...but cached password doesn't match sent password */
788
                util_ald_cache_remove(curl->search_cache, search_nodep);
790
                util_ald_cache_remove(st, curl->search_cache, search_nodep);
789
            }
791
            }
790
            else {
792
            else {
791
                /* ...and entry is valid */
793
                /* ...and entry is valid */
Lines 920-926 Link Here
920
    the_search_node.lastbind = apr_time_now();
922
    the_search_node.lastbind = apr_time_now();
921
    the_search_node.vals = vals;
923
    the_search_node.vals = vals;
922
    if (curl) {
924
    if (curl) {
923
        util_ald_cache_insert(curl->search_cache, &the_search_node);
925
        util_ald_cache_insert(st, curl->search_cache, &the_search_node);
924
    }
926
    }
925
    ldap_msgfree(res);
927
    ldap_msgfree(res);
926
    LDAP_CACHE_UNLOCK();
928
    LDAP_CACHE_UNLOCK();
Lines 1044-1049 Link Here
1044
    return(NULL);
1046
    return(NULL);
1045
}
1047
}
1046
1048
1049
static const char *util_ldap_set_shm_file(cmd_parms *cmd, void *dummy, const char *file)
1050
{
1051
    util_ldap_state_t *st = 
1052
        (util_ldap_state_t *)ap_get_module_config(cmd->server->module_config, 
1053
						  &ldap_module);
1054
1055
    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, cmd->server, 
1056
                      "LDAP: Shm Session Cache file - %s", 
1057
                       file);
1058
1059
    st->shm_file = apr_pstrdup(cmd->pool, file);
1060
1061
    return(NULL);
1062
}
1047
1063
1048
const char *util_ldap_set_cert_type(cmd_parms *cmd, void *dummy, const char *Type)
1064
const char *util_ldap_set_cert_type(cmd_parms *cmd, void *dummy, const char *Type)
1049
{
1065
{
Lines 1091-1112 Link Here
1091
    return st;
1107
    return st;
1092
}
1108
}
1093
1109
1094
static void util_ldap_init_module(apr_pool_t *pool, server_rec *s)
1095
{
1096
    util_ldap_state_t *st = 
1097
        (util_ldap_state_t *)ap_get_module_config(s->module_config, 
1098
						  &ldap_module);
1099
1100
    apr_status_t result = util_ldap_cache_init(pool, st->cache_bytes);
1101
    char buf[MAX_STRING_LEN];
1102
1103
    apr_strerror(result, buf, sizeof(buf));
1104
    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, result, s, 
1105
                      "[%d] ldap cache init: %s", 
1106
                      getpid(), buf);
1107
}
1108
1109
1110
static apr_status_t util_ldap_cleanup_module(void *data)
1110
static apr_status_t util_ldap_cleanup_module(void *data)
1111
{
1111
{
1112
    server_rec *s = data;
1112
    server_rec *s = data;
Lines 1128-1138 Link Here
1128
                                 apr_pool_t *ptemp, server_rec *s)
1128
                                 apr_pool_t *ptemp, server_rec *s)
1129
{
1129
{
1130
    int rc = LDAP_SUCCESS;
1130
    int rc = LDAP_SUCCESS;
1131
1131
    
1132
    apr_status_t result;
1133
    char buf[MAX_STRING_LEN];
1134
    
1132
    util_ldap_state_t *st = (util_ldap_state_t *)ap_get_module_config(
1135
    util_ldap_state_t *st = (util_ldap_state_t *)ap_get_module_config(
1133
                                                s->module_config, 
1136
                                                s->module_config, 
1134
                                                &ldap_module);
1137
                                                &ldap_module);
1135
1138
1139
1136
        /* log the LDAP SDK used 
1140
        /* log the LDAP SDK used 
1137
        */
1141
        */
1138
    #if APR_HAS_NETSCAPE_LDAPSDK 
1142
    #if APR_HAS_NETSCAPE_LDAPSDK 
Lines 1161-1168 Link Here
1161
1165
1162
    #endif /* APR_HAS_NETSCAPE_LDAPSDK */
1166
    #endif /* APR_HAS_NETSCAPE_LDAPSDK */
1163
1167
1168
    /* initializing cache
1169
    */
1170
    if (!st->util_ldap_shm) {
1171
	    result = util_ldap_cache_init(st);
1172
	    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, result, s, "LDAP: using file: %s for shm cache", st->shm_file);
1173
    
1174
	    apr_strerror(result, buf, sizeof(buf));
1175
	    ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, result, s, 
1176
	                      "[%d] ldap cache init: %s", 
1177
	                      getpid(), buf);
1178
    }
1164
1179
1165
1180
    /* register cleanup
1181
    */
1166
    apr_pool_cleanup_register(p, s, util_ldap_cleanup_module,
1182
    apr_pool_cleanup_register(p, s, util_ldap_cleanup_module,
1167
                              util_ldap_cleanup_module); 
1183
                              util_ldap_cleanup_module); 
1168
1184
Lines 1325-1337 Link Here
1325
                 "    DER_FILE      - file in binary DER format "
1341
                 "    DER_FILE      - file in binary DER format "
1326
                 "    BASE64_FILE   - file in Base64 format "
1342
                 "    BASE64_FILE   - file in Base64 format "
1327
                 "    CERT7_DB_PATH - Netscape certificate database file "),
1343
                 "    CERT7_DB_PATH - Netscape certificate database file "),
1344
1345
    AP_INIT_TAKE1("LDAPShmCacheFile", util_ldap_set_shm_file, NULL, RSRC_CONF,
1346
                 "Set the file used by shared memory for LDAP cache"),
1347
1328
    {NULL}
1348
    {NULL}
1329
};
1349
};
1330
1350
1331
static void util_ldap_register_hooks(apr_pool_t *p)
1351
static void util_ldap_register_hooks(apr_pool_t *p)
1332
{
1352
{
1333
    ap_hook_post_config(util_ldap_post_config,NULL,NULL,APR_HOOK_MIDDLE);
1353
    ap_hook_post_config(util_ldap_post_config,NULL,NULL,APR_HOOK_MIDDLE);
1334
    ap_hook_child_init(util_ldap_init_module, NULL, NULL, APR_HOOK_MIDDLE);
1335
    ap_hook_handler(util_ldap_handler, NULL, NULL, APR_HOOK_MIDDLE);
1354
    ap_hook_handler(util_ldap_handler, NULL, NULL, APR_HOOK_MIDDLE);
1336
}
1355
}
1337
1356
(-)modules/experimental/util_ldap_cache.c (-71 / +87 lines)
Lines 66-74 Link Here
66
66
67
#ifdef APU_HAS_LDAP
67
#ifdef APU_HAS_LDAP
68
68
69
#define MODLDAP_SHMEM_CACHE "/tmp/mod_ldap_cache"
70
71
72
/* ------------------------------------------------------------------ */
69
/* ------------------------------------------------------------------ */
73
70
74
unsigned long util_ldap_url_node_hash(void *n)
71
unsigned long util_ldap_url_node_hash(void *n)
Lines 85-98 Link Here
85
    return(strcmp(na->url, nb->url) == 0);
82
    return(strcmp(na->url, nb->url) == 0);
86
}
83
}
87
84
88
void *util_ldap_url_node_copy(void *c)
85
void *util_ldap_url_node_copy(util_ldap_state_t *st, void *c)
89
{
86
{
90
    util_url_node_t *n = (util_url_node_t *)c;
87
    util_url_node_t *n = (util_url_node_t *)c;
91
    util_url_node_t *node = (util_url_node_t *)util_ald_alloc(sizeof(util_url_node_t));
88
    util_url_node_t *node = (util_url_node_t *)util_ald_alloc(st, sizeof(util_url_node_t));
92
89
93
    if (node) {
90
    if (node) {
94
        if (!(node->url = util_ald_strdup(n->url))) {
91
        if (!(node->url = util_ald_strdup(st, n->url))) {
95
            util_ald_free(node->url);
92
            util_ald_free(st, node->url);
96
            return NULL;
93
            return NULL;
97
        }
94
        }
98
        node->search_cache = n->search_cache;
95
        node->search_cache = n->search_cache;
Lines 105-119 Link Here
105
    }
102
    }
106
}
103
}
107
104
108
void util_ldap_url_node_free(void *n)
105
void util_ldap_url_node_free(util_ldap_state_t *st, void *n)
109
{
106
{
110
    util_url_node_t *node = (util_url_node_t *)n;
107
    util_url_node_t *node = (util_url_node_t *)n;
111
108
112
    util_ald_free(node->url);
109
    util_ald_free(st, node->url);
113
    util_ald_destroy_cache(node->search_cache);
110
    util_ald_destroy_cache(st, node->search_cache);
114
    util_ald_destroy_cache(node->compare_cache);
111
    util_ald_destroy_cache(st, node->compare_cache);
115
    util_ald_destroy_cache(node->dn_compare_cache);
112
    util_ald_destroy_cache(st, node->dn_compare_cache);
116
    util_ald_free(node);
113
    util_ald_free(st, node);
117
}
114
}
118
115
119
/* ------------------------------------------------------------------ */
116
/* ------------------------------------------------------------------ */
Lines 131-140 Link Here
131
		  ((util_search_node_t *)b)->username) == 0);
128
		  ((util_search_node_t *)b)->username) == 0);
132
}
129
}
133
130
134
void *util_ldap_search_node_copy(void *c)
131
void *util_ldap_search_node_copy(util_ldap_state_t *st, void *c)
135
{
132
{
136
    util_search_node_t *node = (util_search_node_t *)c;
133
    util_search_node_t *node = (util_search_node_t *)c;
137
    util_search_node_t *newnode = util_ald_alloc(sizeof(util_search_node_t));
134
    util_search_node_t *newnode = util_ald_alloc(st, sizeof(util_search_node_t));
138
135
139
    /* safety check */
136
    /* safety check */
140
    if (newnode) {
137
    if (newnode) {
Lines 144-156 Link Here
144
            int k = 0;
141
            int k = 0;
145
            int i = 0;
142
            int i = 0;
146
            while (node->vals[k++]);
143
            while (node->vals[k++]);
147
            if (!(newnode->vals = util_ald_alloc(sizeof(char *) * (k+1)))) {
144
            if (!(newnode->vals = util_ald_alloc(st, sizeof(char *) * (k+1)))) {
148
                util_ldap_search_node_free(newnode);
145
                util_ldap_search_node_free(st, newnode);
149
                return NULL;
146
                return NULL;
150
            }
147
            }
151
            while (node->vals[i]) {
148
            while (node->vals[i]) {
152
                if (!(newnode->vals[i] = util_ald_strdup(node->vals[i]))) {
149
                if (!(newnode->vals[i] = util_ald_strdup(st, node->vals[i]))) {
153
                    util_ldap_search_node_free(newnode);
150
                    util_ldap_search_node_free(st, newnode);
154
                    return NULL;
151
                    return NULL;
155
                }
152
                }
156
                i++;
153
                i++;
Lines 159-168 Link Here
159
        else {
156
        else {
160
            newnode->vals = NULL;
157
            newnode->vals = NULL;
161
        }
158
        }
162
        if (!(newnode->username = util_ald_strdup(node->username)) ||
159
        if (!(newnode->username = util_ald_strdup(st, node->username)) ||
163
            !(newnode->dn = util_ald_strdup(node->dn)) ||
160
            !(newnode->dn = util_ald_strdup(st, node->dn)) ||
164
            !(newnode->bindpw = util_ald_strdup(node->bindpw)) ) {
161
            !(newnode->bindpw = util_ald_strdup(st, node->bindpw)) ) {
165
            util_ldap_search_node_free(newnode);
162
            util_ldap_search_node_free(st, newnode);
166
            return NULL;
163
            return NULL;
167
        }
164
        }
168
        newnode->lastbind = node->lastbind;
165
        newnode->lastbind = node->lastbind;
Lines 171-190 Link Here
171
    return (void *)newnode;
168
    return (void *)newnode;
172
}
169
}
173
170
174
void util_ldap_search_node_free(void *n)
171
void util_ldap_search_node_free(util_ldap_state_t *st, void *n)
175
{
172
{
176
    int i = 0;
173
    int i = 0;
177
    util_search_node_t *node = (util_search_node_t *)n;
174
    util_search_node_t *node = (util_search_node_t *)n;
178
    if (node->vals) {
175
    if (node->vals) {
179
        while (node->vals[i]) {
176
        while (node->vals[i]) {
180
            util_ald_free(node->vals[i++]);
177
            util_ald_free(st, node->vals[i++]);
181
        }
178
        }
182
        util_ald_free(node->vals);
179
        util_ald_free(st, node->vals);
183
    }
180
    }
184
    util_ald_free(node->username);
181
    util_ald_free(st, node->username);
185
    util_ald_free(node->dn);
182
    util_ald_free(st, node->dn);
186
    util_ald_free(node->bindpw);
183
    util_ald_free(st, node->bindpw);
187
    util_ald_free(node);
184
    util_ald_free(st, node);
188
}
185
}
189
186
190
/* ------------------------------------------------------------------ */
187
/* ------------------------------------------------------------------ */
Lines 204-219 Link Here
204
	    strcmp(na->value, nb->value) == 0);
201
	    strcmp(na->value, nb->value) == 0);
205
}
202
}
206
203
207
void *util_ldap_compare_node_copy(void *c)
204
void *util_ldap_compare_node_copy(util_ldap_state_t *st, void *c)
208
{
205
{
209
    util_compare_node_t *n = (util_compare_node_t *)c;
206
    util_compare_node_t *n = (util_compare_node_t *)c;
210
    util_compare_node_t *node = (util_compare_node_t *)util_ald_alloc(sizeof(util_compare_node_t));
207
    util_compare_node_t *node = (util_compare_node_t *)util_ald_alloc(st, sizeof(util_compare_node_t));
211
208
212
    if (node) {
209
    if (node) {
213
        if (!(node->dn = util_ald_strdup(n->dn)) ||
210
        if (!(node->dn = util_ald_strdup(st, n->dn)) ||
214
            !(node->attrib = util_ald_strdup(n->attrib)) ||
211
            !(node->attrib = util_ald_strdup(st, n->attrib)) ||
215
            !(node->value = util_ald_strdup(n->value))) {
212
            !(node->value = util_ald_strdup(st, n->value))) {
216
            util_ldap_compare_node_free(node);
213
            util_ldap_compare_node_free(st, node);
217
            return NULL;
214
            return NULL;
218
        }
215
        }
219
        node->lastcompare = n->lastcompare;
216
        node->lastcompare = n->lastcompare;
Lines 225-237 Link Here
225
    }
222
    }
226
}
223
}
227
224
228
void util_ldap_compare_node_free(void *n)
225
void util_ldap_compare_node_free(util_ldap_state_t *st, void *n)
229
{
226
{
230
    util_compare_node_t *node = (util_compare_node_t *)n;
227
    util_compare_node_t *node = (util_compare_node_t *)n;
231
    util_ald_free(node->dn);
228
    util_ald_free(st, node->dn);
232
    util_ald_free(node->attrib);
229
    util_ald_free(st, node->attrib);
233
    util_ald_free(node->value);
230
    util_ald_free(st, node->value);
234
    util_ald_free(node);
231
    util_ald_free(st, node);
235
}
232
}
236
233
237
/* ------------------------------------------------------------------ */
234
/* ------------------------------------------------------------------ */
Lines 247-260 Link Here
247
		   ((util_dn_compare_node_t *)b)->reqdn) == 0);
244
		   ((util_dn_compare_node_t *)b)->reqdn) == 0);
248
}
245
}
249
246
250
void *util_ldap_dn_compare_node_copy(void *c)
247
void *util_ldap_dn_compare_node_copy(util_ldap_state_t *st, void *c)
251
{
248
{
252
    util_dn_compare_node_t *n = (util_dn_compare_node_t *)c;
249
    util_dn_compare_node_t *n = (util_dn_compare_node_t *)c;
253
    util_dn_compare_node_t *node = (util_dn_compare_node_t *)util_ald_alloc(sizeof(util_dn_compare_node_t));
250
    util_dn_compare_node_t *node = (util_dn_compare_node_t *)util_ald_alloc(st, sizeof(util_dn_compare_node_t));
254
    if (node) {
251
    if (node) {
255
        if (!(node->reqdn = util_ald_strdup(n->reqdn)) ||
252
        if (!(node->reqdn = util_ald_strdup(st, n->reqdn)) ||
256
            !(node->dn = util_ald_strdup(n->dn))) {
253
            !(node->dn = util_ald_strdup(st, n->dn))) {
257
            util_ldap_dn_compare_node_free(node);
254
            util_ldap_dn_compare_node_free(st, node);
258
            return NULL;
255
            return NULL;
259
        }
256
        }
260
        return node;
257
        return node;
Lines 264-275 Link Here
264
    }
261
    }
265
}
262
}
266
263
267
void util_ldap_dn_compare_node_free(void *n)
264
void util_ldap_dn_compare_node_free(util_ldap_state_t *st, void *n)
268
{
265
{
269
    util_dn_compare_node_t *node = (util_dn_compare_node_t *)n;
266
    util_dn_compare_node_t *node = (util_dn_compare_node_t *)n;
270
    util_ald_free(node->reqdn);
267
    util_ald_free(st, node->reqdn);
271
    util_ald_free(node->dn);
268
    util_ald_free(st, node->dn);
272
    util_ald_free(node);
269
    util_ald_free(st, node);
273
}
270
}
274
271
275
272
Lines 279-324 Link Here
279
276
280
apr_status_t util_ldap_cache_module_kill(void *data)
277
apr_status_t util_ldap_cache_module_kill(void *data)
281
{
278
{
279
    util_ldap_state_t *st = (util_ldap_state_t *) data;
280
281
    if (!st) {
282
    	return -1;
283
    }    
284
282
#if APR_HAS_SHARED_MEMORY
285
#if APR_HAS_SHARED_MEMORY
283
    if (util_ldap_shm != NULL) {
286
    if (st->util_ldap_shm != NULL) {
284
        apr_status_t result = apr_shm_destroy(util_ldap_shm);
287
        apr_status_t result = apr_shm_destroy(st->util_ldap_shm);
285
        util_ldap_shm = NULL;
288
        st->util_ldap_shm = NULL;
289
        
290
        /* Remove cache file */
291
        unlink(st->shm_file);
286
        return result;
292
        return result;
287
    }
293
    }
288
#endif
294
#endif
289
    util_ald_destroy_cache(util_ldap_cache);
295
    util_ald_destroy_cache(st, st->ldap_cache);
290
    return APR_SUCCESS;
296
    return APR_SUCCESS;
291
}
297
}
292
298
293
apr_status_t util_ldap_cache_init(apr_pool_t *pool, apr_size_t reqsize)
299
apr_status_t util_ldap_cache_init(void *data)
294
{
300
{
301
    util_ldap_state_t *st = (util_ldap_state_t *) data;
302
303
    if (!st) {
304
    	return -1;
305
    }
306
295
#if APR_HAS_SHARED_MEMORY
307
#if APR_HAS_SHARED_MEMORY
296
    apr_status_t result;
308
    apr_status_t result;
309
    char *filename = NULL;
310
    
311
    /* if no cache file specified - create default */
312
    if (!st->shm_file) {
313
	    filename = (char *)apr_psprintf(st->pool, "logs/ldap_cache");
314
    }	    
315
    
316
    filename = st->shm_file;	    
317
    st->shm_file = ap_server_root_relative(st->pool, filename);
318
319
    result = apr_shm_create(&(st->util_ldap_shm), st->cache_bytes, st->shm_file, st->pool);
297
320
298
    result = apr_shm_create(&util_ldap_shm, reqsize, MODLDAP_SHMEM_CACHE, pool);
299
    if (result == EEXIST) {
300
        /*
301
         * The cache could have already been created (i.e. we may be a child process).  See
302
         * if we can attach to the existing shared memory
303
         */
304
        result = apr_shm_attach(&util_ldap_shm, MODLDAP_SHMEM_CACHE, pool);
305
    } 
306
    if (result != APR_SUCCESS) {
321
    if (result != APR_SUCCESS) {
307
        return result;
322
        return result;
308
    }
323
    }
309
324
310
    /* This will create a rmm "handler" to get into the shared memory area */
325
    /* This will create a rmm "handler" to get into the shared memory area */
311
    apr_rmm_init(&util_ldap_rmm, NULL,
326
    apr_rmm_init(&(st->util_ldap_rmm), NULL,
312
			(void *)apr_shm_baseaddr_get(util_ldap_shm), reqsize, pool);
327
			(void *)apr_shm_baseaddr_get(st->util_ldap_shm), st->cache_bytes, st->pool);
313
#endif
328
#endif
314
329
315
    apr_pool_cleanup_register(pool, NULL, util_ldap_cache_module_kill, apr_pool_cleanup_null);
330
    apr_pool_cleanup_register(st->pool, NULL, util_ldap_cache_module_kill, apr_pool_cleanup_null);
316
331
317
    util_ldap_cache = util_ald_create_cache(50,
332
    st->ldap_cache = (util_ald_cache_t *) util_ald_create_cache(st,
318
				     util_ldap_url_node_hash,
333
    					     50,
319
				     util_ldap_url_node_compare,
334
					     util_ldap_url_node_hash,
320
				     util_ldap_url_node_copy,
335
					     util_ldap_url_node_compare,
321
				     util_ldap_url_node_free);
336
					     util_ldap_url_node_copy,
337
					     util_ldap_url_node_free);
322
    return APR_SUCCESS;
338
    return APR_SUCCESS;
323
}
339
}
324
340
(-)modules/experimental/util_ldap_cache.h (-26 / +22 lines)
Lines 1-3 Link Here
1
1
/* ====================================================================
2
/* ====================================================================
2
 * The Apache Software License, Version 1.1
3
 * The Apache Software License, Version 1.1
3
 *
4
 *
Lines 85-92 Link Here
85
    apr_time_t marktime;	/* Time that the cache became 3/4 full */
86
    apr_time_t marktime;	/* Time that the cache became 3/4 full */
86
    unsigned long (*hash)(void *);  /* Func to hash the payload */
87
    unsigned long (*hash)(void *);  /* Func to hash the payload */
87
    int (*compare)(void *, void *); /* Func to compare two payloads */
88
    int (*compare)(void *, void *); /* Func to compare two payloads */
88
    void * (*copy)(void *);	/* Func to alloc mem and copy payload to new mem */
89
    void * (*copy)(util_ldap_state_t *, void *);	/* Func to alloc mem and copy payload to new mem */
89
    void (*free)(void *);	/* Func to free mem used by the payload */
90
    void (*free)(util_ldap_state_t *, void *);	/* Func to free mem used by the payload */
90
    util_cache_node_t **nodes;
91
    util_cache_node_t **nodes;
91
92
92
    unsigned long numpurges;	/* No. of times the cache has been purged */
93
    unsigned long numpurges;	/* No. of times the cache has been purged */
Lines 102-113 Link Here
102
    unsigned long removes;	/* Number of removes */
103
    unsigned long removes;	/* Number of removes */
103
} util_ald_cache_t;
104
} util_ald_cache_t;
104
105
105
#if APR_HAS_SHARED_MEMORY
106
apr_shm_t *util_ldap_shm;
107
apr_rmm_t *util_ldap_rmm;
108
#endif
109
util_ald_cache_t *util_ldap_cache;
110
111
#if APR_HAS_THREADS
106
#if APR_HAS_THREADS
112
apr_thread_rwlock_t *util_ldap_cache_lock;
107
apr_thread_rwlock_t *util_ldap_cache_lock;
113
#define LDAP_CACHE_LOCK_CREATE(p) \
108
#define LDAP_CACHE_LOCK_CREATE(p) \
Lines 192-230 Link Here
192
/* util_ldap_cache.c */
187
/* util_ldap_cache.c */
193
unsigned long util_ldap_url_node_hash(void *n);
188
unsigned long util_ldap_url_node_hash(void *n);
194
int util_ldap_url_node_compare(void *a, void *b);
189
int util_ldap_url_node_compare(void *a, void *b);
195
void *util_ldap_url_node_copy(void *c);
190
void *util_ldap_url_node_copy(util_ldap_state_t *st, void *c);
196
void util_ldap_url_node_free(void *n);
191
void util_ldap_url_node_free(util_ldap_state_t *st, void *n);
197
unsigned long util_ldap_search_node_hash(void *n);
192
unsigned long util_ldap_search_node_hash(void *n);
198
int util_ldap_search_node_compare(void *a, void *b);
193
int util_ldap_search_node_compare(void *a, void *b);
199
void *util_ldap_search_node_copy(void *c);
194
void *util_ldap_search_node_copy(util_ldap_state_t *st, void *c);
200
void util_ldap_search_node_free(void *n);
195
void util_ldap_search_node_free(util_ldap_state_t *st, void *n);
201
unsigned long util_ldap_compare_node_hash(void *n);
196
unsigned long util_ldap_compare_node_hash(void *n);
202
int util_ldap_compare_node_compare(void *a, void *b);
197
int util_ldap_compare_node_compare(void *a, void *b);
203
void *util_ldap_compare_node_copy(void *c);
198
void *util_ldap_compare_node_copy(util_ldap_state_t *st, void *c);
204
void util_ldap_compare_node_free(void *n);
199
void util_ldap_compare_node_free(util_ldap_state_t *st, void *n);
205
unsigned long util_ldap_dn_compare_node_hash(void *n);
200
unsigned long util_ldap_dn_compare_node_hash(void *n);
206
int util_ldap_dn_compare_node_compare(void *a, void *b);
201
int util_ldap_dn_compare_node_compare(void *a, void *b);
207
void *util_ldap_dn_compare_node_copy(void *c);
202
void *util_ldap_dn_compare_node_copy(util_ldap_state_t *st, void *c);
208
void util_ldap_dn_compare_node_free(void *n);
203
void util_ldap_dn_compare_node_free(util_ldap_state_t *st, void *n);
209
204
210
205
211
/* util_ldap_cache_mgr.c */
206
/* util_ldap_cache_mgr.c */
212
207
213
void util_ald_free(const void *ptr);
208
void util_ald_free(util_ldap_state_t *st, const void *ptr);
214
void *util_ald_alloc(unsigned long size);
209
void *util_ald_alloc(util_ldap_state_t *st, unsigned long size);
215
const char *util_ald_strdup(const char *s);
210
const char *util_ald_strdup(util_ldap_state_t *st, const char *s);
216
unsigned long util_ald_hash_string(int nstr, ...);
211
unsigned long util_ald_hash_string(int nstr, ...);
217
void util_ald_cache_purge(util_ald_cache_t *cache);
212
void util_ald_cache_purge(util_ldap_state_t *st);
218
util_url_node_t *util_ald_create_caches(util_ldap_state_t *s, const char *url);
213
util_url_node_t *util_ald_create_caches(util_ldap_state_t *s, const char *url);
219
util_ald_cache_t *util_ald_create_cache(unsigned long maxentries,
214
util_ald_cache_t *util_ald_create_cache(util_ldap_state_t *st,
215
				unsigned long maxentries,
220
                                unsigned long (*hashfunc)(void *), 
216
                                unsigned long (*hashfunc)(void *), 
221
                                int (*comparefunc)(void *, void *),
217
                                int (*comparefunc)(void *, void *),
222
                                void * (*copyfunc)(void *),
218
                                void * (*copyfunc)(util_ldap_state_t *, void *),
223
                                void (*freefunc)(void *));
219
                                void (*freefunc)(util_ldap_state_t *, void *));
224
void util_ald_destroy_cache(util_ald_cache_t *cache);
220
void util_ald_destroy_cache(util_ldap_state_t *st, util_ald_cache_t *cache);
225
void *util_ald_cache_fetch(util_ald_cache_t *cache, void *payload);
221
void *util_ald_cache_fetch(util_ald_cache_t *cache, void *payload);
226
void util_ald_cache_insert(util_ald_cache_t *cache, void *payload);
222
void util_ald_cache_insert(util_ldap_state_t *st, util_ald_cache_t *cache, void *payload);
227
void util_ald_cache_remove(util_ald_cache_t *cache, void *payload);
223
void util_ald_cache_remove(util_ldap_state_t *st, util_ald_cache_t *cache, void *payload);
228
char *util_ald_cache_display_stats(apr_pool_t *p, util_ald_cache_t *cache,
224
char *util_ald_cache_display_stats(apr_pool_t *p, util_ald_cache_t *cache,
229
                                 char *name);
225
                                 char *name);
230
226
(-)modules/experimental/util_ldap_cache_mgr.c (-37 / +44 lines)
Lines 112-123 Link Here
112
  0
112
  0
113
};
113
};
114
114
115
void util_ald_free(const void *ptr)
115
void util_ald_free(util_ldap_state_t *st, const void *ptr)
116
{
116
{
117
#if APR_HAS_SHARED_MEMORY
117
#if APR_HAS_SHARED_MEMORY
118
    if (util_ldap_shm) {
118
    if (st->util_ldap_shm) {
119
        if (ptr)
119
        if (ptr)
120
            apr_rmm_free(util_ldap_rmm, apr_rmm_offset_get(util_ldap_rmm, (void *)ptr));
120
            apr_rmm_free(st->util_ldap_rmm, apr_rmm_offset_get(st->util_ldap_rmm, (void *)ptr));
121
    } else {
121
    } else {
122
        if (ptr)
122
        if (ptr)
123
            free((void *)ptr);
123
            free((void *)ptr);
Lines 128-140 Link Here
128
#endif
128
#endif
129
}
129
}
130
130
131
void *util_ald_alloc(unsigned long size)
131
void *util_ald_alloc(util_ldap_state_t *st, unsigned long size)
132
{
132
{
133
    if (0 == size)
133
    if (0 == size)
134
        return NULL;
134
        return NULL;
135
#if APR_HAS_SHARED_MEMORY
135
#if APR_HAS_SHARED_MEMORY
136
    if (util_ldap_shm) {
136
    if (st->util_ldap_shm) {
137
        return (void *)apr_rmm_addr_get(util_ldap_rmm, apr_rmm_calloc(util_ldap_rmm, size));
137
        return (void *)apr_rmm_addr_get(st->util_ldap_rmm, apr_rmm_calloc(st->util_ldap_rmm, size));
138
    } else {
138
    } else {
139
        return (void *)calloc(sizeof(char), size);
139
        return (void *)calloc(sizeof(char), size);
140
    }
140
    }
Lines 143-153 Link Here
143
#endif
143
#endif
144
}
144
}
145
145
146
const char *util_ald_strdup(const char *s)
146
const char *util_ald_strdup(util_ldap_state_t *st, const char *s)
147
{
147
{
148
#if APR_HAS_SHARED_MEMORY
148
#if APR_HAS_SHARED_MEMORY
149
    if (util_ldap_shm) {
149
    if (st->util_ldap_shm) {
150
        char *buf = (char *)apr_rmm_addr_get(util_ldap_rmm, apr_rmm_calloc(util_ldap_rmm, strlen(s)+1));
150
        char *buf = (char *)apr_rmm_addr_get(st->util_ldap_rmm, apr_rmm_calloc(st->util_ldap_rmm, strlen(s)+1));
151
        if (buf) {
151
        if (buf) {
152
            strcpy(buf, s);
152
            strcpy(buf, s);
153
            return buf;
153
            return buf;
Lines 199-206 Link Here
199
  that were added before that time. It's pretty simplistic, but time to
199
  that were added before that time. It's pretty simplistic, but time to
200
  purge is only O(n), which is more important.
200
  purge is only O(n), which is more important.
201
*/
201
*/
202
void util_ald_cache_purge(util_ald_cache_t *cache)
202
void util_ald_cache_purge(util_ldap_state_t *st)
203
{
203
{
204
    util_ald_cache_t *cache = (util_ald_cache_t *)st->ldap_cache;
204
    unsigned long i;
205
    unsigned long i;
205
    util_cache_node_t *p, *q;
206
    util_cache_node_t *p, *q;
206
    apr_time_t t;
207
    apr_time_t t;
Lines 217-224 Link Here
217
        while (p != NULL) {
218
        while (p != NULL) {
218
            if (p->add_time < cache->marktime) {
219
            if (p->add_time < cache->marktime) {
219
	        q = p->next;
220
	        q = p->next;
220
	        (*cache->free)(p->payload);
221
	        (*cache->free)(st, p->payload);
221
	        util_ald_free(p);
222
	        util_ald_free(st, p);
222
	        cache->numentries--;
223
	        cache->numentries--;
223
	        cache->npurged++;
224
	        cache->npurged++;
224
	        p = q;
225
	        p = q;
Lines 247-263 Link Here
247
    util_ald_cache_t *dn_compare_cache;
248
    util_ald_cache_t *dn_compare_cache;
248
249
249
    /* create the three caches */
250
    /* create the three caches */
250
    search_cache = util_ald_create_cache(st->search_cache_size,
251
    search_cache = util_ald_create_cache(st,
252
    					  st->search_cache_size,
251
					  util_ldap_search_node_hash,
253
					  util_ldap_search_node_hash,
252
					  util_ldap_search_node_compare,
254
					  util_ldap_search_node_compare,
253
					  util_ldap_search_node_copy,
255
					  util_ldap_search_node_copy,
254
					  util_ldap_search_node_free);
256
					  util_ldap_search_node_free);
255
    compare_cache = util_ald_create_cache(st->compare_cache_size,
257
    compare_cache = util_ald_create_cache(st,
258
    					   st->compare_cache_size,
256
					   util_ldap_compare_node_hash,
259
					   util_ldap_compare_node_hash,
257
					   util_ldap_compare_node_compare,
260
					   util_ldap_compare_node_compare,
258
					   util_ldap_compare_node_copy,
261
					   util_ldap_compare_node_copy,
259
					   util_ldap_compare_node_free);
262
					   util_ldap_compare_node_free);
260
    dn_compare_cache = util_ald_create_cache(st->compare_cache_size,
263
    dn_compare_cache = util_ald_create_cache(st,
264
    					      st->compare_cache_size,
261
					      util_ldap_dn_compare_node_hash,
265
					      util_ldap_dn_compare_node_hash,
262
					      util_ldap_dn_compare_node_compare,
266
					      util_ldap_dn_compare_node_compare,
263
					      util_ldap_dn_compare_node_copy,
267
					      util_ldap_dn_compare_node_copy,
Lines 272-290 Link Here
272
        curl->compare_cache = compare_cache;
276
        curl->compare_cache = compare_cache;
273
        curl->dn_compare_cache = dn_compare_cache;
277
        curl->dn_compare_cache = dn_compare_cache;
274
278
275
        util_ald_cache_insert(util_ldap_cache, curl);
279
        util_ald_cache_insert(st, st->ldap_cache, curl);
276
280
	return curl;
277
    }
281
    }
278
282
279
    return curl;
283
    /* cache is not valid */
284
    return NULL;
280
}
285
}
281
286
282
287
283
util_ald_cache_t *util_ald_create_cache(unsigned long maxentries,
288
util_ald_cache_t *util_ald_create_cache(util_ldap_state_t *st,
289
				unsigned long maxentries,
284
                                unsigned long (*hashfunc)(void *), 
290
                                unsigned long (*hashfunc)(void *), 
285
                                int (*comparefunc)(void *, void *),
291
                                int (*comparefunc)(void *, void *),
286
                                void * (*copyfunc)(void *),
292
                                void * (*copyfunc)(util_ldap_state_t *, void *),
287
                                void (*freefunc)(void *))
293
                                void (*freefunc)(util_ldap_state_t *, void *))
288
{
294
{
289
    util_ald_cache_t *cache;
295
    util_ald_cache_t *cache;
290
    unsigned long i;
296
    unsigned long i;
Lines 292-298 Link Here
292
    if (maxentries <= 0)
298
    if (maxentries <= 0)
293
        return NULL;
299
        return NULL;
294
300
295
    cache = (util_ald_cache_t *)util_ald_alloc(sizeof(util_ald_cache_t));
301
    cache = (util_ald_cache_t *)util_ald_alloc(st, sizeof(util_ald_cache_t));
296
    if (!cache)
302
    if (!cache)
297
        return NULL;
303
        return NULL;
298
304
Lines 303-311 Link Here
303
        for (i = 0; primes[i] && primes[i] < cache->size; ++i) ;
309
        for (i = 0; primes[i] && primes[i] < cache->size; ++i) ;
304
            cache->size = primes[i]? primes[i] : primes[i-1];
310
            cache->size = primes[i]? primes[i] : primes[i-1];
305
311
306
    cache->nodes = (util_cache_node_t **)util_ald_alloc(cache->size * sizeof(util_cache_node_t *));
312
    cache->nodes = (util_cache_node_t **)util_ald_alloc(st, cache->size * sizeof(util_cache_node_t *));
307
    if (!cache->nodes) {
313
    if (!cache->nodes) {
308
        util_ald_free(cache);
314
        util_ald_free(st, cache);
309
        return NULL;
315
        return NULL;
310
    }
316
    }
311
317
Lines 332-338 Link Here
332
    return cache;
338
    return cache;
333
}
339
}
334
340
335
void util_ald_destroy_cache(util_ald_cache_t *cache)
341
void util_ald_destroy_cache(util_ldap_state_t *st, util_ald_cache_t *cache)
336
{
342
{
337
    unsigned long i;
343
    unsigned long i;
338
    util_cache_node_t *p, *q;
344
    util_cache_node_t *p, *q;
Lines 345-357 Link Here
345
        q = NULL;
351
        q = NULL;
346
        while (p != NULL) {
352
        while (p != NULL) {
347
            q = p->next;
353
            q = p->next;
348
           (*cache->free)(p->payload);
354
           (*cache->free)(st, p->payload);
349
           util_ald_free(p);
355
           util_ald_free(st, p);
350
           p = q;
356
           p = q;
351
        }
357
        }
352
    }
358
    }
353
    util_ald_free(cache->nodes);
359
    util_ald_free(st, cache->nodes);
354
    util_ald_free(cache);
360
    util_ald_free(st, cache);
355
}
361
}
356
362
357
void *util_ald_cache_fetch(util_ald_cache_t *cache, void *payload)
363
void *util_ald_cache_fetch(util_ald_cache_t *cache, void *payload)
Lines 382-388 Link Here
382
 * Insert an item into the cache. 
388
 * Insert an item into the cache. 
383
 * *** Does not catch duplicates!!! ***
389
 * *** Does not catch duplicates!!! ***
384
 */
390
 */
385
void util_ald_cache_insert(util_ald_cache_t *cache, void *payload)
391
void util_ald_cache_insert(util_ldap_state_t *st, util_ald_cache_t *cache, void *payload)
386
{
392
{
387
    int hashval;
393
    int hashval;
388
    util_cache_node_t *node;
394
    util_cache_node_t *node;
Lines 392-409 Link Here
392
398
393
    cache->inserts++;
399
    cache->inserts++;
394
    hashval = (*cache->hash)(payload) % cache->size;
400
    hashval = (*cache->hash)(payload) % cache->size;
395
    node = (util_cache_node_t *)util_ald_alloc(sizeof(util_cache_node_t));
401
    node = (util_cache_node_t *)util_ald_alloc(st, sizeof(util_cache_node_t));
396
    node->add_time = apr_time_now();
402
    node->add_time = apr_time_now();
397
    node->payload = (*cache->copy)(payload);
403
    node->payload = (*cache->copy)(st, payload);
398
    node->next = cache->nodes[hashval];
404
    node->next = cache->nodes[hashval];
399
    cache->nodes[hashval] = node;
405
    cache->nodes[hashval] = node;
400
    if (++cache->numentries == cache->fullmark) 
406
    if (++cache->numentries == cache->fullmark) 
401
        cache->marktime=apr_time_now();
407
        cache->marktime=apr_time_now();
402
    if (cache->numentries >= cache->maxentries)
408
    if (cache->numentries >= cache->maxentries)
403
        util_ald_cache_purge(cache);
409
        util_ald_cache_purge(st);
404
}
410
}
405
411
406
void util_ald_cache_remove(util_ald_cache_t *cache, void *payload)
412
void util_ald_cache_remove(util_ldap_state_t *st, util_ald_cache_t *cache, void *payload)
407
{
413
{
408
    int hashval;
414
    int hashval;
409
    util_cache_node_t *p, *q;
415
    util_cache_node_t *p, *q;
Lines 431-438 Link Here
431
        /* We found the node and it's not the first in the list */
437
        /* We found the node and it's not the first in the list */
432
        q->next = p->next;
438
        q->next = p->next;
433
    }
439
    }
434
    (*cache->free)(p->payload);
440
    (*cache->free)(st, p->payload);
435
    util_ald_free(p);
441
    util_ald_free(st, p);
436
    cache->numentries--;
442
    cache->numentries--;
437
}
443
}
438
444
Lines 499-506 Link Here
499
    return buf;
505
    return buf;
500
}
506
}
501
507
502
char *util_ald_cache_display(apr_pool_t *pool)
508
char *util_ald_cache_display(apr_pool_t *pool, void *data)
503
{
509
{
510
    util_ald_cache_t *util_ldap_cache = (util_ald_cache_t *) data;
504
    unsigned long i;
511
    unsigned long i;
505
    char *buf, *t1, *t2, *t3;
512
    char *buf, *t1, *t2, *t3;
506
513

Return to bug 18756