always compile before commit :-)
[Samba.git] / source / nsswitch / winbindd_nss.h
blobaedbaaf1fd9579b5659123087f1f2ab36673e648
1 /*
2 Unix SMB/Netbios implementation.
3 Version 2.0
5 Winbind daemon for ntdom nss module
7 Copyright (C) Tim Potter 2000
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
19 You should have received a copy of the GNU Library General Public
20 License along with this library; if not, write to the
21 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.
25 #ifndef _WINBINDD_NTDOM_H
26 #define _WINBINDD_NTDOM_H
28 #define WINBINDD_SOCKET_NAME "pipe" /* Name of PF_UNIX socket */
29 #define WINBINDD_SOCKET_DIR "/tmp/.winbindd" /* Name of PF_UNIX dir */
31 #define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
32 #define WINBINDD_DONT_ENV "_NO_WINBINDD"
34 /* Socket commands */
36 enum winbindd_cmd {
38 /* Get users and groups */
40 WINBINDD_GETPWNAM_FROM_USER,
41 WINBINDD_GETPWNAM_FROM_UID,
42 WINBINDD_GETGRNAM_FROM_GROUP,
43 WINBINDD_GETGRNAM_FROM_GID,
44 WINBINDD_GETGROUPS,
46 /* Enumerate users and groups */
48 WINBINDD_SETPWENT,
49 WINBINDD_ENDPWENT,
50 WINBINDD_GETPWENT,
51 WINBINDD_SETGRENT,
52 WINBINDD_ENDGRENT,
53 WINBINDD_GETGRENT,
55 /* PAM authenticate and password change */
57 WINBINDD_PAM_AUTH,
58 WINBINDD_PAM_CHAUTHTOK,
60 /* List various things */
62 WINBINDD_LIST_USERS, /* List w/o rid->id mapping */
63 WINBINDD_LIST_GROUPS, /* Ditto */
64 WINBINDD_LIST_TRUSTDOM,
66 /* SID conversion */
68 WINBINDD_LOOKUPSID,
69 WINBINDD_LOOKUPNAME,
71 /* S*RS functions */
73 WINBINDD_SID_TO_UID,
74 WINBINDD_SID_TO_GID,
75 WINBINDD_UID_TO_SID,
76 WINBINDD_GID_TO_SID,
78 /* Miscellaneous other stuff */
80 WINBINDD_CHECK_MACHACC, /* Check machine account pw works */
82 /* Placeholder for end of cmd list */
84 WINBINDD_NUM_CMDS
87 /* Winbind request structure */
89 struct winbindd_request {
90 enum winbindd_cmd cmd; /* Winbindd command to execute */
91 pid_t pid; /* pid of calling process */
93 union {
94 fstring username; /* getpwnam */
95 fstring groupname; /* getgrnam */
96 uid_t uid; /* getpwuid, uid_to_sid */
97 gid_t gid; /* getgrgid, gid_to_sid */
98 struct {
99 fstring user;
100 fstring pass;
101 } auth; /* pam_winbind auth module */
102 struct {
103 fstring user;
104 fstring oldpass;
105 fstring newpass;
106 } chauthtok; /* pam_winbind passwd module */
107 fstring sid; /* lookupsid, sid_to_[ug]id */
108 fstring name; /* lookupname */
109 uint32 num_entries; /* getpwent, getgrent */
110 } data;
111 fstring domain; /* {set,get,end}{pw,gr}ent() */
114 /* Response values */
116 enum winbindd_result {
117 WINBINDD_ERROR,
118 WINBINDD_OK
121 /* Winbind response structure */
123 struct winbindd_response {
125 /* Header information */
127 int length; /* Length of response */
128 enum winbindd_result result; /* Result code */
130 /* Fixed length return data */
132 union {
134 /* getpwnam, getpwuid */
136 struct winbindd_pw {
137 fstring pw_name;
138 fstring pw_passwd;
139 uid_t pw_uid;
140 gid_t pw_gid;
141 fstring pw_gecos;
142 fstring pw_dir;
143 fstring pw_shell;
144 } pw;
146 /* getgrnam, getgrgid */
148 struct winbindd_gr {
149 fstring gr_name;
150 fstring gr_passwd;
151 gid_t gr_gid;
152 int num_gr_mem;
153 int gr_mem_ofs; /* offset to group membership */
154 } gr;
156 uint32 num_entries; /* getpwent, getgrent */
157 struct {
158 fstring sid; /* lookupname, [ug]id_to_sid */
159 int type;
160 } sid;
161 struct {
162 fstring name; /* lookupsid */
163 int type;
164 } name;
165 uid_t uid; /* sid_to_uid */
166 gid_t gid; /* sid_to_gid */
167 } data;
169 /* Variable length return data */
171 void *extra_data; /* getgrnam, getgrgid, getgrent */
174 #endif