fix for uclibc-without-shadow.h compilation

This commit is contained in:
Denis Vlasenko 2006-12-30 14:46:51 +00:00
parent d9e4ddc38b
commit b5a122b6f9
3 changed files with 18 additions and 10 deletions

View File

@ -39,25 +39,29 @@
#include <unistd.h> #include <unistd.h>
#include <utime.h> #include <utime.h>
#ifdef CONFIG_SELINUX #if ENABLE_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif
#ifdef CONFIG_LOCALE_SUPPORT #if ENABLE_LOCALE_SUPPORT
#include <locale.h> #include <locale.h>
#else #else
#define setlocale(x,y) #define setlocale(x,y) ((void)0)
#endif #endif
#include "pwd_.h" #include "pwd_.h"
#include "grp_.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" #include "shadow_.h"
#endif
/* Try to pull in PATH_MAX */ /* Try to pull in PATH_MAX */
#include <limits.h> #include <limits.h>
#include <sys/param.h> #include <sys/param.h>
#ifndef PATH_MAX #ifndef PATH_MAX
#define PATH_MAX 256 #define PATH_MAX 256
#endif #endif
/* Tested to work correctly (IIRC :]) */ /* Tested to work correctly (IIRC :]) */
@ -142,12 +146,12 @@
#endif #endif
/* buffer allocation schemes */ /* 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_BUFFER(buffer,len) char buffer[len]
#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len] #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
#define RELEASE_CONFIG_BUFFER(buffer) ((void)0) #define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
#else #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_BUFFER(buffer,len) static char buffer[len]
#define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len] #define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
#define RELEASE_CONFIG_BUFFER(buffer) ((void)0) #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 void change_identity(const struct passwd *pw);
extern const char *change_identity_e2str(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); 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 renew_current_security_context(void);
extern void set_current_security_context(security_context_t sid); extern void set_current_security_context(security_context_t sid);
#endif #endif
@ -636,7 +640,7 @@ extern const char bb_default_login_shell[];
#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+6) #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 CURRENT_VC "/dev/vc/0"
# define VC_1 "/dev/vc/1" # define VC_1 "/dev/vc/1"
# define VC_2 "/dev/vc/2" # define VC_2 "/dev/vc/2"

View File

@ -276,7 +276,8 @@ int passwd_main(int argc, char **argv)
} }
filename = bb_path_passwd_file; filename = bb_path_passwd_file;
if (ENABLE_FEATURE_SHADOWPASSWDS) { #if ENABLE_FEATURE_SHADOWPASSWDS
{
struct spwd *sp = getspnam(name); struct spwd *sp = getspnam(name);
if (!sp) { if (!sp) {
/* LOGMODE_BOTH */ /* LOGMODE_BOTH */
@ -288,6 +289,7 @@ int passwd_main(int argc, char **argv)
pw->pw_passwd = sp->sp_pwdp; pw->pw_passwd = sp->sp_pwdp;
} }
} }
#endif
/* Decide what the new password will be */ /* Decide what the new password will be */
newp = NULL; newp = NULL;

View File

@ -74,13 +74,15 @@ int sulogin_main(int argc, char **argv)
goto auth_error; goto auth_error;
} }
if (ENABLE_FEATURE_SHADOWPASSWDS) { #if ENABLE_FEATURE_SHADOWPASSWDS
{
struct spwd *spwd = getspnam(pwd->pw_name); struct spwd *spwd = getspnam(pwd->pw_name);
if (!spwd) { if (!spwd) {
goto auth_error; goto auth_error;
} }
pwd->pw_passwd = spwd->sp_pwdp; pwd->pw_passwd = spwd->sp_pwdp;
} }
#endif
while (1) { while (1) {
/* cp points to a static buffer that is zeroed every time */ /* cp points to a static buffer that is zeroed every time */