summaryrefslogtreecommitdiff
path: root/usr/src/lib/libsecdb/common/getuserattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libsecdb/common/getuserattr.c')
-rw-r--r--usr/src/lib/libsecdb/common/getuserattr.c109
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)