File: pwdb_map.h

package info (click to toggle)
pwdb 0.54preD-3
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 644 kB
  • ctags: 797
  • sloc: ansic: 8,459; makefile: 346; sh: 204
file content (98 lines) | stat: -rw-r--r-- 3,329 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * $Id$
 *
 * This file is intended to provide a simple mapping from old,
 * libc-based passwd manipulation functions to their equivalent
 * functions in the pwdb library.
 *
 * This file should be included in all 'pw' and 'sp' manipulating
 * source code that wishes to make use of these replacement database
 * functions.
 *
 * Written by Andrew G. Morgan <morgan@parc.power.net>
 *
 * [Please use at your own risk. I cannot be held accountable for any
 * problems you may encounter with this file. Life is too short. You
 * have the source: read it.]
 */

#ifndef PWDB_MAP_H
#define PWDB_MAP_H

#define _PWD_H      1           /* stops inclusion of <pwd.h> */
#define _SHADOW_H   1           /* stops inclusion of <shadow.h> */

#include <pwdb/pwdb_unix.h>
#include <pwdb/pwdb_shadow.h>
#include <pwdb/pwdb_common.h>

/*
 * What follows are a set of macros that completely redirect standard
 * 'pw' and 'sp' definitions to those associated with the pwdb library */

/* structures */

#define passwd __pwdb_passwd                 /* - vanilla UNIX - */
#define spwd   __pwdb_spwd                   /* - SHADOW - */

#define group  __pwdb_group                  /* - GROUP - */
#define sgrp   __pwdb_sgrp                   /* - GSHADOW - */

/* functions */

/* - vanilla UNIX - */

#define getpwent()                           __pwdb_getpwent()

#define setpwent()                           __pwdb_setpwent()
#define endpwent()                           __pwdb_endpwent()

#define fgetpwent(/* (FILE *) */ f)          __pwdb_fgetpwent(f)
#define putpwent(/* (const struct passwd *) */ p, /* (FILE *) */ f) \
                                             __pwdb_fgetpwent(p,f)

#define getpwnam(/* (const char *) */ user)  __pwdb_getpwnam(user)
#define getpwuid(/* (uid_t) */ uid)          __pwdb_getpwuid(uid)

#define sgetpwent(/* (char *) */buf)         __pwdb_sgetpwent(buf)

/* - SHADOW - */

#define getspent()                           __pwdb_getspent()

#define setspent()                           __pwdb_setspent()
#define endspent()                           __pwdb_endspent()

#define fgetspent(/* (FILE *) */ f)          __pwdb_fgetspent(f)
#define putspent(/* (const struct spwd *) */ s, /* (FILE *) */ f) \
                                             __pwdb_putspent(s,f)

#define getspnam(/* (const char *) */ name)  __pwdb_getspnam(name)

#define sgetspent(/* (const char *) */ e)    __pwdb_sgetspent(e)

/* - GROUP / GSHADOW - */

#define setgrent()                          __pwdb_setgrent()
#define setsgent()                          __pwdb_setsgent()

#define endgrent()                          __pwdb_endgrent()
#define endsgent()                          __pwdb_endsgent()

#define getgrent()                          __pwdb_getgrent()
#define getsgent()                          __pwdb_getsgent()

#define fgetgrent(/* (FILE *) */ f)         __pwdb_fgetgrent(f)
#define fgetsgent(/* (FILE *) */ f)         __pwdb_fgetsgent(f)

#define getgrnam(/* (const char *) */ name) __pwdb_getgrnam(name)
#define getsgnam(/* (const char *) */ name) __pwdb_getsgnam(name)

#define getgrgid(/* (gid_t) */ g)           __pwdb_getgrgid(g)

/* Locking functions */

#define lckpwdf()                            __pwdb_lckpwdf()
#define ulckpwdf()                           __pwdb_ulckpwdf()

#endif /* PWDB_MAP_H */