]> granicus.if.org Git - sudo/commitdiff
now groks shost
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 17 Mar 1996 20:08:56 +0000 (20:08 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 17 Mar 1996 20:08:56 +0000 (20:08 +0000)
testsudoers.c

index 30991cd9cc8926d6757c3e33bf571c66a5a268d7..54f6730e9c21888bd74db6757eb4c3eba96f1e49 100644 (file)
@@ -65,6 +65,7 @@ extern int num_interfaces;
 
 char *cmnd = NULL;
 char host[MAXHOSTNAMELEN+1];
+char *shost;
 char cwd[MAXPATHLEN+1];
 struct passwd *user_pw_ent;
 char **Argv;
@@ -220,6 +221,7 @@ main(argc, argv)
     char **argv;
 {
     struct passwd pw_ent;
+    char *p;
 #ifdef YYDEBUG
     extern int yydebug;
     yydebug = 1;
@@ -239,6 +241,17 @@ main(argc, argv)
     cmnd = argv[1];
     pw_ent.pw_name = argv[2];
     strcpy(host, argv[3]);
+    if ((p = strchr(host, '.'))) {
+       *p = '\0';
+       if ((shost = strdup(host)) == NULL) {
+           perror("malloc");
+           (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
+           exit(1);
+       }
+       *p = '.';
+    } else {
+       shost = &host[0];
+    }
 
     clearaliases = 0;