aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-09-13 15:42:47 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-09-13 15:42:47 +0000
commit92582f2e11e26fba24ffc60f8ff0883ce94ba87c (patch)
tree346c847e92b917fd7dc73400c870cf6fbabacfe1
parent577905f1e45a9d9b65ef538408a7b8bb4fdb14fe (diff)
downloadbusybox-w32-92582f2e11e26fba24ffc60f8ff0883ce94ba87c.tar.gz
busybox-w32-92582f2e11e26fba24ffc60f8ff0883ce94ba87c.tar.bz2
busybox-w32-92582f2e11e26fba24ffc60f8ff0883ce94ba87c.zip
- r16075 broke for de-selected FEATURE_UTMP; Partial fix that wants some more cleanup (see FIXME in the patch).
-rw-r--r--loginutils/login.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/loginutils/login.c b/loginutils/login.c
index c0f4b72bb..2c23a8d50 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -3,23 +3,11 @@
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
4 */ 4 */
5 5
6#include <fcntl.h> 6#include "busybox.h"
7#include <signal.h>
8#include <stdio.h>
9#include <stdlib.h>
10#include <string.h>
11#include <syslog.h>
12#include <termios.h>
13#include <unistd.h>
14#include <utmp.h> 7#include <utmp.h>
15#include <sys/resource.h> 8#include <sys/resource.h>
16#include <sys/stat.h> 9#include <syslog.h>
17#include <sys/types.h>
18#include <sys/wait.h>
19#include <ctype.h>
20#include <time.h>
21 10
22#include "busybox.h"
23#ifdef CONFIG_SELINUX 11#ifdef CONFIG_SELINUX
24#include <selinux/selinux.h> /* for is_selinux_enabled() */ 12#include <selinux/selinux.h> /* for is_selinux_enabled() */
25#include <selinux/get_context_list.h> /* for get_default_context() */ 13#include <selinux/get_context_list.h> /* for get_default_context() */
@@ -27,12 +15,12 @@
27#include <errno.h> 15#include <errno.h>
28#endif 16#endif
29 17
30#ifdef CONFIG_FEATURE_UTMP 18/* import from utmp.c
31// import from utmp.c 19 * XXX: FIXME: provide empty bodies if ENABLE_FEATURE_UTMP == 0
20 */
32static struct utmp utent; 21static struct utmp utent;
33static void read_or_build_utent(int picky); 22static void read_or_build_utent(int);
34static void write_utent(const char *username); 23static void write_utent(const char *);
35#endif
36 24
37enum { 25enum {
38 TIMEOUT = 60, 26 TIMEOUT = 60,
@@ -43,12 +31,10 @@ enum {
43 31
44static void die_if_nologin_and_non_root(int amroot); 32static void die_if_nologin_and_non_root(int amroot);
45 33
46#if defined CONFIG_FEATURE_SECURETTY 34#if ENABLE_FEATURE_SECURETTY
47static int check_securetty(void); 35static int check_securetty(void);
48
49#else 36#else
50static inline int check_securetty(void) { return 1; } 37static inline int check_securetty(void) { return 1; }
51
52#endif 38#endif
53 39
54static void get_username_or_die(char *buf, int size_buf); 40static void get_username_or_die(char *buf, int size_buf);
@@ -84,9 +70,6 @@ int login_main(int argc, char **argv)
84 int flag; 70 int flag;
85 int count = 0; 71 int count = 0;
86 struct passwd *pw; 72 struct passwd *pw;
87#ifdef CONFIG_WHEEL_GROUP
88 struct group *grp;
89#endif
90 int opt_preserve = 0; 73 int opt_preserve = 0;
91 int opt_fflag = 0; 74 int opt_fflag = 0;
92 char *opt_host = 0; 75 char *opt_host = 0;
@@ -321,7 +304,7 @@ static void die_if_nologin_and_non_root(int amroot)
321 puts("\r\n[Disconnect bypassed -- root login allowed.]\r"); 304 puts("\r\n[Disconnect bypassed -- root login allowed.]\r");
322} 305}
323 306
324#ifdef CONFIG_FEATURE_SECURETTY 307#if ENABLE_FEATURE_SECURETTY
325 308
326static int check_securetty(void) 309static int check_securetty(void)
327{ 310{
@@ -367,7 +350,7 @@ static void motd(void)
367} 350}
368 351
369 352
370#ifdef CONFIG_FEATURE_UTMP 353#if ENABLE_FEATURE_UTMP
371/* vv Taken from tinylogin utmp.c vv */ 354/* vv Taken from tinylogin utmp.c vv */
372 355
373/* 356/*
@@ -432,7 +415,7 @@ static void write_utent(const char *username)
432 setutent(); 415 setutent();
433 pututline(&utent); 416 pututline(&utent);
434 endutent(); 417 endutent();
435#ifdef CONFIG_FEATURE_WTMP 418#if ENABLE_FEATURE_WTMP
436 if (access(bb_path_wtmp_file, R_OK|W_OK) == -1) { 419 if (access(bb_path_wtmp_file, R_OK|W_OK) == -1) {
437 close(creat(bb_path_wtmp_file, 0664)); 420 close(creat(bb_path_wtmp_file, 0664));
438 } 421 }