diff options
author | djl <none@none> | 2006-09-29 06:00:17 -0700 |
---|---|---|
committer | djl <none@none> | 2006-09-29 06:00:17 -0700 |
commit | cb5caa98562cf06753163f558cbcfe30b8f4673a (patch) | |
tree | 7a24623821583899295e29553207e69701b471ff /usr/src/lib/libsecdb/common/getuserattr.c | |
parent | 350f572a3fa518fc3690d53066c2c54fd03b5a08 (diff) | |
download | illumos-joyent-cb5caa98562cf06753163f558cbcfe30b8f4673a.tar.gz |
PSARC 2005/133 Sparks: Name Service Switch 2
4406529 artificial limit of 10 threads per backend
4516075 LDAP connections could be reused more
4696964 LDAP naming services should support Kerberos authentication
4740951 Need host based authentication options in Native LDAP
4952533 Some backends of gethostby* do not set h_errno correctly
4979596 getXbyY calls should have better buffer mechanism
5028908 /usr/bin/logins accesses free memory deep in nss_getent_u().
5046881 nscd: old-data-ok parameter is not useful, should go away
6225323 NSS/nscd Enhancements (Sparks Project)
--HG--
rename : usr/src/cmd/nscd/attrstr.c => deleted_files/usr/src/cmd/nscd/attrstr.c
rename : usr/src/cmd/nscd/hash.c => deleted_files/usr/src/cmd/nscd/hash.c
rename : usr/src/cmd/nscd/nscd_parse.c => deleted_files/usr/src/cmd/nscd/nscd_parse.c
rename : usr/src/cmd/nscd/nscd.h => usr/src/cmd/nscd/cache.h
Diffstat (limited to 'usr/src/lib/libsecdb/common/getuserattr.c')
-rw-r--r-- | usr/src/lib/libsecdb/common/getuserattr.c | 109 |
1 files changed, 3 insertions, 106 deletions
diff --git a/usr/src/lib/libsecdb/common/getuserattr.c b/usr/src/lib/libsecdb/common/getuserattr.c index 7c0c8b9ff8..dd0789b5dd 100644 --- a/usr/src/lib/libsecdb/common/getuserattr.c +++ b/usr/src/lib/libsecdb/common/getuserattr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -46,7 +45,6 @@ extern void _enduserattr(void); static userattr_t *userstr2attr(userstr_t *); -static userstr_t *process_getuser(userstr_t *, char *, int, nsc_data_t *); userattr_t * @@ -80,51 +78,11 @@ userattr_t * getusernam(const char *name) { int err = 0; - int ndata; - int adata; char buf[NSS_BUFLEN_USERATTR]; userstr_t user; - union { - nsc_data_t s_d; - char s_b[1024]; - } space; - nsc_data_t *sptr; userstr_t *resptr = (userstr_t *)NULL; -#ifdef PIC - if ((name == NULL) || - (strlen(name) >= (sizeof (space) - sizeof (nsc_data_t)))) { - errno = ERANGE; - return ((userattr_t *)NULL); - } - ndata = sizeof (space); - adata = strlen(name) + sizeof (nsc_call_t) + 1; - space.s_d.nsc_call.nsc_callnumber = GETUSERNAM; - (void) strcpy(space.s_d.nsc_call.nsc_u.name, name); - sptr = &space.s_d; - - switch (_nsc_trydoorcall(&sptr, &ndata, &adata)) { - case SUCCESS: /* positive cache hit */ - break; - case NOTFOUND: /* negative cache hit */ - return ((userattr_t *)NULL); - default: - (void) memset(&user, 0, sizeof (userattr_t)); - resptr = _getusernam(name, &user, buf, - NSS_BUFLEN_USERATTR, &err); - return (userstr2attr(resptr)); - } - resptr = process_getuser(&user, buf, NSS_BUFLEN_USERATTR, sptr); - - /* - * check if doors reallocated the memory underneath us - * if they did munmap it or suffer a memory leak - */ - if (sptr != &space.s_d) - (void) munmap((void *)sptr, ndata); -#else /* !PIC */ resptr = _getusernam(name, &user, buf, NSS_BUFLEN_USERATTR, &err); -#endif /* PIC */ return (userstr2attr(resptr)); @@ -191,67 +149,6 @@ userstr2attr(userstr_t *user) } -static userstr_t * -process_getuser( - userstr_t *result, - char *buffer, - int buflen, - nsc_data_t *sptr) -{ - char *fixed; -#ifdef _LP64 - userstr_t user64; - - fixed = (char *)(((uintptr_t)buffer + 7) & ~7); -#else - fixed = (char *)(((uintptr_t)buffer + 3) & ~3); -#endif - buflen -= fixed - buffer; - buffer = fixed; - - if (sptr->nsc_ret.nsc_return_code != SUCCESS) - return ((userstr_t *)NULL); - -#ifdef _LP64 - if (sptr->nsc_ret.nsc_bufferbytesused - (int)sizeof (userstr32_t) - > buflen) -#else - if (sptr->nsc_ret.nsc_bufferbytesused - (int)sizeof (userstr_t) - > buflen) -#endif - { - errno = ERANGE; - return ((userstr_t *)NULL); - } - -#ifdef _LP64 - (void) memcpy(buffer, (sptr->nsc_ret.nsc_u.buff + sizeof (userstr32_t)), - (sptr->nsc_ret.nsc_bufferbytesused - sizeof (userstr32_t))); - user64.name = (char *)(sptr->nsc_ret.nsc_u.user.name + - (uintptr_t)buffer); - user64.qualifier = (char *)(sptr->nsc_ret.nsc_u.user.qualifier + - (uintptr_t)buffer); - user64.res1 = (char *)(sptr->nsc_ret.nsc_u.user.res1 + - (uintptr_t)buffer); - user64.res2 = (char *)(sptr->nsc_ret.nsc_u.user.res2 + - (uintptr_t)buffer); - user64.attr = (char *)(sptr->nsc_ret.nsc_u.user.attr + - (uintptr_t)buffer); - *result = user64; -#else - sptr->nsc_ret.nsc_u.user.name += (uintptr_t)buffer; - sptr->nsc_ret.nsc_u.user.qualifier += (uintptr_t)buffer; - sptr->nsc_ret.nsc_u.user.res1 += (uintptr_t)buffer; - sptr->nsc_ret.nsc_u.user.res2 += (uintptr_t)buffer; - sptr->nsc_ret.nsc_u.user.attr += (uintptr_t)buffer; - *result = sptr->nsc_ret.nsc_u.user; - (void) memcpy(buffer, (sptr->nsc_ret.nsc_u.buff + sizeof (userstr_t)), - (sptr->nsc_ret.nsc_bufferbytesused - sizeof (userstr_t))); -#endif - return (result); -} - - #ifdef DEBUG void print_userattr(userattr_t *user) |