Print this page
10125 smatch fixes for cmd-inet

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/cmd-inet/usr.bin/pppd/plugins/passprompt.c
          +++ new/usr/src/cmd/cmd-inet/usr.bin/pppd/plugins/passprompt.c
   1    1  /*
   2    2   * passprompt.c - pppd plugin to invoke an external PAP password prompter
   3    3   *
   4    4   * Copyright 1999 Paul Mackerras, Alan Curry.
   5    5   *
   6    6   *  This program is free software; you can redistribute it and/or
   7    7   *  modify it under the terms of the GNU General Public License
   8    8   *  as published by the Free Software Foundation; either version
   9    9   *  2 of the License, or (at your option) any later version.
  10   10   */
       11 +
       12 +/*
       13 + * Copyright (c) 2018, Joyent, Inc.
       14 + */
       15 +
  11   16  #include <errno.h>
  12   17  #include <unistd.h>
  13   18  #include <fcntl.h>
  14   19  #include <sys/wait.h>
  15   20  #include <syslog.h>
  16   21  #include "pppd.h"
  17   22  
  18   23  static char promptprog[PATH_MAX+1];
  19   24  
  20   25  static option_t options[] = {
↓ open down ↓ 42 lines elided ↑ open up ↑
  63   68              red = open("/etc/ppp/prompt-errors", O_WRONLY | O_APPEND | O_CREAT,
  64   69                  0600);
  65   70              (void) dup2(red, 1);
  66   71              (void) dup2(red, 2);
  67   72          }
  68   73          (void) seteuid(getuid());
  69   74          (void) setegid(getgid());
  70   75          argv[0] = promptprog;
  71   76          argv[1] = user == NULL ? "" : user;
  72   77          argv[2] = remote_name;
  73      -        slprintf(fdstr, sizeof (fdstr), "%d", p[1]);
       78 +        (void) slprintf(fdstr, sizeof (fdstr), "%d", p[1]);
  74   79          argv[3] = fdstr;
  75   80          argv[4] = NULL;
  76   81          (void) execv(*argv, argv);
  77   82          _exit(127);
  78   83      }
  79   84  
  80   85      /* we are the parent, read the password from the pipe */
  81   86      (void) close(p[1]);
  82   87      readgood = 0;
  83   88      do {
↓ open down ↓ 40 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX