2 Unix SMB/Netbios implementation.
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.
31 #include "winbindd_nss.h"
33 /* Client state structure */
35 struct winbindd_cli_state {
36 struct winbindd_cli_state *prev, *next; /* Linked list pointers */
37 int sock; /* Open socket from client */
38 pid_t pid; /* pid of client */
39 int read_buf_len, write_buf_len; /* Indexes in request/response */
40 BOOL finished; /* Can delete from list */
41 BOOL write_extra_data; /* Write extra_data field */
42 struct winbindd_request request; /* Request from client */
43 struct winbindd_response response; /* Respose to client */
44 struct getent_state *getpwent_state; /* State for getpwent() */
45 struct getent_state *getgrent_state; /* State for getgrent() */
48 /* State between get{pw,gr}ent() calls */
51 struct getent_state *prev, *next;
53 uint32 sam_entry_index, num_sam_entries;
55 uint32 grp_query_start_ndx;
56 BOOL got_all_sam_entries, got_sam_entries;
57 struct winbindd_domain *domain;
60 /* Storage for cached getpwent() user entries */
62 struct getpwent_user {
63 fstring name; /* Account name */
64 fstring gecos; /* User information */
65 uint32 user_rid, group_rid; /* NT user and group rids */
68 /* Server state structure */
70 struct winbindd_state {
72 /* User and group id pool */
74 uid_t uid_low, uid_high; /* Range of uids to allocate */
75 gid_t gid_low, gid_high; /* Range of gids to allocate */
78 extern struct winbindd_state server_state; /* Server information */
84 uint32 group_rid; /* primary group */
87 /* per-domain methods. This is how LDAP vs RPC is selected
88 This will eventually be the sole entry point to all the methods,
89 I'm just starting small
91 struct winbindd_methods {
92 NTSTATUS (*query_user_list)(struct winbindd_domain *domain,
94 uint32 *start_ndx, uint32 *num_entries,
95 WINBIND_USERINFO **info);
97 NTSTATUS (*enum_dom_groups)(struct winbindd_domain *domain,
99 uint32 *start_ndx, uint32 *num_entries,
100 struct acct_info **info);
102 NTSTATUS (*name_to_sid)(struct winbindd_domain *domain,
105 enum SID_NAME_USE *type);
107 NTSTATUS (*sid_to_name)(struct winbindd_domain *domain,
111 enum SID_NAME_USE *type);
113 /* query_user is a bit strange. The backend has a choice of
114 doing the lookup by user name or rid */
115 NTSTATUS (*query_user)(struct winbindd_domain *domain,
117 const char *user_name, uint32 user_rid,
118 WINBIND_USERINFO *user_info);
121 /* Structures to hold per domain information */
122 struct winbindd_domain {
123 fstring name; /* Domain name */
124 DOM_SID sid; /* SID for this domain */
125 struct winbindd_methods *methods; /* lookup methods for
128 struct winbindd_domain *prev, *next; /* Linked list info */
131 extern struct winbindd_domain *domain_list; /* List of domains we know */
133 /* Used to glue a policy handle and cli_state together */
136 struct cli_state *cli;
140 #include "winbindd_proto.h"
142 #include "rpc_parse.h"
143 #include "rpc_client.h"
145 #define WINBINDD_ESTABLISH_LOOP 30
146 #define DOM_SEQUENCE_NONE ((uint32)-1)
150 #define SETENV(name, value, overwrite) setenv(name,value,overwrite)
152 #define SETENV(name, value, overwrite) \
155 slprintf(envvar, sizeof(fstring), "%s=%s", name, value); \
159 #define SETENV(name, value, overwrite) ;
162 #endif /* _WINBINDD_H */