aboutsummaryrefslogtreecommitdiff
path: root/miscutils/crond.c
diff options
context:
space:
mode:
authorGravatar Glenn L McGrath <bug1@ihug.co.nz>2003-09-03 12:18:42 +0000
committerGravatar Glenn L McGrath <bug1@ihug.co.nz>2003-09-03 12:18:42 +0000
commit99bd5adf995ee0f83bdda92384137ae810c4c92b (patch)
tree253331bcdcf278ef28a6f67f87faf80786b78e97 /miscutils/crond.c
parent759d7ececd56e5b25bbfcc54a04bf939d80c7ee9 (diff)
downloadbusybox-99bd5adf995ee0f83bdda92384137ae810c4c92b.tar.gz
busybox-99bd5adf995ee0f83bdda92384137ae810c4c92b.tar.bz2
more crond+crontab integrating with loginutil libbb functions and deleted
patch from Thomas Gleixner to init. Viodz last_patch_108
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
ChangeUser(const char *user)
{
struct passwd *pas;
+ const char *err_msg;
/*
* Obtain password entry and change privilages
@@ -315,18 +316,9 @@ ChangeUser(const char *user)
/*
* Change running state to the user in question
*/
-
- if (initgroups(user, pas->pw_gid) < 0) {
- crondlog("\011initgroups failed: %s %m", user);
- return(-1);
- }
- /* drop all priviledges */
- if (setgid(pas->pw_gid) < 0) {
- crondlog("\011setgid failed: %s %d", user, pas->pw_gid);
- return(-1);
- }
- if (setuid(pas->pw_uid) < 0) {
- crondlog("\011setuid failed: %s %d", user, pas->pw_uid);
+ err_msg = change_identity_e2str(pas);
+ if (err_msg) {
+ crondlog("\011%s for user %s", err_msg, user);
return(-1);
}
if (chdir(pas->pw_dir) < 0) {