]> granicus.if.org Git - sudo/commitdiff
Do not call set_fqdn() until sudoers parses (where is gets run as a callback).
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 18 Jun 2010 21:21:10 +0000 (17:21 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 18 Jun 2010 21:21:10 +0000 (17:21 -0400)
Otherwise, if sudo is built --with-fqdn the fqdn will be set even if
!fqdn is set in sudoers.

--HG--
branch : 1.7

sudo.c

diff --git a/sudo.c b/sudo.c
index b384d567ce11f3835a3660c9a9b353607290742f..e1bc6c3bd436867a24ed5c32df5a958f870fed12 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -576,22 +576,17 @@ init_vars(sudo_mode, envp)
      * "shost" is the unqualified form of the hostname.
      */
     nohostname = gethostname(thost, sizeof(thost));
-    if (nohostname)
+    if (nohostname) {
        user_host = user_shost = "localhost";
-    else {
+    else {
        thost[sizeof(thost) - 1] = '\0';
        user_host = estrdup(thost);
-       if (def_fqdn) {
-           /* Defer call to set_fqdn() until log_error() is safe. */
-           user_shost = user_host;
+       if ((p = strchr(user_host, '.'))) {
+           *p = '\0';
+           user_shost = estrdup(user_host);
+           *p = '.';
        } else {
-           if ((p = strchr(user_host, '.'))) {
-               *p = '\0';
-               user_shost = estrdup(user_host);
-               *p = '.';
-           } else {
-               user_shost = user_host;
-           }
+           user_shost = user_host;
        }
     }
 
@@ -672,9 +667,6 @@ init_vars(sudo_mode, envp)
     }
 #endif
 
-    if (def_fqdn)
-       set_fqdn();                     /* may call log_error() */
-
     if (nohostname)
        log_error(USE_ERRNO|MSG_ONLY, "can't get hostname");