New upstream version 4.8.1
This commit is contained in:
+21
-10
@@ -223,7 +223,7 @@ static void open_files (void);
|
||||
static void open_shadow (void);
|
||||
static void faillog_reset (uid_t);
|
||||
static void lastlog_reset (uid_t);
|
||||
static void tallylog_reset (char *);
|
||||
static void tallylog_reset (const char *);
|
||||
static void usr_update (void);
|
||||
static void create_home (void);
|
||||
static void create_mail (void);
|
||||
@@ -1328,15 +1328,22 @@ static void process_flags (int argc, char **argv)
|
||||
if ( ( !VALID (optarg) )
|
||||
|| ( ('\0' != optarg[0])
|
||||
&& ('/' != optarg[0])
|
||||
&& ('*' != optarg[0]) )
|
||||
|| (stat(optarg, &st) != 0)
|
||||
|| (S_ISDIR(st.st_mode))
|
||||
|| (access(optarg, X_OK) != 0)) {
|
||||
&& ('*' != optarg[0]) )) {
|
||||
fprintf (stderr,
|
||||
_("%s: invalid shell '%s'\n"),
|
||||
Prog, optarg);
|
||||
exit (E_BAD_ARG);
|
||||
}
|
||||
if ( '\0' != optarg[0]
|
||||
&& '*' != optarg[0]
|
||||
&& strcmp(optarg, "/sbin/nologin") != 0
|
||||
&& ( stat(optarg, &st) != 0
|
||||
|| S_ISDIR(st.st_mode)
|
||||
|| access(optarg, X_OK) != 0)) {
|
||||
fprintf (stderr,
|
||||
_("%s: Warning: missing or non-executable shell '%s'\n"),
|
||||
Prog, optarg);
|
||||
}
|
||||
user_shell = optarg;
|
||||
def_shell = optarg;
|
||||
sflg = true;
|
||||
@@ -1912,7 +1919,7 @@ static void lastlog_reset (uid_t uid)
|
||||
}
|
||||
}
|
||||
|
||||
static void tallylog_reset (char *user_name)
|
||||
static void tallylog_reset (const char *user_name)
|
||||
{
|
||||
const char pam_tally2[] = "/sbin/pam_tally2";
|
||||
const char *pname;
|
||||
@@ -1968,6 +1975,7 @@ static void usr_update (void)
|
||||
{
|
||||
struct passwd pwent;
|
||||
struct spwd spent;
|
||||
char *tty;
|
||||
|
||||
/*
|
||||
* Fill in the password structure with any new fields, making
|
||||
@@ -1980,10 +1988,12 @@ static void usr_update (void)
|
||||
* Create a syslog entry. We need to do this now in case anything
|
||||
* happens so we know what we were trying to accomplish.
|
||||
*/
|
||||
tty=ttyname (STDIN_FILENO);
|
||||
SYSLOG ((LOG_INFO,
|
||||
"new user: name=%s, UID=%u, GID=%u, home=%s, shell=%s",
|
||||
"new user: name=%s, UID=%u, GID=%u, home=%s, shell=%s, from=%s",
|
||||
user_name, (unsigned int) user_id,
|
||||
(unsigned int) user_gid, user_home, user_shell));
|
||||
(unsigned int) user_gid, user_home, user_shell,
|
||||
tty ? tty : "none" ));
|
||||
|
||||
/*
|
||||
* Initialize faillog and lastlog entries for this UID in case
|
||||
@@ -2152,8 +2162,9 @@ static void create_home (void)
|
||||
}
|
||||
|
||||
(void) chown (prefix_user_home, user_id, user_gid);
|
||||
chmod (prefix_user_home,
|
||||
0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
|
||||
mode_t mode = getdef_num ("HOME_MODE",
|
||||
0777 & ~getdef_num ("UMASK", GETDEF_DEFAULT_UMASK));
|
||||
chmod (prefix_user_home, mode);
|
||||
home_added = true;
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
|
||||
Reference in New Issue
Block a user