|
|
1.1 ! root 1: static char sccsid[] = "@(#)netlogin.c 4.1 (Berkeley) 9/12/82"; ! 2: ! 3: /* sccs id variable */ ! 4: static char *netlogin_sid = "@(#)netlogin.c 1.2"; ! 5: ! 6: /* ! 7: netlogin - specify login name and password in environment ! 8: */ ! 9: # include "defs.h" ! 10: ! 11: /* global variables */ ! 12: struct userinfo status; ! 13: ! 14: main(argc,argv) ! 15: char **argv; ! 16: { ! 17: char mch, stemp[20], sencpasswd[30]; ! 18: # ifdef V6 ! 19: fprintf(stderr,"The netlogin command doesn't work on Version 6 UNIX\n"); ! 20: exit(EX_UNAVAILABLE); ! 21: # endif ! 22: mch = 0; ! 23: status.login[0] = 0; ! 24: status.mpasswd[0] = 0; ! 25: while(argc > 1 && argv[1][0] == '-'){ ! 26: argc--; ! 27: argv++; ! 28: switch(argv[0][1]){ ! 29: case 'm': ! 30: harg(stemp); ! 31: mch = lookup(stemp); ! 32: if(mch == 0){ ! 33: fprintf(stderr,"Bad machine %s\n",stemp); ! 34: exit(EX_NOHOST); ! 35: } ! 36: break; ! 37: case 'l': ! 38: harg(status.login); ! 39: break; ! 40: default: ! 41: usage(); ! 42: break; ! 43: } ! 44: } ! 45: if(mch == 0)usage(); ! 46: passwdent(); ! 47: promptlogin(mch); ! 48: if(strcmp(status.mpasswd,"\"\"") == 0)status.mpasswd[0] = 0; ! 49: mkpwunclear(status.mpasswd,mch,sencpasswd); ! 50: printf("%s,%s\n",status.login,sencpasswd); ! 51: exit(EX_OK); ! 52: } ! 53: usage(){ ! 54: fprintf(stderr,"Usage: netlogin -m mach [-l username]\n"); ! 55: exit(EX_USAGE); ! 56: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.