1
1
/* config.c - configuration file handling routines */
2
/* $OpenLDAP: pkg/ldap/servers/slapd/config.c,v 1.441.2.24 2009/06/02 23:41:32 quanah Exp $ */
2
/* $OpenLDAP: pkg/ldap/servers/slapd/config.c,v 1.441.2.26 2009/08/02 21:26:43 quanah Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5
5
* Copyright 1998-2009 The OpenLDAP Foundation.
260
261
return(ARG_BAD_CONF);
265
if ( lutil_atoulx( &ularg, c->argv[1], 0 ) != 0 ) {
266
snprintf( c->cr_msg, sizeof( c->cr_msg ),
267
"<%s> unable to parse \"%s\" as unsigned long",
268
c->argv[0], c->argv[1] );
269
Debug(LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE, "%s: %s\n",
270
c->log, c->cr_msg, 0);
271
return(ARG_BAD_CONF);
263
274
case ARG_BER_LEN_T: {
265
276
if ( lutil_atoulx( &l, c->argv[1], 0 ) != 0 ) {
308
319
case ARG_INT: c->value_int = iarg; break;
309
320
case ARG_UINT: c->value_uint = uiarg; break;
310
321
case ARG_LONG: c->value_long = larg; break;
322
case ARG_ULONG: c->value_ulong = ularg; break;
311
323
case ARG_BER_LEN_T: c->value_ber_t = barg; break;
359
371
case ARG_INT: *(int*)ptr = c->value_int; break;
360
372
case ARG_UINT: *(unsigned*)ptr = c->value_uint; break;
361
373
case ARG_LONG: *(long*)ptr = c->value_long; break;
374
case ARG_ULONG: *(unsigned long*)ptr = c->value_ulong; break;
362
375
case ARG_BER_LEN_T: *(ber_len_t*)ptr = c->value_ber_t; break;
363
376
case ARG_STRING: {
364
377
char *cc = *(char**)ptr;
449
462
case ARG_INT: c->value_int = *(int *)ptr; break;
450
463
case ARG_UINT: c->value_uint = *(unsigned *)ptr; break;
451
464
case ARG_LONG: c->value_long = *(long *)ptr; break;
465
case ARG_ULONG: c->value_ulong = *(unsigned long *)ptr; break;
452
466
case ARG_BER_LEN_T: c->value_ber_t = *(ber_len_t *)ptr; break;
454
468
if ( *(char **)ptr )
467
481
case ARG_INT: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%d", c->value_int); break;
468
482
case ARG_UINT: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%u", c->value_uint); break;
469
483
case ARG_LONG: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%ld", c->value_long); break;
484
case ARG_ULONG: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%lu", c->value_ulong); break;
470
485
case ARG_BER_LEN_T: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%ld", c->value_ber_t); break;
471
486
case ARG_ON_OFF: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%s",
472
487
c->value_int ? "TRUE" : "FALSE"); break;
2130
/* See if the given URL (in plain and parsed form) matches
2131
* any of the server's listener addresses. Return matching
2132
* Listener or NULL for no match.
2134
Listener *config_check_my_url( const char *url, LDAPURLDesc *lud )
2136
Listener **l = slapd_get_listeners();
2139
/* Try a straight compare with Listener strings */
2140
for ( i=0; l && l[i]; i++ ) {
2141
if ( !strcasecmp( url, l[i]->sl_url.bv_val )) {
2147
/* If hostname is empty, or is localhost, or matches
2148
* our hostname, this url refers to this host.
2149
* Compare it against listeners and ports.
2151
if ( !lud->lud_host || !lud->lud_host[0] ||
2152
!strncasecmp("localhost", lud->lud_host,
2153
STRLENOF("localhost")) ||
2154
!strcasecmp( global_host, lud->lud_host )) {
2156
for ( i=0; l && l[i]; i++ ) {
2158
ldap_url_parse( l[i]->sl_url.bv_val, &lu2 );
2160
if ( strcasecmp( lud->lud_scheme,
2163
if ( lud->lud_port != lu2->lud_port )
2165
/* Listener on ANY address */
2166
if ( !lu2->lud_host || !lu2->lud_host[0] ) {
2170
/* URL on ANY address */
2171
if ( !lud->lud_host || !lud->lud_host[0] ) {
2175
/* Listener has specific host, must
2178
if ( !strcasecmp( lud->lud_host,
2184
ldap_free_urldesc( lu2 );