[BusyBox-cvs] busybox/loginutils addgroup.c,1.9,1.10 adduser.c,1.4,1.5 deluser.c,1.2,1.3 getty.c,1.7,1.8 login.c,1.9,1.10 passwd.c,1.4,1.5 su.c,1.2,1.3 sulogin.c,1.1,1.2 vlock.c,1.2,1.3

Manuel Novoa III mjn3 at busybox.net
Wed Mar 19 09:13:45 UTC 2003


Update of /var/cvs/busybox/loginutils
In directory winder:/home/mjn3/work/busybox/loginutils

Modified Files:
	addgroup.c adduser.c deluser.c getty.c login.c passwd.c su.c 
	sulogin.c vlock.c 
Log Message:
Major coreutils update.


Index: addgroup.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/addgroup.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- addgroup.c	9 Jan 2003 18:53:53 -0000	1.9
+++ addgroup.c	19 Mar 2003 09:12:20 -0000	1.10
@@ -54,16 +54,16 @@
 	struct group *grp;
 	const int max = 65000;
 
-	etc_group = xfopen(filename, "r");
+	etc_group = bb_xfopen(filename, "r");
 
 	/* make sure gr_name isn't taken, make sure gid is kosher */
 	desired = g->gr_gid;
 	while ((grp = fgetgrent(etc_group))) {
 		if ((strcmp(grp->gr_name, g->gr_name)) == 0) {
-			error_msg_and_die("%s: group already in use\n", g->gr_name);
+			bb_error_msg_and_die("%s: group already in use\n", g->gr_name);
 		}
 		if ((desired) && grp->gr_gid == desired) {
-			error_msg_and_die("%d: gid has already been allocated\n",
+			bb_error_msg_and_die("%d: gid has already been allocated\n",
 							  desired);
 		}
 		if ((grp->gr_gid > g->gr_gid) && (grp->gr_gid < max)) {
@@ -89,7 +89,6 @@
 
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
 	FILE *etc_gshadow;
-	const char *gshadow = gshadow_file;
 #endif
 
 	struct group gr;
@@ -104,7 +103,7 @@
 		return 1;
 
 	/* add entry to group */
-	etc_group = xfopen(filename, "a");
+	etc_group = bb_xfopen(filename, "a");
 
 	fprintf(etc_group, entryfmt, group, default_passwd, gr.gr_gid, user);
 	fclose(etc_group);
@@ -112,8 +111,8 @@
 
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
 	/* add entry to gshadow if necessary */
-	if (access(gshadow, F_OK|W_OK) == 0) {
-		etc_gshadow = xfopen(gshadow, "a");
+	if (access(bb_path_gshadow_file, F_OK|W_OK) == 0) {
+		etc_gshadow = bb_xfopen(bb_path_gshadow_file, "a");
 		fprintf(etc_gshadow, "%s:!::\n", group);
 		fclose(etc_gshadow);
 	}
@@ -144,7 +143,7 @@
 				gid = strtol(optarg, NULL, 10);
 				break;
 			default:
-				show_usage();
+				bb_show_usage();
 				break;
 		}
 	}
@@ -153,7 +152,7 @@
 		group = argv[optind];
 		optind++;
 	} else {
-		show_usage();
+		bb_show_usage();
 	}
 	
 	if (optind < argc) {
@@ -164,12 +163,12 @@
 	}
 	
 	if (geteuid() != 0) {
-		error_msg_and_die
+		bb_error_msg_and_die
 			("Only root may add a group to the system.");
 	}
 
 	/* werk */
-	return addgroup(group_file, group, gid, user);
+	return addgroup(bb_path_group_file, group, gid, user);
 }
 
 /* $Id$ */

Index: adduser.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/adduser.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- adduser.c	16 Sep 2002 06:22:24 -0000	1.4
+++ adduser.c	19 Mar 2003 09:12:20 -0000	1.5
@@ -66,7 +66,7 @@
 	const int min = 500;
 	const int max = 65000;
 
-	passwd = wfopen(filename, "r");
+	passwd = bb_wfopen(filename, "r");
 	if (!passwd)
 		return 4;
 
@@ -112,7 +112,7 @@
 {
 	char *cmd;
 
-	bb_asprintf(&cmd, "addgroup -g %d %s", gid, login);
+	bb_xasprintf(&cmd, "addgroup -g %d %s", gid, login);
 	system(cmd);
 	free(cmd);
 }
@@ -123,7 +123,7 @@
 {
 	static const char prog[] = "passwd";
 	execlp(prog, prog, login, NULL);
-	error_msg_and_die("Failed to execute '%s', you must set the password for '%s' manually", prog, login);
+	bb_error_msg_and_die("Failed to execute '%s', you must set the password for '%s' manually", prog, login);
 }
 
 /* putpwent(3) remix */
@@ -137,7 +137,7 @@
 #endif
 
 	/* make sure everything is kosher and setup uid && gid */
-	passwd = wfopen(filename, "a");
+	passwd = bb_wfopen(filename, "a");
 	if (passwd == NULL) {
 		return 1;
 	}
@@ -147,13 +147,13 @@
 	r = passwd_study(filename, p);
 	if (r) {
 		if (r == 1)
-			error_msg("%s: login already in use", p->pw_name);
+			bb_error_msg("%s: login already in use", p->pw_name);
 		else if (r == 2)
-			error_msg("illegal uid or no uids left");
+			bb_error_msg("illegal uid or no uids left");
 		else if (r == 3)
-			error_msg("group name %s already in use", p->pw_name);
+			bb_error_msg("group name %s already in use", p->pw_name);
 		else
-			error_msg("generic error.");
+			bb_error_msg("generic error.");
 		return 1;
 	}
 
@@ -166,7 +166,7 @@
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
 	/* add to shadow if necessary */
 	if (shadow_enabled) {
-		shadow = wfopen(shadow_file, "a");
+		shadow = bb_wfopen(bb_path_shadow_file, "a");
 		if (shadow == NULL) {
 			return 1;
 		}
@@ -191,16 +191,16 @@
 
 	/* mkdir */
 	if (mkdir(p->pw_dir, 0755)) {
-		perror_msg("%s", p->pw_dir);
+		bb_perror_msg("%s", p->pw_dir);
 	}
 	/* Set the owner and group so it is owned by the new user. */
 	if (chown(p->pw_dir, p->pw_uid, p->pw_gid)) {
-		perror_msg("%s", p->pw_dir);
+		bb_perror_msg("%s", p->pw_dir);
 	}
 	/* Now fix up the permissions to 2755. Can't do it before now
 	 * since chown will clear the setgid bit */
 	if (chmod(p->pw_dir, 02755)) {
-		perror_msg("%s", p->pw_dir);
+		bb_perror_msg("%s", p->pw_dir);
 	}
 	/* interactively set passwd */
 	passwd_wrapper(p->pw_name);
@@ -234,7 +234,7 @@
 
 	/* init */
 	if (argc < 2) {
-		show_usage();
+		bb_show_usage();
 	}
 	gecos = default_gecos;
 	shell = default_shell;
@@ -252,18 +252,18 @@
 				shell = optarg;
 				break;
 			default:
-				show_usage ();
+				bb_show_usage();
 				break;
 		}
 
 	/* got root? */
 	if (i_am_not_root()) {
-		error_msg_and_die( "Only root may add a user or group to the system.");
+		bb_error_msg_and_die( "Only root may add a user or group to the system.");
 	}
 
 	/* get login */
 	if (optind >= argc) {
-		error_msg_and_die( "no user specified");
+		bb_error_msg_and_die( "no user specified");
 	}
 	login = argv[optind];
 
@@ -273,7 +273,7 @@
 	}
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
 	/* is /etc/shadow in use? */
-	shadow_enabled = (0 == access(shadow_file, F_OK));
+	shadow_enabled = (0 == access(bb_path_shadow_file, F_OK));
 #endif
 
 	/* create a passwd struct */
@@ -286,7 +286,7 @@
 	pw.pw_shell = (char *)shell;
 
 	/* grand finale */
-	return adduser(passwd_file, &pw);
+	return adduser(bb_path_passwd_file, &pw);
 }
 
 /* $Id$ */

Index: deluser.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/deluser.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- deluser.c	23 Jun 2002 04:24:24 -0000	1.2
+++ deluser.c	19 Mar 2003 09:12:20 -0000	1.3
@@ -116,19 +116,19 @@
 	int failure;
 
 	if (argc != 2) {
-		show_usage();
+		bb_show_usage();
 	} else {
 
-		failure = del_line_matching(argv[1], group_file);
+		failure = del_line_matching(argv[1], bb_path_group_file);
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
-		if (access(gshadow_file, W_OK) == 0) {
+		if (access(bb_path_gshadow_file, W_OK) == 0) {
 			/* EDR the |= works if the error is not 0, so he had it wrong */
-			failure |= del_line_matching(argv[1], gshadow_file);
+			failure |= del_line_matching(argv[1], bb_path_gshadow_file);
 		}
 #endif							/* CONFIG_FEATURE_SHADOWPASSWDS */
 		/* if (!successful) { */
 		if (failure) {
-			error_msg_and_die("%s: Group could not be removed\n", argv[1]);
+			bb_error_msg_and_die("%s: Group could not be removed\n", argv[1]);
 		}
 
 	}
@@ -142,34 +142,34 @@
 	int failure;
 
 	if (argc != 2) {
-		show_usage();
+		bb_show_usage();
 	} else {
 
-		failure = del_line_matching(argv[1], passwd_file);
+		failure = del_line_matching(argv[1], bb_path_passwd_file);
 		/* if (!successful) { */
 		if (failure) {
-			error_msg_and_die("%s: User could not be removed from %s\n",
-							  argv[1], passwd_file);
+			bb_error_msg_and_die("%s: User could not be removed from %s\n",
+							  argv[1], bb_path_passwd_file);
 		}
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
-		failure = del_line_matching(argv[1], shadow_file);
+		failure = del_line_matching(argv[1], bb_path_shadow_file);
 		/* if (!successful) { */
 		if (failure) {
-			error_msg_and_die("%s: User could not be removed from %s\n",
-							  argv[1], shadow_file);
+			bb_error_msg_and_die("%s: User could not be removed from %s\n",
+							  argv[1], bb_path_shadow_file);
 		}
-		failure = del_line_matching(argv[1], gshadow_file);
+		failure = del_line_matching(argv[1], bb_path_gshadow_file);
 		/* if (!successful) { */
 		if (failure) {
-			error_msg_and_die("%s: User could not be removed from %s\n",
-							  argv[1], gshadow_file);
+			bb_error_msg_and_die("%s: User could not be removed from %s\n",
+							  argv[1], bb_path_gshadow_file);
 		}
 #endif							/* CONFIG_FEATURE_SHADOWPASSWDS */
-		failure = del_line_matching(argv[1], group_file);
+		failure = del_line_matching(argv[1], bb_path_group_file);
 		/* if (!successful) { */
 		if (failure) {
-			error_msg_and_die("%s: User could not be removed from %s\n",
-							  argv[1], group_file);
+			bb_error_msg_and_die("%s: User could not be removed from %s\n",
+							  argv[1], bb_path_group_file);
 		}
 
 	}

Index: getty.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/getty.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- getty.c	8 Feb 2003 22:33:53 -0000	1.7
+++ getty.c	19 Mar 2003 09:12:20 -0000	1.8
@@ -169,6 +169,7 @@
 	0,							/* no capslock */
 };
 
+#if 0
 struct Speedtab {
 	long speed;
 	int code;
@@ -211,6 +212,7 @@
 #endif
 	{0, 0},
 };
+#endif
 
 static void parse_args(int argc, char **argv, struct options *op);
 static void parse_speeds(struct options *op, char *arg);
@@ -263,7 +265,7 @@
 	};
 
 #ifdef DEBUGGING
-	dbf = xfopen(DEBUGTERM, "w");
+	dbf = bb_xfopen(DEBUGTERM, "w");
 
 	{
 		int i;
@@ -383,7 +385,7 @@
 		switch (c) {
 		case 'I':
 			if (!(op->initstring = strdup(optarg)))
-				error(memory_exhausted);
+				error(bb_msg_memory_exhausted);
 				
 			{
 				const char *p;
@@ -396,7 +398,7 @@
 				while (*p) {
 					if (*p == '\\') {
 						p++;
-						*q++ = process_escape_sequence(&p);
+						*q++ = bb_process_escape_sequence(&p);
 					} else {
 						*q++ = *p++;
 					}
@@ -439,12 +441,12 @@
 			op->flags |= F_WAITCRLF;
 			break;
 		default:
-			show_usage();
+			bb_show_usage();
 		}
 	}
 	debug("after getopt loop\n");
 	if (argc < optind + 2)		/* check parameter count */
-		show_usage();
+		bb_show_usage();
 
 	/* we loosen up a bit and accept both "baudrate tty" and "tty baudrate" */
 	if ('0' <= argv[optind][0] && argv[optind][0] <= '9') {
@@ -953,6 +955,7 @@
 /* bcode - convert speed string to speed code; return 0 on failure */
 static int bcode(const char *s)
 {
+#if 0
 	struct Speedtab *sp;
 	long speed = atol(s);
 
@@ -960,6 +963,14 @@
 		if (sp->speed == speed)
 			return (sp->code);
 	return (0);
+#else
+	int r;
+
+	if ((r = bb_value_to_baud(atol(s))) > 0) {
+		return r;
+	}
+	return 0;
+#endif
 }
 
 /* error - report errors to console or syslog; only understands %s and %m */
@@ -982,7 +993,7 @@
 	buf[0] = '\0';
 	bp = buf;
 #else
-	strncpy(buf, applet_name, 256);
+	strncpy(buf, bb_applet_name, 256);
 	strncat(buf, ": ", 256);
 	buf[255] = 0;
 	bp = buf + strlen(buf);

Index: login.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/login.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- login.c	21 Jan 2003 20:55:55 -0000	1.9
+++ login.c	19 Mar 2003 09:12:20 -0000	1.10
@@ -94,10 +94,10 @@
 			 * (-f root, *NOT* -froot). --marekm
 			 */
 			if ( optarg != argv[optind-1] )
-				show_usage ( );
+				bb_show_usage( );
 
 			if ( !amroot ) 		/* Auth bypass only if real UID is zero */
-				error_msg_and_die ( "-f permission denied" );
+				bb_error_msg_and_die ( "-f permission denied" );
 			
 			safe_strncpy(username, optarg, USERNAME_SIZE);
 			opt_fflag = 1;
@@ -106,7 +106,7 @@
 			opt_host = optarg;
 			break;
 		default:
-			show_usage ( );
+			bb_show_usage( );
 		}
 	}
 
@@ -275,11 +275,11 @@
 
 static int check_nologin ( int amroot )
 {
-	if ( access ( nologin_file, F_OK ) == 0 ) {
+	if ( access ( bb_path_nologin_file, F_OK ) == 0 ) {
 		FILE *fp;
 		int c;
 
-		if (( fp = fopen ( nologin_file, "r" ))) {
+		if (( fp = fopen ( bb_path_nologin_file, "r" ))) {
 			while (( c = getc ( fp )) != EOF )
 				putchar (( c == '\n' ) ? '\r' : c );
 
@@ -304,9 +304,9 @@
 	int i;
 	char buf[BUFSIZ];
 
-	if (( fp = fopen ( securetty_file, "r" ))) {
+	if (( fp = fopen ( bb_path_securetty_file, "r" ))) {
 		while ( fgets ( buf, sizeof( buf ) - 1, fp )) {
-			for ( i = xstrlen( buf ) - 1; i >= 0; --i ) {
+			for ( i = bb_strlen( buf ) - 1; i >= 0; --i ) {
 				if ( !isspace ( buf[i] ))
 					break;
 			}
@@ -348,7 +348,7 @@
 	FILE *fp;
 	register int c;
 
-	if (( fp = fopen ( motd_file, "r" ))) {
+	if (( fp = fopen ( bb_path_motd_file, "r" ))) {
 		while (( c = getc ( fp )) != EOF ) 
 			putchar ( c );		
 		fclose ( fp );

Index: passwd.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/passwd.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- passwd.c	8 Feb 2003 23:20:02 -0000	1.4
+++ passwd.c	19 Mar 2003 09:12:20 -0000	1.5
@@ -46,13 +46,13 @@
 	struct stat sb;
 	struct flock lock;
 
-	if (access(shadow_file, F_OK) == 0) {
+	if (access(bb_path_shadow_file, F_OK) == 0) {
 		has_shadow = 1;
 	}
 	if (has_shadow) {
-		snprintf(filename, sizeof filename, "%s", shadow_file);
+		snprintf(filename, sizeof filename, "%s", bb_path_shadow_file);
 	} else {
-		snprintf(filename, sizeof filename, "%s", passwd_file);
+		snprintf(filename, sizeof filename, "%s", bb_path_passwd_file);
 	}
 
 	if (((fp = fopen(filename, "r+")) == 0) || (fstat(fileno(fp), &sb))) {
@@ -167,30 +167,30 @@
 			uflg++;
 			break;
 		default:
-			show_usage();
+			bb_show_usage();
 		}
 	}
 	ruid = getuid();
 	pw = (struct passwd *) getpwuid(ruid);
 	if (!pw) {
-               error_msg_and_die("Cannot determine your user name.");
+               bb_error_msg_and_die("Cannot determine your user name.");
 	}
-	myname = (char *) xstrdup(pw->pw_name);
+	myname = (char *) bb_xstrdup(pw->pw_name);
 	if (optind < argc) {
 		name = argv[optind];
 	} else {
 		name = myname;
 	}
 	if ((lflg || uflg || dflg) && (optind >= argc || !amroot)) {
-		show_usage();
+		bb_show_usage();
 	}
 	pw = getpwnam(name);
 	if (!pw) {
-		error_msg_and_die("Unknown user %s\n", name);
+		bb_error_msg_and_die("Unknown user %s\n", name);
 	}
 	if (!amroot && pw->pw_uid != getuid()) {
 		syslog(LOG_WARNING, "can't change pwd for `%s'", name);
-		error_msg_and_die("Permission denied.\n");
+		bb_error_msg_and_die("Permission denied.\n");
 	}
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
 	sp = getspnam(name);
@@ -209,12 +209,12 @@
 		if (!amroot) {
 			if (cp[0] == '!') {
 				syslog(LOG_WARNING, "password locked for `%s'", np);
-				error_msg_and_die( "The password for `%s' cannot be changed.\n", np);
+				bb_error_msg_and_die( "The password for `%s' cannot be changed.\n", np);
 			}
 		}
 		printf("Changing password for %s\n", name);
 		if (new_password(pw, amroot, algo)) {
-			error_msg_and_die( "The password for %s is unchanged.\n", name);
+			bb_error_msg_and_die( "The password for %s is unchanged.\n", name);
 		}
 	} else if (lflg) {
 		if (crypt_passwd[0] != '!') {
@@ -238,7 +238,7 @@
 	umask(077);
 	if (setuid(0)) {
 		syslog(LOG_ERR, "can't setuid(0)");
-		error_msg_and_die( "Cannot change ID to root.\n");
+		bb_error_msg_and_die( "Cannot change ID to root.\n");
 	}
 	if (!update_passwd(pw, crypt_passwd)) {
 		syslog(LOG_INFO, "password for `%s' changed by user `%s'", name,
@@ -246,7 +246,7 @@
 		printf("Password changed.\n");
 	} else {
 		syslog(LOG_WARNING, "an error occurred updating the password file");
-		error_msg_and_die("An error occurred updating the password file.\n");
+		bb_error_msg_and_die("An error occurred updating the password file.\n");
 	}
 	return (0);
 }

Index: su.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/su.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- su.c	23 Jun 2002 04:24:24 -0000	1.2
+++ su.c	19 Mar 2003 09:12:20 -0000	1.3
@@ -94,7 +94,7 @@
 			opt_loginshell = 1;
 			break;
 		default:
-			show_usage ( );
+			bb_show_usage( );
 			break;
 		}
 	}
@@ -114,7 +114,7 @@
 		
 	pw = getpwnam ( opt_username );
 	if ( !pw )
-		error_msg_and_die ( "user %s does not exist", opt_username );
+		bb_error_msg_and_die ( "user %s does not exist", opt_username );
 		
 	/* Make sure pw->pw_shell is non-NULL.  It may be NULL when NEW_USER
 	   is a username that is retrieved via NIS (YP), but that doesn't have
@@ -127,15 +127,15 @@
 	   the static data through the getlogin call from log_su.  */
 	pw_copy = *pw;
 	pw = &pw_copy;
-	pw-> pw_name  = xstrdup ( pw-> pw_name );
-	pw-> pw_dir   = xstrdup ( pw-> pw_dir );
-	pw-> pw_shell = xstrdup ( pw-> pw_shell );
+	pw-> pw_name  = bb_xstrdup ( pw-> pw_name );
+	pw-> pw_dir   = bb_xstrdup ( pw-> pw_dir );
+	pw-> pw_shell = bb_xstrdup ( pw-> pw_shell );
 
 	if (( getuid ( ) == 0 ) || correct_password ( pw )) 
 		log_su ( pw, 1 );
 	else {
 		log_su ( pw, 0 );
-		error_msg_and_die ( "incorrect password" );
+		bb_error_msg_and_die ( "incorrect password" );
 	}
 
 	if ( !opt_shell && opt_preserve )
@@ -152,7 +152,7 @@
 	}
 
 	if ( !opt_shell )
-		opt_shell = xstrdup ( pw-> pw_shell );
+		opt_shell = bb_xstrdup ( pw-> pw_shell );
 
 	change_identity ( pw );	
 	setup_environment ( opt_shell, opt_loginshell, !opt_preserve, pw );

Index: sulogin.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/sulogin.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- sulogin.c	23 Jun 2002 04:24:24 -0000	1.1
+++ sulogin.c	19 Mar 2003 09:12:20 -0000	1.2
@@ -117,9 +117,9 @@
 			}
 		}
 	}
-	if (access(passwd_file, 0) == -1) {
+	if (access(bb_path_passwd_file, 0) == -1) {
 		syslog(LOG_WARNING, "No password file\n");
-		error_msg_and_die("No password file\n");
+		bb_error_msg_and_die("No password file\n");
 	}
 	if (!isatty(0) || !isatty(1) || !isatty(2)) {
 		exit(EXIT_FAILURE);
@@ -135,7 +135,7 @@
 	alarm(timeout);
 	if (!(pwd = getpwnam(name))) {
 		syslog(LOG_WARNING, "No password entry for `root'\n");
-		error_msg_and_die("No password entry for `root'\n");
+		bb_error_msg_and_die("No password entry for `root'\n");
 	}
 	pwent = *pwd;
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS

Index: vlock.c
===================================================================
RCS file: /var/cvs/busybox/loginutils/vlock.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- vlock.c	3 Jul 2002 09:13:21 -0000	1.2
+++ vlock.c	19 Mar 2003 09:12:20 -0000	1.3
@@ -29,6 +29,7 @@
  * It now works with md5, sha1, etc passwords. */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/vt.h>
 #include <signal.h>
 #include <string.h>
@@ -96,26 +97,26 @@
 	struct termios term;
 
 	if (argc > 2) {
-		show_usage();
+		bb_show_usage();
 	}
 
 	if (argc == 2) {
 		if (strncmp(argv[1], "-a", 2)) {
-			show_usage();
+			bb_show_usage();
 		} else {
 			o_lock_all = 1;
 		}
 	}
 
 	if ((pw = getpwuid(getuid())) == NULL) {
-		error_msg_and_die("no password for uid %d\n", getuid());
+		bb_error_msg_and_die("no password for uid %d\n", getuid());
 	}
 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
 	if ((strcmp(pw->pw_passwd, "x") == 0)
 		|| (strcmp(pw->pw_passwd, "*") == 0)) {
 
 		if ((spw = getspuid(getuid())) == NULL) {
-			error_msg_and_die("could not read shadow password for uid %d: %s\n",
+			bb_error_msg_and_die("could not read shadow password for uid %d: %s\n",
 					   getuid(), strerror(errno));
 		}
 		if (spw->sp_pwdp) {
@@ -124,7 +125,7 @@
 	}
 #endif							/* CONFIG_FEATURE_SHADOWPASSWDS */
 	if (pw->pw_passwd[0] == '!' || pw->pw_passwd[0] == '*') {
-		error_msg_and_die("Account disabled for uid %d\n", getuid());
+		bb_error_msg_and_die("Account disabled for uid %d\n", getuid());
 	}
 
 	/* we no longer need root privs */
@@ -132,11 +133,11 @@
 	setgid(getgid());
 
 	if ((vfd = open("/dev/tty", O_RDWR)) < 0) {
-		error_msg_and_die("/dev/tty");
+		bb_error_msg_and_die("/dev/tty");
 	};
 
 	if (ioctl(vfd, VT_GETMODE, &vtm) < 0) {
-		error_msg_and_die("/dev/tty");
+		bb_error_msg_and_die("/dev/tty");
 	};
 
 	/* mask a bunch of signals */




More information about the busybox-cvs mailing list