Cast [ug]ids to unsigned long and printf with %lu
This commit is contained in:
15
check.c
15
check.c
@@ -370,8 +370,9 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs)
|
|||||||
log_error(NO_EXIT, "%s exists but is not a directory (0%o)",
|
log_error(NO_EXIT, "%s exists but is not a directory (0%o)",
|
||||||
dirparent, sb.st_mode);
|
dirparent, sb.st_mode);
|
||||||
else if (sb.st_uid != timestamp_uid)
|
else if (sb.st_uid != timestamp_uid)
|
||||||
log_error(NO_EXIT, "%s owned by uid %ld, should be uid %ld",
|
log_error(NO_EXIT, "%s owned by uid %lu, should be uid %lu",
|
||||||
dirparent, (long) sb.st_uid, (long) timestamp_uid);
|
dirparent, (unsigned long) sb.st_uid,
|
||||||
|
(unsigned long) timestamp_uid);
|
||||||
else if ((sb.st_mode & 0000022))
|
else if ((sb.st_mode & 0000022))
|
||||||
log_error(NO_EXIT,
|
log_error(NO_EXIT,
|
||||||
"%s writable by non-owner (0%o), should be mode 0700",
|
"%s writable by non-owner (0%o), should be mode 0700",
|
||||||
@@ -416,8 +417,9 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs)
|
|||||||
log_error(NO_EXIT, "%s exists but is not a directory (0%o)",
|
log_error(NO_EXIT, "%s exists but is not a directory (0%o)",
|
||||||
timestampdir, sb.st_mode);
|
timestampdir, sb.st_mode);
|
||||||
} else if (sb.st_uid != timestamp_uid)
|
} else if (sb.st_uid != timestamp_uid)
|
||||||
log_error(NO_EXIT, "%s owned by uid %ld, should be uid %ld",
|
log_error(NO_EXIT, "%s owned by uid %lu, should be uid %lu",
|
||||||
timestampdir, (long) sb.st_uid, (long) timestamp_uid);
|
timestampdir, (unsigned long) sb.st_uid,
|
||||||
|
(unsigned long) timestamp_uid);
|
||||||
else if ((sb.st_mode & 0000022))
|
else if ((sb.st_mode & 0000022))
|
||||||
log_error(NO_EXIT,
|
log_error(NO_EXIT,
|
||||||
"%s writable by non-owner (0%o), should be mode 0700",
|
"%s writable by non-owner (0%o), should be mode 0700",
|
||||||
@@ -458,8 +460,9 @@ timestamp_status(timestampdir, timestampfile, user, make_dirs)
|
|||||||
/* If bad uid or file mode, complain and kill the bogus file. */
|
/* If bad uid or file mode, complain and kill the bogus file. */
|
||||||
if (sb.st_uid != timestamp_uid) {
|
if (sb.st_uid != timestamp_uid) {
|
||||||
log_error(NO_EXIT,
|
log_error(NO_EXIT,
|
||||||
"%s owned by uid %ld, should be uid %ld",
|
"%s owned by uid %ud, should be uid %lu",
|
||||||
timestampfile, (long) sb.st_uid, (long) timestamp_uid);
|
timestampfile, (unsigned long) sb.st_uid,
|
||||||
|
(unsigned long) timestamp_uid);
|
||||||
(void) unlink(timestampfile);
|
(void) unlink(timestampfile);
|
||||||
} else if ((sb.st_mode & 0000022)) {
|
} else if ((sb.st_mode & 0000022)) {
|
||||||
log_error(NO_EXIT,
|
log_error(NO_EXIT,
|
||||||
|
4
env.c
4
env.c
@@ -442,9 +442,9 @@ rebuild_env(sudo_mode, envp)
|
|||||||
|
|
||||||
/* Add the SUDO_USER, SUDO_UID, SUDO_GID environment variables. */
|
/* Add the SUDO_USER, SUDO_UID, SUDO_GID environment variables. */
|
||||||
insert_env(format_env("SUDO_USER", user_name), 1);
|
insert_env(format_env("SUDO_USER", user_name), 1);
|
||||||
easprintf(&cp, "SUDO_UID=%ld", (long) user_uid);
|
easprintf(&cp, "SUDO_UID=%lu", (unsigned long) user_uid);
|
||||||
insert_env(cp, 1);
|
insert_env(cp, 1);
|
||||||
easprintf(&cp, "SUDO_GID=%ld", (long) user_gid);
|
easprintf(&cp, "SUDO_GID=%lu", (unsigned long) user_gid);
|
||||||
insert_env(cp, 1);
|
insert_env(cp, 1);
|
||||||
|
|
||||||
return(new_environ);
|
return(new_environ);
|
||||||
|
12
sudo.c
12
sudo.c
@@ -530,8 +530,8 @@ init_vars(sudo_mode)
|
|||||||
pw.pw_name = pw_name;
|
pw.pw_name = pw_name;
|
||||||
sudo_user.pw = &pw;
|
sudo_user.pw = &pw;
|
||||||
|
|
||||||
log_error(0, "uid %ld does not exist in the passwd file!",
|
log_error(0, "uid %lu does not exist in the passwd file!",
|
||||||
(long) pw.pw_uid);
|
(unsigned long) pw.pw_uid);
|
||||||
}
|
}
|
||||||
if (user_shell == NULL || *user_shell == '\0')
|
if (user_shell == NULL || *user_shell == '\0')
|
||||||
user_shell = sudo_user.pw->pw_shell;
|
user_shell = sudo_user.pw->pw_shell;
|
||||||
@@ -844,11 +844,11 @@ check_sudoers()
|
|||||||
log_error(0, "%s is mode 0%o, should be 0%o", _PATH_SUDOERS,
|
log_error(0, "%s is mode 0%o, should be 0%o", _PATH_SUDOERS,
|
||||||
(statbuf.st_mode & 07777), SUDOERS_MODE);
|
(statbuf.st_mode & 07777), SUDOERS_MODE);
|
||||||
else if (statbuf.st_uid != SUDOERS_UID)
|
else if (statbuf.st_uid != SUDOERS_UID)
|
||||||
log_error(0, "%s is owned by uid %ld, should be %d", _PATH_SUDOERS,
|
log_error(0, "%s is owned by uid %lu, should be %lu", _PATH_SUDOERS,
|
||||||
(long) statbuf.st_uid, SUDOERS_UID);
|
(unsigned long) statbuf.st_uid, SUDOERS_UID);
|
||||||
else if (statbuf.st_gid != SUDOERS_GID)
|
else if (statbuf.st_gid != SUDOERS_GID)
|
||||||
log_error(0, "%s is owned by gid %ld, should be %d", _PATH_SUDOERS,
|
log_error(0, "%s is owned by gid %lu, should be %lu", _PATH_SUDOERS,
|
||||||
(long) statbuf.st_gid, SUDOERS_GID);
|
(unsigned long) statbuf.st_gid, SUDOERS_GID);
|
||||||
else {
|
else {
|
||||||
/* Solaris sometimes returns EAGAIN so try 10 times */
|
/* Solaris sometimes returns EAGAIN so try 10 times */
|
||||||
for (i = 0; i < 10 ; i++) {
|
for (i = 0; i < 10 ; i++) {
|
||||||
|
Reference in New Issue
Block a user