mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 13:48:06 +00:00
replace our no_shadow fix with a better patch from upstream (#1118)
SVN-Revision: 5961
This commit is contained in:
parent
0d0cb7bf9c
commit
db9220ba83
@ -1,12 +1,230 @@
|
||||
--- busybox-1.3.1-old/include/libbb.h 2006-12-27 05:56:18.000000000 +0100
|
||||
+++ busybox-1.3.1/include/libbb.h 2006-12-28 07:08:09.000000000 +0100
|
||||
@@ -51,9 +51,7 @@
|
||||
--- busybox-1.3.1/include/libbb.h Wed Dec 27 05:56:18 2006
|
||||
+++ busybox-1.3.1.shadow/include/libbb.h Sat Dec 30 15:24:07 2006
|
||||
@@ -46,11 +46,13 @@
|
||||
#ifdef CONFIG_LOCALE_SUPPORT
|
||||
#include <locale.h>
|
||||
#else
|
||||
-#define setlocale(x,y)
|
||||
+#define setlocale(x,y) ((void)0)
|
||||
#endif
|
||||
|
||||
#include "pwd_.h"
|
||||
#include "grp_.h"
|
||||
-#if ENABLE_FEATURE_SHADOWPASSWDS
|
||||
+/* 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 */
|
||||
#endif
|
||||
@@ -59,7 +61,7 @@
|
||||
#include <limits.h>
|
||||
#include <sys/param.h>
|
||||
#ifndef PATH_MAX
|
||||
-#define PATH_MAX 256
|
||||
+#define PATH_MAX 256
|
||||
#endif
|
||||
|
||||
/* Tested to work correctly (IIRC :]) */
|
||||
--- busybox-1.3.1/libpwdgrp/pwd_grp.c Wed Dec 27 05:56:32 2006
|
||||
+++ busybox-1.3.1.shadow/libpwdgrp/pwd_grp.c Sat Dec 30 15:24:07 2006
|
||||
@@ -52,7 +52,9 @@
|
||||
|
||||
extern int __parsepwent(void *pw, char *line);
|
||||
extern int __parsegrent(void *gr, char *line);
|
||||
+#if ENABLE_USE_BB_SHADOW
|
||||
extern int __parsespent(void *sp, char *line);
|
||||
+#endif
|
||||
|
||||
extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data,
|
||||
char *__restrict line_buff, size_t buflen, FILE *f);
|
||||
@@ -103,6 +105,7 @@
|
||||
return rv;
|
||||
}
|
||||
|
||||
+#if ENABLE_USE_BB_SHADOW
|
||||
int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
|
||||
char *__restrict buffer, size_t buflen,
|
||||
struct spwd **__restrict result)
|
||||
@@ -117,6 +120,7 @@
|
||||
|
||||
return rv;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/**********************************************************************/
|
||||
/* For the various fget??ent funcs, return NULL on failure and a
|
||||
@@ -144,6 +148,7 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
+#if ENABLE_USE_BB_SHADOW
|
||||
extern int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
|
||||
char *__restrict buffer, size_t buflen,
|
||||
struct spwd **__restrict result);
|
||||
@@ -184,6 +189,7 @@
|
||||
DONE:
|
||||
return rv;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
@@ -207,6 +213,7 @@
|
||||
#define DO_GETXXKEY_R_PATHNAME _PATH_GROUP
|
||||
#include "pwd_grp_internal.c"
|
||||
|
||||
+#if ENABLE_USE_BB_SHADOW
|
||||
#define GETXXKEY_R_FUNC getspnam_R
|
||||
#define GETXXKEY_R_PARSER __parsespent
|
||||
#define GETXXKEY_R_ENTTYPE struct spwd
|
||||
@@ -214,6 +221,7 @@
|
||||
#define DO_GETXXKEY_R_KEYTYPE const char *__restrict
|
||||
#define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW
|
||||
#include "pwd_grp_internal.c"
|
||||
+#endif
|
||||
|
||||
#define GETXXKEY_R_FUNC getpwuid_R
|
||||
#define GETXXKEY_R_PARSER __parsepwent
|
||||
@@ -253,6 +261,7 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
+#if 0 //ENABLE_USE_BB_SHADOW
|
||||
/* This function is non-standard and is currently not built. It seems
|
||||
* to have been created as a reentrant version of the non-standard
|
||||
* functions getspuid. Why getspuid was added, I do not know. */
|
||||
@@ -286,6 +295,7 @@
|
||||
getspuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result);
|
||||
return result;
|
||||
}
|
||||
+#endif
|
||||
|
||||
struct passwd *getpwnam(const char *name)
|
||||
{
|
||||
@@ -307,6 +317,7 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
+#if ENABLE_USE_BB_SHADOW
|
||||
struct spwd *getspnam(const char *name)
|
||||
{
|
||||
static char buffer[PWD_BUFFER_SIZE];
|
||||
@@ -316,6 +327,7 @@
|
||||
getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result);
|
||||
return result;
|
||||
}
|
||||
+#endif
|
||||
|
||||
int getpw(uid_t uid, char *buf)
|
||||
{
|
||||
@@ -444,6 +456,7 @@
|
||||
return rv;
|
||||
}
|
||||
|
||||
+#if ENABLE_USE_BB_SHADOW
|
||||
static FILE *spf /*= NULL*/;
|
||||
void setspent(void)
|
||||
{
|
||||
@@ -488,6 +501,7 @@
|
||||
UNLOCK;
|
||||
return rv;
|
||||
}
|
||||
+#endif
|
||||
|
||||
struct passwd *getpwent(void)
|
||||
{
|
||||
@@ -509,6 +523,7 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
+#if ENABLE_USE_BB_SHADOW
|
||||
struct spwd *getspent(void)
|
||||
{
|
||||
static char line_buff[PWD_BUFFER_SIZE];
|
||||
@@ -528,6 +543,7 @@
|
||||
sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result);
|
||||
return result;
|
||||
}
|
||||
+#endif
|
||||
|
||||
int initgroups(const char *user, gid_t gid)
|
||||
{
|
||||
@@ -643,6 +659,7 @@
|
||||
return rv;
|
||||
}
|
||||
|
||||
+#if ENABLE_USE_BB_SHADOW
|
||||
static const unsigned char _sp_off[] = {
|
||||
offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */
|
||||
offsetof(struct spwd, sp_min), /* 3 - not a char ptr */
|
||||
@@ -688,6 +705,7 @@
|
||||
DO_UNLOCK:
|
||||
return rv;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/**********************************************************************/
|
||||
/* Internal uClibc functions. */
|
||||
@@ -846,6 +864,7 @@
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
+#if ENABLE_USE_BB_SHADOW
|
||||
static const unsigned char sp_off[] = {
|
||||
offsetof(struct spwd, sp_namp), /* 0 */
|
||||
offsetof(struct spwd, sp_pwdp), /* 1 */
|
||||
@@ -900,6 +919,7 @@
|
||||
|
||||
return EINVAL;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
--- busybox-1.3.1/loginutils/passwd.c Wed Dec 27 05:56:20 2006
|
||||
+++ busybox-1.3.1.shadow/loginutils/passwd.c Sat Dec 30 15:24:07 2006
|
||||
@@ -275,7 +275,8 @@
|
||||
}
|
||||
|
||||
filename = bb_path_passwd_file;
|
||||
- if (ENABLE_FEATURE_SHADOWPASSWDS) {
|
||||
+#if ENABLE_FEATURE_SHADOWPASSWDS
|
||||
+ {
|
||||
struct spwd *sp = getspnam(name);
|
||||
if (!sp) {
|
||||
/* LOGMODE_BOTH */
|
||||
@@ -287,6 +288,7 @@
|
||||
pw->pw_passwd = sp->sp_pwdp;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* Decide what the new password will be */
|
||||
newp = NULL;
|
||||
--- busybox-1.3.1/loginutils/sulogin.c Wed Dec 27 05:56:20 2006
|
||||
+++ busybox-1.3.1.shadow/loginutils/sulogin.c Sat Dec 30 15:24:07 2006
|
||||
@@ -41,7 +41,6 @@
|
||||
char *timeout_arg;
|
||||
const char * const *p;
|
||||
struct passwd *pwd;
|
||||
- struct spwd *spwd;
|
||||
const char *shell;
|
||||
|
||||
logmode = LOGMODE_BOTH;
|
||||
@@ -75,13 +74,15 @@
|
||||
goto auth_error;
|
||||
}
|
||||
|
||||
- if (ENABLE_FEATURE_SHADOWPASSWDS) {
|
||||
- spwd = getspnam(pwd->pw_name);
|
||||
+#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 */
|
||||
|
Loading…
Reference in New Issue
Block a user