Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--nss/passwd.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 5a4fac5..b3b25bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -364,6 +364,10 @@ then
#include <netinet/ether.h>
#endif])
+ # check if struct passwd has a pw_class member
+ AC_CHECK_MEMBERS([struct passwd.pw_class],,,[
+ #include <pwd.h>])
+
# check for a definition of struct rpcent
AC_CHECK_TYPES(struct rpcent,,,[
#include <netdb.h>
diff --git a/nss/passwd.c b/nss/passwd.c
index 43694ef..a5cc3f0 100644
--- a/nss/passwd.c
+++ b/nss/passwd.c
@@ -45,6 +45,10 @@ static nss_status_t read_passwd(
READ_BUF_STRING(fp,result->pw_gecos);
READ_BUF_STRING(fp,result->pw_dir);
READ_BUF_STRING(fp,result->pw_shell);
+#ifdef HAVE_STRUCT_PASSWD_PW_CLASS
+ /* set the user access class to an empty string */
+ result->pw_class=result->pw_name+strlen(result->pw_name);
+#endif /* HAVE_STRUCT_PASSWD_PW_CLASS */
return NSS_STATUS_SUCCESS;
}