Skip to content
Snippets Groups Projects
Commit 32bdecbb authored by Ben Collins's avatar Ben Collins
Browse files

for slurpd's replica directory (slurpd.status, and rej file) use a subdir of...

for slurpd's replica directory (slurpd.status, and rej file) use a subdir of what the user specifies (add replica/ to it) to avoid /tmp races. A lot of the files that slurpd uses cannot be opened with O_EXCL, nor can we safely determine if there are any hardlinks from another file to it, so we create our own subdirectory so we can control the perms, even in /tmp
parent a44adcfb
No related branches found
No related tags found
No related merge requests found
......@@ -111,7 +111,8 @@ doargs(
rflag++;
break;
case 't': /* dir to use for our copies of replogs */
g->slurpd_rdir = strdup( optarg );
g->slurpd_rdir = (char *)malloc (strlen(optarg) + strlen("/replica") + 1);
sprintf(g->slurpd_rdir, "%s/replica", optarg);
break;
case 'k': /* name of kerberos srvtab file */
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
......
......@@ -50,7 +50,7 @@ init_globals( void )
g->slurpd_shutdown = 0;
g->num_replicas = 0;
g->replicas = NULL;
g->slurpd_rdir = DEFAULT_SLURPD_REPLICA_DIR;
g->slurpd_rdir = DEFAULT_SLURPD_REPLICA_DIR "/replica";
strcpy( g->slurpd_status_file, DEFAULT_SLURPD_STATUS_FILE );
g->slapd_replogfile[ 0 ] = '\0';
g->slurpd_replogfile[ 0 ] = '\0';
......
......@@ -70,6 +70,14 @@ main(
exit( EXIT_FAILURE );
}
/*
* Make sure our directory exists
*/
if ( mkdir(sglob->slurpd_rdir, 0755) == -1 && errno != EEXIST) {
perror(sglob->slurpd_rdir);
exit( 1 );
}
/*
* Get any saved state information off the disk.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment