aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-09-03 12:18:42 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-09-03 12:18:42 +0000
commit99bd5adf995ee0f83bdda92384137ae810c4c92b (patch)
tree253331bcdcf278ef28a6f67f87faf80786b78e97 /libbb
parent759d7ececd56e5b25bbfcc54a04bf939d80c7ee9 (diff)
downloadbusybox-w32-99bd5adf995ee0f83bdda92384137ae810c4c92b.tar.gz
busybox-w32-99bd5adf995ee0f83bdda92384137ae810c4c92b.tar.bz2
busybox-w32-99bd5adf995ee0f83bdda92384137ae810c4c92b.zip
more crond+crontab integrating with loginutil libbb functions and deleted
patch from Thomas Gleixner to init. Viodz last_patch_108
Diffstat (limited to 'libbb')
-rw-r--r--libbb/change_identity.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libbb/change_identity.c b/libbb/change_identity.c
index c2b73eeb8..adebad8ed 100644
--- a/libbb/change_identity.c
+++ b/libbb/change_identity.c
@@ -40,15 +40,23 @@
40 40
41 41
42/* Become the user and group(s) specified by PW. */ 42/* Become the user and group(s) specified by PW. */
43void change_identity ( const struct passwd *pw ) 43const char *change_identity_e2str ( const struct passwd *pw )
44{ 44{
45 if ( initgroups ( pw-> pw_name, pw-> pw_gid ) == -1 ) 45 if ( initgroups ( pw-> pw_name, pw-> pw_gid ) == -1 )
46 bb_perror_msg_and_die ( "cannot set groups" ); 46 return "cannot set groups";
47 endgrent ( ); 47 endgrent ( );
48 48
49 if ( setgid ( pw-> pw_gid )) 49 if ( setgid ( pw-> pw_gid ))
50 bb_perror_msg_and_die ( "cannot set group id" ); 50 return "cannot set group id";
51 if ( setuid ( pw->pw_uid )) 51 if ( setuid ( pw->pw_uid ))
52 bb_perror_msg_and_die ( "cannot set user id" ); 52 return "cannot set user id";
53 return NULL;
53} 54}
54 55
56void change_identity ( const struct passwd *pw )
57{
58 const char *err_msg = change_identity_e2str(pw);
59
60 if(err_msg)
61 bb_perror_msg_and_die ( "%s", err_msg );
62}