aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTito Ragusa <farmatito@tiscali.it>2011-01-16 23:39:45 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-01-16 23:39:45 +0100
commitad3d72f082cbdb152837ae87d1d285cbbf67913a (patch)
tree5d6891db54a1c179b1fe956bff485b29e2a8945d
parente8d0a1450a04d83b540f1f58297e79c2cf0f5b4f (diff)
downloadbusybox-ad3d72f082cbdb152837ae87d1d285cbbf67913a.tar.gz
move passwd, shadow, group and gshadow path definitions to libbb.h
...and define them only if the used libc doesn't. Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/libbb.h21
-rw-r--r--include/shadow_.h5
-rw-r--r--libpwdgrp/pwd_grp.c10
3 files changed, 17 insertions, 19 deletions
diff --git a/include/libbb.h b/include/libbb.h
index d3ad6e294..67dfbc361 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -68,6 +68,19 @@
# include <shadow.h>
# endif
#endif
+/* Just in case libc doesn't define some of these... */
+#ifndef _PATH_PASSWD
+#define _PATH_PASSWD "/etc/passwd"
+#endif
+#ifndef _PATH_GROUP
+#define _PATH_GROUP "/etc/group"
+#endif
+#ifndef _PATH_SHADOW
+#define _PATH_SHADOW "/etc/shadow"
+#endif
+#ifndef _PATH_GSHADOW
+#define _PATH_GSHADOW "/etc/gshadow"
+#endif
#if defined __FreeBSD__ || defined __OpenBSD__
# include <netinet/in.h>
# include <arpa/inet.h>
@@ -1604,10 +1617,10 @@ extern const char bb_path_wtmp_file[];
* get the list of currently mounted filesystems */
#define bb_path_mtab_file IF_FEATURE_MTAB_SUPPORT("/etc/mtab")IF_NOT_FEATURE_MTAB_SUPPORT("/proc/mounts")
-#define bb_path_passwd_file "/etc/passwd"
-#define bb_path_shadow_file "/etc/shadow"
-#define bb_path_gshadow_file "/etc/gshadow"
-#define bb_path_group_file "/etc/group"
+#define bb_path_passwd_file _PATH_PASSWD
+#define bb_path_group_file _PATH_GROUP
+#define bb_path_shadow_file _PATH_SHADOW
+#define bb_path_gshadow_file _PATH_GSHADOW
#define bb_path_motd_file "/etc/motd"
diff --git a/include/shadow_.h b/include/shadow_.h
index de126ddec..648a62ab3 100644
--- a/include/shadow_.h
+++ b/include/shadow_.h
@@ -37,11 +37,6 @@ struct spwd {
unsigned long sp_flag; /* Reserved */
};
-/* Paths to the user database files */
-#ifndef _PATH_SHADOW
-#define _PATH_SHADOW "/etc/shadow"
-#endif
-
#define setspent bb_internal_setspent
#define endspent bb_internal_endspent
#define getspent bb_internal_getspent
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c
index abb6f189a..2eb9d9dd1 100644
--- a/libpwdgrp/pwd_grp.c
+++ b/libpwdgrp/pwd_grp.c
@@ -20,16 +20,6 @@
#include "libbb.h"
#include <assert.h>
-#ifndef _PATH_SHADOW
-#define _PATH_SHADOW "/etc/shadow"
-#endif
-#ifndef _PATH_PASSWD
-#define _PATH_PASSWD "/etc/passwd"
-#endif
-#ifndef _PATH_GROUP
-#define _PATH_GROUP "/etc/group"
-#endif
-
/**********************************************************************/
/* Sizes for statically allocated buffers. */