summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetze <metze@0c0555d6-39d7-0310-84fc-f1cc0bd64818>2007-11-06 12:34:50 +0000
committerStefan Metzmacher <metze@samba.org>2007-11-09 09:53:01 +0100
commitc4a20912b12915281cbe68e6816475eda7191e56 (patch)
treefb464881672b8053026b20b8ca624f45631c9816
parent39d65a9f50b67b3cffb4ba3c01bcfdff563b6764 (diff)
downloadsamba-c4a20912b12915281cbe68e6816475eda7191e56.tar.gz
samba-c4a20912b12915281cbe68e6816475eda7191e56.tar.bz2
samba-c4a20912b12915281cbe68e6816475eda7191e56.zip
nss_wrapper: hopefully a better fix for the solaris get*ent_r functions
metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_4_0@25873 0c0555d6-39d7-0310-84fc-f1cc0bd64818 (This used to be commit e0c8c01650b2aa0a1ab491c9800b8aa575bf4185)
-rw-r--r--source3/lib/nss_wrapper/nss_wrapper.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source3/lib/nss_wrapper/nss_wrapper.c b/source3/lib/nss_wrapper/nss_wrapper.c
index f4ea9bb6de..5bf7ebda4f 100644
--- a/source3/lib/nss_wrapper/nss_wrapper.c
+++ b/source3/lib/nss_wrapper/nss_wrapper.c
@@ -906,7 +906,21 @@ _PUBLIC_ int nwrap_getpwent_r(struct passwd *pwdst, char *buf,
struct passwd *pw;
if (!nwrap_enabled()) {
+#ifdef SOLARIS_GETPWENT_R
+ pw = real_getpwent_r(pwdst, buf, buflen);
+ if (!pw) {
+ if (errno == 0) {
+ return ENOENT;
+ }
+ return errno;
+ }
+ if (pwdstp) {
+ *pwdstp = pw;
+ }
+ return 0;
+#else
return real_getpwent_r(pwdst, buf, buflen, pwdstp);
+#endif
}
pw = nwrap_getpwent();
@@ -1078,7 +1092,21 @@ _PUBLIC_ int nwrap_getgrent_r(struct group *grdst, char *buf,
struct group *gr;
if (!nwrap_enabled()) {
+#ifdef SOLARIS_GETGRENT_R
+ gr = real_getgrent_r(grdst, buf, buflen);
+ if (!gr) {
+ if (errno == 0) {
+ return ENOENT;
+ }
+ return errno;
+ }
+ if (grdstp) {
+ *grdstp = gr;
+ }
+ return 0;
+#else
return real_getgrent_r(grdst, buf, buflen, grdstp);
+#endif
}
gr = nwrap_getgrent();