* small formatting fixes
[Samba.git] / source / include / ads.h
blob7504a369b4b9aab5d8803b81d34f53a904239e55
1 /*
2 header for ads (active directory) library routines
4 basically this is a wrapper around ldap
5 */
7 typedef struct {
8 void *ld; /* the active ldap structure */
9 struct in_addr ldap_ip; /* the ip of the active connection, if any */
10 time_t last_attempt; /* last attempt to reconnect */
11 int ldap_port;
13 /* info needed to find the server */
14 struct {
15 char *realm;
16 char *workgroup;
17 char *ldap_server;
18 int foreign; /* set to 1 if connecting to a foreign realm */
19 } server;
21 /* info needed to authenticate */
22 struct {
23 char *realm;
24 char *password;
25 char *user_name;
26 char *kdc_server;
27 int no_bind;
28 } auth;
30 /* info derived from the servers config */
31 struct {
32 char *realm;
33 char *bind_path;
34 char *ldap_server_name;
35 } config;
36 } ADS_STRUCT;
38 typedef struct {
39 char *printerName;
40 char *serverName;
41 char *shortServerName;
42 char *versionNumber;
43 char *uNCName;
44 char **description;
45 char *assetNumber;
46 char *bytesPerMinute;
47 char *defaultPriority;
48 char *driverName;
49 char *driverVersion;
50 char *location;
51 char *operatingSystem;
52 char *operatingSystemHotfix;
53 char *operatingSystemServicePack;
54 char *operatingSystemVersion;
55 char *physicalLocationObject;
56 char **portName;
57 char *printAttributes;
58 char **printBinNames;
59 char *printCollate;
60 char *printColor;
61 char *printDuplexSupported;
62 char *printEndTime;
63 char *printFOrmName;
64 char *printKeepPrintedJobs;
65 char **printLanguage;
66 char *printMACAddress;
67 char *printMaxCopies;
68 char *printMaxResolutionSupported;
69 char *printMaxXExtent;
70 char *printMaxYExtent;
71 char **printMediaReady;
72 char **printMediaSupported;
73 char *printMemory;
74 char *printMinXExtent;
75 char *printMinYExtent;
76 char *printNetworkAddress;
77 char *printNotify;
78 char *printNumberUp;
79 char **printOrientationsSupported;
80 char *printOwner;
81 char *printPagesPerMinute;
82 char *printRate;
83 char *printRateUnit;
84 char *printSeparatorFile;
85 char **printShareName;
86 char *printSpooling;
87 char *printStaplingSupported;
88 char *printStartTime;
89 char *printStatus;
90 char *priority;
91 } ADS_PRINTER_ENTRY;
93 /* there are 4 possible types of errors the ads subsystem can produce */
94 enum ads_error_type {ADS_ERROR_KRB5, ADS_ERROR_GSS,
95 ADS_ERROR_LDAP, ADS_ERROR_SYSTEM};
97 typedef struct {
98 enum ads_error_type error_type;
99 int rc;
100 /* For error_type = ADS_ERROR_GSS minor_status describe GSS API error */
101 /* Where rc represents major_status of GSS API error */
102 int minor_status;
103 } ADS_STATUS;
105 #ifdef HAVE_ADS
106 typedef LDAPMod **ADS_MODLIST;
107 #else
108 typedef void **ADS_MODLIST;
109 #endif
111 /* macros to simplify error returning */
112 #define ADS_ERROR(rc) ads_build_error(ADS_ERROR_LDAP, rc, 0)
113 #define ADS_ERROR_SYSTEM(rc) ads_build_error(ADS_ERROR_SYSTEM, rc?rc:EINVAL, 0)
114 #define ADS_ERROR_KRB5(rc) ads_build_error(ADS_ERROR_KRB5, rc, 0)
115 #define ADS_ERROR_GSS(rc, minor) ads_build_error(ADS_ERROR_GSS, rc, minor)
117 #define ADS_ERR_OK(status) ((status).rc == 0)
118 #define ADS_SUCCESS ADS_ERROR(0)
120 /* time between reconnect attempts */
121 #define ADS_RECONNECT_TIME 5
123 /* timeout on searches */
124 #define ADS_SEARCH_TIMEOUT 10
126 /* ldap control oids */
127 #define ADS_PAGE_CTL_OID "1.2.840.113556.1.4.319"
128 #define ADS_NO_REFERRALS_OID "1.2.840.113556.1.4.1339"
129 #define ADS_SERVER_SORT_OID "1.2.840.113556.1.4.473"
131 #define UF_DONT_EXPIRE_PASSWD 0x10000
132 #define UF_MNS_LOGON_ACCOUNT 0x20000
133 #define UF_SMARTCARD_REQUIRED 0x40000
134 #define UF_TRUSTED_FOR_DELEGATION 0x80000
135 #define UF_NOT_DELEGATED 0x100000
136 #define UF_USE_DES_KEY_ONLY 0x200000
137 #define UF_DONT_REQUIRE_PREAUTH 0x400000
139 #define UF_TEMP_DUPLICATE_ACCOUNT 0x0100
140 #define UF_NORMAL_ACCOUNT 0x0200
141 #define UF_INTERDOMAIN_TRUST_ACCOUNT 0x0800
142 #define UF_WORKSTATION_TRUST_ACCOUNT 0x1000
143 #define UF_SERVER_TRUST_ACCOUNT 0x2000
145 /* account types */
146 #define ATYPE_GROUP 0x10000000
147 #define ATYPE_USER 0x30000000
149 /* Mailslot or cldap getdcname response flags */
150 #define ADS_PDC 0x00000001 /* DC is PDC */
151 #define ADS_GC 0x00000004 /* DC is a GC of forest */
152 #define ADS_LDAP 0x00000008 /* DC is an LDAP server */
153 #define ADS_DS 0x00000010 /* DC supports DS */
154 #define ADS_KDC 0x00000020 /* DC is running KDC */
155 #define ADS_TIMESERV 0x00000040 /* DC is running time services */
156 #define ADS_CLOSEST 0x00000080 /* DC is closest to client */
157 #define ADS_WRITABLE 0x00000100 /* DC has writable DS */
158 #define ADS_GOOD_TIMESERV 0x00000200 /* DC has hardware clock
159 (and running time) */
160 #define ADS_NDNC 0x00000400 /* DomainName is non-domain NC serviced
161 by LDAP server */
162 #define ADS_PINGS 0x0000FFFF /* Ping response */
163 #define ADS_DNS_CONTROLLER 0x20000000 /* DomainControllerName is a DNS name*/
164 #define ADS_DNS_DOMAIN 0x40000000 /* DomainName is a DNS name */
165 #define ADS_DNS_FOREST 0x80000000 /* DnsForestName is a DNS name */
167 /* DomainCntrollerAddressType */
168 #define ADS_INET_ADDRESS 0x00000001
169 #define ADS_NETBIOS_ADDRESS 0x00000002