util_ldap_cache_mgr.c revision 3a11074e78d5961088e8f5520ba3cec163faed9c
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce/* Copyright 2001-2004 The Apache Software Foundation
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * Licensed under the Apache License, Version 2.0 (the "License");
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * you may not use this file except in compliance with the License.
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * You may obtain a copy of the License at
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * Unless required by applicable law or agreed to in writing, software
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * distributed under the License is distributed on an "AS IS" BASIS,
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * See the License for the specific language governing permissions and
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * limitations under the License.
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * util_ldap_cache_mgr.c: LDAP cache manager things
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * Original code from auth_ldap module for Apache v1.3:
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * Copyright 1998, 1999 Enbridge Pipelines Inc.
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce * Copyright 1999-2001 Dave Carrigan
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorce/* only here until strdup is gone */
8f2a34cc6964a1f80a1434e05315a7ae0bb5774eSimo Sorce/* here till malloc is gone */
a8d1a344e580f29699aed9b88d87fc3c6f5d113bSimo Sorcestatic const unsigned long primes[] =
if (ptr)
if (ptr)
if (ptr)
if (0 == size)
return NULL;
if (buf) {
return buf;
return NULL;
return strdup(s);
return strdup(s);
char *str, *p;
for (i=0; i < nstr; ++i) {
for (p = str; *p; ++p) {
util_cache_node_t *p, *q;
apr_time_t t;
if (!cache)
while (p != NULL) {
q = p->next;
p = p->next;
t = apr_time_now();
return newcurl;
unsigned long (*hashfunc)(void *),
int (*comparefunc)(void *, void *),
return NULL;
return NULL;
if (!cache)
return NULL;
cache->nodes = (util_cache_node_t **)util_ald_alloc(cache, cache->size * sizeof(util_cache_node_t *));
return NULL;
return cache;
util_cache_node_t *p, *q;
q = NULL;
while (p != NULL) {
q = p->next;
int hashval;
return NULL;
p = p->next) ;
if (p != NULL) {
return p->payload;
return NULL;
int hashval;
return NULL;
return NULL;
return NULL;
int hashval;
util_cache_node_t *p, *q;
p = p->next) {
if (p == NULL)
if (q == NULL) {
int totchainlen = 0;
int nchains = 0;
double chainlen;
nchains++;
totchainlen++;
if (id) {
r->uri,
id,
name);
buf2,
buf,
buf);
return buf;
if (!util_ldap_cache) {
return "<tr valign='top'><td nowrap colspan=7>Cache has not been enabled/initialised.</td></tr>";
"<td bgcolor='#000000'><font size='-1' face='Arial,Helvetica' color='#ffffff'><b>Cache Name:</b></font></td>"
"<td bgcolor='#ffffff'><font size='-1' face='Arial,Helvetica' color='#000000'><b>%s (%s)</b></font></td>"
buf,
switch (cachetype[0]) {
date_str[0] = 0;
"<td bgcolor='#000000'><font size='-1' face='Arial,Helvetica' color='#ffffff'><b>Size:</b></font></td>"
"<td bgcolor='#ffffff'><font size='-1' face='Arial,Helvetica' color='#000000'><b>%ld</b></font></td>"
"<td bgcolor='#000000'><font size='-1' face='Arial,Helvetica' color='#ffffff'><b>Max Entries:</b></font></td>"
"<td bgcolor='#ffffff'><font size='-1' face='Arial,Helvetica' color='#000000'><b>%ld</b></font></td>"
"<td bgcolor='#000000'><font size='-1' face='Arial,Helvetica' color='#ffffff'><b># Entries:</b></font></td>"
"<td bgcolor='#ffffff'><font size='-1' face='Arial,Helvetica' color='#000000'><b>%ld</b></font></td>"
"<td bgcolor='#000000'><font size='-1' face='Arial,Helvetica' color='#ffffff'><b>Full Mark:</b></font></td>"
"<td bgcolor='#ffffff'><font size='-1' face='Arial,Helvetica' color='#000000'><b>%ld</b></font></td>"
"<td bgcolor='#000000'><font size='-1' face='Arial,Helvetica' color='#ffffff'><b>Full Mark Time:</b></font></td>"
"<td bgcolor='#ffffff'><font size='-1' face='Arial,Helvetica' color='#000000'><b>%s</b></font></td>"
date_str), r);
buf,
return buf;