X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fmain.c;h=944faff679c8cefdb3285fe57b004a65dbf3035b;hb=f955f17076dc185a589d90baa2acd33afc4c1448;hp=01fbf316af4f763501d0a60c363bb8174c619659;hpb=f0190506f1ac4175345a5bb90d5c73376c657ef0;p=openldap diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 01fbf316af..944faff679 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2004 The OpenLDAP Foundation. + * Copyright 1998-2005 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,8 +34,6 @@ #include #include -#include "ldap_pvt.h" - #include "slap.h" #include "lutil.h" #include "ldif.h" @@ -255,13 +253,14 @@ int main( int argc, char **argv ) #ifdef HAVE_NT_SERVICE_MANAGER char *configfile = ".\\slapd.conf"; + char *configdir = ".\\slapd.d"; #else char *configfile = SLAPD_DEFAULT_CONFIGFILE; + char *configdir = SLAPD_DEFAULT_CONFIGDIR; #endif char *serverName; int serverMode = SLAP_SERVER_MODE; - struct berval cookie = BER_BVNULL; struct sync_cookie *scp = NULL; struct sync_cookie *scp_entry = NULL; @@ -291,6 +290,7 @@ int main( int argc, char **argv ) { int *i; char *newConfigFile; + char *newConfigDir; char *newUrls; char *regService = NULL; @@ -322,11 +322,17 @@ int main( int argc, char **argv ) configfile = newConfigFile; Debug ( LDAP_DEBUG_ANY, "new config file from registry is: %s\n", configfile, 0, 0 ); } + + newConfigDir = (char*)lutil_getRegParam( regService, "ConfigDir" ); + if ( newConfigDir != NULL ) { + configdir = newConfigDir; + Debug ( LDAP_DEBUG_ANY, "new config dir from registry is: %s\n", configdir, 0, 0 ); + } } #endif while ( (i = getopt( argc, argv, - "c:d:f:h:n:o:s:StT:V" + "c:d:f:F:h:n:o:s:StT:V" #if LDAP_PF_INET6 "46" #endif @@ -358,8 +364,7 @@ int main( int argc, char **argv ) case 'c': /* provide sync cookie, override if exist in replica */ scp = (struct sync_cookie *) ch_calloc( 1, sizeof( struct sync_cookie )); - ber_str2bv( optarg, strlen( optarg ), 1, &cookie ); - ber_bvarray_add( &scp->octet_str, &cookie ); + ber_str2bv( optarg, 0, 1, &scp->octet_str ); slap_parse_sync_cookie( scp ); LDAP_STAILQ_FOREACH( scp_entry, &slap_sync_cookie, sc_next ) { @@ -389,6 +394,10 @@ int main( int argc, char **argv ) configfile = ch_strdup( optarg ); break; + case 'F': /* use config dir */ + configdir = ch_strdup( optarg ); + break; + case 'o': { char *val = strchr( optarg, '=' ); struct berval opt; @@ -503,7 +512,6 @@ unhandled_option:; (void) ldap_pvt_thread_initialize(); - lutil_set_debug_level( "slapd", slap_debug ); ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &slap_debug); ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &slap_debug); ldif_debug = slap_debug; @@ -623,7 +631,13 @@ unhandled_option:; goto destroy; } - if ( read_config( configfile, 0 ) != 0 ) { +#ifdef SLAP_DYNACL + if ( acl_init() ) { + goto destroy; + } +#endif /* SLAP_DYNACL */ + + if ( read_config( configfile, configdir ) != 0 ) { rc = 1; SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 19 ); @@ -644,13 +658,6 @@ unhandled_option:; } } - if ( glue_sub_init( ) != 0 ) { - Debug( LDAP_DEBUG_ANY, - "subordinate config error\n", - 0, 0, 0 ); - goto destroy; - } - if ( slap_schema_check( ) != 0 ) { Debug( LDAP_DEBUG_ANY, "schema prep error\n", @@ -706,6 +713,9 @@ unhandled_option:; #endif (void) SIGNAL( SIGINT, slap_sig_shutdown ); (void) SIGNAL( SIGTERM, slap_sig_shutdown ); +#ifdef SIGTRAP + (void) SIGNAL( SIGTRAP, slap_sig_shutdown ); +#endif #ifdef LDAP_SIGCHLD (void) SIGNAL( LDAP_SIGCHLD, wait4child ); #endif