1272343Sngie/*
2272343Sngie * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska H��gskolan
3272343Sngie * (Royal Institute of Technology, Stockholm, Sweden).
4272343Sngie * All rights reserved.
5272343Sngie *
6272343Sngie * Redistribution and use in source and binary forms, with or without
7272343Sngie * modification, are permitted provided that the following conditions
8272343Sngie * are met:
9272343Sngie *
10272343Sngie * 1. Redistributions of source code must retain the above copyright
11272343Sngie *    notice, this list of conditions and the following disclaimer.
12272343Sngie *
13272343Sngie * 2. Redistributions in binary form must reproduce the above copyright
14272343Sngie *    notice, this list of conditions and the following disclaimer in the
15272343Sngie *    documentation and/or other materials provided with the distribution.
16272343Sngie *
17272343Sngie * 3. Neither the name of the Institute nor the names of its contributors
18272343Sngie *    may be used to endorse or promote products derived from this software
19272343Sngie *    without specific prior written permission.
20272343Sngie *
21272343Sngie * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22272343Sngie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23272343Sngie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24272343Sngie * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25272343Sngie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26272343Sngie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27272343Sngie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28272343Sngie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29272343Sngie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30272343Sngie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31272343Sngie * SUCH DAMAGE.
32272343Sngie */
33272343Sngie
34272343Sngie#include <config.h>
35272343Sngie
36272343Sngie#include "roken.h"
37272343Sngie#ifdef HAVE_SHADOW_H
38272343Sngie#include <shadow.h>
39272343Sngie#endif
40272343Sngie
41272343SngieROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL
42272343Sngiek_getpwnam (const char *user)
43272343Sngie{
44272343Sngie     struct passwd *p;
45272343Sngie
46272343Sngie     p = getpwnam (user);
47272343Sngie#if defined(HAVE_GETSPNAM) && defined(HAVE_STRUCT_SPWD)
48272343Sngie     if(p)
49272343Sngie     {
50272343Sngie	  struct spwd *spwd;
51272343Sngie
52272343Sngie	  spwd = getspnam (user);
53272343Sngie	  if (spwd)
54272343Sngie	       p->pw_passwd = spwd->sp_pwdp;
55272343Sngie	  endspent ();
56272343Sngie     }
57272343Sngie#else
58272343Sngie     endpwent ();
59272343Sngie#endif
60272343Sngie     return p;
61272343Sngie}
62272343Sngie