diff options
-rw-r--r-- | usr/src/lib/nsswitch/compat/common/compat_common.c | 33 | ||||
-rw-r--r-- | usr/src/lib/nsswitch/files/common/netmasks.c | 4 | ||||
-rw-r--r-- | usr/src/lib/nsswitch/ldap/common/getgrent.c | 7 | ||||
-rw-r--r-- | usr/src/lib/nsswitch/nis/common/getnetgrent.c | 4 |
4 files changed, 29 insertions, 19 deletions
diff --git a/usr/src/lib/nsswitch/compat/common/compat_common.c b/usr/src/lib/nsswitch/compat/common/compat_common.c index 903a2e9e40..d696f80b3c 100644 --- a/usr/src/lib/nsswitch/compat/common/compat_common.c +++ b/usr/src/lib/nsswitch/compat/common/compat_common.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Common code and structures used by name-service-switch "compat" backends. @@ -544,21 +544,30 @@ _attrdb_compat_XY_all(be, argp, netdb, check, op_num) /* * assume a NULL buf.result pointer is an indication * that the lookup result should be returned in /etc - * file format + * file format (if called from _nss_compat_getent(), + * be->return_string_data and argp->buf.result + * would be set already if argp->buf.result is NULL) */ - if (argp->buf.result == NULL) { - be->return_string_data = 1; + if (check != NULL) { + if (argp->buf.result == NULL) { + be->return_string_data = 1; - /* - * the code executed later needs the result struct - * as working area - */ - argp->buf.result = be->workarea; + /* + * the code executed later needs the result struct + * as working area + */ + argp->buf.result = be->workarea; + } else + be->return_string_data = 0; + } + + /* + * use an alternate str2ent function if necessary + */ + if (be->return_string_data == 1) func = be->str2ent_alt; - } else { - be->return_string_data = 0; + else func = argp->str2ent; - } /*CONSTCOND*/ while (1) { diff --git a/usr/src/lib/nsswitch/files/common/netmasks.c b/usr/src/lib/nsswitch/files/common/netmasks.c index 2fe4a2fe1b..6a0a166acb 100644 --- a/usr/src/lib/nsswitch/files/common/netmasks.c +++ b/usr/src/lib/nsswitch/files/common/netmasks.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * files/netmasks.c -- "files" backend for nsswitch "netmasks" database @@ -100,7 +100,7 @@ getbynet(be, a) argp->buf.buffer = tmpbuf; argp->buf.buflen = NSS_LINELEN_NETMASKS; } - res = _nss_files_XY_all(be, argp, 0, argp->key.name, check_addr); + res = _nss_files_XY_all(be, argp, 1, argp->key.name, check_addr); if (argp->buf.result != NULL) { argp->buf.buffer = NULL; argp->buf.buflen = 0; diff --git a/usr/src/lib/nsswitch/ldap/common/getgrent.c b/usr/src/lib/nsswitch/ldap/common/getgrent.c index 3456b6241f..c22a48ba8d 100644 --- a/usr/src/lib/nsswitch/ldap/common/getgrent.c +++ b/usr/src/lib/nsswitch/ldap/common/getgrent.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -127,8 +127,8 @@ _nss_ldap_group2str(ldap_backend_ptr be, nss_XbyY_args_t *argp) members = __ns_ldap_getAttrStruct(result->entry, _G_MEM); if (members == NULL || members->attrvalue == NULL) { - nss_result = NSS_STR_PARSE_PARSE; - goto result_grp2str; + /* no member is fine, skip processing the member list */ + goto nomember; } for (i = 0; i < members->value_count; i++) { @@ -147,6 +147,7 @@ _nss_ldap_group2str(ldap_backend_ptr be, nss_XbyY_args_t *argp) TEST_AND_ADJUST(len, buffer, buflen, result_grp2str); } } +nomember: /* The front end marshaller doesn't need the trailing nulls */ if (argp->buf.result != NULL) be->buflen = strlen(be->buffer); diff --git a/usr/src/lib/nsswitch/nis/common/getnetgrent.c b/usr/src/lib/nsswitch/nis/common/getnetgrent.c index 92a631421f..76c1f5d5c1 100644 --- a/usr/src/lib/nsswitch/nis/common/getnetgrent.c +++ b/usr/src/lib/nsswitch/nis/common/getnetgrent.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -805,7 +805,7 @@ easy_way(be, ia, argp, map, try_lc, statusp) /* =====> is this (an authoritative "no") always the right thing to do? */ /* Answer: yes, except for hostnames that aren't all lowercase */ - *statusp = NSS_SUCCESS; /* Yup, three different flavours of */ + *statusp = NSS_NOTFOUND; /* Yup, three different flavours of */ ia->status = NSS_NETGR_NO; /* status information, so-called. */ return (1); /* Silly, innit? */ } |