mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 08:09:34 -05:00
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
This commit is contained in:
parent
a44adcfb43
commit
32bdecbb5f
3 changed files with 11 additions and 2 deletions
|
|
@ -111,7 +111,8 @@ doargs(
|
||||||
rflag++;
|
rflag++;
|
||||||
break;
|
break;
|
||||||
case 't': /* dir to use for our copies of replogs */
|
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;
|
break;
|
||||||
case 'k': /* name of kerberos srvtab file */
|
case 'k': /* name of kerberos srvtab file */
|
||||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
|
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ init_globals( void )
|
||||||
g->slurpd_shutdown = 0;
|
g->slurpd_shutdown = 0;
|
||||||
g->num_replicas = 0;
|
g->num_replicas = 0;
|
||||||
g->replicas = NULL;
|
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 );
|
strcpy( g->slurpd_status_file, DEFAULT_SLURPD_STATUS_FILE );
|
||||||
g->slapd_replogfile[ 0 ] = '\0';
|
g->slapd_replogfile[ 0 ] = '\0';
|
||||||
g->slurpd_replogfile[ 0 ] = '\0';
|
g->slurpd_replogfile[ 0 ] = '\0';
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,14 @@ main(
|
||||||
exit( EXIT_FAILURE );
|
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.
|
* Get any saved state information off the disk.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue