]>
Commit | Line | Data |
---|---|---|
c3a08f59 A |
1 | #ifndef _DIRECTORY_SERVICE_H_ |
2 | #define _DIRECTORY_SERVICE_H_ | |
3 | ||
4 | #include <stdio.h> | |
5 | #include <string.h> | |
6 | #include <sys/types.h> | |
7 | #include <sys/wait.h> | |
8 | #include <stdlib.h> | |
9 | #include <unistd.h> | |
10 | #include <pwd.h> | |
11 | #include <errno.h> | |
12 | #include <DirectoryService/DirectoryService.h> | |
13 | ||
14 | /*--------------------------------------------------------------------------- | |
15 | * Convenience macros: to be used to provide a cleanup section (eg, to | |
16 | * deallocate memory, etc). IF, CLEANUP and ENDIF must always be used, and | |
17 | * must be used with braces; ELSE is optional, but must also be used with | |
18 | * braces. | |
19 | * | |
20 | * IF(expression) { | |
21 | * ... | |
22 | * } CLEANUP { | |
23 | * ... | |
24 | * } ELSE { | |
25 | * ... | |
26 | * } ENDIF | |
27 | * | |
28 | * "break" may be used in the IF section to exit the block prematurely; the | |
29 | * CLEANUP section will still be performed. "break" in the CLEANUP and ELSE | |
30 | * sections apply to higher level blocks. | |
31 | *---------------------------------------------------------------------------*/ | |
32 | #define IF(x) if(x) { do | |
33 | #define CLEANUP while(0); | |
34 | #define ELSE } else { | |
35 | #define ENDIF } | |
36 | ||
37 | /*--------------------------------------------------------------------------- | |
38 | * Error codes (not including DirectoryService error codes and standard error | |
39 | * codes) | |
40 | *---------------------------------------------------------------------------*/ | |
41 | #define E_NOTFOUND -1000 | |
42 | #define E_NOGLOBALCONFIG -1001 | |
43 | #define E_NOLOOKUPORDER -1002 | |
44 | #define E_POPENFAILED -1003 | |
45 | #define E_CHILDFAILED -1004 | |
46 | #define E_DATALISTOUTOFMEM -1005 | |
47 | #define E_PATHOUTOFMEM -1006 | |
48 | #define E_NICLFAILED -1007 | |
49 | ||
50 | /*--------------------------------------------------------------------------- | |
51 | * Success return values from wherepwent() | |
52 | *---------------------------------------------------------------------------*/ | |
53 | enum { | |
54 | WHERE_FILES = 0, | |
55 | WHERE_LOCALNI, | |
56 | WHERE_REMOTENI, | |
57 | WHERE_DS, | |
58 | WHERE_NIS, | |
59 | }; | |
60 | ||
61 | /*--------------------------------------------------------------------------- | |
62 | * Global variables | |
63 | *---------------------------------------------------------------------------*/ | |
2fc1e207 | 64 | extern char *DSPath; |
c3a08f59 A |
65 | extern const char MasterPasswd[]; |
66 | ||
67 | /*--------------------------------------------------------------------------- | |
68 | * Function prototypes | |
69 | *---------------------------------------------------------------------------*/ | |
70 | extern void setrestricted(int where, struct passwd *pw); | |
71 | extern void update_local_ni(struct passwd *pworig, struct passwd *pw); | |
72 | extern int wherepwent(const char *name); | |
73 | ||
74 | #endif /* _DIRECTORY_SERVICE_H_ */ |