]> granicus.if.org Git - sudo/commitdiff
added support for shost if FQDN
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 11 Mar 1996 01:16:09 +0000 (01:16 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 11 Mar 1996 01:16:09 +0000 (01:16 +0000)
sudo.c
sudo.h

diff --git a/sudo.c b/sudo.c
index 267b5dc7951fb8e7c74a757dcb352d4ed1afea32..2516f2c726d37b3c377f48bb8ee5c2e3ee08d114 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -140,6 +140,9 @@ char *cmnd = NULL;
 char *tty = NULL;
 char *prompt = PASSPROMPT;
 char host[MAXHOSTNAMELEN + 1];
+#ifdef FQDN
+char shost[MAXHOSTNAMELEN + 1];
+#endif /*FQDN */
 char cwd[MAXPATHLEN + 1];
 struct stat cmnd_st;
 extern struct interface *interfaces;
@@ -454,10 +457,18 @@ static void load_globals(sudo_mode)
        inform_user(GLOBAL_NO_HOSTNAME);
 #ifdef FQDN
     } else {
-       if ((h_ent = gethostbyname(host)) == NULL)
+       if ((h_ent = gethostbyname(host)) == NULL) {
            log_error(GLOBAL_HOST_UNREGISTERED);
-       else
+       } else {
            strcpy(host, h_ent -> h_name);
+           if ((p = strchr(host, '.'))) {
+               *p = '\0';
+               strcpy(shost, host);
+               *p = '.';
+           } else {
+               strcpy(shost, host);
+           }
+       }    
     }
 #else
     }
diff --git a/sudo.h b/sudo.h
index 949393d5760a316726cad494665dc8d7ee150822..d96446860715555e853fa6d95aefeaf0df1de22d 100644 (file)
--- a/sudo.h
+++ b/sudo.h
@@ -186,6 +186,9 @@ void load_interfaces        __P((void));
  */
 #ifndef MAIN
 extern char host[];
+#ifdef FQDN
+extern char shost[];
+#endif /* FQDN */
 extern char cwd[];
 extern struct interface *interfaces;
 extern int num_interfaces;