]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/main.c
Added a conformant sortedResults support which is unable to sort anything.
[openldap] / servers / slapd / main.c
index d458acb033e11974ad473f9420b665e098fbffce..944faff679c8cefdb3285fe57b004a65dbf3035b 100644 (file)
@@ -253,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;
 
@@ -289,6 +290,7 @@ int main( int argc, char **argv )
        {
                int *i;
                char *newConfigFile;
+               char *newConfigDir;
                char *newUrls;
                char *regService = NULL;
 
@@ -320,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
@@ -356,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 ) {
@@ -387,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;
@@ -626,7 +637,7 @@ unhandled_option:;
        }
 #endif /* SLAP_DYNACL */
 
-       if ( read_config( configfile, 0 ) != 0 ) {
+       if ( read_config( configfile, configdir ) != 0 ) {
                rc = 1;
                SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 19 );