home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume6 / shadow-2.pt3 / dialchk.c < prev    next >
C/C++ Source or Header  |  1989-02-03  |  744b  |  42 lines

  1. #include <stdio.h>
  2. #include "config.h"
  3. #include "dialup.h"
  4.  
  5. /*
  6.  * Check for dialup password
  7.  *
  8.  *    dialcheck tests to see if tty is listed as being a dialup
  9.  *    line.  If so, a dialup password may be required if the shell
  10.  *    is listed as one which requires a second password.
  11.  */
  12.  
  13. #ifdef    DIALUP
  14. int    dialcheck (tty, shell)
  15. char    *tty;
  16. char    *shell;
  17. {
  18.     char    *crypt ();
  19.     char    *getpass ();
  20.     struct    dialup    *dialup;
  21.     char    *pass;
  22.     char    *cp;
  23.  
  24.     if (! isadialup (tty))
  25.         return (1);
  26.  
  27.     if (! (dialup = getdushell (shell)))
  28.         return (1);
  29.  
  30.     endduent ();
  31.  
  32.     if (dialup->du_passwd[0] == '\0')
  33.         return (1);
  34.  
  35.     if (! (pass = getpass ("Dialup Password:")))
  36.         return (0);
  37.  
  38.     cp = crypt (pass, dialup->du_passwd);
  39.     return (strcmp (cp, dialup->du_passwd) == 0);
  40. }
  41. #endif
  42.