Merge pull request #272 from ikerexxe/useradd_covscan
useradd: check return value from chmod and log it
This commit is contained in:
commit
994a3b463c
@ -2247,7 +2247,10 @@ static void create_home (void)
|
|||||||
(void) chown (prefix_user_home, user_id, user_gid);
|
(void) chown (prefix_user_home, user_id, user_gid);
|
||||||
mode_t mode = getdef_num ("HOME_MODE",
|
mode_t mode = getdef_num ("HOME_MODE",
|
||||||
0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
|
0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
|
||||||
chmod (prefix_user_home, mode);
|
if (chmod (prefix_user_home, mode)) {
|
||||||
|
fprintf (stderr, _("%s: warning: chown on '%s' failed: %m\n"),
|
||||||
|
Prog, path);
|
||||||
|
}
|
||||||
home_added = true;
|
home_added = true;
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_ADD_USER, Prog,
|
audit_logger (AUDIT_ADD_USER, Prog,
|
||||||
|
Loading…
Reference in New Issue
Block a user