ldap/servers/slapd/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit 513e5a83ff806e9dcfa9b32287e2ce7b6ff95ddf Author: Noriko Hosoi nhosoi@redhat.com Date: Tue Feb 8 15:56:57 2011 -0800
Bug 604881 - admin server log files have incorrect permissions/ownerships
https://bugzilla.redhat.com/show_bug.cgi?id=604881
Description: Log files generated in the server's startup time has the server's owner (nsslapd-localuser) for the owner and the group who starts the server (ordinarily, root). Once the server goes into the daemon stage, new log files are owned by owner: nsslapd- localuser and group: the local user's primary group. The latter is the correct ownership of the log files. This patch sets the correct ownership to the files generated in the server's startup time, as well.
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index 21d78e4..059cf33 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -218,7 +218,7 @@ extern void collation_init(); */
static void -chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn) +chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn, PRBool both) { PRDir *dir; PRDirEntry *entry; @@ -247,7 +247,7 @@ chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn) while( (entry = PR_ReadDir(dir , PR_SKIP_BOTH )) !=NULL ) { PR_snprintf(file,MAXPATHLEN+1,"%s/%s",log,entry->name); - slapd_chown_if_not_owner( file, pw->pw_uid, -1 ); + slapd_chown_if_not_owner( file, pw->pw_uid, both?pw->pw_gid:-1 ); } PR_CloseDir( dir ); } @@ -290,19 +290,19 @@ fix_ownership()
/* config directory needs to be owned by the local user */ if (slapdFrontendConfig->configdir) { - chown_dir_files(slapdFrontendConfig->configdir, pw, PR_FALSE); + chown_dir_files(slapdFrontendConfig->configdir, pw, PR_FALSE, PR_FALSE); } /* do access log file, if any */ if (slapdFrontendConfig->accesslog) { - chown_dir_files(slapdFrontendConfig->accesslog, pw, PR_TRUE); + chown_dir_files(slapdFrontendConfig->accesslog, pw, PR_TRUE, PR_TRUE); } /* do audit log file, if any */ if (slapdFrontendConfig->auditlog) { - chown_dir_files(slapdFrontendConfig->auditlog, pw, PR_TRUE); + chown_dir_files(slapdFrontendConfig->auditlog, pw, PR_TRUE, PR_TRUE); } /* do error log file, if any */ if (slapdFrontendConfig->errorlog) { - chown_dir_files(slapdFrontendConfig->errorlog, pw, PR_TRUE); + chown_dir_files(slapdFrontendConfig->errorlog, pw, PR_TRUE, PR_TRUE); } } #endif