net ads info now reports the IP of the LDAP server as well as its name - very useful...
[ira/wip.git] / source3 / include / ads.h
1 /*
2   header for ads (active directory) library routines
3
4   basically this is a wrapper around ldap
5 */
6
7 typedef struct {
8         void *ld;
9         char *realm;
10         char *workgroup;
11         char *ldap_server;
12         char *ldap_server_name;
13         char *kdc_server;
14         int ldap_port;
15         char *bind_path;
16         time_t last_attempt;
17         char *password;
18         char *user_name;
19         char *server_realm;
20         struct in_addr ldap_ip;
21 } ADS_STRUCT;
22
23 typedef struct {
24         char *printerName;
25         char *serverName;
26         char *shortServerName;
27         char *versionNumber;
28         char *uNCName;
29         char **description;
30         char *assetNumber;
31         char *bytesPerMinute;
32         char *defaultPriority;
33         char *driverName;
34         char *driverVersion;
35         char *location;
36         char *operatingSystem;
37         char *operatingSystemHotfix;
38         char *operatingSystemServicePack;
39         char *operatingSystemVersion;
40         char *physicalLocationObject;
41         char **portName;
42         char *printAttributes;
43         char **printBinNames;
44         char *printCollate;
45         char *printColor;
46         char *printDuplexSupported;
47         char *printEndTime;
48         char *printFOrmName;
49         char *printKeepPrintedJobs;
50         char **printLanguage;
51         char *printMACAddress;
52         char *printMaxCopies;
53         char *printMaxResolutionSupported;
54         char *printMaxXExtent;
55         char *printMaxYExtent;
56         char **printMediaReady;
57         char **printMediaSupported;
58         char *printMemory;
59         char *printMinXExtent;
60         char *printMinYExtent;
61         char *printNetworkAddress;
62         char *printNotify;
63         char *printNumberUp;
64         char **printOrientationsSupported;
65         char *printOwner;
66         char *printPagesPerMinute;
67         char *printRate;
68         char *printRateUnit;
69         char *printSeparatorFile;
70         char **printShareName;
71         char *printSpooling;
72         char *printStaplingSupported;
73         char *printStartTime;
74         char *printStatus;
75         char *priority;
76 } ADS_PRINTER_ENTRY;
77
78 /* there are 4 possible types of errors the ads subsystem can produce */
79 enum ads_error_type {ADS_ERROR_KRB5, ADS_ERROR_GSS, 
80                      ADS_ERROR_LDAP, ADS_ERROR_SYSTEM};
81
82 typedef struct {
83         enum ads_error_type error_type;
84         int rc;
85         /* For error_type = ADS_ERROR_GSS minor_status describe GSS API error */
86         /* Where rc represents major_status of GSS API error */
87         int minor_status;
88 } ADS_STATUS;
89
90 #ifdef HAVE_ADS
91 typedef LDAPMod **ADS_MODLIST;
92 #else
93 typedef void **ADS_MODLIST;
94 #endif
95
96 /* macros to simplify error returning */
97 #define ADS_ERROR(rc) ads_build_error(ADS_ERROR_LDAP, rc, 0)
98 #define ADS_ERROR_SYSTEM(rc) ads_build_error(ADS_ERROR_SYSTEM, rc, 0)
99 #define ADS_ERROR_KRB5(rc) ads_build_error(ADS_ERROR_KRB5, rc, 0)
100 #define ADS_ERROR_GSS(rc, minor) ads_build_error(ADS_ERROR_GSS, rc, minor)
101
102 #define ADS_ERR_OK(status) ((status).rc == 0)
103 #define ADS_SUCCESS ADS_ERROR(0)
104
105 /* time between reconnect attempts */
106 #define ADS_RECONNECT_TIME 5
107
108 /* timeout on searches */
109 #define ADS_SEARCH_TIMEOUT 10
110
111 /* ldap control oids */
112 #define ADS_PAGE_CTL_OID "1.2.840.113556.1.4.319"
113 #define ADS_NO_REFERRALS_OID "1.2.840.113556.1.4.1339"
114 #define ADS_SERVER_SORT_OID "1.2.840.113556.1.4.473"
115
116 #define UF_DONT_EXPIRE_PASSWD           0x10000
117 #define UF_MNS_LOGON_ACCOUNT            0x20000
118 #define UF_SMARTCARD_REQUIRED           0x40000
119 #define UF_TRUSTED_FOR_DELEGATION       0x80000
120 #define UF_NOT_DELEGATED               0x100000
121 #define UF_USE_DES_KEY_ONLY            0x200000
122 #define UF_DONT_REQUIRE_PREAUTH        0x400000
123
124 #define UF_TEMP_DUPLICATE_ACCOUNT       0x0100
125 #define UF_NORMAL_ACCOUNT               0x0200
126 #define UF_INTERDOMAIN_TRUST_ACCOUNT    0x0800
127 #define UF_WORKSTATION_TRUST_ACCOUNT    0x1000
128 #define UF_SERVER_TRUST_ACCOUNT         0x2000
129
130 /* account types */
131 #define ATYPE_GROUP               0x10000000
132 #define ATYPE_USER                0x30000000