53 lines · 855 B · C
RawDownload
#include <u.h>#include <libc.h>#include <authsrv.h>#include <bio.h>#include "authcmdlib.h" voidusage(void){	fprint(2, "usage: netkey\n");	exits("usage");} voidmain(int argc, char *argv[]){	char buf[32], key[DESKEYLEN], *pass;	char *s;	int n; 	ARGBEGIN{	default:		usage();	}ARGEND	if(argc)		usage(); 	s = getenv("service");	if(s != nil && strcmp(s, "cpu") == 0){		fprint(2, "netkey must not be run on the cpu server\n");		exits("boofhead");	}	private(); 	pass = readcons("Password", nil, 1);	if(pass == nil)		exits("no password");	passtodeskey(key, pass);	memset(pass, 0, strlen(pass));	free(pass); 	for(;;){		print("challenge: ");		n = read(0, buf, sizeof buf - 1);		if(n <= 0)			exits(0);		buf[n] = '\0';		n = strtol(buf, 0, 10);		sprint(buf, "%d", n);		netcrypt(key, buf);		print("response: %s\n", buf);	}}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t