home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
3
/
3348
/
dialchk.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-05-16
|
1KB
|
66 lines
/*
* Copyright 1989, 1990, John F. Haugh II
* All rights reserved.
*
* Permission is granted to copy and create derivative works for any
* non-commercial purpose, provided this copyright notice is preserved
* in all copies of source code, or included in human readable form
* and conspicuously displayed on all copies of object code or
* distribution media.
*/
#include <stdio.h>
#ifdef BSD
#include <strings.h>
#else
#include <string.h>
#endif
#include "config.h"
#include "dialup.h"
#ifndef lint
static char sccsid[] = "@(#)dialchk.c 3.2 19:44:18 12/10/90";
#endif
extern char *pw_encrypt();
/*
* Check for dialup password
*
* dialcheck tests to see if tty is listed as being a dialup
* line. If so, a dialup password may be required if the shell
* is listed as one which requires a second password.
*/
int dialcheck (tty, shell)
char *tty;
char *shell;
{
char *crypt ();
char *getpass ();
struct dialup *dialup;
char *pass;
char *cp;
setduent ();
if (! isadialup (tty)) {
endduent ();
return (1);
}
if (! (dialup = getdushell (shell))) {
endduent ();
return (1);
}
endduent ();
if (dialup->du_passwd[0] == '\0')
return (1);
if (! (pass = getpass ("Dialup Password:")))
return (0);
cp = pw_encrypt (pass, dialup->du_passwd);
return (strcmp (cp, dialup->du_passwd) == 0);
}