diff options
Diffstat (limited to 'ldap/servers')
25 files changed, 293 insertions, 415 deletions
diff --git a/ldap/servers/plugins/Makefile b/ldap/servers/plugins/Makefile index 48e3c925..64854009 100644 --- a/ldap/servers/plugins/Makefile +++ b/ldap/servers/plugins/Makefile @@ -51,13 +51,14 @@ NSPR20=true # probably should be defined somewhere else (not sure where) include $(BUILD_ROOT)/nsconfig.mk include $(LDAP_SRC)/nsldap.mk +PLUGINS = _referint _collation _syntaxes _passthru _utils _uiduniq _roles _acl _replication _cos _pwdstorage _rever _chainingdb _distrib _retrocl _statechange _http _views ifneq ($(ARCH), WINNT) -all: _referint _collation _syntaxes _passthru _utils _uiduniq _roles _acl _replication _cos _pwdstorage _rever _chainingdb _distrib _retrocl _statechange _http _views -# richm 20050303 - do not build pam pass thru for DS 7.1 -#all: _referint _collation _syntaxes _passthru _utils _uiduniq _roles _acl _replication _cos _pwdstorage _rever _chainingdb _distrib _retrocl _statechange _http _views _pam_passthru -else -all: _referint _collation _syntaxes _passthru _utils _uiduniq _roles _acl _replication _cos _pwdstorage _rever _chainingdb _distrib _retrocl _statechange _http _views +ifneq ($(BRAND), redhat) +PLUGINS += _pam_passthru endif +endif + +all: $(PLUGINS) _utils: cd shared; $(MAKE) $(MFLAGS) all diff --git a/ldap/servers/plugins/chainingdb/cb_search.c b/ldap/servers/plugins/chainingdb/cb_search.c index 5facadc2..0d898a39 100644 --- a/ldap/servers/plugins/chainingdb/cb_search.c +++ b/ldap/servers/plugins/chainingdb/cb_search.c @@ -179,7 +179,7 @@ chainingdb_build_candidate_list ( Slapi_PBlock *pb ) slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL ); return 1; } - timeout.tv_sec=(time_t)timelimit-(now-optime); + timeout.tv_sec=timelimit-(now-optime); timeout.tv_usec=0; } @@ -414,10 +414,7 @@ chainingdb_next_search_entry ( Slapi_PBlock *pb ) { char *target; - int sizelimit, timelimit; - int rc, parse_rc, retcode; - int i, attrsonly; - time_t optime; + int sizelimit,timelimit, rc, parse_rc, optime,i,retcode, attrsonly; LDAPMessage *res=NULL; char *matched_msg,*error_msg; cb_searchContext *ctx=NULL; diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c index f7bf89db..56fa517e 100644 --- a/ldap/servers/slapd/auth.c +++ b/ldap/servers/slapd/auth.c @@ -272,27 +272,41 @@ void client_auth_init () { char *instancedir; + int len = 0; + char *val = NULL; + char* filename; + char netsite_root[MAXPATHLEN]; int err; if (client_auth_config_file == NULL) { - char *confdir = config_get_configdir(); - if (NULL == confdir) { - LDAPDebug (LDAP_DEBUG_ANY, - "client_auth_init: failed to get configdir\n", - 0, 0, 0); - return; - } - client_auth_config_file = PR_smprintf("%s/certmap.conf", confdir); - if (NULL == client_auth_config_file) { - LDAPDebug (LDAP_DEBUG_ANY, - "client_auth_init: failed to duplicate \"%s/certmap\"\n", - confdir, 0, 0); - return; - } + client_auth_config_file = "shared/config/certmap.conf"; } - err = ldaputil_init (client_auth_config_file, "", NULL, "slapd", NULL); + + /* calculate the server_root from instance dir */ + instancedir = config_get_instancedir(); + /* make sure path does not end in the path separator character */ + len = strlen(instancedir); + if (instancedir[len-1] == '/' || instancedir[len-1] == '\\') { + instancedir[len-1] = '\0'; + } + + /* get the server root from the path */ + val = strrchr(instancedir, '/'); + if (!val) { + val = strrchr(instancedir, '\\'); + } + if (val) { + val++; + *val = '\0'; + } + + PL_strncpyz(netsite_root, instancedir, MAXPATHLEN); + slapi_ch_free_string(&instancedir); + filename = PR_smprintf("%s%s", netsite_root, client_auth_config_file); + + err = ldaputil_init (filename, "", netsite_root, "slapd", NULL); if (err != LDAPU_SUCCESS) { LDAPDebug (LDAP_DEBUG_TRACE, "ldaputil_init(%s,...) %i\n", - client_auth_config_file, err, 0); + filename, err, 0); } else { LDAPUVTable_t vtable = { NULL /* ssl_init */, @@ -315,6 +329,9 @@ client_auth_init () slapu_value_free_len}; ldapu_VTable_set (&vtable); } + PR_smprintf_free (filename); + /* why do we define these strings if we never use them? */ + if (ldapu_strings != NULL); /* Generate a component id for cert-based authentication */ generate_id(); diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index 2168e514..d117d1d9 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -683,7 +683,6 @@ static void dblayer_init_dbenv(DB_ENV *pEnv, dblayer_private *priv) #endif #ifdef LINUX #include <linux/kernel.h> -#include <linux/sys.h> #include <sys/sysinfo.h> /* undocumented (?) */ #include <sys/resource.h> #endif diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c index b02c90c4..34a7aada 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_search.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c @@ -422,7 +422,7 @@ ldbm_back_search( Slapi_PBlock *pb ) if (sort && (NULL != candidates)) { time_t optime = 0; - time_t tlimit = 0; + int tlimit = 0; slapi_pblock_get( pb, SLAPI_SEARCH_TIMELIMIT, &tlimit ); slapi_pblock_get( pb, SLAPI_OPINITIATED_TIME, &optime ); diff --git a/ldap/servers/slapd/back-ldif/search.c b/ldap/servers/slapd/back-ldif/search.c index f66b4c97..e93cd85c 100644 --- a/ldap/servers/slapd/back-ldif/search.c +++ b/ldap/servers/slapd/back-ldif/search.c @@ -143,7 +143,7 @@ ldif_back_search( Slapi_PBlock *pb ) /*Make sure we're not exceeding our time limit...*/ currtime = time(&dummy); - if ((tlimit > 0) && ((currtime - optime) > (time_t)tlimit)){ + if ((tlimit > 0) && ((currtime - optime) > tlimit)){ slapi_send_ldap_result( pb, LDAP_TIMELIMIT_EXCEEDED, NULL, NULL, nentries, NULL); /*We "hit" the cache*/ diff --git a/ldap/servers/slapd/config.c b/ldap/servers/slapd/config.c index 9cfdd8d4..ed012c2a 100644 --- a/ldap/servers/slapd/config.c +++ b/ldap/servers/slapd/config.c @@ -160,40 +160,30 @@ slapd_bootstrap_config(const char *configdir) char *buf = 0; char *lastp = 0; char *entrystr = 0; - char *instancedir = NULL; - if (NULL == configdir) { - slapi_log_error(SLAPI_LOG_FATAL, - "startup", "Passed null config directory\n"); - return rc; /* Fail */ - } PR_snprintf(configfile, sizeof(configfile), "%s/%s", configdir, - CONFIG_FILENAME); + CONFIG_FILENAME); if ( (rc = PR_GetFileInfo( configfile, &prfinfo )) != PR_SUCCESS ) { /* the "real" file does not exist; see if there is a tmpfile */ char tmpfile[MAXPATHLEN+1]; - slapi_log_error(SLAPI_LOG_FATAL, "config", - "The configuration file %s does not exist\n", configfile); PR_snprintf(tmpfile, sizeof(tmpfile), "%s/%s.tmp", configdir, - CONFIG_FILENAME); + CONFIG_FILENAME); if ( PR_GetFileInfo( tmpfile, &prfinfo ) == PR_SUCCESS ) { rc = PR_Rename(tmpfile, configfile); if (rc == PR_SUCCESS) { slapi_log_error(SLAPI_LOG_FATAL, "config", "The configuration file %s was restored from backup %s\n", configfile, tmpfile); + rc = 1; } else { slapi_log_error(SLAPI_LOG_FATAL, "config", "The configuration file %s was not restored from backup %s, error %d\n", configfile, tmpfile, rc); - return rc; /* Fail */ + rc = 0; } } else { - slapi_log_error(SLAPI_LOG_FATAL, "config", - "The backup configuration file %s does not exist, either.\n", - tmpfile); - return rc; /* Fail */ + rc = 0; /* fail */ } } if ( (rc = PR_GetFileInfo( configfile, &prfinfo )) != PR_SUCCESS ) @@ -201,7 +191,7 @@ slapd_bootstrap_config(const char *configdir) PRErrorCode prerr = PR_GetError(); slapi_log_error(SLAPI_LOG_FATAL, "config", "The given config file %s could not be accessed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n", configfile, prerr, slapd_pr_strerror(prerr)); - return rc; + rc = 0; /* Fail */ } else if (( prfd = PR_Open( configfile, PR_RDONLY, SLAPD_DEFAULT_FILE_MODE )) == NULL ) @@ -209,7 +199,7 @@ slapd_bootstrap_config(const char *configdir) PRErrorCode prerr = PR_GetError(); slapi_log_error(SLAPI_LOG_FATAL, "config", "The given config file %s could not be opened for reading, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n", configfile, prerr, slapd_pr_strerror(prerr)); - return rc; /* Fail */ + rc = 0; /* Fail */ } else { @@ -228,7 +218,7 @@ slapd_bootstrap_config(const char *configdir) if(!done) { - char workpath[MAXPATHLEN+1]; + char errorlog[MAXPATHLEN+1]; char loglevel[BUFSIZ]; char maxdescriptors[BUFSIZ]; char val[BUFSIZ]; @@ -237,7 +227,7 @@ slapd_bootstrap_config(const char *configdir) char schemacheck[BUFSIZ]; Slapi_DN plug_dn; - workpath[0] = loglevel[0] = maxdescriptors[0] = '\0'; + errorlog[0] = loglevel[0] = maxdescriptors[0] = '\0'; val[0] = logenabled[0] = schemacheck[0] = '\0'; _localuser[0] = '\0'; @@ -262,28 +252,6 @@ slapd_bootstrap_config(const char *configdir) continue; } - /* if instancedir is not set, set it first */ - { - instancedir = config_get_instancedir(); - if (NULL == instancedir) { - workpath[0] = '\0'; - if (entry_has_attr_and_value(e, - CONFIG_INSTANCEDIR_ATTRIBUTE, - workpath, sizeof(workpath))) { - if (config_set_instancedir( - CONFIG_INSTANCEDIR_ATTRIBUTE, - workpath, errorbuf, CONFIG_APPLY) - != LDAP_SUCCESS) { - LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", - configfile, CONFIG_INSTANCEDIR_ATTRIBUTE, - errorbuf); - } - } - } else { - slapi_ch_free((void **)&instancedir); - } - } - /* increase file descriptors */ #if !defined(_WIN32) && !defined(AIX) if (!maxdescriptors[0] && @@ -333,13 +301,12 @@ slapd_bootstrap_config(const char *configdir) #endif /* set the log file name */ - workpath[0] = '\0'; - if (!workpath[0] && + if (!errorlog[0] && entry_has_attr_and_value(e, CONFIG_ERRORLOG_ATTRIBUTE, - workpath, sizeof(workpath))) + errorlog, sizeof(errorlog))) { if (config_set_errorlog(CONFIG_ERRORLOG_ATTRIBUTE, - workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS) + errorlog, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS) { LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile, CONFIG_ERRORLOG_ATTRIBUTE, errorbuf); @@ -518,18 +485,6 @@ slapd_bootstrap_config(const char *configdir) slapi_entry_free(e); } - /* - * check if the instance dir is set. - */ - if ( NULL == ( instancedir = config_get_instancedir() )) { - slapi_log_error(SLAPI_LOG_FATAL, "startup", - "Instance directory is not specifiled in the file %s. It is mandatory.\n", - configfile); - exit (1); - } else { - slapi_ch_free((void **)&instancedir); - } - /* kexcoff: initialize rootpwstoragescheme and pw_storagescheme * if not explicilty set in the config file */ diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c index 2cf78577..c26f9fc1 100644 --- a/ldap/servers/slapd/dse.c +++ b/ldap/servers/slapd/dse.c @@ -38,9 +38,10 @@ /* * dse.c - DSE (DSA-Specific Entry) persistent storage. * - * The DSE store is an LDIF file contained in the file dse.ldif. - * The file is located in the directory specified with '-D' - * when staring the server. + * The DSE store is an LDIF file contained in the file + * INSTANCEDIR/config/XXX.ldif, where INSTANCEDIR is + * the directory of the server instance, and XXX is + * dfined by the caller of dse_new. * * In core, the DSEs are stored in an AVL tree, keyed on * DN. Whenever a modification is made to a DSE, the @@ -353,15 +354,14 @@ struct dse * dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfilename, const char *configdir) { struct dse *pdse= NULL; + const char *config_sub_dir = "config"; + char *id = config_get_instancedir(); char *realconfigdir = NULL; - if (configdir!=NULL) - { - realconfigdir = slapi_ch_strdup(configdir); - } - else - { - realconfigdir = config_get_configdir(); + if (configdir!=NULL) { + realconfigdir = slapi_ch_strdup(configdir); + } else if (id!=NULL) { + realconfigdir = slapi_ch_smprintf("%s/%s", id, config_sub_dir); } if(realconfigdir!=NULL) { @@ -412,6 +412,7 @@ dse_new( char *filename, char *tmpfilename, char *backfilename, char *startokfil } slapi_ch_free( (void **) &realconfigdir ); } + slapi_ch_free( (void **) &id ); return pdse; } diff --git a/ldap/servers/slapd/fedse.c b/ldap/servers/slapd/fedse.c index 9e2ef358..ef3034d4 100644 --- a/ldap/servers/slapd/fedse.c +++ b/ldap/servers/slapd/fedse.c @@ -38,9 +38,9 @@ /* * fedse.c - Front End DSE (DSA-Specific Entry) persistent storage. * - * The DSE store is an LDIF file contained in the file dse.ldif. - * The file is located in the directory specified with '-D' - * when staring the server. + * The DSE store is an LDIF file contained in the file + * INSTANCEDIR/config/dse.ldif, where INSTANCEDIR is + * the directory of the server instance. * * In core, the DSEs are stored in an AVL tree, keyed on * DN. Whenever a modification is made to a DSE, the @@ -1866,54 +1866,48 @@ setup_internal_backends(char *configdir) int fedse_create_startOK(char *filename, char *startokfilename, const char *configdir) { + const char *config_sub_dir = "config"; + char *id = config_get_instancedir(); char *realconfigdir = NULL; - char *dse_filename = NULL; - char *dse_filestartOK = NULL; - int rc = -1; + char *dse_filename = NULL; + char *dse_filestartOK = NULL; + int rc = -1; - if (configdir!=NULL) - { + if (configdir!=NULL) { realconfigdir = slapi_ch_strdup(configdir); + } else if (id!=NULL) { + realconfigdir = slapi_ch_smprintf("%s/%s", id, config_sub_dir); } - else - { - realconfigdir = config_get_configdir(); - } + slapi_ch_free_string(&id); if(realconfigdir!=NULL) { - /* Set the full path name for the config DSE entry */ - if (!strstr(filename, realconfigdir)) - { - dse_filename = slapi_ch_smprintf("%s/%s", realconfigdir, filename); - } - else - { - dse_filename = slapi_ch_strdup(filename); - } - - if (!strstr(startokfilename, realconfigdir)) - { - dse_filestartOK = slapi_ch_smprintf("%s/%s", - realconfigdir, startokfilename); - } - else - { - dse_filestartOK = slapi_ch_strdup(startokfilename); - } + /* Set the full path name for the config DSE entry */ + if (!strstr(filename, realconfigdir)) + { + dse_filename = slapi_ch_smprintf("%s/%s", realconfigdir, filename ); + } + else + dse_filename = slapi_ch_strdup(filename); - rc = slapi_copy(dse_filename, dse_filestartOK); - if ( rc != 0 ) - { - slapi_log_error( SLAPI_LOG_FATAL, "dse", "Cannot copy" - " DSE file \"%s\" to \"%s\" OS error %d (%s)\n", - dse_filename, dse_filestartOK, - rc, slapd_system_strerror(rc) ); - } - - slapi_ch_free_string(&dse_filename); - slapi_ch_free_string(&dse_filestartOK); - slapi_ch_free_string(&realconfigdir); - } + if (!strstr(startokfilename, realconfigdir)) { + dse_filestartOK = slapi_ch_smprintf("%s/%s", realconfigdir, startokfilename ); + } + else + dse_filestartOK = slapi_ch_strdup(startokfilename); + + rc = slapi_copy(dse_filename, dse_filestartOK); + if ( rc != 0 ) + { + slapi_log_error( SLAPI_LOG_FATAL, "dse", "Cannot copy" + " DSE file \"%s\" to \"%s\" OS error %d (%s)\n", + dse_filename, dse_filestartOK, + rc, slapd_system_strerror(rc) ); + } + + slapi_ch_free_string(&dse_filename); + slapi_ch_free_string(&dse_filestartOK); + slapi_ch_free_string(&realconfigdir); + } - return rc; + return rc; } diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c index 7cb039b4..0ddb5fcf 100644 --- a/ldap/servers/slapd/libglobs.c +++ b/ldap/servers/slapd/libglobs.c @@ -513,16 +513,9 @@ static struct config_get_and_set { CONFIG_CONSTANT_STRING, NULL}, {CONFIG_HASH_FILTERS_ATTRIBUTE, config_set_hash_filters, NULL, 0, NULL, CONFIG_ON_OFF, (ConfigGetFunc)config_get_hash_filters}, - {CONFIG_INSTANCEDIR_ATTRIBUTE, config_set_instancedir, + {CONFIG_INSTANCEDIR_ATTRIBUTE, NULL /* read only */, NULL, 0, (void**)&global_slapdFrontendConfig.instancedir, CONFIG_STRING, NULL}, - /* parameterizing schema dir */ - {CONFIG_SCHEMADIR_ATTRIBUTE, config_set_schemadir, - NULL, 0, - (void**)&global_slapdFrontendConfig.schemadir, CONFIG_STRING, NULL}, - /* parameterizing ldif dir */ - {CONFIG_LDIFDIR_ATTRIBUTE, config_set_ldifdir, - NULL, 0, NULL, CONFIG_STRING, NULL}, {CONFIG_REWRITE_RFC1274_ATTRIBUTE, config_set_rewrite_rfc1274, NULL, 0, (void**)&global_slapdFrontendConfig.rewrite_rfc1274, CONFIG_ON_OFF, NULL}, @@ -2351,7 +2344,7 @@ config_set_instancedir( const char *attrname, char *value, char *errorbuf, int a /* Set the slapd type also */ config_set_slapd_type (); - /* Set the configdir if not set (it must be set since 7.2) */ + /* Set the configdir if not set */ if (!slapdFrontendConfig->configdir) { char newdir[MAXPATHLEN+1]; @@ -4227,49 +4220,6 @@ config_set_configdir(const char *attrname, char *value, char *errorbuf, int appl return retVal; } -char * -config_get_schemadir() -{ - slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); - char *retVal; - - CFG_LOCK_READ(slapdFrontendConfig); - retVal = config_copy_strval(slapdFrontendConfig->schemadir); - CFG_UNLOCK_READ(slapdFrontendConfig); - - return retVal; -} - -int -config_set_schemadir(const char *attrname, char *value, char *errorbuf, int apply) -{ - int retVal = LDAP_SUCCESS; - slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); - - if ( config_value_is_null( attrname, value, errorbuf, 0 )) { - return LDAP_OPERATIONS_ERROR; - } - - if (!apply) { - return retVal; - } - - CFG_LOCK_WRITE(slapdFrontendConfig); - slapi_ch_free((void **)&slapdFrontendConfig->schemadir); - - slapdFrontendConfig->schemadir = slapi_ch_strdup(value); - - CFG_UNLOCK_WRITE(slapdFrontendConfig); - return retVal; -} - -int -config_set_ldifdir(const char *attrname, char *value, char *errorbuf, int apply) -{ - /* noop */ - return LDAP_SUCCESS; -} - char ** config_get_errorlog_list() { diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index 514ce88d..e09f8862 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -255,7 +255,7 @@ chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn) } /* Changes the owner of the files in the logs and - * config directory to the user that the server runs as. + * config directorys to the user that the server runs as. */ static void @@ -276,26 +276,13 @@ fix_ownership() } /* The instance directory needs to be owned by the local user */ - if (slapdFrontendConfig->instancedir) { - slapd_chown_if_not_owner(slapdFrontendConfig->instancedir, - pw->pw_uid, -1); - } - /* config directory */ - if (slapdFrontendConfig->configdir) { - chown_dir_files(slapdFrontendConfig->configdir, pw, PR_FALSE); - } - /* do access log file, if any */ - if (slapdFrontendConfig->accesslog) { - chown_dir_files(slapdFrontendConfig->accesslog, pw, PR_TRUE); - } - /* do audit log file, if any */ - if (slapdFrontendConfig->auditlog) { - chown_dir_files(slapdFrontendConfig->auditlog, pw, PR_TRUE); - } - /* do error log file, if any */ - if (slapdFrontendConfig->errorlog) { - chown_dir_files(slapdFrontendConfig->errorlog, pw, PR_TRUE); - } + slapd_chown_if_not_owner( slapdFrontendConfig->instancedir, pw->pw_uid, -1 ); + PR_snprintf(dirname,sizeof(dirname),"%s/config",slapdFrontendConfig->instancedir); + chown_dir_files(dirname, pw, PR_FALSE); /* config directory */ + chown_dir_files(slapdFrontendConfig->accesslog, pw, PR_TRUE); /* do access log directory */ + chown_dir_files(slapdFrontendConfig->auditlog, pw, PR_TRUE); /* do audit log directory */ + chown_dir_files(slapdFrontendConfig->errorlog, pw, PR_TRUE); /* do error log directory */ + } #endif @@ -378,7 +365,7 @@ name2exemode( char *progname, char *s, int exit_if_unknown ) } #endif else if ( exit_if_unknown ) { - fprintf( stderr, "usage: %s -D configdir " + fprintf( stderr, "usage: %s -D instancedir " "[ldif2db | db2ldif | archive2db " "| db2archive | db2index | refer | suffix2instance" #if defined(UPGRADEDB) @@ -410,46 +397,46 @@ usage( char *name, char *extraname ) switch( slapd_exemode ) { case SLAPD_EXEMODE_DB2LDIF: - usagestr = "usage: %s %s%s-D configdir [-n backend-instance-name] [-d debuglevel] " + usagestr = "usage: %s %s%s-D instancedir [-n backend-instance-name] [-d debuglevel] " "[-N] [-a outputfile] [-r] [-C] [{-s includesuffix}*] " "[{-x excludesuffix}*] [-u] [-U] [-m] [-M] [-E]\n" "Note: either \"-n backend_instance_name\" or \"-s includesuffix\" is required.\n"; break; case SLAPD_EXEMODE_LDIF2DB: - usagestr = "usage: %s %s%s-D configdir [-d debuglevel] " + usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] " "[-n backend_instance_name] [-O] [-g uniqueid_type] [--namespaceid uniqueID]" "[{-s includesuffix}*] [{-x excludesuffix}*] [-E] {-i ldif-file}*\n" "Note: either \"-n backend_instance_name\" or \"-s includesuffix\" is required.\n"; break; case SLAPD_EXEMODE_DB2ARCHIVE: - usagestr = "usage: %s %s%s-D configdir [-d debuglevel] -a archivedir\n"; + usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] -a archivedir\n"; break; case SLAPD_EXEMODE_ARCHIVE2DB: - usagestr = "usage: %s %s%s-D configdir [-d debuglevel] -a archivedir\n"; + usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] -a archivedir\n"; break; case SLAPD_EXEMODE_DB2INDEX: - usagestr = "usage: %s %s%s-D configdir -n backend-instance-name " + usagestr = "usage: %s %s%s-D instancedir -n backend-instance-name " "[-d debuglevel] {-t attributetype}* {-T VLV Search Name}*\n"; /* JCM should say 'Address Book' or something instead of VLV */ break; case SLAPD_EXEMODE_REFERRAL: - usagestr = "usage: %s %s%s-D configdir -r referral-url [-p port]\n"; + usagestr = "usage: %s %s%s-D instancedir -r referral-url [-p port]\n"; break; case SLAPD_EXEMODE_DBTEST: - usagestr = "usage: %s %s%s-D configdir -n backend-instance-name " + usagestr = "usage: %s %s%s-D instancedir -n backend-instance-name " "[-d debuglevel] [-S] [-v]\n"; break; case SLAPD_EXEMODE_SUFFIX2INSTANCE: - usagestr = "usage: %s %s%s -D configdir {-s suffix}*\n"; + usagestr = "usage: %s %s%s -D instancedir {-s suffix}*\n"; break; #if defined(UPGRADEDB) case SLAPD_EXEMODE_UPGRADEDB: - usagestr = "usage: %s %s%s-D configdir [-d debuglevel] [-f] -a archivedir\n"; + usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] [-f] -a archivedir\n"; break; #endif default: /* SLAPD_EXEMODE_SLAPD */ - usagestr = "usage: %s %s%s-D configdir [-d debuglevel] " + usagestr = "usage: %s %s%s-D instancedir [-d debuglevel] " "[-i pidlogfile] [-v] [-V]\n"; } @@ -696,9 +683,9 @@ main( int argc, char **argv) } #endif - process_command_line(argc,argv,myname,&extraname); + process_command_line(argc,argv,myname,&extraname); - if (!slapdFrontendConfig->instancedir && + if (!slapdFrontendConfig->instancedir || !slapdFrontendConfig->configdir) { usage( myname, extraname ); exit( 1 ); @@ -711,7 +698,7 @@ main( int argc, char **argv) } #ifndef LDAP_DONT_USE_SMARTHEAP - MemRegisterTask(); + MemRegisterTask(); #endif slapd_init(); @@ -719,52 +706,39 @@ main( int argc, char **argv) vattr_init(); if (slapd_exemode == SLAPD_EXEMODE_REFERRAL) { - slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); - /* make up the config stuff */ - referral_set_defaults(); - /* - * Process the config files. - */ - if (0 == slapd_bootstrap_config(slapdFrontendConfig->configdir)) { - slapi_log_error(SLAPI_LOG_FATAL, "startup", - "The configuration files in directory %s could not be read or were not found. Please refer to the error log or output for more information.\n", - slapdFrontendConfig->configdir); - exit(1); - } - - n_port = config_get_port(); - s_port = config_get_secureport(); + /* make up the config stuff */ + referral_set_defaults(); + n_port = config_get_port(); + s_port = config_get_secureport(); register_objects(); } else { - slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); - /* The 2 calls below have been moved to this place to make sure that - * they are called before setup_internal_backends to avoid bug 524439 */ - /* - * The 2 calls below where being sometimes called AFTER - * ldapi_register_extended_op (such fact was being stated and - * reproducible for some optimized installations at startup (bug - * 524439)... Such bad call was happening in the context of - * setup_internal_backends -> dse_read_file -> load_plugin_entry -> - * plugin_setup -> replication_multimaster_plugin_init -> - * slapi_register_plugin -> plugin_setup -> - * multimaster_start_extop_init -> * slapi_pblock_set -> - * ldapi_register_extended_op... Unfortunately, the server - * design is such that it is assumed that ldapi_init_extended_ops is - * always called first. - * THE FIX: Move the two calls below before a call to - * setup_internal_backends (down in this same function) - */ - init_saslmechanisms(); - ldapi_init_extended_ops(); + slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); + /* The 2 calls below have been moved to this place to make sure that they + * are called before setup_internal_backends to avoid bug 524439 */ + /* + * The 2 calls below where being sometimes called AFTER ldapi_register_extended_op + * (such fact was being stated and reproducible for some optimized installations + * at startup (bug 524439)... Such bad call was happening in the context of + * setup_internal_backends -> dse_read_file -> load_plugin_entry -> + * plugin_setup -> replication_multimaster_plugin_init -> + * slapi_register_plugin -> plugin_setup -> multimaster_start_extop_init -> + * slapi_pblock_set -> ldapi_register_extended_op... Unfortunately, the server + * design is such that it is assumed that ldapi_init_extended_ops is always + * called first. + * THE FIX: Move the two calls below before a call to setup_internal_backends + * (down in this same function) + */ + init_saslmechanisms(); + ldapi_init_extended_ops(); - /* - * Initialize the default backend. This should be done before we - * process the config. files - */ - defbackend_init(); - + /* + * Initialize the default backend. This should be done before we + * process the config. files + */ + defbackend_init(); + /* * Register the extensible objects with the factory. */ @@ -772,12 +746,12 @@ main( int argc, char **argv) /* * Register the controls that we support. */ - init_controls(); + init_controls(); - /* - * Process the config files. - */ - if (0 == slapd_bootstrap_config(slapdFrontendConfig->configdir)) { + /* + * Process the config files. + */ + if (0 == slapd_bootstrap_config(slapdFrontendConfig->configdir)) { slapi_log_error(SLAPI_LOG_FATAL, "startup", "The configuration files in directory %s could not be read or were not found. Please refer to the error log or output for more information.\n", slapdFrontendConfig->configdir); @@ -785,7 +759,7 @@ main( int argc, char **argv) } /* -sduloutre: must be done before any internal search */ - /* do it before splitting off to other modes too -robey */ + /* do it before splitting off to other modes too -robey */ /* -richm: must be done before reading config files */ if (0 != (return_value = compute_init())) { LDAPDebug(LDAP_DEBUG_ANY, "Initialization Failed 0 %d\n",return_value,0,0); @@ -800,8 +774,8 @@ main( int argc, char **argv) exit(1); } - n_port = config_get_port(); - s_port = config_get_secureport(); + n_port = config_get_port(); + s_port = config_get_secureport(); } raise_process_limits(); /* should be done ASAP once config file read */ @@ -818,22 +792,22 @@ main( int argc, char **argv) set_entry_points(); #if defined( XP_WIN32 ) - if (slapd_exemode == SLAPD_EXEMODE_SLAPD) { - /* Register with the NT EventLog */ - hSlapdEventSource = RegisterEventSource(NULL, pszServerName ); - if( !hSlapdEventSource ) { - char szMessage[256]; - PR_snprintf( szMessage, sizeof(szMessage), "Directory Server %s is terminating. Failed " - "to set the EventLog source.", pszServerName); - MessageBox(GetDesktopWindow(), szMessage, " ", - MB_ICONEXCLAMATION | MB_OK); - exit( 1 ); - } + if (slapd_exemode == SLAPD_EXEMODE_SLAPD) { + /* Register with the NT EventLog */ + hSlapdEventSource = RegisterEventSource(NULL, pszServerName ); + if( !hSlapdEventSource ) { + char szMessage[256]; + PR_snprintf( szMessage, sizeof(szMessage), "Directory Server %s is terminating. Failed " + "to set the EventLog source.", pszServerName); + MessageBox(GetDesktopWindow(), szMessage, " ", + MB_ICONEXCLAMATION | MB_OK); + exit( 1 ); + } - /* Check to ensure there isn't a copy of this server already running. */ - if( MultipleInstances() ) - exit( 1 ); - } + /* Check to ensure there isn't a copy of this server already running. */ + if( MultipleInstances() ) + exit( 1 ); + } #endif /* @@ -852,8 +826,8 @@ main( int argc, char **argv) * we need to be root in order to open them. */ - if ((slapd_exemode == SLAPD_EXEMODE_SLAPD) || - (slapd_exemode == SLAPD_EXEMODE_REFERRAL)) { + if ((slapd_exemode == SLAPD_EXEMODE_SLAPD) || + (slapd_exemode == SLAPD_EXEMODE_REFERRAL)) { ports_info.n_port = (unsigned short)n_port; if ( slapd_listenhost2addr( config_get_listenhost(), &ports_info.n_listenaddr ) != 0 ) { @@ -868,9 +842,9 @@ main( int argc, char **argv) return_value = daemon_pre_setuid_init(&ports_info); if (0 != return_value) { - LDAPDebug( LDAP_DEBUG_ANY, "Failed to init daemon\n", - 0, 0, 0 ); - exit(1); + LDAPDebug( LDAP_DEBUG_ANY, "Failed to init daemon\n", + 0, 0, 0 ); + exit(1); } } @@ -879,9 +853,9 @@ main( int argc, char **argv) #ifndef _WIN32 return_value = main_setuid(slapdFrontendConfig->localuser); if (0 != return_value) { - LDAPDebug( LDAP_DEBUG_ANY, "Failed to change user and group identity to that of %s\n", + LDAPDebug( LDAP_DEBUG_ANY, "Failed to change user and group identity to that of %s\n", slapdFrontendConfig->localuser, 0, 0 ); - exit(1); + exit(1); } #endif @@ -896,7 +870,7 @@ main( int argc, char **argv) && (0 != s_port) && (s_port <= LDAP_PORT_MAX); /* As of DS 6.1, always do a full initialization so that other * modules can assume NSS is available - */ + */ if ( slapd_nss_init((slapd_exemode == SLAPD_EXEMODE_SLAPD), (slapd_exemode != SLAPD_EXEMODE_REFERRAL) /* have config? */ )) { LDAPDebug(LDAP_DEBUG_ANY, @@ -914,14 +888,14 @@ main( int argc, char **argv) exit( 1 ); } - if ((slapd_exemode == SLAPD_EXEMODE_SLAPD) || - (slapd_exemode == SLAPD_EXEMODE_REFERRAL)) { - if ( init_ssl && ( 0 != slapd_ssl_init2(&ports_info.s_socket, 0) ) ) { - LDAPDebug(LDAP_DEBUG_ANY, - "ERROR: SSL Initialization phase 2 Failed.\n", 0, 0, 0 ); - exit( 1 ); - } - } + if ((slapd_exemode == SLAPD_EXEMODE_SLAPD) || + (slapd_exemode == SLAPD_EXEMODE_REFERRAL)) { + if ( init_ssl && ( 0 != slapd_ssl_init2(&ports_info.s_socket, 0) ) ) { + LDAPDebug(LDAP_DEBUG_ANY, + "ERROR: SSL Initialization phase 2 Failed.\n", 0, 0, 0 ); + exit( 1 ); + } + } /* * if we were called upon to do special database stuff, do it and be @@ -929,52 +903,52 @@ main( int argc, char **argv) */ switch ( slapd_exemode ) { case SLAPD_EXEMODE_LDIF2DB: - return slapd_exemode_ldif2db(); + return slapd_exemode_ldif2db(); case SLAPD_EXEMODE_DB2LDIF: - return slapd_exemode_db2ldif(argc,argv); + return slapd_exemode_db2ldif(argc,argv); case SLAPD_EXEMODE_DB2INDEX: - return slapd_exemode_db2index(); + return slapd_exemode_db2index(); case SLAPD_EXEMODE_ARCHIVE2DB: - return slapd_exemode_archive2db(); + return slapd_exemode_archive2db(); case SLAPD_EXEMODE_DB2ARCHIVE: - return slapd_exemode_db2archive(); + return slapd_exemode_db2archive(); case SLAPD_EXEMODE_DBTEST: - return slapd_exemode_dbtest(); + return slapd_exemode_dbtest(); case SLAPD_EXEMODE_REFERRAL: /* check that all the necessary info was given, then go on */ - if (! config_check_referral_mode()) { - LDAPDebug(LDAP_DEBUG_ANY, - "ERROR: No referral URL supplied\n", 0, 0, 0); + if (! config_check_referral_mode()) { + LDAPDebug(LDAP_DEBUG_ANY, + "ERROR: No referral URL supplied\n", 0, 0, 0); usage( myname, extraname ); - exit(1); + exit(1); } break; case SLAPD_EXEMODE_SUFFIX2INSTANCE: - return slapd_exemode_suffix2instance(); + return slapd_exemode_suffix2instance(); #if defined(UPGRADEDB) case SLAPD_EXEMODE_UPGRADEDB: - return slapd_exemode_upgradedb(); + return slapd_exemode_upgradedb(); #endif case SLAPD_EXEMODE_PRINTVERSION: - slapd_print_version(1); - exit(1); + slapd_print_version(1); + exit(1); } /* * Detach ourselves from the terminal (unless running in debug mode). * We must detach before we start any threads since detach forks() on * UNIX. - * Have to detach after ssl_init - the user may be prompted for the PIN - * on the terminal, so it must be open. + * Have to detach after ssl_init - the user may be prompted for the PIN + * on the terminal, so it must be open. */ detach(); @@ -995,8 +969,8 @@ main( int argc, char **argv) * slapd processes that are currently running */ if ((slapd_exemode != SLAPD_EXEMODE_REFERRAL) && - ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica, - skip_db_protect_check) == -1 )) { + ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica, + skip_db_protect_check) == -1 )) { LDAPDebug( LDAP_DEBUG_ANY, "Shutting down due to possible conflicts with other slapd processes\n", 0, 0, 0 ); @@ -1014,7 +988,7 @@ main( int argc, char **argv) char *versionstring = config_get_versionstring(); char *buildnum = config_get_buildnum(); LDAPDebug( LDAP_DEBUG_ANY, "%s B%s starting up\n", - versionstring, buildnum, 0 ); + versionstring, buildnum, 0 ); slapi_ch_free((void **)&buildnum); slapi_ch_free((void **)&versionstring); } @@ -1029,8 +1003,8 @@ main( int argc, char **argv) slapdFrontendConfig->configdir); eq_init(); /* must be done before plugins started */ - snmp_collator_start(); - ps_init_psearch_system(); /* must come before plugin_startall() */ + snmp_collator_start(); + ps_init_psearch_system(); /* must come before plugin_startall() */ /* Initailize the mapping tree */ @@ -1038,12 +1012,12 @@ main( int argc, char **argv) { LDAPDebug( LDAP_DEBUG_ANY, "Failed to init mapping tree\n", 0, 0, 0 ); - exit(1); + exit(1); } /* initialize UniqueID generator - must be done once backends are started - and event queue is initialized but before plugins are started */ + and event queue is initialized but before plugins are started */ sdn = slapi_sdn_new_dn_byval ("cn=uniqueid generator,cn=config"); rc = uniqueIDGenInit (NULL, sdn, slapd_exemode == SLAPD_EXEMODE_SLAPD); slapi_sdn_free (&sdn); @@ -1051,7 +1025,7 @@ main( int argc, char **argv) { LDAPDebug( LDAP_DEBUG_ANY, "Fatal Error---Failed to initialize uniqueid generator; error = %d. " - "Exiting now.\n", rc, 0, 0 ); + "Exiting now.\n", rc, 0, 0 ); exit( 1 ); } @@ -1060,17 +1034,17 @@ main( int argc, char **argv) if ( slapd_security_library_is_initialized() != 0 ) { - start_tls_register_plugin(); + start_tls_register_plugin(); LDAPDebug( LDAP_DEBUG_PLUGIN, - "Start TLS plugin registered.\n", - 0, 0, 0 ); + "Start TLS plugin registered.\n", + 0, 0, 0 ); } #endif - passwd_modify_register_plugin(); - LDAPDebug( LDAP_DEBUG_PLUGIN, - "Password Modify plugin registered.\n", 0, 0, 0 ); + passwd_modify_register_plugin(); + LDAPDebug( LDAP_DEBUG_PLUGIN, + "Password Modify plugin registered.\n", 0, 0, 0 ); - plugin_startall(argc, argv, 1 /* Start Backends */, 1 /* Start Globals */); + plugin_startall(argc, argv, 1 /* Start Backends */, 1 /* Start Globals */); if (housekeeping_start((time_t)0, NULL) == NULL) { exit (1); } @@ -1078,50 +1052,50 @@ main( int argc, char **argv) eq_start(); /* must be done after plugins started */ #ifdef HPUX10 - /* HPUX linker voodoo */ - if (collation_init == NULL) { + /* HPUX linker voodoo */ + if (collation_init == NULL) { exit (1); - } - + } + #endif /* HPUX */ - normalize_oc(); + normalize_oc(); - if (n_port) { + if (n_port) { #if defined(NET_SSL) - } else if ( config_get_security()) { + } else if ( config_get_security()) { #endif - } else { + } else { #ifdef _WIN32 - if( SlapdIsAService() ) - { - LDAPServerStatus.dwCurrentState = SERVICE_STOPPED; - LDAPServerStatus.dwCheckPoint = 0; - LDAPServerStatus.dwWaitHint = 0; - LDAPServerStatus.dwWin32ExitCode = 1; - LDAPServerStatus.dwServiceSpecificExitCode = 1; - - SetServiceStatus(hLDAPServerServiceStatus, &LDAPServerStatus); - - /* Log this event */ - ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_START_FAILED, 1, - "Check server port specification"); - } - else - { - char szMessage[256]; - PR_snprintf( szMessage, sizeof(szMessage), "The Directory Server %s is terminating due to an error. Check server port specification", pszServerName); - MessageBox(GetDesktopWindow(), szMessage, " ", MB_ICONEXCLAMATION | MB_OK); - } + if( SlapdIsAService() ) + { + LDAPServerStatus.dwCurrentState = SERVICE_STOPPED; + LDAPServerStatus.dwCheckPoint = 0; + LDAPServerStatus.dwWaitHint = 0; + LDAPServerStatus.dwWin32ExitCode = 1; + LDAPServerStatus.dwServiceSpecificExitCode = 1; + + SetServiceStatus(hLDAPServerServiceStatus, &LDAPServerStatus); + + /* Log this event */ + ReportSlapdEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVER_START_FAILED, 1, + "Check server port specification"); + } + else + { + char szMessage[256]; + PR_snprintf( szMessage, sizeof(szMessage), "The Directory Server %s is terminating due to an error. Check server port specification", pszServerName); + MessageBox(GetDesktopWindow(), szMessage, " ", MB_ICONEXCLAMATION | MB_OK); + } #endif - exit(1); - } + exit(1); + } } - { - Slapi_PBlock pb; - memset( &pb, '\0', sizeof(pb) ); - pb.pb_backend = be; + { + Slapi_PBlock pb; + memset( &pb, '\0', sizeof(pb) ); + pb.pb_backend = be; } if (slapd_exemode != SLAPD_EXEMODE_REFERRAL) { @@ -1250,7 +1224,7 @@ process_command_line(int argc, char **argv, char *myname, {"debug",ArgRequired,'d'}, {"backend",ArgRequired,'n'}, {"allowMultipleProcesses",ArgNone,'S'}, - {"configDir",ArgRequired,'D'}, + {"instanceDir",ArgRequired,'D'}, {0,0,0}}; @@ -1266,7 +1240,7 @@ process_command_line(int argc, char **argv, char *myname, /*{"whatshouldwecallthis",ArgNone,'C'},*/ {"allowMultipleProcesses",ArgNone,'S'}, {"noUniqueIds",ArgNone,'u'}, - {"configDir",ArgRequired,'D'}, + {"instanceDir",ArgRequired,'D'}, {"encrypt",ArgOptional,'E'}, {"nowrap",ArgNone,'U'}, {"minimalEncode",ArgNone,'m'}, @@ -1290,7 +1264,7 @@ process_command_line(int argc, char **argv, char *myname, {"allowMultipleProcesses",ArgNone,'S'}, {"namespaceid", ArgRequired, 'G'}, {"nostate",ArgNone,'Z'}, - {"configDir",ArgRequired,'D'}, + {"instanceDir",ArgRequired,'D'}, {"encrypt",ArgOptional,'E'}, {0,0,0}}; @@ -1302,7 +1276,7 @@ process_command_line(int argc, char **argv, char *myname, {"archive",ArgRequired,'a'}, {"backEndInstName",ArgRequired,'n'}, {"allowMultipleProcesses",ArgNone,'S'}, - {"configDir",ArgRequired,'D'}, + {"instanceDir",ArgRequired,'D'}, {0,0,0}}; @@ -1313,7 +1287,7 @@ process_command_line(int argc, char **argv, char *myname, {"pidfile",ArgRequired,'i'}, {"archive",ArgRequired,'a'}, {"allowMultipleProcesses",ArgNone,'S'}, - {"configDir",ArgRequired,'D'}, + {"instanceDir",ArgRequired,'D'}, {0,0,0}}; char *opts_db2index = "vd:a:t:T:SD:n:s:x:"; @@ -1325,7 +1299,7 @@ process_command_line(int argc, char **argv, char *myname, {"indexAttribute",ArgRequired,'t'}, {"vlvIndex",ArgRequired,'T'}, {"allowMultipleProcesses",ArgNone,'S'}, - {"configDir",ArgRequired,'D'}, + {"instanceDir",ArgRequired,'D'}, {"include",ArgRequired,'s'}, {"exclude",ArgRequired,'x'}, {0,0,0}}; @@ -1337,7 +1311,7 @@ process_command_line(int argc, char **argv, char *myname, {"debug",ArgRequired,'d'}, {"force",ArgNone,'f'}, {"archive",ArgRequired,'a'}, - {"configDir",ArgRequired,'D'}, + {"instanceDir",ArgRequired,'D'}, {0,0,0}}; #endif @@ -1348,7 +1322,7 @@ process_command_line(int argc, char **argv, char *myname, {"port",ArgRequired,'p'}, {"referralMode",ArgRequired,'r'}, {"allowMultipleProcesses",ArgNone,'S'}, - {"configDir",ArgRequired,'D'}, + {"instanceDir",ArgRequired,'D'}, {0,0,0}}; char *opts_suffix2instance = "s:D:"; @@ -1364,7 +1338,7 @@ process_command_line(int argc, char **argv, char *myname, {"debug",ArgRequired,'d'}, {"pidfile",ArgRequired,'i'}, {"allowMultipleProcesses",ArgNone,'S'}, - {"configDir",ArgRequired,'D'}, + {"instanceDir",ArgRequired,'D'}, {"startpidfile",ArgRequired,'w'}, {0,0,0}}; @@ -1446,7 +1420,7 @@ process_command_line(int argc, char **argv, char *myname, while ( (i = getopt_ext( argc, argv, opts, long_opts, &longopt_index)) != EOF ) { - char *configdir = 0; + char *instancedir = 0; switch ( i ) { #ifdef LDAP_DEBUG case 'd': /* turn on debugging */ @@ -1472,11 +1446,11 @@ process_command_line(int argc, char **argv, char *myname, #endif case 'D': /* config dir */ - configdir = rel2abspath( optarg_ext ); + instancedir = rel2abspath( optarg_ext ); #if defined( XP_WIN32 ) pszServerName = slapi_ch_malloc( MAX_SERVICE_NAME ); - if( !SlapdGetServerNameFromCmdline(pszServerName, configdir, 1) ) + if( !SlapdGetServerNameFromCmdline(pszServerName, instancedir, 1) ) { MessageBox(GetDesktopWindow(), "Failed to get the Directory" " Server name from the command-line argument.", @@ -1484,13 +1458,13 @@ process_command_line(int argc, char **argv, char *myname, exit( 1 ); } #endif - if ( config_set_configdir( "configdir (-D)", - configdir, errorbuf, 1) != LDAP_SUCCESS ) { + if ( config_set_instancedir( "instancedir (-D)", + instancedir, errorbuf, 1) != LDAP_SUCCESS ) { fprintf( stderr, "%s: aborting now\n", errorbuf ); usage( myname, *extraname ); exit( 1 ); } - slapi_ch_free((void **)&configdir); + slapi_ch_free((void **)&instancedir); break; diff --git a/ldap/servers/slapd/modutil.c b/ldap/servers/slapd/modutil.c index 47739318..e8b9ebf8 100644 --- a/ldap/servers/slapd/modutil.c +++ b/ldap/servers/slapd/modutil.c @@ -367,7 +367,7 @@ mod2smod (LDAPMod *mod, Slapi_Mod *smod) if (mod->mod_op & LDAP_MOD_BVALUES) { - while (mod->mod_bvalues[smod->num_values]) + while (mod->mod_bvalues && mod->mod_bvalues[smod->num_values]) { smod->num_values ++; } @@ -375,7 +375,7 @@ mod2smod (LDAPMod *mod, Slapi_Mod *smod) else { PR_ASSERT(0); /* ggood shouldn't ever use string values in server */ - while (mod->mod_values[smod->num_values]) + while (mod->mod_values && mod->mod_values[smod->num_values]) { smod->num_values ++; } diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c index 48e9f998..4a6bbca6 100644 --- a/ldap/servers/slapd/pblock.c +++ b/ldap/servers/slapd/pblock.c @@ -348,7 +348,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value ) (*(int *)value) = pblock->pb_op->o_params.operation_type; break; case SLAPI_OPINITIATED_TIME: - (*(time_t *)value) = pblock->pb_op->o_time; + (*(int *)value) = pblock->pb_op->o_time; break; case SLAPI_REQUESTOR_ISROOT: (*(int *)value) = pblock->pb_requestor_isroot; diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h index 54044a71..5726a5c2 100644 --- a/ldap/servers/slapd/proto-slap.h +++ b/ldap/servers/slapd/proto-slap.h @@ -301,8 +301,6 @@ int config_set_versionstring(const char *attrname, char *versionstring, char *e int config_set_enquote_sup_oc(const char *attrname, char *value, char *errorbuf, int apply ); int config_set_basedn( const char *attrname, char *value, char *errorbuf, int apply ); int config_set_configdir( const char *attrname, char *value, char *errorbuf, int apply ); -int config_set_schemadir( const char *attrname, char *value, char *errorbuf, int apply ); -int config_set_ldifdir( const char *attrname, char *value, char *errorbuf, int apply ); int config_set_attrname_exceptions( const char *attrname, char *value, char *errorbuf, int apply ); int config_set_hash_filters( const char *attrname, char *value, char *errorbuf, int apply ); int config_set_rewrite_rfc1274( const char *attrname, char *value, char *errorbuf, int apply ); @@ -400,7 +398,6 @@ char *config_get_buildnum(void); int config_get_enquote_sup_oc(); char *config_get_basedn(); char *config_get_configdir(); -char *config_get_schemadir(); char **config_get_errorlog_list(); char **config_get_accesslog_list(); char **config_get_auditlog_list(); diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c index a8f35db8..e3ca1685 100644 --- a/ldap/servers/slapd/schema.c +++ b/ldap/servers/slapd/schema.c @@ -4014,11 +4014,7 @@ init_schema_dse(const char *configdir) slapi_sdn_init_dn_byref(&schema,"cn=schema"); - schemadir = config_get_schemadir(); - if (NULL == schemadir) { - /* schemadir info is not configured, let's use the default place */ - schemadir = slapi_ch_smprintf("%s/%s", configdir, SCHEMA_SUBDIR_NAME); - } + schemadir = slapi_ch_smprintf("%s/%s", configdir, SCHEMA_SUBDIR_NAME); filelist = get_priority_filelist(schemadir, ".*ldif$"); if (!filelist || !*filelist) diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h index c6fb41f9..14947bca 100644 --- a/ldap/servers/slapd/slap.h +++ b/ldap/servers/slapd/slap.h @@ -1708,8 +1708,6 @@ typedef struct _slapdEntryPoints { #define CONFIG_REWRITE_RFC1274_ATTRIBUTE "nsslapd-rewrite-rfc1274" #define CONFIG_CONFIG_ATTRIBUTE "nsslapd-config" -#define CONFIG_SCHEMADIR_ATTRIBUTE "nsslapd-schemadir" -#define CONFIG_LDIFDIR_ATTRIBUTE "nsslapd-ldifdir" #define CONFIG_SSLCLIENTAUTH_ATTRIBUTE "nsslapd-SSLclientAuth" #define CONFIG_SSL_CHECK_HOSTNAME_ATTRIBUTE "nsslapd-ssl-check-hostname" #define CONFIG_HASH_FILTERS_ATTRIBUTE "nsslapd-hash-filters" @@ -1884,7 +1882,6 @@ typedef struct _slapdFrontendConfig { char *workingdir; /* full path of directory before detach */ char *configdir; /* full path name of directory containing configuration files */ - char *schemadir; /* full path name of directory containing schema files */ int attrname_exceptions; /* if true, allow questionable attribute names */ int rewrite_rfc1274; /* return attrs for both v2 and v3 names */ char *schemareplace; /* see CONFIG_SCHEMAREPLACE_* #defines below */ diff --git a/ldap/servers/slapd/test-plugins/testbind.c b/ldap/servers/slapd/test-plugins/testbind.c index 1b2bed98..3419a66e 100644 --- a/ldap/servers/slapd/test-plugins/testbind.c +++ b/ldap/servers/slapd/test-plugins/testbind.c @@ -69,7 +69,7 @@ #include <string.h> #include "slapi-plugin.h" -Slapi_PluginDesc bindpdesc = { "test-bind", "Fedora Project", "1.0.3", +Slapi_PluginDesc bindpdesc = { "test-bind", "Fedora Project", "1.0.4", "sample bind pre-operation plugin" }; static Slapi_ComponentId *plugin_id = NULL; diff --git a/ldap/servers/slapd/test-plugins/testdatainterop.c b/ldap/servers/slapd/test-plugins/testdatainterop.c index f855c47d..4f7e64f9 100644 --- a/ldap/servers/slapd/test-plugins/testdatainterop.c +++ b/ldap/servers/slapd/test-plugins/testdatainterop.c @@ -113,7 +113,7 @@ /* * Static variables. */ -static Slapi_PluginDesc plugindesc = { PLUGIN_NAME, "Fedora Project", "1.0.3", +static Slapi_PluginDesc plugindesc = { PLUGIN_NAME, "Fedora Project", "1.0.4", "sample pre-operation null suffix plugin" }; static Slapi_ComponentId *plugin_id = NULL; diff --git a/ldap/servers/slapd/test-plugins/testentry.c b/ldap/servers/slapd/test-plugins/testentry.c index c8aa0373..87a0b0a3 100644 --- a/ldap/servers/slapd/test-plugins/testentry.c +++ b/ldap/servers/slapd/test-plugins/testentry.c @@ -90,7 +90,7 @@ nsslapd-pluginId: test-entry #include <string.h> #include "slapi-plugin.h" -Slapi_PluginDesc entrypdesc = { "test-entry", "Fedora Project", "1.0.3", +Slapi_PluginDesc entrypdesc = { "test-entry", "Fedora Project", "1.0.4", "sample entry modification plugin" }; /* Entry store plug-in function */ diff --git a/ldap/servers/slapd/test-plugins/testextendedop.c b/ldap/servers/slapd/test-plugins/testextendedop.c index f4d11137..38574c5b 100644 --- a/ldap/servers/slapd/test-plugins/testextendedop.c +++ b/ldap/servers/slapd/test-plugins/testextendedop.c @@ -83,7 +83,7 @@ /* OID of the extended operation handled by this plug-in */ #define MY_OID "1.2.3.4" -Slapi_PluginDesc expdesc = { "test-extendedop", "Fedora Project", "1.0.3", +Slapi_PluginDesc expdesc = { "test-extendedop", "Fedora Project", "1.0.4", "sample extended operation plugin" }; diff --git a/ldap/servers/slapd/test-plugins/testgetip.c b/ldap/servers/slapd/test-plugins/testgetip.c index 432fb127..724d96b7 100644 --- a/ldap/servers/slapd/test-plugins/testgetip.c +++ b/ldap/servers/slapd/test-plugins/testgetip.c @@ -74,7 +74,7 @@ #include "slapi-plugin.h" #include "nspr.h" -Slapi_PluginDesc getippdesc = { "test-getip", "Fedora Project", "1.0.3", +Slapi_PluginDesc getippdesc = { "test-getip", "Fedora Project", "1.0.4", "sample pre-operation plugin" }; static char *netaddr2str( PRNetAddr *addrp, char *buf, size_t buflen ); diff --git a/ldap/servers/slapd/test-plugins/testpostop.c b/ldap/servers/slapd/test-plugins/testpostop.c index 0a4cda37..cb035e7f 100644 --- a/ldap/servers/slapd/test-plugins/testpostop.c +++ b/ldap/servers/slapd/test-plugins/testpostop.c @@ -93,7 +93,7 @@ static char changelogfile[MAX_PATH+1]; static char *changelogfile = "/tmp/changelog"; #endif -Slapi_PluginDesc postoppdesc = { "test-postop", "Fedora Project", "1.0.3", +Slapi_PluginDesc postoppdesc = { "test-postop", "Fedora Project", "1.0.4", "sample post-operation plugin" }; static void write_changelog( int optype, char *dn, void *change, int flag ); diff --git a/ldap/servers/slapd/test-plugins/testpreop.c b/ldap/servers/slapd/test-plugins/testpreop.c index 03cf46b9..e8fb8836 100644 --- a/ldap/servers/slapd/test-plugins/testpreop.c +++ b/ldap/servers/slapd/test-plugins/testpreop.c @@ -79,7 +79,7 @@ #include <string.h> #include "slapi-plugin.h" -Slapi_PluginDesc preoppdesc = { "test-preop", "Fedora Project", "1.0.3", +Slapi_PluginDesc preoppdesc = { "test-preop", "Fedora Project", "1.0.4", "sample pre-operation plugin" }; /* Pre-operation plug-in function */ diff --git a/ldap/servers/slapd/test-plugins/testsaslbind.c b/ldap/servers/slapd/test-plugins/testsaslbind.c index 13ebd272..b68965a4 100644 --- a/ldap/servers/slapd/test-plugins/testsaslbind.c +++ b/ldap/servers/slapd/test-plugins/testsaslbind.c @@ -80,7 +80,7 @@ nsslapd-plugindescription: sample SASL bind pre-operation plugin #include <string.h> #include "slapi-plugin.h" -Slapi_PluginDesc saslpdesc = { "test-saslbind", "Fedora Project", "1.0.3", +Slapi_PluginDesc saslpdesc = { "test-saslbind", "Fedora Project", "1.0.4", "sample SASL bind pre-operation plugin" }; diff --git a/ldap/servers/slapd/tools/pwenc.c b/ldap/servers/slapd/tools/pwenc.c index 524c6a27..c87e0f64 100644 --- a/ldap/servers/slapd/tools/pwenc.c +++ b/ldap/servers/slapd/tools/pwenc.c @@ -82,7 +82,7 @@ static void usage( name ) char *name; { - fprintf( stderr, "usage: %s -D config-dir [-H] [-s scheme | -c comparepwd ] password...\n", name ); + fprintf( stderr, "usage: %s -D instance-dir [-H] [-s scheme | -c comparepwd ] password...\n", name ); exit( 1 ); } @@ -133,7 +133,7 @@ main( argc, argv ) slapdFrontendConfig_t *slapdFrontendConfig = NULL; char *opts = "Hs:c:D:"; - char *configdir = NULL; + char *instancedir = NULL; name = argv[ 0 ]; pwsp = cmppwsp = NULL; @@ -157,13 +157,13 @@ main( argc, argv ) /* kexcoff: quite the same as slapd_bootstrap_config */ FrontendConfig_init(); - configdir = rel2abspath( optarg ); - if ( config_set_configdir( "configdir (-D)", configdir, + instancedir = rel2abspath( optarg ); + if ( config_set_instancedir( "configdir (-D)", instancedir, errorbuf, 1) != LDAP_SUCCESS ) { fprintf( stderr, "%s\n", errorbuf ); return( 1 ); } - slapi_ch_free((void **)&configdir); + slapi_ch_free((void **)&instancedir); slapdFrontendConfig = getFrontendConfig(); |
