|
|
BSD 4.3tahoe
/* $Header: /var/lib/cvsd/repos/CSRG/43BSDTahoe/new/xns/morexnslib/auth/getXNSuser.c,v 1.1.1.1 2018/04/24 16:12:58 root Exp $ */
/*
* Copyright (c) 1986, 1987 Xerox Corporation.
*/
/* $Log: getXNSuser.c,v $
/* Revision 1.1.1.1 2018/04/24 16:12:58 root
/* BSD 4.3tahoe
/*
* Revision 1.2 87/07/28 08:39:23 ed
* fprintf to stderr instead of stdin (how did it work?).
*
* Revision 1.1 87/03/23 10:26:08 ed
* Initial revision
*
*/
#include <stdio.h>
#include <xnscourier/Authentication2.h>
#include <xnscourier/Clearinghouse2.h>
#include <ctype.h>
/* This should be constant somewhere ?? */
static char name[85]; /* 80 is max three part name + 3 for separators(:) */
static Cardinal passwd;
getXNSuser(xnsname, xnspwd)
char **xnsname;
Cardinal **xnspwd;
{
char *pwd, *cp, *username;
char *getXNSpass(), *getenv(), *index();
FILE *tty, *fopen();
if ( ((username= getenv("XNSNAME")) == NULL) || (username[0] == '\0') ) {
if ( (tty= fopen("/dev/tty", "r+")) == NULL ) {
tty= stdin;
} else {
setbuf(tty, (char *)NULL);
}
fprintf(stderr, "Enter XNS name: ");
fgets(name, sizeof(name), tty);
if ( (cp= index(name, '\n')) )
*cp= '\0';
if ( name[0] == '\0' )
*xnsname= "Unknown";
else
*xnsname= name;
fclose(tty);
} else {
*xnsname= username;
}
if ( ((pwd= getenv("XNSPASSWD")) == NULL) || (*pwd == '\0') ) {
pwd= getXNSpass("Enter XNS password: ");
passwd= hashpass(pwd);
} else {
passwd= atoi(pwd);
}
*xnspwd= &passwd;
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.