summaryrefslogtreecommitdiff
path: root/usr.bin/sudo
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-01-15 02:17:04 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-01-15 02:17:04 +0000
commite07fc170a6888658267372d08d1a11076b151fa9 (patch)
treeddb703c34731812c7597ec51c7d51a28e64bba03 /usr.bin/sudo
parent1fc9a892e88a895af7c0083c065b31ec9dcf97e2 (diff)
update to sudo 1.6.4p1
Diffstat (limited to 'usr.bin/sudo')
-rw-r--r--usr.bin/sudo/CHANGES11
-rw-r--r--usr.bin/sudo/env.c13
-rw-r--r--usr.bin/sudo/sudo.c24
-rw-r--r--usr.bin/sudo/version.h2
4 files changed, 31 insertions, 19 deletions
diff --git a/usr.bin/sudo/CHANGES b/usr.bin/sudo/CHANGES
index fc75c1b2533..ac7265c4f61 100644
--- a/usr.bin/sudo/CHANGES
+++ b/usr.bin/sudo/CHANGES
@@ -1458,3 +1458,14 @@ Sudo 1.6.3p7 released.
456) config.h.in is now generated by autoheader.
Sudo 1.6.4 released.
+
+457) Move the call to rebuild_env() until after MODE_RESET_HOME is set.
+ Otherwise, the set_home option has no effect.
+
+458) Fix use of freed memory when the "fqdn" flag is set. This was
+ introduced by the fix for the "segv when gethostbynam() fails" bug.
+
+459) Add 'continue' statements to optimize the switch statement.
+ From Solar.
+
+Sudo 1.6.4p1 released.
diff --git a/usr.bin/sudo/env.c b/usr.bin/sudo/env.c
index 43d8c4c0b2f..b2ab7c0c26b 100644
--- a/usr.bin/sudo/env.c
+++ b/usr.bin/sudo/env.c
@@ -157,29 +157,32 @@ zero_env(envp)
case 'H':
if (strncmp("HOME=", *ep, 5) == 0)
break;
+ continue;
case 'L':
if (strncmp("LOGNAME=", *ep, 8) == 0)
break;
+ continue;
case 'P':
if (strncmp("PATH=", *ep, 5) == 0) {
user_path = *ep + 5;
/* XXX - set to sane default instead of user's? */
break;
}
+ continue;
case 'S':
- if (strncmp("SHELL=", *ep, 6) == 0) {
+ if (strncmp("SHELL=", *ep, 6) == 0)
user_shell = *ep + 6;
- continue;
- } else if (!user_prompt && !strncmp("SUDO_PROMPT=", *ep, 12)) {
+ else if (!user_prompt && !strncmp("SUDO_PROMPT=", *ep, 12))
user_prompt = *ep + 12;
- continue;
- }
+ continue;
case 'T':
if (strncmp("TZ=", *ep, 3) == 0)
break;
+ continue;
case 'U':
if (strncmp("USER=", *ep, 5) == 0)
break;
+ continue;
default:
continue;
}
diff --git a/usr.bin/sudo/sudo.c b/usr.bin/sudo/sudo.c
index 83173713a93..1ac42ce08ff 100644
--- a/usr.bin/sudo/sudo.c
+++ b/usr.bin/sudo/sudo.c
@@ -287,9 +287,6 @@ main(argc, argv, envp)
log_error(NO_MAIL|MSG_ONLY, "no passwd entry for %s!", *user_runas);
}
- /* Build up custom environment that avoids any nasty bits. */
- new_environ = rebuild_env(sudo_mode, envp);
-
/* This goes after the sudoers parse since we honor sudoers options. */
if (sudo_mode == MODE_KILL || sudo_mode == MODE_INVALIDATE) {
remove_timestamp((sudo_mode == MODE_KILL));
@@ -335,6 +332,9 @@ main(argc, argv, envp)
if (!(validated & FLAG_NOPASS))
check_user();
+ /* Build up custom environment that avoids any nasty bits. */
+ new_environ = rebuild_env(sudo_mode, envp);
+
if (validated & VALIDATE_OK) {
/* Finally tell the user if the command did not exist. */
if (cmnd_status == NOT_FOUND_DOT) {
@@ -950,17 +950,15 @@ set_fqdn()
struct hostent *hp;
char *p;
- if (def_flag(I_FQDN)) {
- if (!(hp = gethostbyname(user_host))) {
- log_error(MSG_ONLY|NO_EXIT,
- "unable to lookup %s via gethostbyname()", user_host);
- } else {
- free(user_host);
- user_host = estrdup(hp->h_name);
- }
+ if (!(hp = gethostbyname(user_host))) {
+ log_error(MSG_ONLY|NO_EXIT,
+ "unable to lookup %s via gethostbyname()", user_host);
+ } else {
+ if (user_shost != user_host)
+ free(user_shost);
+ free(user_host);
+ user_host = estrdup(hp->h_name);
}
- if (user_shost != user_host)
- free(user_shost);
if ((p = strchr(user_host, '.'))) {
*p = '\0';
user_shost = estrdup(user_host);
diff --git a/usr.bin/sudo/version.h b/usr.bin/sudo/version.h
index 3a6edd185c5..336397a3f5e 100644
--- a/usr.bin/sudo/version.h
+++ b/usr.bin/sudo/version.h
@@ -37,6 +37,6 @@
#ifndef _SUDO_VERSION_H
#define _SUDO_VERSION_H
-static const char version[] = "1.6.4";
+static const char version[] = "1.6.4p1";
#endif /* _SUDO_VERSION_H */