diff options
author | Glenn L McGrath | 2003-09-03 12:18:42 +0000 |
---|---|---|
committer | Glenn L McGrath | 2003-09-03 12:18:42 +0000 |
commit | 99bd5adf995ee0f83bdda92384137ae810c4c92b (patch) | |
tree | 253331bcdcf278ef28a6f67f87faf80786b78e97 /miscutils/crontab.c | |
parent | 759d7ececd56e5b25bbfcc54a04bf939d80c7ee9 (diff) | |
download | busybox-99bd5adf995ee0f83bdda92384137ae810c4c92b.zip busybox-99bd5adf995ee0f83bdda92384137ae810c4c92b.tar.gz |
more crond+crontab integrating with loginutil libbb functions and deleted
patch from Thomas Gleixner to init.
Viodz last_patch_108
Diffstat (limited to 'miscutils/crontab.c')
-rw-r--r-- | miscutils/crontab.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/miscutils/crontab.c b/miscutils/crontab.c index 6c4da95..52d08dd 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c @@ -333,18 +333,6 @@ EditFile(const char *user, const char *file) wait4(pid, NULL, 0, NULL); } -static void -log(const char *ctl, ...) -{ - va_list va; - char buf[1024]; - - va_start(va, ctl); - vsnprintf(buf, sizeof(buf), ctl, va); - syslog(LOG_NOTICE, "%s",buf ); - va_end(va); -} - static int ChangeUser(const char *user, short dochdir) { @@ -355,7 +343,7 @@ ChangeUser(const char *user, short dochdir) */ if ((pas = getpwnam(user)) == 0) { - log("failed to get uid for %s", user); + bb_perror_msg_and_die("failed to get uid for %s", user); return(-1); } setenv("USER", pas->pw_name, 1); @@ -365,24 +353,13 @@ ChangeUser(const char *user, short dochdir) /* * Change running state to the user in question */ + change_identity(pas); - if (initgroups(user, pas->pw_gid) < 0) { - log("initgroups failed: %s %m", user); - return(-1); - } - if (setregid(pas->pw_gid, pas->pw_gid) < 0) { - log("setregid failed: %s %d", user, pas->pw_gid); - return(-1); - } - if (setreuid(pas->pw_uid, pas->pw_uid) < 0) { - log("setreuid failed: %s %d", user, pas->pw_uid); - return(-1); - } if (dochdir) { if (chdir(pas->pw_dir) < 0) { + bb_perror_msg_and_die("chdir failed: %s %s", user, pas->pw_dir); if (chdir(TMPDIR) < 0) { - log("chdir failed: %s %s", user, pas->pw_dir); - log("chdir failed: %s " TMPDIR, user); + bb_perror_msg_and_die("chdir failed: %s %s", user, TMPDIR); return(-1); } } |