⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userpasswd.c

📁 著名操作系统Plan 9的第三版的部分核心源代码。现在很难找到了。Plan 9是bell实验室开发的Unix后继者。
💻 C
字号:
#include <u.h>#include <libc.h>#include <auth.h>#include <../boot/boot.h>char	password[NAMELEN];#ifdef asdfextern	char *sauth;#endif asdfchar *homsg = "can't set user name or key; please reboot";/* *  get/set user name and password.  verify password with auth server. */voiduserpasswd(int islocal, Method *mp){	int fd;	char *msg;	char hostkey[DESKEYLEN];	if(*username == 0 || strcmp(username, "none") == 0){		strcpy(username, "none");		outin("user", username, sizeof(username));	}	fd = -1;	while(strcmp(username, "none") != 0){		getpasswd(password, sizeof password);		passtokey(hostkey, password);		fd = -1;		if(islocal)			break;		msg = checkkey(mp, username, hostkey);		if(msg == 0)			break;		fprint(2, "?%s\n", msg);		outin("user", username, sizeof(username));	}	if(fd > 0)		close(fd);	/* set host's key */	if(writefile("#c/key", hostkey, DESKEYLEN) < 0)		fatal(homsg);	/* set host's owner (and uid of current process) */	if(writefile("#c/hostowner", username, strlen(username)) < 0)		fatal(homsg);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -