[Fedora-directory-commits] ldapserver/ldap/servers/slapd auth.c, 1.7, 1.8 ch_malloc.c, 1.7, 1.8 config.c, 1.7, 1.8 libglobs.c, 1.10, 1.11 libslapd.def, 1.16, 1.17 log.c, 1.13, 1.14 main.c, 1.12, 1.13 protect_db.c, 1.6, 1.7 proto-slap.h, 1.21, 1.22 slap.h, 1.15, 1.16 snmp_collator.c, 1.8, 1.9 ssl.c, 1.8, 1.9

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Fri Oct 13 01:06:31 UTC 2006


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv23608/ldap/servers/slapd

Modified Files:
	auth.c ch_malloc.c config.c libglobs.c libslapd.def log.c 
	main.c protect_db.c proto-slap.h slap.h snmp_collator.c ssl.c 
Log Message:
[208672] parameterizing the hardcoded paths (phase 2. db, log, lock, pid, cert, and instance dir)
1) introduced these 3 new config attributes:
   nsslapd-lockdir, nsslapd-tmpdir, nsslapd-certdir,
   and eliminated: nsslapd-instancedir.
2) replaced the hardcoded paths with the corresponding attribute value in the
   server as well as in the create/remove instance codes.
3) moved snmp stats file to the nsslapd-tmpdir
4) moved the server instance dir to <prefix>/lib/<brand>-ds/slapd-<id>



Index: auth.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/auth.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- auth.c	27 Sep 2006 23:40:51 -0000	1.7
+++ auth.c	13 Oct 2006 01:06:28 -0000	1.8
@@ -271,7 +271,6 @@
 void
 client_auth_init ()
 {
-    char *instancedir;
     int err;
     if (client_auth_config_file == NULL) {
 	char *confdir = config_get_configdir();


Index: ch_malloc.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/ch_malloc.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ch_malloc.c	19 Apr 2005 22:07:36 -0000	1.7
+++ ch_malloc.c	13 Oct 2006 01:06:28 -0000	1.8
@@ -624,11 +624,12 @@
 {
 	if (!SymInitialized)
 	{
+		/* OBSOLETE: we don't have this directory structure any longer */
 		/*
 		 * searchpath= <instancedir>\bin\slapd\server;<instancedir>\lib
 		 */
 		char *searchpath= NULL;
-		char *id= config_get_instancedir();
+		/* char *id= config_get_instancedir(); eliminated */
 		if(id!=NULL)
 		{
 			char *p= id;


Index: config.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/config.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- config.c	27 Sep 2006 23:40:51 -0000	1.7
+++ config.c	13 Oct 2006 01:06:28 -0000	1.8
@@ -160,7 +160,6 @@
 	char *buf = 0;
 	char *lastp = 0;
 	char *entrystr = 0;
-	char *instancedir = NULL;
 
 	if (NULL == configdir) {
 		slapi_log_error(SLAPI_LOG_FATAL,
@@ -261,29 +260,6 @@
 								entrystr, configfile, 0);
 					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] &&
@@ -369,6 +345,19 @@
 					}
 				}
 
+				/* set the cert dir; needed in slapd_nss_init */
+				workpath[0] = '\0';
+				if (entry_has_attr_and_value(e, CONFIG_CERTDIR_ATTRIBUTE,
+						workpath, sizeof(workpath)))
+				{
+					if (config_set_certdir(CONFIG_CERTDIR_ATTRIBUTE,
+							workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
+					{
+						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
+									  CONFIG_CERTDIR_ATTRIBUTE, errorbuf);
+					}
+				}
+
 				/* see if the entry is a child of the plugin base dn */
 				if (slapi_sdn_isparent(&plug_dn,
 									   slapi_entry_get_sdn_const(e)))
@@ -390,6 +379,7 @@
 						}
 					}
 				}
+
 				/* see if the entry is a grand child of the plugin base dn */
 				if (slapi_sdn_isgrandparent(&plug_dn,
 											slapi_entry_get_sdn_const(e)))
@@ -517,19 +507,6 @@
 				if (e)
 					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
 			 */


Index: libglobs.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/libglobs.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- libglobs.c	27 Sep 2006 23:40:51 -0000	1.10
+++ libglobs.c	13 Oct 2006 01:06:28 -0000	1.11
@@ -513,16 +513,22 @@
 		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,
-		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},
+	/* parameterizing lock dir */
+	{CONFIG_LOCKDIR_ATTRIBUTE, config_set_lockdir,
+		NULL, 0,
+		(void**)&global_slapdFrontendConfig.lockdir, CONFIG_STRING, config_get_lockdir},
+	/* parameterizing tmp dir */
+	{CONFIG_TMPDIR_ATTRIBUTE, config_set_tmpdir,
+		NULL, 0,
+		(void**)&global_slapdFrontendConfig.tmpdir, CONFIG_STRING, config_get_tmpdir},
+	/* parameterizing cert dir */
+	{CONFIG_CERTDIR_ATTRIBUTE, config_set_certdir,
+		NULL, 0,
+		(void**)&global_slapdFrontendConfig.certdir, CONFIG_STRING, config_get_certdir},
 	{CONFIG_REWRITE_RFC1274_ATTRIBUTE, config_set_rewrite_rfc1274,
 		NULL, 0,
 		(void**)&global_slapdFrontendConfig.rewrite_rfc1274, CONFIG_ON_OFF, NULL},
@@ -2325,44 +2331,6 @@
   return retVal;
 }
 
-int 
-config_set_instancedir( 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 ( PR_Access ( value, PR_ACCESS_READ_OK ) != 0 ) {
-	PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Directory \"%s\" is not accessible.", value );
-	retVal = LDAP_OPERATIONS_ERROR;
-	return retVal;
-  }
-
-  if ( apply) {
-	CFG_LOCK_WRITE(slapdFrontendConfig);
-	slapdFrontendConfig->instancedir = slapi_ch_strdup ( value );
-#ifdef _WIN32
-	dostounixpath(slapdFrontendConfig->instancedir);
-#endif /* _WIN32 */
-	CFG_UNLOCK_WRITE(slapdFrontendConfig);
-
-	/* Set the slapd type also */
-	config_set_slapd_type ();
-
-	/* Set the configdir if not set (it must be set since 7.2) */
-	if (!slapdFrontendConfig->configdir)
-	{
-		char newdir[MAXPATHLEN+1];
-		PR_snprintf ( newdir, sizeof(newdir), "%s/%s",
-				slapdFrontendConfig->instancedir, CONFIG_SUBDIR_NAME);
-		retVal = config_set_configdir(attrname, newdir, errorbuf, apply);
-	}
-  }
-  return retVal;
-}
-
 /* alias of encryption key and certificate files is now retrieved through */
 /* calls to psetFullCreate() and psetGetAttrSingleValue(). See ssl.c, */
 /* where this function is still used to set the global variable */
@@ -3715,19 +3683,6 @@
 }
 
 #endif /* _WIN32 */
-
-char *
-config_get_instancedir() {
-  slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-  char *retVal;
-  
-  CFG_LOCK_READ(slapdFrontendConfig);
-  retVal = config_copy_strval( slapdFrontendConfig->instancedir );
-  CFG_UNLOCK_READ(slapdFrontendConfig);
-
-  return retVal;
-}
-
 /* alias of encryption key and certificate files is now retrieved through */
 /* calls to psetFullCreate() and psetGetAttrSingleValue(). See ssl.c, */
 /* where this function is still used to set the global variable */
@@ -4067,27 +4022,6 @@
 	return ( SLAPD_FULL );
 }
 
-/* This function is called once at the startup time and no more */
-void
-config_set_slapd_type( )
-{
-	char	*root = NULL;
-	char	*s_root = NULL;
-  	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
-	CFG_LOCK_WRITE(slapdFrontendConfig);
-	if ( slapdFrontendConfig->instancedir )
-		s_root = root = slapi_ch_strdup ( slapdFrontendConfig->instancedir );
-
-	if ( (root = strrchr( root, '/' )) != NULL ) {
-		*root = '\0';
-        }
-	slapdFrontendConfig->slapd_type = 0;
-	slapdFrontendConfig->versionstring = SLAPD_VERSION_STR;
-	CFG_UNLOCK_WRITE(slapdFrontendConfig);
-	slapi_ch_free ( (void **) &s_root );
-}
-
 int
 config_set_maxbersize( const char *attrname, char *value, char *errorbuf, int apply )
 {
@@ -4263,11 +4197,112 @@
 	return retVal;
 }
 
+char *
+config_get_lockdir()
+{
+	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+	char *retVal;
+
+	CFG_LOCK_READ(slapdFrontendConfig);
+	retVal = config_copy_strval(slapdFrontendConfig->lockdir);
+	CFG_UNLOCK_READ(slapdFrontendConfig);
+
+	return retVal; 
+}
+
 int
-config_set_ldifdir(const char *attrname, char *value, char *errorbuf, int apply)
+config_set_lockdir(const char *attrname, char *value, char *errorbuf, int apply)
 {
-	/* noop */
-	return LDAP_SUCCESS;
+	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->lockdir);
+
+	slapdFrontendConfig->lockdir = slapi_ch_strdup(value);
+  
+	CFG_UNLOCK_WRITE(slapdFrontendConfig);
+	return retVal;
+}
+
+char *
+config_get_tmpdir()
+{
+	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+	char *retVal;
+
+	CFG_LOCK_READ(slapdFrontendConfig);
+	retVal = config_copy_strval(slapdFrontendConfig->tmpdir);
+	CFG_UNLOCK_READ(slapdFrontendConfig);
+
+	return retVal; 
+}
+
+int
+config_set_tmpdir(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->tmpdir);
+
+	slapdFrontendConfig->tmpdir = slapi_ch_strdup(value);
+  
+	CFG_UNLOCK_WRITE(slapdFrontendConfig);
+	return retVal;
+}
+
+char *
+config_get_certdir()
+{
+	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+	char *retVal;
+
+	CFG_LOCK_READ(slapdFrontendConfig);
+	retVal = config_copy_strval(slapdFrontendConfig->certdir);
+	CFG_UNLOCK_READ(slapdFrontendConfig);
+
+	return retVal; 
+}
+
+int
+config_set_certdir(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->certdir);
+
+	slapdFrontendConfig->certdir = slapi_ch_strdup(value);
+  
+	CFG_UNLOCK_WRITE(slapdFrontendConfig);
+	return retVal;
 }
 
 char **


Index: libslapd.def
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/libslapd.def,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- libslapd.def	19 Mar 2006 21:21:22 -0000	1.16
+++ libslapd.def	13 Oct 2006 01:06:28 -0000	1.17
@@ -473,7 +473,7 @@
 	slapi_build_control @437
 	slapi_entry_get_ndn		@438
 	dse_unset_dont_ever_write_dse_files		@439
-	config_set_instancedir 	@440
+;	config_set_instancedir 	@440
 	config_set_encryptionalias 	@441
 	config_set_threadnumber 	@442
 	config_set_maxthreadsperconn 	@443
@@ -537,7 +537,7 @@
     slapi_entry_set_sdn @501
     slapi_sdn_copy @502
 	config_set_basedn	@503
-	config_get_instancedir	@504
+;	config_get_instancedir	@504
 	config_get_encryptionalias	@505
 	config_get_threadnumber	@506
 	config_get_maxthreadsperconn	@507
@@ -570,7 +570,7 @@
 	attr_set_deletion_csn @534
     slapi_mod_dump @535
 	config_is_slapd_lite		@536
-	config_set_slapd_type		@537
+;	config_set_slapd_type		@537
 	config_get_versionstring	@538
 	slapi_is_rootdse			@539
 	slapi_find_matching_paren		@540


Index: log.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/log.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- log.c	11 Apr 2006 02:14:44 -0000	1.13
+++ log.c	13 Oct 2006 01:06:28 -0000	1.14
@@ -225,7 +225,8 @@
 {
 	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 #if defined( XP_WIN32 )
-	char * instancedir = NULL;
+	/* char * instancedir = NULL; obsolete. */
+	/* To port to Windows, need to support FHS. */
 #endif
 
 	ts_time_lock = PR_NewLock();
@@ -234,7 +235,7 @@
 
 #if defined( XP_WIN32 )
 	pszServerName = slapi_ch_malloc( MAX_SERVICE_NAME );
-	instancedir = config_get_instancedir();
+	/* instancedir = config_get_instancedir(); eliminated */
 	unixtodospath(instancedir);
 	if( !SlapdGetServerNameFromCmdline(pszServerName, instancedir, 1) )
 	{
@@ -1578,14 +1579,14 @@
 		PR_snprintf(buff, bufflen, "\t%s:%d (%s)\n\n",
 				fe_cfg->localhost,
 				fe_cfg->security ? fe_cfg->secureport : fe_cfg->port,
-				fe_cfg->instancedir ? fe_cfg->instancedir : "");
+				fe_cfg->configdir ? fe_cfg->configdir : "");
 	}
 	else {
 		/* If fe_cfg->localhost is not set, ignore fe_cfg->port since
 		 * it is the default and might be misleading.
 		 */
 		PR_snprintf(buff, bufflen, "\t<host>:<port> (%s)\n\n",
-				fe_cfg->instancedir ? fe_cfg->instancedir : "");
+				fe_cfg->configdir ? fe_cfg->configdir : "");
 	}
 	LOG_WRITE_NOW(fp, buff, strlen(buff), 0);
 	slapi_ch_free((void **)&buildnum);


Index: main.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/main.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- main.c	27 Sep 2006 23:40:51 -0000	1.12
+++ main.c	13 Oct 2006 01:06:28 -0000	1.13
@@ -274,13 +274,7 @@
 	else {
 		return;
 	}
-
-	/* 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 */
+	/* config directory needs to be owned by the local user */
 	if (slapdFrontendConfig->configdir) {
 		chown_dir_files(slapdFrontendConfig->configdir, pw, PR_FALSE);
 	}
@@ -698,8 +692,7 @@
 
 	process_command_line(argc,argv,myname,&extraname);
 
-	if (!slapdFrontendConfig->instancedir &&
-		!slapdFrontendConfig->configdir) {
+	if (NULL == slapdFrontendConfig->configdir) {
 		usage( myname, extraname );
 		exit( 1 );
 	}


Index: protect_db.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/protect_db.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- protect_db.c	19 Apr 2005 22:07:36 -0000	1.6
+++ protect_db.c	13 Oct 2006 01:06:28 -0000	1.7
@@ -44,7 +44,6 @@
 
 #ifndef _WIN32
 
-#define LOCK_DIR    "locks"
 #define LOCK_FILE   "lock"
 #define IMPORT_DIR  "imports"
 #define EXPORT_DIR  "exports"
@@ -87,8 +86,8 @@
        gets called by an atexit function, and NSPR is long gone by then. */
 
     /* Get the name of the lockfile */
-    snprintf(lockfile, sizeof(lockfile), "%s/%s", slapdFrontendConfig->instancedir, LOCK_FILE);
-	lockfile[sizeof(lockfile)-1] = (char)0;
+    snprintf(lockfile, sizeof(lockfile), "%s/%s", slapdFrontendConfig->lockdir, LOCK_FILE);
+    lockfile[sizeof(lockfile)-1] = (char)0;
     /* Get our pid */
     pid = getpid();
 
@@ -96,7 +95,7 @@
     if ((fd = open(lockfile, O_RDWR | O_CREAT | O_EXCL, 0664)) != -1) {
         /* We got the lock, write our pid to the file */
         write(fd, (void *) &pid, sizeof(pid_t));
-	close(fd);
+    close(fd);
         return 0;
     }
      
@@ -109,13 +108,13 @@
 
     while(1) {
         /* Try to grab the lockfile NUM_TRIES times waiting WAIT_TIME milliseconds after each try */
-	t.tv_sec = 0;
-	t.tv_usec = WAIT_TIME * 1000;
+    t.tv_sec = 0;
+    t.tv_usec = WAIT_TIME * 1000;
         for(x = 0; x < NUM_TRIES; x++) {
             if ((fd = open(lockfile, O_RDWR | O_CREAT | O_EXCL)) != -1) {
                 /* Got the lock */
                 write(fd, (void *) &pid, sizeof(pid_t));
-		close(fd);
+        close(fd);
                 return 0;
             }
             select(0, NULL, NULL, NULL, &t);
@@ -123,7 +122,7 @@
         
         /* We still haven't got the lockfile.  Find out who owns it and see if they are still up */
         if ((fd = open(lockfile,  O_RDONLY)) != -1) {
-			size_t nb_bytes=0;	
+            size_t nb_bytes=0;    
 
             nb_bytes = read(fd, (void *) &owning_pid, sizeof(pid_t));
             if ( (nb_bytes != (size_t)(sizeof(pid_t)) ) || (owning_pid == 0) || (kill(owning_pid, 0) != 0 && errno == ESRCH) ) {
@@ -158,8 +157,8 @@
 
     /* This function assumes that the caller owns the lock, it doesn't check to make sure! */
 
-    snprintf(lockfile, sizeof(lockfile), "%s/%s", slapdFrontendConfig->instancedir, LOCK_FILE);
-	lockfile[sizeof(lockfile)-1] = (char)0;
+    snprintf(lockfile, sizeof(lockfile), "%s/%s", slapdFrontendConfig->lockdir, LOCK_FILE);
+    lockfile[sizeof(lockfile)-1] = (char)0;
     unlink(lockfile);
 }
 
@@ -171,9 +170,9 @@
 is_process_up(pid_t pid) 
 {
     if (kill(pid, 0) == -1 && errno == ESRCH) {
-	return 0;
+        return 0;
     } else {
-	return 1;
+        return 1;
     }
 }
 
@@ -189,24 +188,24 @@
 
     /* Make sure it exists */
     if (PR_MkDir(dir, 0755) != PR_SUCCESS) {
-		PRErrorCode prerr = PR_GetError();
-		if (prerr != PR_FILE_EXISTS_ERROR) {
-			LDAPDebug(LDAP_DEBUG_ANY, FILE_CREATE_ERROR, dir, prerr, slapd_pr_strerror(prerr));
-			return 1;
-		}
+        PRErrorCode prerr = PR_GetError();
+        if (prerr != PR_FILE_EXISTS_ERROR) {
+            LDAPDebug(LDAP_DEBUG_ANY, FILE_CREATE_ERROR, dir, prerr, slapd_pr_strerror(prerr));
+            return 1;
+        }
     }
 
     /* Make sure it's owned by the correct user */
     if (slapdFrontendConfig->localuser != NULL) {
       if ( (pw = getpwnam(slapdFrontendConfig->localuser)) == NULL ) {
-	LDAPDebug(LDAP_DEBUG_ANY, GETPWNAM_WARNING, slapdFrontendConfig->localuser, errno, strerror(errno));
+        LDAPDebug(LDAP_DEBUG_ANY, GETPWNAM_WARNING, slapdFrontendConfig->localuser, errno, strerror(errno));
       } else {
-	if (chown(dir, pw->pw_uid, -1) == -1) {
-	    stat(dir, &stat_buffer);
-	    if (stat_buffer.st_uid != pw->pw_uid) {
-		LDAPDebug(LDAP_DEBUG_ANY, CHOWN_WARNING, dir, 0, 0);
-	    }
-	}
+        if (chown(dir, pw->pw_uid, -1) == -1) {
+            stat(dir, &stat_buffer);
+            if (stat_buffer.st_uid != pw->pw_uid) {
+                LDAPDebug(LDAP_DEBUG_ANY, CHOWN_WARNING, dir, 0, 0);
+            }
+        }
       } /* else */
     }
 
@@ -226,25 +225,25 @@
     slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
     snprintf(file_name, sizeof(file_name), "%s/%d", dir_name, getpid());
-	file_name[sizeof(file_name)-1] = (char)0;
+    file_name[sizeof(file_name)-1] = (char)0;
     
     if ((prfd = PR_Open(file_name, PR_RDWR | PR_CREATE_FILE, 0666)) == NULL) {
-	LDAPDebug(LDAP_DEBUG_ANY, FILE_CREATE_WARNING, file_name, 0, 0);
-	return;
+    LDAPDebug(LDAP_DEBUG_ANY, FILE_CREATE_WARNING, file_name, 0, 0);
+    return;
     }
     
     /* Make sure the owner is of the file is the user the server
      * runs as. */
     if (slapdFrontendConfig->localuser != NULL) {
       if ( (pw = getpwnam(slapdFrontendConfig->localuser)) == NULL ) {
-	LDAPDebug(LDAP_DEBUG_ANY, GETPWNAM_WARNING, slapdFrontendConfig->localuser, errno, strerror(errno));
+    LDAPDebug(LDAP_DEBUG_ANY, GETPWNAM_WARNING, slapdFrontendConfig->localuser, errno, strerror(errno));
       } else {
-	if (chown(file_name, pw->pw_uid, -1) == -1) {
-	    stat(file_name, &stat_buffer);
-	    if (stat_buffer.st_uid != pw->pw_uid) {
-		LDAPDebug(LDAP_DEBUG_ANY, CHOWN_WARNING, file_name, 0, 0);
-	    }
-	}
+        if (chown(file_name, pw->pw_uid, -1) == -1) {
+            stat(file_name, &stat_buffer);
+            if (stat_buffer.st_uid != pw->pw_uid) {
+                LDAPDebug(LDAP_DEBUG_ANY, CHOWN_WARNING, file_name, 0, 0);
+            }
+        }
       } /* else */
     }
     PR_Close(prfd);
@@ -269,22 +268,22 @@
     char file_name[MAXPATHLEN];
 
     if ((dir = PR_OpenDir(dir_name)) == NULL) {
-	return 0;
+        return 0;
     }
 
     while((entry = PR_ReadDir(dir, PR_SKIP_BOTH)) != NULL) {
-	pid = (pid_t) strtol(entry->name, &endp, 0);
-	if (*endp != '\0') {
-	    /* not quite sure what this file was, but we 
-	     * didn't put it there */
-	    continue;
-	}
-	if (is_process_up(pid)) {
-	    result = (long) pid;
-	} else {
-	    PR_snprintf(file_name, MAXPATHLEN, "%s/%s", dir_name, entry->name);
-	    PR_Delete(file_name);
-	}
+        pid = (pid_t) strtol(entry->name, &endp, 0);
+        if (*endp != '\0') {
+            /* not quite sure what this file was, but we 
+             * didn't put it there */
+            continue;
+        }
+        if (is_process_up(pid)) {
+            result = (long) pid;
+        } else {
+            PR_snprintf(file_name, MAXPATHLEN, "%s/%s", dir_name, entry->name);
+            PR_Delete(file_name);
+        }
     }
     PR_CloseDir(dir);
     return result;
@@ -299,7 +298,6 @@
 {
     /* since this is called from an atexit function, we can't use
      * NSPR. */
-
     DIR *dir;
     struct dirent *entry;
     pid_t pid;
@@ -311,30 +309,30 @@
     our_pid = getpid();
 
     if ((dir = opendir(dir_name)) == NULL) {
-	return;
+        return;
     }
 
     while((entry = readdir(dir)) != NULL) {
-	
-	/* skip dot and dot-dot */
-	if (strcmp(entry->d_name, ".") == 0 ||
-	    strcmp(entry->d_name, "..") == 0)
-	    continue;
-
-	pid = (pid_t) strtol(entry->d_name, &endp, 0);
-	if (*endp != '\0') {
-	    /* not quite sure what this file was, but we 
-	     * didn't put it there */
-	    continue;
-	}	
-	if (!is_process_up(pid) || pid == our_pid) {
-	    PR_snprintf(file_name, MAXPATHLEN, "%s/%s", dir_name, entry->d_name);
-	    unlink(file_name);
-	}
+    
+        /* skip dot and dot-dot */
+        if (strcmp(entry->d_name, ".") == 0 ||
+            strcmp(entry->d_name, "..") == 0)
+            continue;
+
+        pid = (pid_t) strtol(entry->d_name, &endp, 0);
+        if (*endp != '\0') {
+            /* not quite sure what this file was, but we 
+             * didn't put it there */
+            continue;
+        }    
+        if (!is_process_up(pid) || pid == our_pid) {
+            PR_snprintf(file_name, sizeof(file_name), "%s/%s", dir_name, entry->d_name);
+            unlink(file_name);
+        }
     }
     closedir(dir);
 }
-	
+    
 
 
 /* Walks through all the pid directories and clears any stale 
@@ -343,31 +341,26 @@
 void
 remove_slapd_process()
 {
-    char lock_dir[MAXPATHLEN];
     char import_dir[MAXPATHLEN];
     char export_dir[MAXPATHLEN];
     char server_dir[MAXPATHLEN];
     slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
-
     /* Create the name of the directories that hold the pids of the currently running 
      * ns-slapd processes */
-    snprintf(lock_dir, sizeof(lock_dir), "%s/%s", slapdFrontendConfig->instancedir, LOCK_DIR);
-	lock_dir[sizeof(lock_dir)-1] = (char)0;
-    snprintf(import_dir, sizeof(import_dir), "%s/%s/%s", slapdFrontendConfig->instancedir, LOCK_DIR, IMPORT_DIR);
-	import_dir[sizeof(import_dir)-1] = (char)0;
-    snprintf(export_dir, sizeof(export_dir), "%s/%s/%s", slapdFrontendConfig->instancedir, LOCK_DIR, EXPORT_DIR);
-	export_dir[sizeof(export_dir)-1] = (char)0;
-    snprintf(server_dir, sizeof(server_dir), "%s/%s/%s", slapdFrontendConfig->instancedir, LOCK_DIR, SERVER_DIR);
-	server_dir[sizeof(server_dir)-1] = (char)0;
+    snprintf(import_dir, sizeof(import_dir), "%s/%s", slapdFrontendConfig->lockdir, IMPORT_DIR);
+    import_dir[sizeof(import_dir)-1] = (char)0;
+    snprintf(export_dir, sizeof(export_dir), "%s/%s", slapdFrontendConfig->lockdir, EXPORT_DIR);
+    export_dir[sizeof(export_dir)-1] = (char)0;
+    snprintf(server_dir, sizeof(server_dir), "%s/%s", slapdFrontendConfig->lockdir, SERVER_DIR);
+    server_dir[sizeof(server_dir)-1] = (char)0;
 
     /* Grab the lockfile */
     if (grab_lockfile() != 0) {
-	/* Unable to grab the lockfile */
-	return;
+        /* Unable to grab the lockfile */
+        return;
     }
 
-    
     remove_and_update(import_dir);
     remove_and_update(export_dir);
     remove_and_update(server_dir);
@@ -378,7 +371,6 @@
 int
 add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
 {
-    char lock_dir[MAXPATHLEN];
     char import_dir[MAXPATHLEN];
     char export_dir[MAXPATHLEN];
     char server_dir[MAXPATHLEN];
@@ -387,33 +379,31 @@
     slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
     if (skip_flag) {
-	return 0;
+        return 0;
     }
 
     /* Create the name of the directories that hold the pids of the currently running 
      * ns-slapd processes */
-    snprintf(lock_dir, sizeof(lock_dir), "%s/%s", slapdFrontendConfig->instancedir, LOCK_DIR);
-	lock_dir[sizeof(lock_dir)-1] = (char)0;
-    snprintf(import_dir, sizeof(import_dir), "%s/%s/%s", slapdFrontendConfig->instancedir, LOCK_DIR, IMPORT_DIR);
-	import_dir[sizeof(import_dir)-1] = (char)0;
-    snprintf(export_dir, sizeof(export_dir), "%s/%s/%s", slapdFrontendConfig->instancedir, LOCK_DIR, EXPORT_DIR);
-	export_dir[sizeof(export_dir)-1] = (char)0;
-    snprintf(server_dir, sizeof(server_dir), "%s/%s/%s", slapdFrontendConfig->instancedir, LOCK_DIR, SERVER_DIR);
-	server_dir[sizeof(server_dir)-1] = (char)0;
+    snprintf(import_dir, sizeof(import_dir), "%s/%s", slapdFrontendConfig->lockdir, IMPORT_DIR);
+    import_dir[sizeof(import_dir)-1] = (char)0;
+    snprintf(export_dir, sizeof(export_dir), "%s/%s", slapdFrontendConfig->lockdir, EXPORT_DIR);
+    export_dir[sizeof(export_dir)-1] = (char)0;
+    snprintf(server_dir, sizeof(server_dir), "%s/%s", slapdFrontendConfig->lockdir, SERVER_DIR);
+    server_dir[sizeof(server_dir)-1] = (char)0;
 
     /* Grab the lockfile */
     if (grab_lockfile() != 0) {
-	/* Unable to grab the lockfile */
-	return -1;
+        /* Unable to grab the lockfile */
+        return -1;
     }
 
     /* Make sure the directories exist */
-    if (make_sure_dir_exists(lock_dir) != 0 ||
-	make_sure_dir_exists(import_dir) != 0 ||
-	make_sure_dir_exists(export_dir) != 0 || 
-	make_sure_dir_exists(server_dir) != 0) {
-	release_lockfile();
-	return -1;
+    if (make_sure_dir_exists(slapdFrontendConfig->lockdir) != 0 ||
+        make_sure_dir_exists(import_dir) != 0 ||
+        make_sure_dir_exists(export_dir) != 0 || 
+        make_sure_dir_exists(server_dir) != 0) {
+        release_lockfile();
+        return -1;
     }
 
     /* Go through the directories and find out what's going on.  
@@ -424,62 +414,62 @@
 
     switch (exec_mode) {
     case SLAPD_EXEMODE_SLAPD:
-	if (running) {
-	    result = -1;
-	    LDAPDebug(LDAP_DEBUG_ANY, NO_SERVER_DUE_TO_SERVER, running, 0, 0);
-	} else if (importing) {
-	    result = -1;
-	    LDAPDebug(LDAP_DEBUG_ANY, NO_SERVER_DUE_TO_IMPORT, importing, 0, 0);
-	} else {
-	    add_this_process_to(server_dir);
-	    result = 0;
-	}
-	break;
+    if (running) {
+        result = -1;
+        LDAPDebug(LDAP_DEBUG_ANY, NO_SERVER_DUE_TO_SERVER, running, 0, 0);
+    } else if (importing) {
+        result = -1;
+        LDAPDebug(LDAP_DEBUG_ANY, NO_SERVER_DUE_TO_IMPORT, importing, 0, 0);
+    } else {
+        add_this_process_to(server_dir);
+        result = 0;
+    }
+    break;
     case SLAPD_EXEMODE_DB2LDIF:
-	if (r_flag)  {
-	    /* When the -r flag is used in db2ldif we need to make sure 
-	     * we get a consistent snapshot of the server.  As a result
-	     * it needs to run by itself, so no other slapd process can
-	     * change the database while it is running. */
-	    if (running || importing) {
-		LDAPDebug(LDAP_DEBUG_ANY, NO_DB2LDIFR_DUE_TO_USE, 0, 0, 0);
-		result = -1;
-	    } else {
-		/* Even though this is really going to export code, we will 
-		 * but it in the importing dir so no other process can change 
-		 * things while we are doing ldif2db with the -r flag. */
-		 add_this_process_to(import_dir);
-		 result = 0;
-	    }
-	} else {
-	    if (importing) {
-		LDAPDebug(LDAP_DEBUG_ANY, NO_DB2LDIF_DUE_TO_IMPORT, importing, 0, 0);
-		result = -1;		
-	    } else {
-		add_this_process_to(export_dir);
-		result = 0;
-	    }
-	}
-	break;
+    if (r_flag)  {
+        /* When the -r flag is used in db2ldif we need to make sure 
+         * we get a consistent snapshot of the server.  As a result
+         * it needs to run by itself, so no other slapd process can
+         * change the database while it is running. */
+        if (running || importing) {
+            LDAPDebug(LDAP_DEBUG_ANY, NO_DB2LDIFR_DUE_TO_USE, 0, 0, 0);
+            result = -1;
+        } else {
+            /* Even though this is really going to export code, we will 
+             * but it in the importing dir so no other process can change 
+             * things while we are doing ldif2db with the -r flag. */
+             add_this_process_to(import_dir);
+             result = 0;
+        }
+    } else {
+        if (importing) {
+            LDAPDebug(LDAP_DEBUG_ANY, NO_DB2LDIF_DUE_TO_IMPORT, importing, 0, 0);
+            result = -1;        
+        } else {
+            add_this_process_to(export_dir);
+            result = 0;
+        }
+    }
+    break;
     case SLAPD_EXEMODE_DB2ARCHIVE:
-	if (importing) {
-	    LDAPDebug(LDAP_DEBUG_ANY, NO_DB2BAK_DUE_TO_IMPORT, importing, 0, 0);	    
-	    result = -1;
-	} else {
-	    add_this_process_to(export_dir);
-	    result = 0;
-	}
-	break;
+    if (importing) {
+        LDAPDebug(LDAP_DEBUG_ANY, NO_DB2BAK_DUE_TO_IMPORT, importing, 0, 0);        
+        result = -1;
+    } else {
+        add_this_process_to(export_dir);
+        result = 0;
+    }
+    break;
     case SLAPD_EXEMODE_ARCHIVE2DB:
     case SLAPD_EXEMODE_LDIF2DB:
-	if (running || importing || exporting) {
-	    LDAPDebug(LDAP_DEBUG_ANY, NO_IMPORT_DUE_TO_USE, 0, 0, 0);
-	    result = -1;
-	} else {
-	    add_this_process_to(import_dir);
-	    result = 0;
-	}
-	break;
+    if (running || importing || exporting) {
+        LDAPDebug(LDAP_DEBUG_ANY, NO_IMPORT_DUE_TO_USE, 0, 0, 0);
+        result = -1;
+    } else {
+        add_this_process_to(import_dir);
+        result = 0;
+    }
+    break;
     case SLAPD_EXEMODE_DB2INDEX:
         if (running || importing || exporting) {
             LDAPDebug(LDAP_DEBUG_ANY, NO_DB2INDEX_DUE_TO_USE, 0, 0, 0);
@@ -514,7 +504,7 @@
     release_lockfile();
     
     if (result == 0) {
-	atexit(remove_slapd_process);
+        atexit(remove_slapd_process);
     }
 
     return result;
@@ -525,31 +515,26 @@
 /* is_slapd_running()
  * returns 1 if slapd is running, 0 if not, -1 on error
  */
-   
-  
 int
 is_slapd_running() {
   char server_dir[MAXPATHLEN];
-  char lock_dir[MAXPATHLEN];
   slapdFrontendConfig_t *cfg = getFrontendConfig();
   int running = 0;
   
-  snprintf(lock_dir, sizeof(lock_dir), "%s/%s", cfg->instancedir, LOCK_DIR);
-  lock_dir[sizeof(lock_dir)-1] = (char)0;
-  snprintf( server_dir, sizeof(server_dir), "%s/%s/%s", cfg->instancedir, LOCK_DIR, SERVER_DIR);
+  snprintf(server_dir, sizeof(server_dir), "%s/%s", cfg->lockdir, SERVER_DIR);
   server_dir[sizeof(server_dir)-1] = (char)0;
   
   /* Grab the lockfile */
   if (grab_lockfile() != 0) {
-	/* Unable to grab the lockfile */
-	return -1;
+    /* Unable to grab the lockfile */
+    return -1;
   }
 
   /* Make sure the directories exist */
-  if (make_sure_dir_exists(lock_dir) != 0 ||
-	  make_sure_dir_exists(server_dir) != 0) {
-	release_lockfile();
-	return -1;
+  if (make_sure_dir_exists(cfg->lockdir) != 0 ||
+      make_sure_dir_exists(server_dir) != 0) {
+    release_lockfile();
+    return -1;
   }
   
   running = sample_and_update(server_dir);
@@ -557,7 +542,6 @@
   return running;
 }
 
- 
 #else /* _WIN32 */
 
 /* The NT version of this code */
@@ -568,11 +552,11 @@
 int
 mutex_exists( char *mutexName )
 {
-	if ( OpenMutex( SYNCHRONIZE, FALSE, mutexName ) == NULL ) {
-		return( 0 );
-	} else {
-		return( 1 );
-	}		
+    if ( OpenMutex( SYNCHRONIZE, FALSE, mutexName ) == NULL ) {
+        return( 0 );
+    } else {
+        return( 1 );
+    }        
 }
 
 /* is_slapd_running(): 
@@ -586,28 +570,28 @@
   int result = 0;
   slapdFrontendConfig_t *cfg = getFrontendConfig();
 
-  strncpy( mutexName, cfg->instancedir, MAXPATHLEN );
-  strncpy( serverMutexName, cfg->instancedir, MAXPATHLEN );
+  strncpy( mutexName, cfg->lockdir, MAXPATHLEN );
+  strncpy( serverMutexName, cfg->lockdir, MAXPATHLEN );
   mutexName[ MAXPATHLEN ] = '\0';
 
   serverMutexName[ MAXPATHLEN ] = '\0';
   strcat( serverMutexName, "/server" );
-	
+    
   return mutex_exists ( serverMutexName );
 }
 
 static void fix_mutex_name(char *name)
 {
-	/* On NT mutex names cannot contain the '\' character.
-	 * This functions replaces '\' with '/' in the supplied
-	 * name. */
-	int x;
-
-	for (x = 0; name[x] != '\0'; x++) {
-		if ('\\' == name[x]) {
-			name[x] = '/';
-		}
-	}
+    /* On NT mutex names cannot contain the '\' character.
+     * This functions replaces '\' with '/' in the supplied
+     * name. */
+    int x;
+
+    for (x = 0; name[x] != '\0'; x++) {
+        if ('\\' == name[x]) {
+            name[x] = '/';
+        }
+    }
 }
 
 /*
@@ -624,9 +608,9 @@
 void
 remove_slapd_process()
 {
-	if (open_mutex) {
-		CloseHandle(open_mutex);
-	}
+    if (open_mutex) {
+        CloseHandle(open_mutex);
+    }
 }
 
 /* This function makes sure different instances of slapd don't
@@ -646,158 +630,158 @@
 int
 add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
 {
-	char mutexName[ MAXPATHLEN + 1 ];
-	char serverMutexName[ MAXPATHLEN + 1 ];
-	char importMutexName[ MAXPATHLEN + 1 ];
-	char exportMutexName[ MAXPATHLEN + 1 ];
-
-	HANDLE mutex;
-	SECURITY_ATTRIBUTES mutexAttributes;
-	PSECURITY_DESCRIPTOR pSD;
-	LPVOID lpMsgBuf;
-
-	int result = 0;
-
-	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
-	if (skip_flag) {
-	    return 0;
-	}
-
-	/* Create the names for the mutexes */
-	PL_strncpyz(mutexName, slapdFrontendConfig->instancedir, sizeof(mutexName));
-
-	/* Make sure the name of the mutex is legal. */
-	fix_mutex_name(mutexName);
-
-	PR_snprintf(serverMutexName, sizeof(serverMutexName), "%s/server", mutexName);
-	PR_snprintf(importMutexName, sizeof(importMutexName), "%s/import", mutexName);
-	PR_snprintf(exportMutexName, sizeof(exportMutexName), "%s/export", mutexName);
-	
-	/* Fill in the security crap for the mutex */
-	pSD = (PSECURITY_DESCRIPTOR)slapi_ch_malloc( sizeof( SECURITY_DESCRIPTOR ) );
-	InitializeSecurityDescriptor( pSD, SECURITY_DESCRIPTOR_REVISION );
-	SetSecurityDescriptorDacl( pSD, TRUE, NULL, FALSE );
-	mutexAttributes.nLength = sizeof( mutexAttributes );
-	mutexAttributes.lpSecurityDescriptor = pSD;
-	mutexAttributes.bInheritHandle = FALSE;
-	
-	/* Get a handle to the main mutex */
-	if ( ( mutex = CreateMutex( &mutexAttributes, FALSE, mutexName ) ) == NULL ) {
-		FormatMessage( 
-    		FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-    		NULL,
-    		GetLastError(),
-    		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
-    		(LPTSTR) &lpMsgBuf,
-    		0,
-    		NULL 
-		);
-
-		LDAPDebug( LDAP_DEBUG_ANY, CREATE_MUTEX_ERROR, lpMsgBuf, 0, 0 );
-		LocalFree( lpMsgBuf );
-		exit( 1 );
-	}
-	
-	/* Lock the main mutex */
-	if ( WaitForSingleObject( mutex, INFINITE ) == WAIT_FAILED ) {
-		FormatMessage( 
-    		FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-    		NULL,
-    		GetLastError(),
-    		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
-    		(LPTSTR) &lpMsgBuf,
-    		0,
-    		NULL 
-		);
-
-		LDAPDebug( LDAP_DEBUG_ANY, WAIT_ERROR, lpMsgBuf, 0, 0 );
-		LocalFree( lpMsgBuf );
-		exit( 1 );
-	}
-
-
-	switch (exec_mode) {
-		case SLAPD_EXEMODE_SLAPD:
-			if ( mutex_exists( serverMutexName ) ||
-				 mutex_exists( importMutexName ) )  {
-				LDAPDebug( LDAP_DEBUG_ANY, NO_SERVER_DUE_TO_USE, 0, 0, 0);
-				result = -1;
-			} else {
-				open_mutex = CreateMutex( &mutexAttributes, FALSE, serverMutexName );
-				result = 0;
-			}
-			break;
-		case SLAPD_EXEMODE_DB2LDIF:
-			if (r_flag)  {
-				/* When the -r flag is used in db2ldif we need to make sure 
-				 * we get a consistent snapshot of the server.  As a result
-				 * it needs to run by itself, so no other slapd process can
-				 * change the database while it is running. */
-				if ( mutex_exists( serverMutexName ) ||
-				 	mutex_exists( importMutexName ) ||
-				 	mutex_exists( exportMutexName ) ) {
-					LDAPDebug(LDAP_DEBUG_ANY, NO_DB2LDIFR_DUE_TO_USE, 0, 0, 0);
-					result = -1;
-				} else {
-					CreateMutex( &mutexAttributes, FALSE, exportMutexName );
-					result = 0;
-				}
-				break;
-			}
-		case SLAPD_EXEMODE_DB2ARCHIVE:
-			if ( mutex_exists( importMutexName ) )  {
-				LDAPDebug(LDAP_DEBUG_ANY, NO_EXPORT_DUE_TO_IMPORT, 0, 0, 0);
-				result = -1;
-			} else {
-				CreateMutex( &mutexAttributes, FALSE, exportMutexName );
-				result = 0;
-			}
-			break;
-		case SLAPD_EXEMODE_ARCHIVE2DB:
-		case SLAPD_EXEMODE_LDIF2DB:
-			if ( mutex_exists( serverMutexName ) ||
-				 mutex_exists( importMutexName ) ||
-				 mutex_exists( exportMutexName ) ) {
-			        LDAPDebug(LDAP_DEBUG_ANY, NO_IMPORT_DUE_TO_USE, 0, 0, 0);
-				result = -1;
-			} else {
-				CreateMutex( &mutexAttributes, FALSE, importMutexName );
-				result = 0;
-			}
-			break;
+    char mutexName[ MAXPATHLEN + 1 ];
+    char serverMutexName[ MAXPATHLEN + 1 ];
+    char importMutexName[ MAXPATHLEN + 1 ];
+    char exportMutexName[ MAXPATHLEN + 1 ];
+
+    HANDLE mutex;
+    SECURITY_ATTRIBUTES mutexAttributes;
+    PSECURITY_DESCRIPTOR pSD;
+    LPVOID lpMsgBuf;
+
+    int result = 0;
+
+    slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+
+    if (skip_flag) {
+        return 0;
+    }
+
+    /* Create the names for the mutexes */
+    PL_strncpyz(mutexName, slapdFrontendConfig->lockdir, sizeof(mutexName));
+
+    /* Make sure the name of the mutex is legal. */
+    fix_mutex_name(mutexName);
+
+    PR_snprintf(serverMutexName, sizeof(serverMutexName), "%s/server", mutexName);
+    PR_snprintf(importMutexName, sizeof(importMutexName), "%s/import", mutexName);
+    PR_snprintf(exportMutexName, sizeof(exportMutexName), "%s/export", mutexName);
+    
+    /* Fill in the security crap for the mutex */
+    pSD = (PSECURITY_DESCRIPTOR)slapi_ch_malloc( sizeof( SECURITY_DESCRIPTOR ) );
+    InitializeSecurityDescriptor( pSD, SECURITY_DESCRIPTOR_REVISION );
+    SetSecurityDescriptorDacl( pSD, TRUE, NULL, FALSE );
+    mutexAttributes.nLength = sizeof( mutexAttributes );
+    mutexAttributes.lpSecurityDescriptor = pSD;
+    mutexAttributes.bInheritHandle = FALSE;
+    
+    /* Get a handle to the main mutex */
+    if ( ( mutex = CreateMutex( &mutexAttributes, FALSE, mutexName ) ) == NULL ) {
+        FormatMessage( 
+            FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+            NULL,
+            GetLastError(),
+            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
+            (LPTSTR) &lpMsgBuf,
+            0,
+            NULL 
+        );
+
+        LDAPDebug( LDAP_DEBUG_ANY, CREATE_MUTEX_ERROR, lpMsgBuf, 0, 0 );
+        LocalFree( lpMsgBuf );
+        exit( 1 );
+    }
+    
+    /* Lock the main mutex */
+    if ( WaitForSingleObject( mutex, INFINITE ) == WAIT_FAILED ) {
+        FormatMessage( 
+            FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+            NULL,
+            GetLastError(),
+            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
+            (LPTSTR) &lpMsgBuf,
+            0,
+            NULL 
+        );
+
+        LDAPDebug( LDAP_DEBUG_ANY, WAIT_ERROR, lpMsgBuf, 0, 0 );
+        LocalFree( lpMsgBuf );
+        exit( 1 );
+    }
+
+
+    switch (exec_mode) {
+        case SLAPD_EXEMODE_SLAPD:
+            if ( mutex_exists( serverMutexName ) ||
+                 mutex_exists( importMutexName ) )  {
+                LDAPDebug( LDAP_DEBUG_ANY, NO_SERVER_DUE_TO_USE, 0, 0, 0);
+                result = -1;
+            } else {
+                open_mutex = CreateMutex( &mutexAttributes, FALSE, serverMutexName );
+                result = 0;
+            }
+            break;
+        case SLAPD_EXEMODE_DB2LDIF:
+            if (r_flag)  {
+                /* When the -r flag is used in db2ldif we need to make sure 
+                 * we get a consistent snapshot of the server.  As a result
+                 * it needs to run by itself, so no other slapd process can
+                 * change the database while it is running. */
+                if ( mutex_exists( serverMutexName ) ||
+                     mutex_exists( importMutexName ) ||
+                     mutex_exists( exportMutexName ) ) {
+                    LDAPDebug(LDAP_DEBUG_ANY, NO_DB2LDIFR_DUE_TO_USE, 0, 0, 0);
+                    result = -1;
+                } else {
+                    CreateMutex( &mutexAttributes, FALSE, exportMutexName );
+                    result = 0;
+                }
+                break;
+            }
+        case SLAPD_EXEMODE_DB2ARCHIVE:
+            if ( mutex_exists( importMutexName ) )  {
+                LDAPDebug(LDAP_DEBUG_ANY, NO_EXPORT_DUE_TO_IMPORT, 0, 0, 0);
+                result = -1;
+            } else {
+                CreateMutex( &mutexAttributes, FALSE, exportMutexName );
+                result = 0;
+            }
+            break;
+        case SLAPD_EXEMODE_ARCHIVE2DB:
+        case SLAPD_EXEMODE_LDIF2DB:
+            if ( mutex_exists( serverMutexName ) ||
+                 mutex_exists( importMutexName ) ||
+                 mutex_exists( exportMutexName ) ) {
+                    LDAPDebug(LDAP_DEBUG_ANY, NO_IMPORT_DUE_TO_USE, 0, 0, 0);
+                result = -1;
+            } else {
+                CreateMutex( &mutexAttributes, FALSE, importMutexName );
+                result = 0;
+            }
+            break;
 #if defined(UPGRADEDB)
-		case SLAPD_EXEMODE_UPGRADEDB:
-			if ( mutex_exists( serverMutexName ) ||
-				 mutex_exists( importMutexName ) ||
-				 mutex_exists( exportMutexName ) ) {
-			        LDAPDebug(LDAP_DEBUG_ANY, NO_UPGRADEDB_DUE_TO_USE, 0, 0, 0);
-				result = -1;
-			} else {
-				CreateMutex( &mutexAttributes, FALSE, importMutexName );
-				result = 0;
-			}
-			break;
+        case SLAPD_EXEMODE_UPGRADEDB:
+            if ( mutex_exists( serverMutexName ) ||
+                 mutex_exists( importMutexName ) ||
+                 mutex_exists( exportMutexName ) ) {
+                    LDAPDebug(LDAP_DEBUG_ANY, NO_UPGRADEDB_DUE_TO_USE, 0, 0, 0);
+                result = -1;
+            } else {
+                CreateMutex( &mutexAttributes, FALSE, importMutexName );
+                result = 0;
+            }
+            break;
 #endif
-		case SLAPD_EXEMODE_DBTEST:
-			if ( mutex_exists( serverMutexName ) ||
-				 mutex_exists( importMutexName ) ||
-				 mutex_exists( exportMutexName ) ) {
-			        LDAPDebug(LDAP_DEBUG_ANY, NO_DBTEST_DUE_TO_USE, 0, 0, 0);
-				result = -1;
-			} else {
-				CreateMutex( &mutexAttributes, FALSE, importMutexName );
-				result = 0;
-			}
-			break;
-	}
-	
-	/* release the main mutex */
-	ReleaseMutex( mutex );
+        case SLAPD_EXEMODE_DBTEST:
+            if ( mutex_exists( serverMutexName ) ||
+                 mutex_exists( importMutexName ) ||
+                 mutex_exists( exportMutexName ) ) {
+                    LDAPDebug(LDAP_DEBUG_ANY, NO_DBTEST_DUE_TO_USE, 0, 0, 0);
+                result = -1;
+            } else {
+                CreateMutex( &mutexAttributes, FALSE, importMutexName );
+                result = 0;
+            }
+            break;
+    }
+    
+    /* release the main mutex */
+    ReleaseMutex( mutex );
 
-	slapi_ch_free((void**)&pSD );
+    slapi_ch_free((void**)&pSD );
 
-	return( result );
+    return( result );
 }
 #endif /* _WIN32 */    
     


Index: proto-slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/proto-slap.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- proto-slap.h	27 Sep 2006 23:40:51 -0000	1.21
+++ proto-slap.h	13 Oct 2006 01:06:28 -0000	1.22
@@ -246,7 +246,6 @@
 int config_set_rootpw( const char *attrname, char *value, char *errorbuf, int apply );
 int config_set_rootpwstoragescheme( const char *attrname, char *value, char *errorbuf, int apply );
 int config_set_workingdir( const char *attrname, char *value, char *errorbuf, int apply );
-int config_set_instancedir( const char *attrname, char *value, char *errorbuf, int apply );
 int config_set_encryptionalias( const char *attrname, char *value, char *errorbuf, int apply );
 int config_set_threadnumber( const char *attrname, char *value, char *errorbuf, int apply );
 int config_set_maxthreadsperconn( const char *attrname, char *value, char *errorbuf, int apply );
@@ -302,7 +301,9 @@
 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_lockdir( const char *attrname, char *value, char *errorbuf, int apply );
+int config_set_tmpdir( const char *attrname, char *value, char *errorbuf, int apply );
+int config_set_certdir( 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 );
@@ -366,7 +367,6 @@
 char *config_get_localuser();
 #endif /* _WIN32 */
 char *config_get_workingdir();
-char *config_get_instancedir();
 char *config_get_encryptionalias();
 int config_get_threadnumber();
 int config_get_maxthreadsperconn();
@@ -401,6 +401,9 @@
 char *config_get_basedn();
 char *config_get_configdir();
 char *config_get_schemadir();
+char *config_get_lockdir();
+char *config_get_tmpdir();
+char *config_get_certdir();
 char **config_get_errorlog_list();
 char **config_get_accesslog_list();
 char **config_get_auditlog_list();
@@ -966,7 +969,6 @@
 struct snmp_vars_t * g_get_global_snmp_vars();
 void FrontendConfig_init();
 int g_get_slapd_security_on();
-void config_set_slapd_type ();
 char *config_get_versionstring();
 
 void libldap_init_debug_level(int *);


Index: slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slap.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- slap.h	27 Sep 2006 23:40:51 -0000	1.15
+++ slap.h	13 Oct 2006 01:06:28 -0000	1.16
@@ -1648,7 +1648,6 @@
 #define CONFIG_SSL3CIPHERS_ATTRIBUTE "nsslapd-SSL3ciphers"
 #define CONFIG_ACCESSLOG_ATTRIBUTE "nsslapd-accesslog"
 #define CONFIG_ERRORLOG_ATTRIBUTE "nsslapd-errorlog"
-#define CONFIG_INSTANCEDIR_ATTRIBUTE "nsslapd-instancedir"
 #define CONFIG_SECUREPORT_ATTRIBUTE "nsslapd-securePort"
 #define CONFIG_SECURELISTENHOST_ATTRIBUTE "nsslapd-securelistenhost"
 #define CONFIG_THREADNUMBER_ATTRIBUTE "nsslapd-threadnumber"
@@ -1709,7 +1708,9 @@
 
 #define CONFIG_CONFIG_ATTRIBUTE "nsslapd-config"
 #define CONFIG_SCHEMADIR_ATTRIBUTE "nsslapd-schemadir"
-#define CONFIG_LDIFDIR_ATTRIBUTE "nsslapd-ldifdir"
+#define CONFIG_LOCKDIR_ATTRIBUTE "nsslapd-lockdir"
+#define CONFIG_TMPDIR_ATTRIBUTE "nsslapd-tmpdir"
+#define CONFIG_CERTDIR_ATTRIBUTE "nsslapd-certdir"
 #define CONFIG_SSLCLIENTAUTH_ATTRIBUTE "nsslapd-SSLclientAuth"
 #define CONFIG_SSL_CHECK_HOSTNAME_ATTRIBUTE "nsslapd-ssl-check-hostname"
 #define CONFIG_HASH_FILTERS_ATTRIBUTE "nsslapd-hash-filters"
@@ -1794,7 +1795,6 @@
   char *encryptionalias;
   char *errorlog;
   char *listenhost;
-  char *instancedir;
 #ifndef _WIN32
   char *localuser;
 #endif /* _WIN32 */
@@ -1877,15 +1877,18 @@
   
   ber_len_t maxbersize; /* Maximum BER element size we'll accept */
   int max_filter_nest_level;/* deepest nested filter we will accept */
-  int enquote_sup_oc;  /* put single quotes around an oc's 
-						  superior oc in cn=schema */
+  int enquote_sup_oc;       /* put single quotes around an oc's 
+                               superior oc in cn=schema */
 
-  char *certmap_basedn;			/* Default Base DN for certmap */
+  char *certmap_basedn;	    /* Default Base DN for certmap */
 
   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 */
+  char *configdir;  /* full path name of directory containing configuration files */
+  char *schemadir;  /* full path name of directory containing schema files */
+  char *lockdir;    /* full path name of directory containing lock files */
+  char *tmpdir;     /* full path name of directory containing tmp files */
+  char *certdir;    /* full path name of directory containing cert 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 */
 } slapdFrontendConfig_t;


Index: snmp_collator.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/snmp_collator.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- snmp_collator.c	19 Apr 2005 22:07:37 -0000	1.8
+++ snmp_collator.c	13 Oct 2006 01:06:28 -0000	1.9
@@ -392,54 +392,50 @@
 {
 
   int err;
-  char *instancedir = config_get_instancedir();
+  char *statspath = config_get_tmpdir();
+  char *lp = NULL;
 
-	/*
-	 * Get directory for our stats file
-	 */
+  /*
+   * Get directory for our stats file
+   */
+  if (NULL == statspath) {
+     statspath = slapi_ch_strdup("/tmp");
+  }
 
-  PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/logs/%s", instancedir, 
-		  AGT_STATS_FILE);
+  PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/%s",
+                                                statspath, AGT_STATS_FILE);
   tmpstatsfile = szStatsFile;
+  slapi_ch_free((void **) &statspath);
 
-  slapi_ch_free((void **) &instancedir);
-
-
-	  /* open the memory map */
-	  
-	  if ((err = agt_mopen_stats(tmpstatsfile, O_RDWR,  &hdl) != 0))
-	  {
-	      if (err != EEXIST)			/* Ignore if file already exists */
-	      {
-	          printf("Failed to open stats file (%s) (error %d).\n", 
-	                 AGT_STATS_FILE, err);
-           
-	          exit(1);
-	      }
-	  }
+  /* open the memory map */
+  if ((err = agt_mopen_stats(tmpstatsfile, O_RDWR,  &hdl) != 0))
+  {
+    if (err != EEXIST)      /* Ignore if file already exists */
+    {
+      printf("Failed to open stats file (%s) (error %d).\n", 
+                                         szStatsFile, err);
+      exit(1);
+    }
+  }
 
 /* read config entry for entity table data */
-	 
 
 /* point stats struct at mmap data */
-	stats = (struct agt_stats_t *) mmap_tbl [hdl].fp;
+  stats = (struct agt_stats_t *) mmap_tbl [hdl].fp;
 
 /* initialize stats data */
 
-	snmp_collator_init();
+  snmp_collator_init();
 /*
-*	now that memmap is open and things point the right way
-*    an atomic set or increment anywhere in slapd should set
-*	the snmp memmap vars correctly and be able to be polled by snmp
+*  now that memmap is open and things point the right way
+*  an atomic set or increment anywhere in slapd should set
+*  the snmp memmap vars correctly and be able to be polled by snmp
 */
 
-	/* Arrange to be called back periodically */
-	snmp_eq_ctx = slapi_eq_repeat(snmp_collator_update, NULL, (time_t)0,
-			SLAPD_SNMP_UPDATE_INTERVAL);
-
-
-return 0;
-
+  /* Arrange to be called back periodically */
+  snmp_eq_ctx = slapi_eq_repeat(snmp_collator_update, NULL, (time_t)0,
+                                SLAPD_SNMP_UPDATE_INTERVAL);
+  return 0;
 }
 
 


Index: ssl.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/ssl.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ssl.c	19 Apr 2005 22:07:37 -0000	1.8
+++ ssl.c	13 Oct 2006 01:06:28 -0000	1.9
@@ -51,10 +51,7 @@
 #include <io.h>
 #endif
 
-#ifdef LINUX
 #include <sys/param.h>
-#endif
-
 #include <ssl.h>
 #include <nss.h>
 #include <key.h>
@@ -456,7 +453,7 @@
 	int len = 0;
     PRUint32 nssFlags = 0;
 	Slapi_Entry *ec = NULL;
-	char *instancedir;
+	char *certdir;
 
 	if (config_available) {
 		getConfigEntry( configDN, &ec );
@@ -469,9 +466,11 @@
 		ec = NULL;
 	}
 
-	instancedir = config_get_instancedir();
-	PL_strncpyz(path, instancedir, sizeof(path));
-	slapi_ch_free_string(&instancedir);
+	/* set in slapd_bootstrap_config,
+	   thus certdir is available even if config_available is false */
+	certdir = config_get_certdir();
+	PL_strncpyz(path, certdir, sizeof(path));
+	slapi_ch_free_string(&certdir);
 
 	/* make sure path does not end in the path separator character */
 	len = strlen(path);
@@ -479,14 +478,15 @@
 		path[len-1] = '\0';
 	}
 
-	/* get the server root from the path */
+	/* get the server instance dir name from path:
+	   <sysconfig>/BRAND_DS/slapd-<id> */
 	val = strrchr(path, '/');
 	if (!val) {
 		val = strrchr(path, '\\');
 	}
 	val++;
 
-	if(keyfn && certfn) {
+	if (keyfn && certfn) {
 		if (is_abspath(certfn)) {
 			warn_if_no_cert_file(certfn);
 			/* first, initialize path from the certfn */
@@ -553,7 +553,6 @@
 		}
 		PR_snprintf(certPref, sizeof(certPref), "%s-", val);
 		PL_strncpyz(keyPref, certPref, sizeof(keyPref));
-		PL_strncpyz(val, "alias/", sizeof(path)-(val-path));
 	}
 
 	slapi_ch_free((void **) &certfn);
@@ -581,10 +580,6 @@
     return rv;
 }
 
-
-
-
-
 /*
  * slapd_ssl_init() is called from main() if we plan to listen
  * on a secure port.
@@ -1004,12 +999,11 @@
 
     tmpDir = slapd_get_tmp_dir();
 
-    slapi_log_error(
-        SLAPI_LOG_TRACE,
-        "slapd_ssl_init2",
-         "tmp dir = %s\n", tmpDir);
+    slapi_log_error(SLAPI_LOG_TRACE,
+                    "slapd_ssl_init2", "tmp dir = %s\n", tmpDir);
 
     rv = SSL_ConfigServerSessionIDCache(0, stimeout, stimeout, tmpDir);
+	slapi_ch_free(&tmpDir);
     if (rv) {
       errorCode = PR_GetError();
       if (errorCode == ENOSPC) {
@@ -1448,12 +1442,11 @@
 	return _ssl_listener_initialized;
 }
 
-
+/* memory to store tmpdir is allocated and returned; caller should free it. */
 char* slapd_get_tmp_dir()
 {
-	static char tmpdir[] = "/tmp";
-	static char tmp[256];
-	char* instanceDir;
+	static char tmp[MAXPATHLEN];
+	char* tmpdir = NULL;;
 #if defined( XP_WIN32 )
 	unsigned ilen;
 	char pch;
@@ -1462,64 +1455,61 @@
 
 	tmp[0] = '\0';
 
-	if((instanceDir = config_get_instancedir()) == NULL)
+	if((tmpdir = config_get_tmpdir()) == NULL)
 	{
 		slapi_log_error(
 			 SLAPI_LOG_FATAL,
 			 "slapd_get_tmp_dir",
-			 "config_get_instancedir returns NULL Setting tmp dir to default\n");
+			 "config_get_tmpdir returns NULL Setting tmp dir to default\n");
 
 #if defined( XP_WIN32 )
-			ilen = sizeof(tmp);
-			GetTempPath( ilen, tmp );
-			tmp[ilen-1] = (char)0;
-			ilen = strlen(tmp);
-			/* Remove trailing slash. */
-			pch = tmp[ilen-1];
-			if( pch == '\\' || pch == '/' )
-				tmp[ilen-1] = '\0';
-			return tmp;
+		ilen = sizeof(tmp);
+		GetTempPath( ilen, tmp );
+		tmp[ilen-1] = (char)0;
+		ilen = strlen(tmp);
+		/* Remove trailing slash. */
+		pch = tmp[ilen-1];
+		if( pch == '\\' || pch == '/' )
+			tmp[ilen-1] = '\0';
 #else
-			return( tmpdir );
+		strcpy(tmp, "/tmp");
 #endif
+		return slapi_ch_strdup(tmp);
 	}
 
-	PR_snprintf(tmp,sizeof(tmp),"%s/tmp",instanceDir);
-	slapi_ch_free_string(&instanceDir);
-
 #if defined( XP_WIN32 )
-	for(ilen=0;ilen < strlen(tmp); ilen++)
 	{
-		if(tmp[ilen]=='/')
-			tmp[ilen]='\\';
+		char *ptr = NULL;
+		char *endptr = tmpdir + strlen(tmpdir);
+		for(ptr = tmpdir; ptr < endptr; ptr++)
+		{
+			if('/' == *ptr)
+				*ptr = '\\';
+		}
 	}
 #endif
 
-	if(stat(tmp,&ffinfo) == -1)
+	if(stat(tmpdir, &ffinfo) == -1)
 #if defined( XP_WIN32 )
-		if(CreateDirectory(tmp, NULL) == 0)
+		if(CreateDirectory(tmpdir, NULL) == 0)
 		{
 			slapi_log_error(
 			 SLAPI_LOG_FATAL,
 			 "slapd_get_tmp_dir",
 			 "CreateDirectory(%s, NULL) Error: %s\n",
-			 tmp, strerror(errno));	
-			return ( tmpdir );
+			 tmpdir, strerror(errno));	
 		}
 #else
-		if(mkdir(tmp, 00770) == -1)
+		if(mkdir(tmpdir, 00770) == -1)
 		{
 			slapi_log_error(
 			 SLAPI_LOG_FATAL,
 			 "slapd_get_tmp_dir",
 			 "mkdir(%s, 00770) Error: %s\n",
-			 tmp, strerror(errno));	
-			return ( tmpdir );
+			 tmpdir, strerror(errno));	
 		}
 #endif
-
-	return ( tmp );
-
+	return ( tmpdir );
 }
 
 #endif /* NET_SSL */




More information about the Fedora-directory-commits mailing list