trying to get HEAD building again. If you want the code
[Samba.git] / source / nsswitch / winbindd_nss.h
blobc4407bbe31c9062302676cc5aad5a0fdbbef999a
1 /*
2 Unix SMB/CIFS implementation.
4 Winbind daemon for ntdom nss module
6 Copyright (C) Tim Potter 2000
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public
19 License along with this library; if not, write to the
20 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.
24 #ifndef SAFE_FREE
25 #define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
26 #endif
28 #ifndef _WINBINDD_NTDOM_H
29 #define _WINBINDD_NTDOM_H
31 #define WINBINDD_SOCKET_NAME "pipe" /* Name of PF_UNIX socket */
32 #define WINBINDD_SOCKET_DIR "/tmp/.winbindd" /* Name of PF_UNIX dir */
33 #define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged" /* name of subdirectory of lp_lockdir() to hold the 'privileged' pipe */
34 #define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
35 #define WINBINDD_DONT_ENV "_NO_WINBINDD"
37 /* Update this when you change the interface. */
39 #define WINBIND_INTERFACE_VERSION 8
41 /* Socket commands */
43 enum winbindd_cmd {
45 WINBINDD_INTERFACE_VERSION, /* Always a well known value */
47 /* Get users and groups */
49 WINBINDD_GETPWNAM,
50 WINBINDD_GETPWUID,
51 WINBINDD_GETGRNAM,
52 WINBINDD_GETGRGID,
53 WINBINDD_GETGROUPS,
55 /* Enumerate users and groups */
57 WINBINDD_SETPWENT,
58 WINBINDD_ENDPWENT,
59 WINBINDD_GETPWENT,
60 WINBINDD_SETGRENT,
61 WINBINDD_ENDGRENT,
62 WINBINDD_GETGRENT,
64 /* PAM authenticate and password change */
66 WINBINDD_PAM_AUTH,
67 WINBINDD_PAM_AUTH_CRAP,
68 WINBINDD_PAM_CHAUTHTOK,
70 /* List various things */
72 WINBINDD_LIST_USERS, /* List w/o rid->id mapping */
73 WINBINDD_LIST_GROUPS, /* Ditto */
74 WINBINDD_LIST_TRUSTDOM,
76 /* SID conversion */
78 WINBINDD_LOOKUPSID,
79 WINBINDD_LOOKUPNAME,
81 /* Lookup functions */
83 WINBINDD_SID_TO_UID,
84 WINBINDD_SID_TO_GID,
85 WINBINDD_UID_TO_SID,
86 WINBINDD_GID_TO_SID,
88 /* Miscellaneous other stuff */
90 WINBINDD_CHECK_MACHACC, /* Check machine account pw works */
91 WINBINDD_PING, /* Just tell me winbind is running */
92 WINBINDD_INFO, /* Various bit of info. Currently just tidbits */
93 WINBINDD_DOMAIN_NAME, /* The domain this winbind server is a member of (lp_workgroup()) */
95 WINBINDD_SHOW_SEQUENCE, /* display sequence numbers of domains */
97 /* WINS commands */
99 WINBINDD_WINS_BYIP,
100 WINBINDD_WINS_BYNAME,
102 /* account management commands */
104 WINBINDD_CREATE_USER,
105 WINBINDD_CREATE_GROUP,
106 WINBINDD_ADD_USER_TO_GROUP,
107 WINBINDD_REMOVE_USER_FROM_GROUP,
108 WINBINDD_SET_USER_PRIMARY_GROUP,
109 WINBINDD_DELETE_USER,
110 WINBINDD_DELETE_GROUP,
112 /* this is like GETGRENT but gives an empty group list */
113 WINBINDD_GETGRLST,
115 WINBINDD_NETBIOS_NAME, /* The netbios name of the server */
116 /* Placeholder for end of cmd list */
118 /* find the location of our privileged pipe */
119 WINBINDD_PRIV_PIPE_DIR,
121 WINBINDD_NUM_CMDS
124 typedef struct winbindd_pw {
125 fstring pw_name;
126 fstring pw_passwd;
127 uid_t pw_uid;
128 gid_t pw_gid;
129 fstring pw_gecos;
130 fstring pw_dir;
131 fstring pw_shell;
132 } WINBINDD_PW;
135 typedef struct winbindd_gr {
136 fstring gr_name;
137 fstring gr_passwd;
138 gid_t gr_gid;
139 int num_gr_mem;
140 int gr_mem_ofs; /* offset to group membership */
141 char **gr_mem;
142 } WINBINDD_GR;
145 #define WBFLAG_PAM_INFO3_NDR 0x0001
146 #define WBFLAG_PAM_INFO3_TEXT 0x0002
147 #define WBFLAG_PAM_NTKEY 0x0004
148 #define WBFLAG_PAM_LMKEY 0x0008
149 #define WBFLAG_PAM_CONTACT_TRUSTDOM 0x0010
150 #define WBFLAG_QUERY_ONLY 0x0020
151 #define WBFLAG_ALLOCATE_RID 0x0040
153 /* Winbind request structure */
155 struct winbindd_request {
156 uint32 length;
157 enum winbindd_cmd cmd; /* Winbindd command to execute */
158 pid_t pid; /* pid of calling process */
159 uint32 flags; /* flags relavant to a given request */
161 union {
162 fstring winsreq; /* WINS request */
163 fstring username; /* getpwnam */
164 fstring groupname; /* getgrnam */
165 uid_t uid; /* getpwuid, uid_to_sid */
166 gid_t gid; /* getgrgid, gid_to_sid */
167 struct {
168 /* We deliberatedly don't split into domain/user to
169 avoid having the client know what the separator
170 character is. */
171 fstring user;
172 fstring pass;
173 } auth; /* pam_winbind auth module */
174 struct {
175 unsigned char chal[8];
176 fstring user;
177 fstring domain;
178 fstring lm_resp;
179 uint16 lm_resp_len;
180 fstring nt_resp;
181 uint16 nt_resp_len;
182 fstring workstation;
183 } auth_crap;
184 struct {
185 fstring user;
186 fstring oldpass;
187 fstring newpass;
188 } chauthtok; /* pam_winbind passwd module */
189 fstring sid; /* lookupsid, sid_to_[ug]id */
190 struct {
191 fstring dom_name; /* lookupname */
192 fstring name;
193 } name;
194 uint32 num_entries; /* getpwent, getgrent */
195 struct {
196 fstring username;
197 fstring groupname;
198 } acct_mgt;
199 } data;
200 char null_term;
203 /* Response values */
205 enum winbindd_result {
206 WINBINDD_ERROR,
207 WINBINDD_OK
210 /* Winbind response structure */
212 struct winbindd_response {
214 /* Header information */
216 uint32 length; /* Length of response */
217 enum winbindd_result result; /* Result code */
219 /* Fixed length return data */
221 union {
222 int interface_version; /* Try to ensure this is always in the same spot... */
224 fstring winsresp; /* WINS response */
226 /* getpwnam, getpwuid */
228 struct winbindd_pw pw;
230 /* getgrnam, getgrgid */
232 struct winbindd_gr gr;
234 uint32 num_entries; /* getpwent, getgrent */
235 struct winbindd_sid {
236 fstring sid; /* lookupname, [ug]id_to_sid */
237 int type;
238 } sid;
239 struct winbindd_name {
240 fstring dom_name; /* lookupsid */
241 fstring name;
242 int type;
243 } name;
244 uid_t uid; /* sid_to_uid */
245 gid_t gid; /* sid_to_gid */
246 struct winbindd_info {
247 char winbind_separator;
248 fstring samba_version;
249 } info;
250 fstring domain_name;
251 fstring netbios_name;
253 struct auth_reply {
254 uint32 nt_status;
255 fstring nt_status_string;
256 fstring error_string;
257 int pam_error;
258 char nt_session_key[16];
259 char first_8_lm_hash[8];
260 } auth;
261 uint32 rid; /* create user or group */
262 } data;
264 /* Variable length return data */
266 void *extra_data; /* getgrnam, getgrgid, getgrent */
269 #endif