aboutsummaryrefslogtreecommitdiff
path: root/miscutils/crond.c
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils/crond.c')
-rw-r--r--miscutils/crond.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 637e09dd8..7915b860a 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -299,6 +299,7 @@ static int
299ChangeUser(const char *user) 299ChangeUser(const char *user)
300{ 300{
301 struct passwd *pas; 301 struct passwd *pas;
302 const char *err_msg;
302 303
303 /* 304 /*
304 * Obtain password entry and change privilages 305 * Obtain password entry and change privilages
@@ -315,18 +316,9 @@ ChangeUser(const char *user)
315 /* 316 /*
316 * Change running state to the user in question 317 * Change running state to the user in question
317 */ 318 */
318 319 err_msg = change_identity_e2str(pas);
319 if (initgroups(user, pas->pw_gid) < 0) { 320 if (err_msg) {
320 crondlog("\011initgroups failed: %s %m", user); 321 crondlog("\011%s for user %s", err_msg, user);
321 return(-1);
322 }
323 /* drop all priviledges */
324 if (setgid(pas->pw_gid) < 0) {
325 crondlog("\011setgid failed: %s %d", user, pas->pw_gid);
326 return(-1);
327 }
328 if (setuid(pas->pw_uid) < 0) {
329 crondlog("\011setuid failed: %s %d", user, pas->pw_uid);
330 return(-1); 322 return(-1);
331 } 323 }
332 if (chdir(pas->pw_dir) < 0) { 324 if (chdir(pas->pw_dir) < 0) {