summaryrefslogtreecommitdiffstats
path: root/ldap
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2006-11-27 21:36:48 +0000
committerRich Megginson <rmeggins@redhat.com>2006-11-27 21:36:48 +0000
commit54dcb0e7438c9df2fbd542422ee5712c4f4a618c (patch)
treeef6d285ba7439e474d5c579e9c5c1b8ca69b3edc /ldap
parent6dd5ae522dbd621eb0d313b54f884b205855625a (diff)
downloadds-54dcb0e7438c9df2fbd542422ee5712c4f4a618c.tar.gz
ds-54dcb0e7438c9df2fbd542422ee5712c4f4a618c.tar.xz
ds-54dcb0e7438c9df2fbd542422ee5712c4f4a618c.zip
Resolves: bug 217403
Bug Description: Instance specific schema files should be owned by server uid Reviewed by: nkinder (Thanks!) Fix Description: Add a new function - ds_copy_group_files_using_mode_owner() - that allows you to set the file mode and owner when copying directories and files. Use that function when copying the schema files to the new instance directory. Platforms tested: RHEL4 Flag Day: no Doc impact: no
Diffstat (limited to 'ldap')
-rw-r--r--ldap/admin/src/create_instance.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/ldap/admin/src/create_instance.c b/ldap/admin/src/create_instance.c
index 10567cf7..eb3018f5 100644
--- a/ldap/admin/src/create_instance.c
+++ b/ldap/admin/src/create_instance.c
@@ -1657,8 +1657,8 @@ is_a_dir(const char *dirname, const char *filename)
}
static char *
-ds_copy_group_files_using_mode(char *src_dir, char *dest_dir,
- char *filter, int use_mode)
+ds_copy_group_files_using_mode_owner(char *src_dir, char *dest_dir,
+ char *filter, int use_mode, struct passwd *pw)
{
char *t = 0;
PRDir *ds = 0;
@@ -1679,9 +1679,9 @@ ds_copy_group_files_using_mode(char *src_dir, char *dest_dir,
if(is_a_dir(src_dir, d->name)) {
char *sub_src_dir = strdup(src_file);
char *sub_dest_dir = strdup(dest_file);
- if( (t = create_instance_mkdir_p(sub_dest_dir, sub_dest_dir, NEWDIR_MODE, NULL)) )
+ if( (t = create_instance_mkdir_p(sub_dest_dir, sub_dest_dir, NEWDIR_MODE, pw)) )
return(t);
- if( (t = ds_copy_group_files_using_mode(sub_src_dir, sub_dest_dir, filter, use_mode)) )
+ if( (t = ds_copy_group_files_using_mode_owner(sub_src_dir, sub_dest_dir, filter, use_mode, pw)) )
return t;
free(sub_src_dir);
free(sub_dest_dir);
@@ -1689,6 +1689,8 @@ ds_copy_group_files_using_mode(char *src_dir, char *dest_dir,
else {
if( (t = create_instance_copy(src_file, dest_file, use_mode, 0 )) )
return t;
+ if (pw)
+ chownfile(pw, dest_file);
}
}
}
@@ -1698,6 +1700,13 @@ ds_copy_group_files_using_mode(char *src_dir, char *dest_dir,
}
static char *
+ds_copy_group_files_using_mode(char *src_dir, char *dest_dir,
+ char *filter, int use_mode)
+{
+ return ds_copy_group_files_using_mode_owner(src_dir, dest_dir, filter, use_mode, NULL);
+}
+
+static char *
ds_copy_group_files(char *src_dir, char *dest_dir, char *filter)
{
return ds_copy_group_files_using_mode(src_dir, dest_dir, filter,
@@ -3499,7 +3508,7 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
*/
PR_snprintf(src, sizeof(src), "%s%c%s%cschema",
cf->sysconfdir, FILE_PATHSEP, cf->brand_ds, FILE_PATHSEP);
- if (NULL != (t = ds_copy_group_files(src, cf->schema_dir, 0)))
+ if (NULL != (t = ds_copy_group_files_using_mode_owner(src, cf->schema_dir, 0, NEWFILE_MODE, pw)))
return t;
#if defined (BUILD_PRESENCE)