~ubuntu-branches/ubuntu/wily/sup/wily

« back to all changes in this revision

Viewing changes to wrap_pwd.c

  • Committer: Bazaar Package Importer
  • Author(s): Jochen Friedrich
  • Date: 2006-11-02 15:03:30 UTC
  • mfrom: (1.1.1 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061102150330-yt4yavw4rj1hz8yj
Tags: 20060803-2
Fix CFLAGS, so libwrap is built into sup again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* wrap_pwd.c: Copyright (C) TOYODA Eizi, 1997 */
2
 
/* In the public domain. */
3
 
 
4
 
#include <stdio.h>
5
 
#include <sys/types.h>
6
 
#include <pwd.h>
7
 
#include <shadow.h>
8
 
 
9
 
#define _WRAP_PWD_NO_MACROS
10
 
#include "wrap_pwd.h"
11
 
 
12
 
static struct passwd  pw;
13
 
 
14
 
      struct passwd *
15
 
wrap_getpwnam(const char *name)
16
 
{
17
 
      struct passwd   *xpw;
18
 
      struct spwd     *shadow;
19
 
      pw = *(xpw = getpwnam(name));
20
 
      if ((shadow = getspnam(name)) != NULL) {
21
 
              pw.pw_passwd = shadow->sp_pwdp;
22
 
      }
23
 
      return &pw;
24
 
}
25
 
 
26
 
      struct passwd *
27
 
wrap_getpwuid(uid_t uid)
28
 
{
29
 
      struct passwd   *xpw;
30
 
      struct spwd     *shadow;
31
 
      pw = *(xpw = getpwuid(uid));
32
 
      if ((shadow = getspnam(pw.pw_name)) != NULL) {
33
 
              pw.pw_passwd = shadow->sp_pwdp;
34
 
      }
35
 
      return &pw;
36
 
}