summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-20 20:20:32 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-20 20:20:32 +0000
commit8b7f6928c69a53fbcc56c7b0b9db14e79ba976da (patch)
tree908ae075ca46840f7ef6a44aefa008c8b342fa55
parenta2af67a8c5a1842f37d23508609c8b94d271c35e (diff)
downloadbusybox-w32-1_3_2.tar.gz
busybox-w32-1_3_2.tar.bz2
busybox-w32-1_3_2.zip
releasing busybox 1.3.21_3_2
-rw-r--r--Makefile4
-rw-r--r--include/libbb.h6
-rw-r--r--libpwdgrp/pwd_grp.c20
-rw-r--r--loginutils/passwd.c4
-rw-r--r--loginutils/sulogin.c7
5 files changed, 33 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index a30026909..8c382c712 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 1 1VERSION = 1
2PATCHLEVEL = 3 2PATCHLEVEL = 3
3SUBLEVEL = 1 3SUBLEVEL = 2
4EXTRAVERSION = 4EXTRAVERSION =
5NAME = Christmas Tree 5NAME = Unnamed
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
diff --git a/include/libbb.h b/include/libbb.h
index 65430d254..1f9be8f61 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -46,11 +46,13 @@
46#ifdef CONFIG_LOCALE_SUPPORT 46#ifdef CONFIG_LOCALE_SUPPORT
47#include <locale.h> 47#include <locale.h>
48#else 48#else
49#define setlocale(x,y) 49#define setlocale(x,y) ((void)0)
50#endif 50#endif
51 51
52#include "pwd_.h" 52#include "pwd_.h"
53#include "grp_.h" 53#include "grp_.h"
54/* ifdef it out, because it may include <shadow.h> */
55/* and we may not even _have_ <shadow.h>! */
54#if ENABLE_FEATURE_SHADOWPASSWDS 56#if ENABLE_FEATURE_SHADOWPASSWDS
55#include "shadow_.h" 57#include "shadow_.h"
56#endif 58#endif
@@ -59,7 +61,7 @@
59#include <limits.h> 61#include <limits.h>
60#include <sys/param.h> 62#include <sys/param.h>
61#ifndef PATH_MAX 63#ifndef PATH_MAX
62#define PATH_MAX 256 64#define PATH_MAX 256
63#endif 65#endif
64 66
65/* Tested to work correctly (IIRC :]) */ 67/* Tested to work correctly (IIRC :]) */
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c
index ac65d4c5b..ddfdfec2e 100644
--- a/libpwdgrp/pwd_grp.c
+++ b/libpwdgrp/pwd_grp.c
@@ -52,7 +52,9 @@
52 52
53extern int __parsepwent(void *pw, char *line); 53extern int __parsepwent(void *pw, char *line);
54extern int __parsegrent(void *gr, char *line); 54extern int __parsegrent(void *gr, char *line);
55#if ENABLE_USE_BB_SHADOW
55extern int __parsespent(void *sp, char *line); 56extern int __parsespent(void *sp, char *line);
57#endif
56 58
57extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, 59extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data,
58 char *__restrict line_buff, size_t buflen, FILE *f); 60 char *__restrict line_buff, size_t buflen, FILE *f);
@@ -103,6 +105,7 @@ int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf,
103 return rv; 105 return rv;
104} 106}
105 107
108#if ENABLE_USE_BB_SHADOW
106int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, 109int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
107 char *__restrict buffer, size_t buflen, 110 char *__restrict buffer, size_t buflen,
108 struct spwd **__restrict result) 111 struct spwd **__restrict result)
@@ -117,6 +120,7 @@ int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
117 120
118 return rv; 121 return rv;
119} 122}
123#endif
120 124
121/**********************************************************************/ 125/**********************************************************************/
122/* For the various fget??ent funcs, return NULL on failure and a 126/* For the various fget??ent funcs, return NULL on failure and a
@@ -144,6 +148,7 @@ struct group *fgetgrent(FILE *stream)
144 return result; 148 return result;
145} 149}
146 150
151#if ENABLE_USE_BB_SHADOW
147extern int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, 152extern int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
148 char *__restrict buffer, size_t buflen, 153 char *__restrict buffer, size_t buflen,
149 struct spwd **__restrict result); 154 struct spwd **__restrict result);
@@ -184,6 +189,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf,
184 DONE: 189 DONE:
185 return rv; 190 return rv;
186} 191}
192#endif
187 193
188/**********************************************************************/ 194/**********************************************************************/
189 195
@@ -207,6 +213,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf,
207#define DO_GETXXKEY_R_PATHNAME _PATH_GROUP 213#define DO_GETXXKEY_R_PATHNAME _PATH_GROUP
208#include "pwd_grp_internal.c" 214#include "pwd_grp_internal.c"
209 215
216#if ENABLE_USE_BB_SHADOW
210#define GETXXKEY_R_FUNC getspnam_R 217#define GETXXKEY_R_FUNC getspnam_R
211#define GETXXKEY_R_PARSER __parsespent 218#define GETXXKEY_R_PARSER __parsespent
212#define GETXXKEY_R_ENTTYPE struct spwd 219#define GETXXKEY_R_ENTTYPE struct spwd
@@ -214,6 +221,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf,
214#define DO_GETXXKEY_R_KEYTYPE const char *__restrict 221#define DO_GETXXKEY_R_KEYTYPE const char *__restrict
215#define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW 222#define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW
216#include "pwd_grp_internal.c" 223#include "pwd_grp_internal.c"
224#endif
217 225
218#define GETXXKEY_R_FUNC getpwuid_R 226#define GETXXKEY_R_FUNC getpwuid_R
219#define GETXXKEY_R_PARSER __parsepwent 227#define GETXXKEY_R_PARSER __parsepwent
@@ -253,6 +261,7 @@ struct group *getgrgid(gid_t gid)
253 return result; 261 return result;
254} 262}
255 263
264#if 0 //ENABLE_USE_BB_SHADOW
256/* This function is non-standard and is currently not built. It seems 265/* This function is non-standard and is currently not built. It seems
257 * to have been created as a reentrant version of the non-standard 266 * to have been created as a reentrant version of the non-standard
258 * functions getspuid. Why getspuid was added, I do not know. */ 267 * functions getspuid. Why getspuid was added, I do not know. */
@@ -286,6 +295,7 @@ struct spwd *getspuid(uid_t uid)
286 getspuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result); 295 getspuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result);
287 return result; 296 return result;
288} 297}
298#endif
289 299
290struct passwd *getpwnam(const char *name) 300struct passwd *getpwnam(const char *name)
291{ 301{
@@ -307,6 +317,7 @@ struct group *getgrnam(const char *name)
307 return result; 317 return result;
308} 318}
309 319
320#if ENABLE_USE_BB_SHADOW
310struct spwd *getspnam(const char *name) 321struct spwd *getspnam(const char *name)
311{ 322{
312 static char buffer[PWD_BUFFER_SIZE]; 323 static char buffer[PWD_BUFFER_SIZE];
@@ -316,6 +327,7 @@ struct spwd *getspnam(const char *name)
316 getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); 327 getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result);
317 return result; 328 return result;
318} 329}
330#endif
319 331
320int getpw(uid_t uid, char *buf) 332int getpw(uid_t uid, char *buf)
321{ 333{
@@ -444,6 +456,7 @@ int getgrent_r(struct group *__restrict resultbuf,
444 return rv; 456 return rv;
445} 457}
446 458
459#if ENABLE_USE_BB_SHADOW
447static FILE *spf /*= NULL*/; 460static FILE *spf /*= NULL*/;
448void setspent(void) 461void setspent(void)
449{ 462{
@@ -488,6 +501,7 @@ int getspent_r(struct spwd *resultbuf, char *buffer,
488 UNLOCK; 501 UNLOCK;
489 return rv; 502 return rv;
490} 503}
504#endif
491 505
492struct passwd *getpwent(void) 506struct passwd *getpwent(void)
493{ 507{
@@ -509,6 +523,7 @@ struct group *getgrent(void)
509 return result; 523 return result;
510} 524}
511 525
526#if ENABLE_USE_BB_SHADOW
512struct spwd *getspent(void) 527struct spwd *getspent(void)
513{ 528{
514 static char line_buff[PWD_BUFFER_SIZE]; 529 static char line_buff[PWD_BUFFER_SIZE];
@@ -528,6 +543,7 @@ struct spwd *sgetspent(const char *string)
528 sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result); 543 sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result);
529 return result; 544 return result;
530} 545}
546#endif
531 547
532int initgroups(const char *user, gid_t gid) 548int initgroups(const char *user, gid_t gid)
533{ 549{
@@ -643,6 +659,7 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f)
643 return rv; 659 return rv;
644} 660}
645 661
662#if ENABLE_USE_BB_SHADOW
646static const unsigned char _sp_off[] = { 663static const unsigned char _sp_off[] = {
647 offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ 664 offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */
648 offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ 665 offsetof(struct spwd, sp_min), /* 3 - not a char ptr */
@@ -688,6 +705,7 @@ int putspent(const struct spwd *p, FILE *stream)
688DO_UNLOCK: 705DO_UNLOCK:
689 return rv; 706 return rv;
690} 707}
708#endif
691 709
692/**********************************************************************/ 710/**********************************************************************/
693/* Internal uClibc functions. */ 711/* Internal uClibc functions. */
@@ -846,6 +864,7 @@ int __parsegrent(void *data, char *line)
846 864
847/**********************************************************************/ 865/**********************************************************************/
848 866
867#if ENABLE_USE_BB_SHADOW
849static const unsigned char sp_off[] = { 868static const unsigned char sp_off[] = {
850 offsetof(struct spwd, sp_namp), /* 0 */ 869 offsetof(struct spwd, sp_namp), /* 0 */
851 offsetof(struct spwd, sp_pwdp), /* 1 */ 870 offsetof(struct spwd, sp_pwdp), /* 1 */
@@ -900,6 +919,7 @@ int __parsespent(void *data, char * line)
900 919
901 return EINVAL; 920 return EINVAL;
902} 921}
922#endif
903 923
904/**********************************************************************/ 924/**********************************************************************/
905 925
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index bcb7f2b26..0d910f56a 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -275,7 +275,8 @@ int passwd_main(int argc, char **argv)
275 } 275 }
276 276
277 filename = bb_path_passwd_file; 277 filename = bb_path_passwd_file;
278 if (ENABLE_FEATURE_SHADOWPASSWDS) { 278#if ENABLE_FEATURE_SHADOWPASSWDS
279 {
279 struct spwd *sp = getspnam(name); 280 struct spwd *sp = getspnam(name);
280 if (!sp) { 281 if (!sp) {
281 /* LOGMODE_BOTH */ 282 /* LOGMODE_BOTH */
@@ -287,6 +288,7 @@ int passwd_main(int argc, char **argv)
287 pw->pw_passwd = sp->sp_pwdp; 288 pw->pw_passwd = sp->sp_pwdp;
288 } 289 }
289 } 290 }
291#endif
290 292
291 /* Decide what the new password will be */ 293 /* Decide what the new password will be */
292 newp = NULL; 294 newp = NULL;
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index c07264e7b..8bcb393f5 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -41,7 +41,6 @@ int sulogin_main(int argc, char **argv)
41 char *timeout_arg; 41 char *timeout_arg;
42 const char * const *p; 42 const char * const *p;
43 struct passwd *pwd; 43 struct passwd *pwd;
44 struct spwd *spwd;
45 const char *shell; 44 const char *shell;
46 45
47 logmode = LOGMODE_BOTH; 46 logmode = LOGMODE_BOTH;
@@ -75,13 +74,15 @@ int sulogin_main(int argc, char **argv)
75 goto auth_error; 74 goto auth_error;
76 } 75 }
77 76
78 if (ENABLE_FEATURE_SHADOWPASSWDS) { 77#if ENABLE_FEATURE_SHADOWPASSWDS
79 spwd = getspnam(pwd->pw_name); 78 {
79 struct spwd *spwd = getspnam(pwd->pw_name);
80 if (!spwd) { 80 if (!spwd) {
81 goto auth_error; 81 goto auth_error;
82 } 82 }
83 pwd->pw_passwd = spwd->sp_pwdp; 83 pwd->pw_passwd = spwd->sp_pwdp;
84 } 84 }
85#endif
85 86
86 while (1) { 87 while (1) {
87 /* cp points to a static buffer that is zeroed every time */ 88 /* cp points to a static buffer that is zeroed every time */