* NEWS, src/newgrp.c: Fix segfault when an user returns to an
unknown GID (either the user was deleted during the user's newgrp session or the user's passwd entry referenced an invalid group). Add a syslog warning in that case. * src/newgrp.c: Add an end of line when reporting an invalid password.
This commit is contained in:
parent
b082ebead2
commit
ae8cbbc34d
@ -1,3 +1,12 @@
|
|||||||
|
2008-01-22 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* NEWS, src/newgrp.c: Fix segfault when an user returns to an
|
||||||
|
unknown GID (either the user was deleted during the user's newgrp
|
||||||
|
session or the user's passwd entry referenced an invalid group).
|
||||||
|
Add a syslog warning in that case.
|
||||||
|
* src/newgrp.c: Add an end of line when reporting an invalid
|
||||||
|
password.
|
||||||
|
|
||||||
2008-01-12 Nicolas François <nicolas.francois@centraliens.net>
|
2008-01-12 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* NEWS, src/useradd.c: Fix the handling of the --defaults option
|
* NEWS, src/useradd.c: Fix the handling of the --defaults option
|
||||||
|
4
NEWS
4
NEWS
@ -26,6 +26,10 @@ shadow-4.1.0 -> shadow-4.1.1 UNRELEASED
|
|||||||
- lastlog
|
- lastlog
|
||||||
* Accept users specified as a numerical UID, or ranges of users (-user,
|
* Accept users specified as a numerical UID, or ranges of users (-user,
|
||||||
user-, user1-user2).
|
user-, user1-user2).
|
||||||
|
- newgrp
|
||||||
|
* Fix segfault when an user returns to an unknown GID (either the user
|
||||||
|
was deleted during the user's newgrp session or the user's passwd
|
||||||
|
entry referenced an invalid group). Add a syslog warning in that case.
|
||||||
- newusers
|
- newusers
|
||||||
* The new users are no more added to the list of members of their groups
|
* The new users are no more added to the list of members of their groups
|
||||||
because the membership is already set by their primary group.
|
because the membership is already set by their primary group.
|
||||||
|
24
src/newgrp.c
24
src/newgrp.c
@ -169,7 +169,7 @@ static void check_perms (const struct group *grp,
|
|||||||
"Invalid password for group `%s' from `%s'",
|
"Invalid password for group `%s' from `%s'",
|
||||||
groupname, pwd->pw_name));
|
groupname, pwd->pw_name));
|
||||||
sleep (1);
|
sleep (1);
|
||||||
fputs (_("Invalid password."), stderr);
|
fputs (_("Invalid password.\n"), stderr);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,6 +252,8 @@ static void syslog_sg (const char *name, const char *group)
|
|||||||
} else if (child) {
|
} else if (child) {
|
||||||
/* parent - wait for child to finish, then log session close */
|
/* parent - wait for child to finish, then log session close */
|
||||||
int cst = 0;
|
int cst = 0;
|
||||||
|
gid_t gid = getgid();
|
||||||
|
struct group *grp = getgrgid (gid);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
@ -265,10 +267,22 @@ static void syslog_sg (const char *name, const char *group)
|
|||||||
} while ((pid == child && WIFSTOPPED (cst)) ||
|
} while ((pid == child && WIFSTOPPED (cst)) ||
|
||||||
(pid != child && errno == EINTR));
|
(pid != child && errno == EINTR));
|
||||||
/* local, no need for xgetgrgid */
|
/* local, no need for xgetgrgid */
|
||||||
SYSLOG ((LOG_INFO,
|
if (NULL != grp) {
|
||||||
"user `%s' (login `%s' on %s) returned to group `%s'",
|
SYSLOG ((LOG_INFO,
|
||||||
name, loginname, tty,
|
"user `%s' (login `%s' on %s) returned to group `%s'",
|
||||||
getgrgid (gid)->gr_name));
|
name, loginname, tty, grp->gr_name));
|
||||||
|
} else {
|
||||||
|
SYSLOG ((LOG_INFO,
|
||||||
|
"user `%s' (login `%s' on %s) returned to group `%d'",
|
||||||
|
name, loginname, tty, gid));
|
||||||
|
/* Either the user's passwd entry has a
|
||||||
|
* GID that does not match with any group,
|
||||||
|
* or the group was deleted while the user
|
||||||
|
* was in a newgrp session.*/
|
||||||
|
SYSLOG ((LOG_WARN,
|
||||||
|
"unknown GID `%u' used by user `%s'",
|
||||||
|
gid, name));
|
||||||
|
}
|
||||||
closelog ();
|
closelog ();
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user