update copyright notice since it we are now almost 4 months into 2003
[Samba.git] / source / nsswitch / winbindd_nss.h
blob28a32ee191182b8aed74972840a702f0a5bb3c42
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 */
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 4
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 /* Placeholder for end of cmd list */
104 WINBINDD_NUM_CMDS
107 /* Winbind request structure */
109 struct winbindd_request {
110 uint32 length;
111 enum winbindd_cmd cmd; /* Winbindd command to execute */
112 pid_t pid; /* pid of calling process */
114 union {
115 fstring winsreq; /* WINS request */
116 fstring username; /* getpwnam */
117 fstring groupname; /* getgrnam */
118 uid_t uid; /* getpwuid, uid_to_sid */
119 gid_t gid; /* getgrgid, gid_to_sid */
120 struct {
121 /* We deliberatedly don't split into domain/user to
122 avoid having the client know what the separator
123 character is. */
124 fstring user;
125 fstring pass;
126 } auth; /* pam_winbind auth module */
127 struct {
128 unsigned char chal[8];
129 fstring user;
130 fstring domain;
131 fstring lm_resp;
132 uint16 lm_resp_len;
133 fstring nt_resp;
134 uint16 nt_resp_len;
135 } auth_crap;
136 struct {
137 fstring user;
138 fstring oldpass;
139 fstring newpass;
140 } chauthtok; /* pam_winbind passwd module */
141 fstring sid; /* lookupsid, sid_to_[ug]id */
142 struct {
143 fstring dom_name; /* lookupname */
144 fstring name;
145 } name;
146 uint32 num_entries; /* getpwent, getgrent */
147 } data;
148 fstring domain; /* {set,get,end}{pw,gr}ent() */
151 /* Response values */
153 enum winbindd_result {
154 WINBINDD_ERROR,
155 WINBINDD_OK
158 /* Winbind response structure */
160 struct winbindd_response {
162 /* Header information */
164 uint32 length; /* Length of response */
165 enum winbindd_result result; /* Result code */
167 /* Fixed length return data */
169 union {
170 int interface_version; /* Try to ensure this is always in the same spot... */
172 fstring winsresp; /* WINS response */
174 /* getpwnam, getpwuid */
176 struct winbindd_pw {
177 fstring pw_name;
178 fstring pw_passwd;
179 uid_t pw_uid;
180 gid_t pw_gid;
181 fstring pw_gecos;
182 fstring pw_dir;
183 fstring pw_shell;
184 } pw;
186 /* getgrnam, getgrgid */
188 struct winbindd_gr {
189 fstring gr_name;
190 fstring gr_passwd;
191 gid_t gr_gid;
192 int num_gr_mem;
193 int gr_mem_ofs; /* offset to group membership */
194 } gr;
196 uint32 num_entries; /* getpwent, getgrent */
197 struct winbindd_sid {
198 fstring sid; /* lookupname, [ug]id_to_sid */
199 int type;
200 } sid;
201 struct winbindd_name {
202 fstring dom_name; /* lookupsid */
203 fstring name;
204 int type;
205 } name;
206 uid_t uid; /* sid_to_uid */
207 gid_t gid; /* sid_to_gid */
208 struct winbindd_info {
209 char winbind_separator;
210 fstring samba_version;
211 } info;
212 fstring domain_name;
214 struct auth_reply {
215 uint32 nt_status;
216 fstring nt_status_string;
217 fstring error_string;
218 int pam_error;
219 } auth;
220 } data;
222 uint32 nt_status; /* Extended error information */
224 /* Variable length return data */
226 void *extra_data; /* getgrnam, getgrgid, getgrent */
229 #endif