aboutsummaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-03-15 08:29:22 +0000
committerEric Andersen <andersen@codepoet.org>2004-03-15 08:29:22 +0000
commitc7bda1ce659294d6e22c06e087f6f265983c7578 (patch)
tree4c6d2217f4d8306c59cf1096f8664e1cfd167213 /loginutils
parent8854004b41065b3d081af7f3df13a100b0c8bfbe (diff)
downloadbusybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.gz
busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.bz2
busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.zip
Remove trailing whitespace. Update copyright to include 2004.
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/Makefile2
-rw-r--r--loginutils/Makefile.in2
-rw-r--r--loginutils/addgroup.c4
-rw-r--r--loginutils/adduser.c4
-rw-r--r--loginutils/getty.c14
-rw-r--r--loginutils/login.c48
-rw-r--r--loginutils/su.c12
7 files changed, 43 insertions, 43 deletions
diff --git a/loginutils/Makefile b/loginutils/Makefile
index 3359d5638..a013d141f 100644
--- a/loginutils/Makefile
+++ b/loginutils/Makefile
@@ -1,6 +1,6 @@
1# Makefile for busybox 1# Makefile for busybox
2# 2#
3# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# This program is free software; you can redistribute it and/or modify 5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by 6# it under the terms of the GNU General Public License as published by
diff --git a/loginutils/Makefile.in b/loginutils/Makefile.in
index 160051094..87c0a5c4e 100644
--- a/loginutils/Makefile.in
+++ b/loginutils/Makefile.in
@@ -1,6 +1,6 @@
1# Makefile for busybox 1# Makefile for busybox
2# 2#
3# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# This program is free software; you can redistribute it and/or modify 5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by 6# it under the terms of the GNU General Public License as published by
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index af1cd7a83..cfbd71624 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -136,7 +136,7 @@ extern void if_i_am_not_root(void);
136/* 136/*
137 * addgroup will take a login_name as its first parameter. 137 * addgroup will take a login_name as its first parameter.
138 * 138 *
139 * gid 139 * gid
140 * 140 *
141 * can be customized via command-line parameters. 141 * can be customized via command-line parameters.
142 * ________________________________________________________________________ */ 142 * ________________________________________________________________________ */
@@ -157,7 +157,7 @@ int addgroup_main(int argc, char **argv)
157 } else { 157 } else {
158 bb_show_usage(); 158 bb_show_usage();
159 } 159 }
160 160
161 if (optind < argc) { 161 if (optind < argc) {
162 user = argv[optind]; 162 user = argv[optind];
163 optind++; 163 optind++;
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index c4ab557d0..3e10fd398 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -77,7 +77,7 @@ static int passwd_study(const char *filename, struct passwd *p)
77 if ((p->pw_uid > max) || (p->pw_uid < min)) 77 if ((p->pw_uid > max) || (p->pw_uid < min))
78 p->pw_uid = min; 78 p->pw_uid = min;
79 79
80 /* stuff to do: 80 /* stuff to do:
81 * make sure login isn't taken; 81 * make sure login isn't taken;
82 * find free uid and gid; 82 * find free uid and gid;
83 */ 83 */
@@ -246,7 +246,7 @@ void if_i_am_not_root(void)
246 * 246 *
247 * home 247 * home
248 * shell 248 * shell
249 * gecos 249 * gecos
250 * 250 *
251 * can be customized via command-line parameters. 251 * can be customized via command-line parameters.
252 * ________________________________________________________________________ */ 252 * ________________________________________________________________________ */
diff --git a/loginutils/getty.c b/loginutils/getty.c
index b12b88fb1..0e475e4c0 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -5,13 +5,13 @@
5 be here. Now read the real man-page agetty.8 instead. 5 be here. Now read the real man-page agetty.8 instead.
6 6
7 -f option added by Eric Rasmussen <ear@usfirst.org> - 12/28/95 7 -f option added by Eric Rasmussen <ear@usfirst.org> - 12/28/95
8 8
9 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org> 9 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
10 - added Native Language Support 10 - added Native Language Support
11 11
12 1999-05-05 Thorsten Kranzkowski <dl8bcu@gmx.net> 12 1999-05-05 Thorsten Kranzkowski <dl8bcu@gmx.net>
13 - enable hardware flow control before displaying /etc/issue 13 - enable hardware flow control before displaying /etc/issue
14 14
15*/ 15*/
16 16
17#include <stdio.h> 17#include <stdio.h>
@@ -54,11 +54,11 @@ extern void updwtmp(const char *filename, const struct utmp *ut);
54 54
55 /* 55 /*
56 * Things you may want to modify. 56 * Things you may want to modify.
57 * 57 *
58 * If ISSUE is not defined, agetty will never display the contents of the 58 * If ISSUE is not defined, agetty will never display the contents of the
59 * /etc/issue file. You will not want to spit out large "issue" files at the 59 * /etc/issue file. You will not want to spit out large "issue" files at the
60 * wrong baud rate. Relevant for System V only. 60 * wrong baud rate. Relevant for System V only.
61 * 61 *
62 * You may disagree with the default line-editing etc. characters defined 62 * You may disagree with the default line-editing etc. characters defined
63 * below. Note, however, that DEL cannot be used for interrupt generation 63 * below. Note, however, that DEL cannot be used for interrupt generation
64 * and for line editing at the same time. 64 * and for line editing at the same time.
@@ -386,7 +386,7 @@ static void parse_args(int argc, char **argv, struct options *op)
386 case 'I': 386 case 'I':
387 if (!(op->initstring = strdup(optarg))) 387 if (!(op->initstring = strdup(optarg)))
388 error(bb_msg_memory_exhausted); 388 error(bb_msg_memory_exhausted);
389 389
390 { 390 {
391 const char *p; 391 const char *p;
392 char *q; 392 char *q;
@@ -700,9 +700,9 @@ static void auto_baud(struct termio *tp)
700 * the DCD line, and if the computer is fast enough to set the proper 700 * the DCD line, and if the computer is fast enough to set the proper
701 * baud rate before the message has gone by. We expect a message of the 701 * baud rate before the message has gone by. We expect a message of the
702 * following format: 702 * following format:
703 * 703 *
704 * <junk><number><junk> 704 * <junk><number><junk>
705 * 705 *
706 * The number is interpreted as the baud rate of the incoming call. If the 706 * The number is interpreted as the baud rate of the incoming call. If the
707 * modem does not tell us the baud rate within one second, we will keep 707 * modem does not tell us the baud rate within one second, we will keep
708 * using the current baud rate. It is advisable to enable BREAK 708 * using the current baud rate. It is advisable to enable BREAK
diff --git a/loginutils/login.c b/loginutils/login.c
index ee50a175a..99f66b53b 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -77,7 +77,7 @@ extern int login_main(int argc, char **argv)
77 int opt_preserve = 0; 77 int opt_preserve = 0;
78 int opt_fflag = 0; 78 int opt_fflag = 0;
79 char *opt_host = 0; 79 char *opt_host = 0;
80 int alarmstarted = 0; 80 int alarmstarted = 0;
81#ifdef CONFIG_SELINUX 81#ifdef CONFIG_SELINUX
82 int flask_enabled = is_flask_enabled(); 82 int flask_enabled = is_flask_enabled();
83 security_id_t sid = 0, old_tty_sid, new_tty_sid; 83 security_id_t sid = 0, old_tty_sid, new_tty_sid;
@@ -88,7 +88,7 @@ extern int login_main(int argc, char **argv)
88 signal ( SIGALRM, alarm_handler ); 88 signal ( SIGALRM, alarm_handler );
89 alarm ( TIMEOUT ); 89 alarm ( TIMEOUT );
90 alarmstarted = 1; 90 alarmstarted = 1;
91 91
92 while (( flag = getopt(argc, argv, "f:h:p")) != EOF ) { 92 while (( flag = getopt(argc, argv, "f:h:p")) != EOF ) {
93 switch ( flag ) { 93 switch ( flag ) {
94 case 'p': 94 case 'p':
@@ -104,7 +104,7 @@ extern int login_main(int argc, char **argv)
104 104
105 if ( !amroot ) /* Auth bypass only if real UID is zero */ 105 if ( !amroot ) /* Auth bypass only if real UID is zero */
106 bb_error_msg_and_die ( "-f permission denied" ); 106 bb_error_msg_and_die ( "-f permission denied" );
107 107
108 safe_strncpy(username, optarg, USERNAME_SIZE); 108 safe_strncpy(username, optarg, USERNAME_SIZE);
109 opt_fflag = 1; 109 opt_fflag = 1;
110 break; 110 break;
@@ -119,7 +119,7 @@ extern int login_main(int argc, char **argv)
119 if (optind < argc) // user from command line (getty) 119 if (optind < argc) // user from command line (getty)
120 safe_strncpy(username, argv[optind], USERNAME_SIZE); 120 safe_strncpy(username, argv[optind], USERNAME_SIZE);
121 121
122 if ( !isatty ( 0 ) || !isatty ( 1 ) || !isatty ( 2 )) 122 if ( !isatty ( 0 ) || !isatty ( 1 ) || !isatty ( 2 ))
123 return EXIT_FAILURE; /* Must be a terminal */ 123 return EXIT_FAILURE; /* Must be a terminal */
124 124
125#ifdef CONFIG_FEATURE_U_W_TMP 125#ifdef CONFIG_FEATURE_U_W_TMP
@@ -136,7 +136,7 @@ extern int login_main(int argc, char **argv)
136 if ( amroot ) 136 if ( amroot )
137 memset ( utent.ut_host, 0, sizeof utent.ut_host ); 137 memset ( utent.ut_host, 0, sizeof utent.ut_host );
138#endif 138#endif
139 139
140 if ( opt_host ) { 140 if ( opt_host ) {
141#ifdef CONFIG_FEATURE_U_W_TMP 141#ifdef CONFIG_FEATURE_U_W_TMP
142 safe_strncpy ( utent.ut_host, opt_host, sizeof( utent. ut_host )); 142 safe_strncpy ( utent.ut_host, opt_host, sizeof( utent. ut_host ));
@@ -145,7 +145,7 @@ extern int login_main(int argc, char **argv)
145 } 145 }
146 else 146 else
147 snprintf ( fromhost, sizeof( fromhost ) - 1, " on `%.100s'", tty ); 147 snprintf ( fromhost, sizeof( fromhost ) - 1, " on `%.100s'", tty );
148 148
149 setpgrp(); 149 setpgrp();
150 150
151 openlog ( "login", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH ); 151 openlog ( "login", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH );
@@ -167,14 +167,14 @@ extern int login_main(int argc, char **argv)
167 pw_copy.pw_passwd = "!"; 167 pw_copy.pw_passwd = "!";
168 opt_fflag = 0; 168 opt_fflag = 0;
169 failed = 1; 169 failed = 1;
170 } else 170 } else
171 pw_copy = *pw; 171 pw_copy = *pw;
172 172
173 pw = &pw_copy; 173 pw = &pw_copy;
174 174
175 if (( pw-> pw_passwd [0] == '!' ) || ( pw-> pw_passwd[0] == '*' )) 175 if (( pw-> pw_passwd [0] == '!' ) || ( pw-> pw_passwd[0] == '*' ))
176 failed = 1; 176 failed = 1;
177 177
178 if ( opt_fflag ) { 178 if ( opt_fflag ) {
179 opt_fflag = 0; 179 opt_fflag = 0;
180 goto auth_ok; 180 goto auth_ok;
@@ -192,14 +192,14 @@ extern int login_main(int argc, char **argv)
192 goto auth_ok; 192 goto auth_ok;
193 193
194 failed = 1; 194 failed = 1;
195 195
196auth_ok: 196auth_ok:
197 if ( !failed) 197 if ( !failed)
198 break; 198 break;
199 199
200 { // delay next try 200 { // delay next try
201 time_t start, now; 201 time_t start, now;
202 202
203 time ( &start ); 203 time ( &start );
204 now = start; 204 now = start;
205 while ( difftime ( now, start ) < FAIL_DELAY) { 205 while ( difftime ( now, start ) < FAIL_DELAY) {
@@ -215,7 +215,7 @@ auth_ok:
215 return EXIT_FAILURE; 215 return EXIT_FAILURE;
216 } 216 }
217 } 217 }
218 218
219 alarm ( 0 ); 219 alarm ( 0 );
220 if ( check_nologin ( pw-> pw_uid == 0 )) 220 if ( check_nologin ( pw-> pw_uid == 0 ))
221 return EXIT_FAILURE; 221 return EXIT_FAILURE;
@@ -253,15 +253,15 @@ auth_ok:
253 sid = 0; 253 sid = 0;
254#endif 254#endif
255 255
256 if ( *tty != '/' ) 256 if ( *tty != '/' )
257 snprintf ( full_tty, sizeof( full_tty ) - 1, "/dev/%s", tty); 257 snprintf ( full_tty, sizeof( full_tty ) - 1, "/dev/%s", tty);
258 else 258 else
259 safe_strncpy ( full_tty, tty, sizeof( full_tty ) - 1 ); 259 safe_strncpy ( full_tty, tty, sizeof( full_tty ) - 1 );
260 260
261 if ( !is_my_tty ( full_tty )) 261 if ( !is_my_tty ( full_tty ))
262 syslog ( LOG_ERR, "unable to determine TTY name, got %s\n", full_tty ); 262 syslog ( LOG_ERR, "unable to determine TTY name, got %s\n", full_tty );
263 263
264 /* Try these, but don't complain if they fail 264 /* Try these, but don't complain if they fail
265 * (for example when the root fs is read only) */ 265 * (for example when the root fs is read only) */
266 chown ( full_tty, pw-> pw_uid, pw-> pw_gid ); 266 chown ( full_tty, pw-> pw_uid, pw-> pw_gid );
267 chmod ( full_tty, 0600 ); 267 chmod ( full_tty, 0600 );
@@ -275,14 +275,14 @@ auth_ok:
275 motd ( ); 275 motd ( );
276 signal ( SIGALRM, SIG_DFL ); /* default alarm signal */ 276 signal ( SIGALRM, SIG_DFL ); /* default alarm signal */
277 277
278 if ( pw-> pw_uid == 0 ) 278 if ( pw-> pw_uid == 0 )
279 syslog ( LOG_INFO, "root login %s\n", fromhost ); 279 syslog ( LOG_INFO, "root login %s\n", fromhost );
280 run_shell ( tmp, 1, 0, 0 280 run_shell ( tmp, 1, 0, 0
281#ifdef CONFIG_SELINUX 281#ifdef CONFIG_SELINUX
282 , sid 282 , sid
283#endif 283#endif
284 ); /* exec the shell finally. */ 284 ); /* exec the shell finally. */
285 285
286 return EXIT_FAILURE; 286 return EXIT_FAILURE;
287} 287}
288 288
@@ -306,7 +306,7 @@ static int login_prompt ( char *buf_name )
306 for ( sp = buf; isspace ( *sp ); sp++ ) { } 306 for ( sp = buf; isspace ( *sp ); sp++ ) { }
307 for ( ep = sp; isgraph ( *ep ); ep++ ) { } 307 for ( ep = sp; isgraph ( *ep ); ep++ ) { }
308 308
309 *ep = 0; 309 *ep = 0;
310 safe_strncpy(buf_name, sp, USERNAME_SIZE); 310 safe_strncpy(buf_name, sp, USERNAME_SIZE);
311 if(buf_name[0]) 311 if(buf_name[0])
312 return 1; 312 return 1;
@@ -332,7 +332,7 @@ static int check_nologin ( int amroot )
332 } 332 }
333 if ( !amroot ) 333 if ( !amroot )
334 return 1; 334 return 1;
335 335
336 puts ( "\r\n[Disconnect bypassed -- root login allowed.]\r" ); 336 puts ( "\r\n[Disconnect bypassed -- root login allowed.]\r" );
337 } 337 }
338 return 0; 338 return 0;
@@ -377,7 +377,7 @@ static int is_my_tty ( const char *tty )
377 377
378 if ( stat ( tty, &by_name ) || fstat ( 0, &by_fd )) 378 if ( stat ( tty, &by_name ) || fstat ( 0, &by_fd ))
379 return 0; 379 return 0;
380 380
381 if ( by_name. st_rdev != by_fd. st_rdev ) 381 if ( by_name. st_rdev != by_fd. st_rdev )
382 return 0; 382 return 0;
383 else 383 else
@@ -391,8 +391,8 @@ static void motd ( )
391 register int c; 391 register int c;
392 392
393 if (( fp = fopen ( bb_path_motd_file, "r" ))) { 393 if (( fp = fopen ( bb_path_motd_file, "r" ))) {
394 while (( c = getc ( fp )) != EOF ) 394 while (( c = getc ( fp )) != EOF )
395 putchar ( c ); 395 putchar ( c );
396 fclose ( fp ); 396 fclose ( fp );
397 } 397 }
398} 398}
diff --git a/loginutils/su.c b/loginutils/su.c
index 2d7a7ac05..ec0c16c7d 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -84,12 +84,12 @@ int su_main ( int argc, char **argv )
84 } 84 }
85 85
86 /* get user if specified */ 86 /* get user if specified */
87 if ( optind < argc ) 87 if ( optind < argc )
88 opt_username = argv [optind++]; 88 opt_username = argv [optind++];
89 89
90 if ( optind < argc ) 90 if ( optind < argc )
91 opt_args = argv + optind; 91 opt_args = argv + optind;
92 92
93#if defined( SYSLOG_SUCCESS ) || defined( SYSLOG_FAILURE ) 93#if defined( SYSLOG_SUCCESS ) || defined( SYSLOG_FAILURE )
94#ifdef CONFIG_FEATURE_U_W_TMP 94#ifdef CONFIG_FEATURE_U_W_TMP
95 /* The utmp entry (via getlogin) is probably the best way to identify 95 /* The utmp entry (via getlogin) is probably the best way to identify
@@ -108,11 +108,11 @@ int su_main ( int argc, char **argv )
108 108
109 openlog ( bb_applet_name, 0, LOG_AUTH ); 109 openlog ( bb_applet_name, 0, LOG_AUTH );
110#endif 110#endif
111 111
112 pw = getpwnam ( opt_username ); 112 pw = getpwnam ( opt_username );
113 if ( !pw ) 113 if ( !pw )
114 bb_error_msg_and_die ( "user %s does not exist", opt_username ); 114 bb_error_msg_and_die ( "user %s does not exist", opt_username );
115 115
116 /* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER 116 /* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER
117 is a username that is retrieved via NIS (YP), but that doesn't have 117 is a username that is retrieved via NIS (YP), but that doesn't have
118 a default shell listed. */ 118 a default shell listed. */
@@ -145,13 +145,13 @@ int su_main ( int argc, char **argv )
145 if ( !opt_shell ) 145 if ( !opt_shell )
146 opt_shell = pw->pw_shell; 146 opt_shell = pw->pw_shell;
147 147
148 change_identity ( pw ); 148 change_identity ( pw );
149 setup_environment ( opt_shell, opt_loginshell, !opt_preserve, pw ); 149 setup_environment ( opt_shell, opt_loginshell, !opt_preserve, pw );
150 run_shell ( opt_shell, opt_loginshell, opt_command, (const char**)opt_args 150 run_shell ( opt_shell, opt_loginshell, opt_command, (const char**)opt_args
151#ifdef CONFIG_SELINUX 151#ifdef CONFIG_SELINUX
152 , 0 152 , 0
153#endif 153#endif
154 ); 154 );
155 155
156 return EXIT_FAILURE; 156 return EXIT_FAILURE;
157} 157}