亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? login.c

?? minix軟件源代碼
?? C
字號:
/* login - log into the system			Author: Patrick van Kleef *//* Original version by Patrick van Kleef.  History of modifications: * * Peter S. Housel   Jan. 1988 *  - Set up $USER, $HOME and $TERM. *  - Set signals to SIG_DFL. * * Terrence W. Holm   June 1988 *  - Allow a username as an optional argument. *  - Time out if a password is not typed within 60 seconds. *  - Perform a dummy delay after a bad username is entered. *  - Don't allow a login if "/etc/nologin" exists. *  - Cause a failure on bad "pw_shell" fields. *  - Record the login in "/usr/adm/wtmp". * * Peter S. Housel   Dec. 1988 *  - Record the login in "/etc/utmp" also. * * F. van Kempen     June 1989 *  - various patches for Minix V1.4a. * * F. van Kempen     September 1989 *  - added login-failure administration (new utmp.h needed!). *  - support arguments in pw_shell field *  - adapted source text to MINIX Style Sheet * * F. van Kempen     October 1989 *  - adapted to new utmp database. * F. van Kempen,    December 1989 *  - fixed 'slot' assumption in wtmp() *  - fixed all MSS-stuff *  - adapted to POSIX (MINIX 1.5) * F. van Kempen,    January 1990 *  - made all 'bad login accounting' optional by "#ifdef BADLOG". * F. van Kempen,    Februari 1990 *  - fixed 'first argument' bug and added some casts. * * Andy Tanenbaum April 1990 * - if /bin/sh cannot be located, try /usr/bin/sh * * Michael A. Temari	October 1990 *  - handle more than single digit tty devices * * Philip Homburg - Feb 28 1992 *  - use ttyname to get the name of a tty. * * Kees J. Bot - Feb 13 1993 *  - putting out garbage. *  - added lastlog. * * Kees J. Bot - Feb 13 1993 *  - supplementary groups. * * Kees J. Bot - Jan 3 1996 *  - ported back to standard Minix. */#include <sys/types.h>#include <sys/stat.h>#include <ttyent.h>#include <errno.h>#include <fcntl.h>#include <pwd.h>#include <grp.h>#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <utmp.h>#include <time.h>#include <minix/minlib.h>char PATH_UTMP[] = "/etc/utmp";			/* current logins */char PATH_WTMP[] = "/usr/adm/wtmp";		/* login/logout history */char PATH_LASTLOG[] = "/usr/adm/lastlog";	/* last login history */char PATH_MOTD[] = "/etc/motd";			/* message of the day */#define TTY_GID		4			/* group ID of ttys */#define EXTRA_ENV	6/* Crude indication of a tty being physically secure: */#define securetty(dev)		((unsigned) ((dev) - 0x0400) < (unsigned) 8)int time_out;char *hostname;char user[32];char logname[35];char home[128];char shell[128];char term[128];char **env;extern char **environ;_PROTOTYPE(int main, (int argc, char **argv));_PROTOTYPE(void wtmp, (char *user, int uid));_PROTOTYPE(void show_file, (char *nam));_PROTOTYPE(void Time_out, (int dummy));_PROTOTYPE(void usage, (void));_PROTOTYPE(void add2env, (char **env, char *entry, int replace));void wtmp(user, uid)char *user;			/* user name */int uid;			/* user id */{  /* Make entries in /usr/adm/wtmp and /etc/utmp. */  struct utmp entry;  register int fd= -1;  int lineno;  int err = 0;  char *what;  /* First, read the current UTMP entry. we need some of its   * parameters! (like PID, ID etc...).   */  what= "ttyslot()";  lineno= ttyslot();  if (lineno == 0) err= errno;	/* ttyslot failed */  if (err == 0 && (fd = open(what = PATH_UTMP, O_RDONLY)) < 0) {  	if (errno == ENOENT) return;  	err= errno;  }  if (err == 0 && lseek(fd, (off_t) lineno * sizeof(entry), SEEK_SET) < 0)  	err= errno;  if (err == 0 && read(fd, (char *) &entry, sizeof(entry)) != sizeof(entry))  	err= errno;  if (fd >= 0) close(fd);  /* Enter new fields. */  strncpy(entry.ut_user, user, sizeof(entry.ut_user));  if (hostname) strncpy(entry.ut_host, hostname, sizeof(entry.ut_host));  if (entry.ut_pid == 0) entry.ut_pid = getpid();  entry.ut_type = USER_PROCESS;		/* we are past login... */  time(&entry.ut_time);  /* Write a WTMP record. */  if (err == 0) {  	if ((fd = open(what = PATH_WTMP, O_WRONLY|O_APPEND)) < 0) {  		if (errno != ENOENT) err= errno;	} else {		if (write(fd, (char *) &entry, sizeof(entry)) < 0) err= errno;		close(fd);	}  }  /* Rewrite the UTMP entry. */  if (err == 0 && (fd = open(what = PATH_UTMP, O_WRONLY)) < 0)	err= errno;  if (err == 0 && lseek(fd, (off_t) lineno * sizeof(entry), SEEK_SET) < 0)	err= errno;  if (err == 0 && write(fd, (char *) &entry, sizeof(entry)) < 0)	err= errno;  if (fd >= 0) close(fd);  /* Write the LASTLOG entry. */  if (err == 0 && (fd = open(what = PATH_LASTLOG, O_WRONLY)) < 0) {	if (errno == ENOENT) return;	err= errno;  }  if (err == 0 && lseek(fd, (off_t) uid * sizeof(entry), SEEK_SET) < 0)	err= errno;  if (err == 0 && write(fd, (char *) &entry, sizeof(entry)) < 0)	err= errno;  if (fd >= 0) close(fd);  if (err != 0) {  	fprintf(stderr, "login: %s: %s\n", what, strerror(err));  	return;  }}void show_file(nam)char *nam;{/* Read a textfile and show it on the desired terminal. */  register int fd, len;  char buf[80];  if ((fd = open(nam, O_RDONLY)) > 0) {	len = 1;	while (len > 0) {		len = read(fd, buf, 80);		write(1, buf, len);	}	close(fd);  }}int main(argc, argv)int argc;char *argv[];{  char name[30];  char *password, *cryptedpwd;  char *tty_name;  int n, ap, check_pw, bad, secure, i, envsiz;  struct passwd *pwd;  char *bp, *argx[8], **ep;	/* pw_shell arguments */  char argx0[64];		/* argv[0] of the shell */  char *sh = "/bin/sh";		/* sh/pw_shell field value */  char *initialname;  int c, f_flag, p_flag;  char *h_arg;  int authorized, preserv_env;  struct ttyent *ttyp;  struct stat ttystat;  struct sigaction sa;  /* Don't let QUIT dump core. */  sigemptyset(&sa.sa_mask);  sa.sa_flags = 0;  sa.sa_handler = exit;  sigaction(SIGQUIT, &sa, NULL);  /* Parse options.  */  f_flag= 0;  p_flag= 0;  h_arg= NULL;  while ((c= getopt(argc, argv, "?fh:p")) != -1)  {	switch(c)	{	case 'f':		if (f_flag)			usage();		f_flag= 1;		break;	case 'h':		if (h_arg)			usage();		if (getuid() == 0)			h_arg= optarg;		break;	case 'p':		if (p_flag)			usage();		p_flag= 1;		break;	case '?':		usage();	default:		fprintf(stderr, "login: getopt failed: '%c'\n", c);		exit(1);	}  }  if (optind < argc)	initialname= argv[optind++];  else	initialname= NULL;  if (optind != argc)	usage();  authorized= f_flag;  hostname= h_arg;  preserv_env= p_flag;  /* Look up /dev/tty number. */  tty_name= ttyname(0);  if (tty_name == NULL)  {	write(1, "Unable to lookup tty name\n", 26);	exit(1);  }  /* Get login name and passwd. */  for (;;initialname= NULL) {	if (initialname)		strcpy(name, initialname);	else {		do {			write(1, "login: ", 7);			n = read(0, name, 30);			if (n == 0) exit(1);			if (n < 0)			{				if (errno != EINTR)					fprintf(stderr,						"login: read failed: %s\n",							strerror(errno));				exit(1);			}		} while (n < 2);		name[n - 1] = 0;	}	/* Start timer running. */	time_out = 0;	sa.sa_handler = Time_out;	sigaction(SIGALRM, &sa, NULL);	alarm(60);	/* Look up login/passwd. */	pwd = getpwnam(name);	check_pw = 1;			/* default is check password. */	/* For now, only console is secure. */	secure = fstat(0, &ttystat) == 0 && securetty(ttystat.st_rdev);	if (pwd && authorized && initialname			&& (pwd->pw_uid == getuid() || getuid() == 0)) {		check_pw= 0;		/* Don't ask a password for					 * pre-authorized users.					 */	} else	if (pwd && secure && strcmp(crypt("", pwd->pw_passwd),						pwd->pw_passwd) == 0) {		check_pw= 0;		/* empty password */	}	if (check_pw) {		password = getpass("Password:");		if (time_out) exit(1);		bad = 0;		if (!pwd) bad = 1;		if (!password) { password = ""; bad = 1; }		if (!secure && pwd && strcmp(crypt("", pwd->pw_passwd),					pwd->pw_passwd) == 0) bad = 1;		cryptedpwd = bad ? "*" : pwd->pw_passwd;		if (strcmp(crypt(password, cryptedpwd), cryptedpwd) != 0) {			write(1, "Login incorrect\n", 16);			continue;		}	}	/* Check if the system is going down  */	if (access("/etc/nologin", 0) == 0 && strcmp(name, "root") != 0) {		write(1, "System going down\n\n", 19);		continue;	}	/* Stop timer. */	alarm(0);	/* Write login record to /usr/adm/wtmp and /etc/utmp */	wtmp(name, pwd->pw_uid);	/* Create the argv[] array from the pw_shell field. */	ap = 0;	argx[ap++] = argx0;	/* "-sh" most likely */	if (pwd->pw_shell[0]) {		sh = pwd->pw_shell;		bp = sh;		while (*bp) {			while (*bp && *bp != ' ' && *bp != '\t') bp++;			if (*bp == ' ' || *bp == '\t') {				*bp++ = '\0';	/* mark end of string */				argx[ap++] = bp;			}		}	} else	argx[ap] = NULL;	strcpy(argx0, "-");	/* most shells need it for their .profile */	if ((bp= strrchr(sh, '/')) == NULL) bp = sh; else bp++;	strncat(argx0, bp, sizeof(argx0) - 2);	/* Set the environment */	if (p_flag)	{		for (ep= environ; *ep; ep++)			;	}	else		ep= environ;	envsiz= ep-environ;	env= calloc(envsiz + EXTRA_ENV, sizeof(*env));	if (env == NULL)	{		fprintf(stderr, "login: out of memory\n");		exit(1);	}	for (i= 0; i<envsiz; i++)		env[i]= environ[i];	strcpy(user, "USER=");	strcat(user, name);	add2env(env, user, 1);	strcpy(logname, "LOGNAME=");	strcat(logname, name);	add2env(env, logname, 1);	strcpy(home, "HOME=");	strcat(home, pwd->pw_dir);	add2env(env, home, 1);	strcpy(shell, "SHELL=");	strcat(shell, sh);	add2env(env, shell, 1);	if ((ttyp = getttynam(tty_name + 5)) != NULL) {		strcpy(term, "TERM=");		strcat(term, ttyp->ty_type);		add2env(env, term, 0);	}	/* Show the message-of-the-day. */	show_file(PATH_MOTD);	/* Assign the terminal to this user. */	chown(tty_name, pwd->pw_uid, TTY_GID);	chmod(tty_name, 0620);	/* Change id. */#if __minix_vmd	initgroups(pwd->pw_name, pwd->pw_gid);#endif	setgid(pwd->pw_gid);	setuid(pwd->pw_uid);	/* cd $HOME */	chdir(pwd->pw_dir);	/* Reset signals to default values. */	sa.sa_handler = SIG_DFL;	for (n = 1; n <= _NSIG; ++n) sigaction(n, &sa, NULL);	/* Execute the user's shell. */	execve(sh, argx, env);	if (pwd->pw_gid == 0) {		/* Privileged user gets /bin/sh in times of crisis. */		sh= "/bin/sh";		argx[0]= "-sh";		strcpy(shell, "SHELL=");		strcat(shell, sh);		execve(sh, argx, env);	}	write(1, "exec failure\n", 13);	exit(1);  }  return(0);}void Time_out(dummy)int dummy; /* to keep the compiler happy */{   write(2, "\r\nLogin timed out after 60 seconds\r\n", 36);   time_out = 1;}void usage(){	fprintf(stderr, "Usage: login [-h hostname] [-f] [-p] [username]\n");	exit(1);}void add2env(env, entry, replace)char **env;char *entry;int replace;{/* Replace an environment variable with entry or add entry if the environment * variable doesn't exit yet.  */	char *cp;	int keylen;	cp= strchr(entry, '=');	keylen= cp-entry+1;	for(; *env; env++)	{		if (strncmp(*env, entry, keylen) == 0) {			if (!replace) return;		/* Don't replace */			break;		}	}	*env= entry;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩专区一卡二卡| 欧美肥妇free| 欧美午夜在线观看| 精品国产一区二区三区av性色| 国产精品欧美一级免费| 美女一区二区三区在线观看| 91欧美一区二区| 久久精品亚洲一区二区三区浴池 | 亚洲在线视频免费观看| 国产一区二区三区日韩 | 日韩成人午夜精品| 91国产成人在线| 日本一区二区三区久久久久久久久不| 五月天欧美精品| 91豆麻精品91久久久久久| 精品91自产拍在线观看一区| 亚洲va欧美va国产va天堂影院| 成人精品在线视频观看| 精品国产乱码久久久久久蜜臀| 亚洲电影中文字幕在线观看| 99精品久久免费看蜜臀剧情介绍| 久久久精品蜜桃| 国产一区二区三区国产| 欧美一卡二卡在线| 日本亚洲天堂网| 欧美性xxxxxxxx| 一区二区在线电影| 91精彩视频在线| 亚洲综合免费观看高清在线观看| 播五月开心婷婷综合| 久久色成人在线| 国产一区欧美日韩| 久久亚洲精品小早川怜子| 狠狠色综合日日| 精品国产自在久精品国产| 另类欧美日韩国产在线| 日韩免费成人网| 国产一区视频导航| 国产精品久久久久影院亚瑟 | 国产盗摄一区二区| 久久久91精品国产一区二区精品| 美国av一区二区| 久久久亚洲精华液精华液精华液| 国产在线精品一区二区不卡了| 亚洲精品在线一区二区| 国产精品123| 亚洲丝袜美腿综合| 欧美色精品在线视频| 日韩精品视频网站| 日韩精品一区二区三区在线观看 | 久久久99精品久久| 成人听书哪个软件好| 日韩一区在线看| 欧美日韩在线精品一区二区三区激情| 午夜精品久久久久久久久| 欧美一二三四在线| 成人国产亚洲欧美成人综合网| 亚洲免费av网站| 91精品在线免费观看| 经典三级在线一区| 亚洲欧美在线观看| 欧美一级淫片007| 东方欧美亚洲色图在线| 亚洲精品国产第一综合99久久 | 免费在线观看不卡| 自拍偷在线精品自拍偷无码专区| 欧美三级韩国三级日本三斤| 青草av.久久免费一区| 国产精品婷婷午夜在线观看| 91最新地址在线播放| 日韩国产在线一| 欧美激情一区二区三区蜜桃视频| 91九色02白丝porn| 国产精品1区2区| 日韩在线一区二区| 中文字幕一区二区三区精华液 | 国产一区二区美女诱惑| 亚洲精品久久嫩草网站秘色| 69堂国产成人免费视频| 99久久伊人久久99| 麻豆91在线看| 亚洲成人久久影院| 国产精品成人一区二区艾草 | 欧美一区二区三区公司| 99久久久国产精品免费蜜臀| 美洲天堂一区二卡三卡四卡视频| 最新日韩在线视频| 久久久久久久综合日本| 欧美精品免费视频| 在线观看欧美精品| 成人av电影免费观看| 国产一区二区在线观看视频| 亚洲国产成人精品视频| 18成人在线视频| 国产丝袜欧美中文另类| 欧美不卡一二三| 在线播放日韩导航| 在线观看av一区二区| 成人毛片在线观看| 国产激情一区二区三区| 美女久久久精品| 日韩—二三区免费观看av| 亚洲精品视频自拍| 亚洲欧美一区二区久久| 中文幕一区二区三区久久蜜桃| 欧美xxxxx裸体时装秀| 91精品国产乱码久久蜜臀| 欧美色偷偷大香| 欧美性大战久久久久久久| 色噜噜狠狠色综合中国| 91色乱码一区二区三区| 不卡一区中文字幕| k8久久久一区二区三区| 成人免费黄色大片| 99麻豆久久久国产精品免费| 国产精品66部| 成人中文字幕电影| 99久久精品费精品国产一区二区| www.日本不卡| 91麻豆福利精品推荐| 91色porny| 欧美日韩在线播放三区| 欧美日韩视频在线一区二区| 欧美日韩三级一区二区| 欧美片在线播放| 日韩欧美国产系列| 久久先锋资源网| 中文字幕免费一区| 一区二区三区欧美视频| 亚洲成人1区2区| 美腿丝袜一区二区三区| 国产精品亚洲人在线观看| 麻豆91在线播放免费| 国产精品白丝jk黑袜喷水| 国产精品99久久久久久宅男| 成人国产在线观看| 欧美日韩小视频| 精品国产免费视频| 中文字幕中文在线不卡住| 一区二区在线看| 久久99精品国产麻豆婷婷洗澡| 玖玖九九国产精品| 成人不卡免费av| 欧美高清视频在线高清观看mv色露露十八| 91麻豆精品国产91久久久资源速度| 日韩一区二区三| 国产精品久久久久久久久动漫 | 亚洲人成网站色在线观看 | 亚洲天堂免费在线观看视频| 亚洲韩国一区二区三区| 国产一区二区伦理片| 色噜噜狠狠色综合中国| 欧美电影免费提供在线观看| 国产偷v国产偷v亚洲高清| 樱花影视一区二区| 狠狠色综合色综合网络| 在线影视一区二区三区| 日韩一级黄色片| 亚洲精品国产a久久久久久| 日本亚洲三级在线| 日本电影亚洲天堂一区| 欧美精品一区二区三区很污很色的| 国产精品伦理一区二区| 日韩高清欧美激情| 91亚洲男人天堂| 久久综合久久综合久久| 亚洲国产sm捆绑调教视频| 国产激情偷乱视频一区二区三区 | 午夜国产精品影院在线观看| 成人精品亚洲人成在线| 欧美zozo另类异族| 婷婷久久综合九色国产成人| 成人高清在线视频| 精品国产乱码久久久久久牛牛| 亚洲午夜免费电影| 色婷婷综合激情| 中文子幕无线码一区tr| 麻豆成人免费电影| 7777精品伊人久久久大香线蕉 | 午夜精品一区在线观看| 99视频一区二区| 国产午夜精品一区二区 | 久久精品视频在线看| 免费观看日韩av| 欧美日韩精品一区二区在线播放| 中文字幕一区三区| 97超碰欧美中文字幕| 26uuu成人网一区二区三区| 亚洲成人精品一区二区| 91福利精品视频| 亚洲美女一区二区三区| 色综合久久久久久久久| 国产精品久久久久久久岛一牛影视| 国产精品资源站在线| 久久久久国产精品麻豆ai换脸 | 日韩激情一区二区| 欧美日韩高清一区二区不卡| 亚洲精品成人在线| 欧美丝袜丝交足nylons图片| 亚洲欧美成人一区二区三区|