Commit 47f53d7b 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 c142f710
......@@ -105,7 +105,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 HAVE_KERBEROS
......
......@@ -48,7 +48,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';
......
......@@ -65,6 +65,14 @@ main(
exit( 1 );
}
/*
* 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.
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment