summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authormetze <metze@0c0555d6-39d7-0310-84fc-f1cc0bd64818>2007-11-06 09:26:42 +0000
committerStefan Metzmacher <metze@samba.org>2007-11-09 09:53:00 +0100
commit673d502ba3ffb70df2e75d0b521f946d7f0a2a2e (patch)
tree07650c30e6247a97b9c58216ed9fa1a3466ecd1d /source3/lib
parent05206ce0c29e1272f4ad9c30af66a62e12316d0c (diff)
downloadsamba-673d502ba3ffb70df2e75d0b521f946d7f0a2a2e.tar.gz
samba-673d502ba3ffb70df2e75d0b521f946d7f0a2a2e.tar.bz2
samba-673d502ba3ffb70df2e75d0b521f946d7f0a2a2e.zip
nss_wrapper: add solaris versions of getpwent_r and getgrent_r
metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_4_0@25868 0c0555d6-39d7-0310-84fc-f1cc0bd64818 (This used to be commit 70ea441fe46d75162adc6c4b055a9fd5fab00342)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/nss_wrapper/nss_wrapper.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/source3/lib/nss_wrapper/nss_wrapper.c b/source3/lib/nss_wrapper/nss_wrapper.c
index 1b75aa59e6..72ddd8d5c3 100644
--- a/source3/lib/nss_wrapper/nss_wrapper.c
+++ b/source3/lib/nss_wrapper/nss_wrapper.c
@@ -892,6 +892,36 @@ _PUBLIC_ struct passwd *nwrap_getpwent(void)
return pw;
}
+#ifdef SOLARIS_GETPWENT_R
+_PUBLIC_ struct passwd *nwrap_getpwent_r(struct passwd *pwdst,
+ char *buf,
+ int buflen)
+{
+ struct passwd *pw;
+ struct passwd *pwdstp = NULL;
+ int ret;
+
+ if (!nwrap_enabled()) {
+ return real_getpwent_r(pwdst, buf, buflen);
+ }
+
+ pw = nwrap_getpwent();
+ if (!pw) {
+ if (errno == 0) {
+ errno = ENOENT;
+ }
+ return NULL;
+ }
+
+ ret = nwrap_pw_copy_r(pw, pwdst, buf, buflen, &pwdstp);
+ if (ret != 0) {
+ errno = ret;
+ return NULL;
+ }
+
+ return pwdstp;
+}
+#else
_PUBLIC_ int nwrap_getpwent_r(struct passwd *pwdst, char *buf,
size_t buflen, struct passwd **pwdstp)
{
@@ -911,6 +941,7 @@ _PUBLIC_ int nwrap_getpwent_r(struct passwd *pwdst, char *buf,
return nwrap_pw_copy_r(pw, pwdst, buf, buflen, pwdstp);
}
+#endif
_PUBLIC_ void nwrap_endpwent(void)
{
@@ -1064,6 +1095,36 @@ _PUBLIC_ struct group *nwrap_getgrent(void)
return gr;
}
+#ifdef SOLARIS_GETGRENT_R
+_PUBLIC_ struct group *nwrap_getgrent_r(struct group *grdst,
+ char *buf,
+ int buflen)
+{
+ struct group *gr;
+ struct group *grdstp = NULL;
+ int ret;
+
+ if (!nwrap_enabled()) {
+ return real_getgrent_r(grdst, buf, buflen);
+ }
+
+ gr = nwrap_getgrent();
+ if (!gr) {
+ if (errno == 0) {
+ errno = ENOENT;
+ }
+ return NULL;
+ }
+
+ ret = nwrap_gr_copy_r(gr, grdst, buf, buflen, &grdstp);
+ if (ret != 0) {
+ errno = ret;
+ return NULL;
+ }
+
+ return grdstp;
+}
+#else
_PUBLIC_ int nwrap_getgrent_r(struct group *grdst, char *buf,
size_t buflen, struct group **grdstp)
{
@@ -1083,6 +1144,7 @@ _PUBLIC_ int nwrap_getgrent_r(struct group *grdst, char *buf,
return nwrap_gr_copy_r(gr, grdst, buf, buflen, grdstp);
}
+#endif
_PUBLIC_ void nwrap_endgrent(void)
{