]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/options.c
pppd: Print version information to stdout instead of stderr (#133)
[ppp.git] / pppd / options.c
index 6e38d43ee900b20a4d5069d4ff8c877dfb930c3f..e08c1080e738fa3ee2059bf4c632210d4baf58d2 100644 (file)
@@ -79,7 +79,6 @@
 char *strdup __P((char *));
 #endif
 
-static const char rcsid[] = RCSID;
 
 struct option_value {
     struct option_value *next;
@@ -802,6 +801,11 @@ process_option(opt, cmd, argv)
                free(*optptr);
            *optptr = sv;
        }
+       /* obfuscate original argument for things like password */
+       if (opt->flags & OPT_HIDE) {
+           memset(*argv, '?', strlen(*argv));
+           *argv = "********";
+       }
        break;
 
     case o_special_noarg:
@@ -992,7 +996,7 @@ print_option(opt, mainopt, printer, arg)
                        p = (char *) opt->addr2;
                        if ((opt->flags & OPT_STATIC) == 0)
                                p = *(char **)p;
-                       printer("%q", p);
+                       printer(arg, "%q", p);
                } else if (opt->flags & OPT_A2LIST) {
                        struct option_value *ovp;
 
@@ -1089,7 +1093,7 @@ showversion(argv)
     char **argv;
 {
     if (phase == PHASE_INITIALIZE) {
-       fprintf(stderr, "pppd version %s\n", VERSION);
+       fprintf(stdout, "pppd version %s\n", VERSION);
        exit(0);
     }
     return 0;
@@ -1358,6 +1362,7 @@ getword(f, word, newlinep, filename)
 
        c = getc(f);
     }
+    word[MAXWORDLEN-1] = 0;    /* make sure word is null-terminated */
 
     /*
      * End of the word: check for errors.
@@ -1753,7 +1758,7 @@ user_unsetenv(argv)
        option_error("unexpected = in name: %s", arg);
        return 0;
     }
-    if (arg == '\0') {
+    if (*arg == '\0') {
        option_error("missing variable name for unset");
        return 0;
     }