* libmisc/setugid.c (setup_uid_gid): The is_console argument is now a bool.
* libmisc/setugid.c: Avoid implicit conversion of integers / pointers to booleans. * libmisc/setugid.c: Add brackets.
This commit is contained in:
parent
2533c87bd6
commit
7f9dfde0dc
@ -1,6 +1,6 @@
|
|||||||
2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
|
2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* libmisc/setugid.c (setup_uid_gid): The is_console argument is no
|
* libmisc/setugid.c (setup_uid_gid): The is_console argument is now
|
||||||
a bool.
|
a bool.
|
||||||
* libmisc/setugid.c: Avoid implicit conversion of integers /
|
* libmisc/setugid.c: Avoid implicit conversion of integers /
|
||||||
pointers to booleans.
|
pointers to booleans.
|
||||||
|
@ -82,7 +82,7 @@ int change_uid (const struct passwd *info)
|
|||||||
/*
|
/*
|
||||||
* Set the real UID to the UID value in the password file.
|
* Set the real UID to the UID value in the password file.
|
||||||
*/
|
*/
|
||||||
if (setuid (info->pw_uid)) {
|
if (setuid (info->pw_uid) != 0) {
|
||||||
perror ("setuid");
|
perror ("setuid");
|
||||||
SYSLOG ((LOG_ERR, "bad user ID `%d' for user `%s': %m\n",
|
SYSLOG ((LOG_ERR, "bad user ID `%d' for user `%s': %m\n",
|
||||||
(int) info->pw_uid, info->pw_name));
|
(int) info->pw_uid, info->pw_name));
|
||||||
@ -103,7 +103,7 @@ int change_uid (const struct passwd *info)
|
|||||||
* Returns 0 on success, or -1 on failure.
|
* Returns 0 on success, or -1 on failure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int setup_uid_gid (const struct passwd *info, int is_console)
|
int setup_uid_gid (const struct passwd *info, bool is_console)
|
||||||
{
|
{
|
||||||
if (setup_groups (info) < 0)
|
if (setup_groups (info) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -112,9 +112,10 @@ int setup_uid_gid (const struct passwd *info, int is_console)
|
|||||||
if (is_console) {
|
if (is_console) {
|
||||||
char *cp = getdef_str ("CONSOLE_GROUPS");
|
char *cp = getdef_str ("CONSOLE_GROUPS");
|
||||||
|
|
||||||
if (cp && add_groups (cp))
|
if ((NULL != cp) && (add_groups (cp) != 0)) {
|
||||||
perror ("Warning: add_groups");
|
perror ("Warning: add_groups");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif /* HAVE_INITGROUPS */
|
#endif /* HAVE_INITGROUPS */
|
||||||
|
|
||||||
if (change_uid (info) < 0)
|
if (change_uid (info) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user