more crond+crontab integrating with loginutil libbb functions and deleted
patch from Thomas Gleixner to init.
Viodz last_patch_108
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 637e09d..7915b86 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -299,6 +299,7 @@
ChangeUser(const char *user)
{
struct passwd *pas;
+ const char *err_msg;
/*
* Obtain password entry and change privilages
@@ -315,18 +316,9 @@
/*
* 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) {