fix for uclibc-without-shadow.h compilation
authorDenis Vlasenko <vda.linux@googlemail.com>
Sat, 30 Dec 2006 14:46:51 +0000 (14:46 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sat, 30 Dec 2006 14:46:51 +0000 (14:46 -0000)
include/libbb.h
loginutils/passwd.c
loginutils/sulogin.c

index 6948695e944bd0d9d9f477e5d6f1eed986a32d22..5d7248104150192affd40b6e266871f9976a9b78 100644 (file)
 #include <unistd.h>
 #include <utime.h>
 
-#ifdef CONFIG_SELINUX
+#if ENABLE_SELINUX
 #include <selinux/selinux.h>
 #endif
 
-#ifdef CONFIG_LOCALE_SUPPORT
+#if ENABLE_LOCALE_SUPPORT
 #include <locale.h>
 #else
-#define setlocale(x,y)
+#define setlocale(x,y) ((void)0)
 #endif
 
 #include "pwd_.h"
 #include "grp_.h"
+/* ifdef it out, because it may include <shadow.h> */
+/* and we may not even _have_ <shadow.h>! */
+#if ENABLE_FEATURE_SHADOWPASSWDS
 #include "shadow_.h"
+#endif
 
 /* Try to pull in PATH_MAX */
 #include <limits.h>
 #include <sys/param.h>
 #ifndef PATH_MAX
-#define  PATH_MAX         256
+#define PATH_MAX 256
 #endif
 
 /* Tested to work correctly (IIRC :]) */
 #endif
 
 /* buffer allocation schemes */
-#ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
+#if ENABLE_FEATURE_BUFFERS_GO_ON_STACK
 #define RESERVE_CONFIG_BUFFER(buffer,len)           char buffer[len]
 #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
 #define RELEASE_CONFIG_BUFFER(buffer)      ((void)0)
 #else
-#ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
+#if ENABLE_FEATURE_BUFFERS_GO_IN_BSS
 #define RESERVE_CONFIG_BUFFER(buffer,len)  static          char buffer[len]
 #define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
 #define RELEASE_CONFIG_BUFFER(buffer)      ((void)0)
@@ -466,7 +470,7 @@ extern void bb_do_delay(int seconds);
 extern void change_identity(const struct passwd *pw);
 extern const char *change_identity_e2str(const struct passwd *pw);
 extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args);
-#ifdef CONFIG_SELINUX
+#if ENABLE_SELINUX
 extern void renew_current_security_context(void);
 extern void set_current_security_context(security_context_t sid);
 #endif
@@ -636,7 +640,7 @@ extern const char bb_default_login_shell[];
 #define DEFAULT_SHELL_SHORT_NAME     (bb_default_login_shell+6)
 
 
-#ifdef CONFIG_FEATURE_DEVFS
+#if ENABLE_FEATURE_DEVFS
 # define CURRENT_VC "/dev/vc/0"
 # define VC_1 "/dev/vc/1"
 # define VC_2 "/dev/vc/2"
index c825c978fdc388baa1daa49221bacec3ba260ae5..5c822b190c37683302c8d87c509a945e01d730aa 100644 (file)
@@ -276,7 +276,8 @@ int passwd_main(int argc, char **argv)
        }
 
        filename = bb_path_passwd_file;
-       if (ENABLE_FEATURE_SHADOWPASSWDS) {
+#if ENABLE_FEATURE_SHADOWPASSWDS
+       {
                struct spwd *sp = getspnam(name);
                if (!sp) {
                        /* LOGMODE_BOTH */
@@ -288,6 +289,7 @@ int passwd_main(int argc, char **argv)
                        pw->pw_passwd = sp->sp_pwdp;
                }
        }
+#endif
 
        /* Decide what the new password will be */
        newp = NULL;
index 30f9d9350a600a7434dade20f454508f12a561d7..8bcb393f5b0146fe83ab6ac695796d611165a4ec 100644 (file)
@@ -74,13 +74,15 @@ int sulogin_main(int argc, char **argv)
                goto auth_error;
        }
 
-       if (ENABLE_FEATURE_SHADOWPASSWDS) {
+#if ENABLE_FEATURE_SHADOWPASSWDS
+       {
                struct spwd *spwd = getspnam(pwd->pw_name);
                if (!spwd) {
                        goto auth_error;
                }
                pwd->pw_passwd = spwd->sp_pwdp;
        }
+#endif
 
        while (1) {
                /* cp points to a static buffer that is zeroed every time */