Preliminary merge of winbind into HEAD. Note that this compiles and links
[Samba/gbeck.git] / source / nsswitch / winbindd.h
blobc848047089c0b22461ea426efd2d9890e51d1408
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_H
26 #define _WINBINDD_H
28 #include "includes.h"
29 #include "nterr.h"
31 #include "winbindd_nss.h"
33 /* Naughty global stuff */
35 extern int DEBUGLEVEL;
37 /* Client state structure */
39 struct winbindd_cli_state {
40 struct winbindd_cli_state *prev, *next; /* Linked list pointers */
41 int sock; /* Open socket from client */
42 pid_t pid; /* pid of client */
43 int read_buf_len, write_buf_len; /* Indexes in request/response */
44 BOOL finished; /* Can delete from list */
45 BOOL write_extra_data; /* Write extra_data field */
46 struct winbindd_request request; /* Request from client */
47 struct winbindd_response response; /* Respose to client */
48 struct getent_state *getpwent_state; /* State for getpwent() */
49 struct getent_state *getgrent_state; /* State for getgrent() */
52 /* State between get{pw,gr}ent() calls */
54 struct getent_state {
55 struct getent_state *prev, *next;
56 void *sam_entries;
57 uint32 sam_entry_index, num_sam_entries;
58 uint32 dispinfo_ndx;
59 BOOL got_all_sam_entries, got_sam_entries;
60 struct winbindd_domain *domain;
63 /* Storage for cached getpwent() user entries */
65 struct getpwent_user {
66 fstring name; /* Account name */
67 fstring gecos; /* User information */
68 uint32 user_rid, group_rid; /* NT user and group rids */
71 /* Server state structure */
73 struct winbindd_state {
74 /* Netbios name of PDC */
75 fstring controller;
77 /* User and group id pool */
78 uid_t uid_low, uid_high; /* Range of uids to allocate */
79 gid_t gid_low, gid_high; /* Range of gids to allocate */
81 /* Cached handle to lsa pipe */
82 CLI_POLICY_HND lsa_handle;
83 BOOL lsa_handle_open;
84 BOOL pwdb_initialised;
87 extern struct winbindd_state server_state; /* Server information */
89 /* Structures to hold per domain information */
91 struct winbindd_domain {
93 /* Domain information */
95 fstring name; /* Domain name */
96 fstring controller; /* NetBIOS name of DC */
98 DOM_SID sid; /* SID for this domain */
99 BOOL got_domain_info; /* Got controller and sid */
101 /* Cached handles to samr pipe */
103 CLI_POLICY_HND sam_handle, sam_dom_handle;
104 BOOL sam_handle_open, sam_dom_handle_open;
105 time_t last_check;
107 struct winbindd_domain *prev, *next; /* Linked list info */
110 extern struct winbindd_domain *domain_list; /* List of domains we know */
112 #include "winbindd_proto.h"
114 #include "rpc_parse.h"
115 #include "rpc_client.h"
117 #define WINBINDD_ESTABLISH_LOOP 30
118 #define DOM_SEQUENCE_NONE ((uint32)-1)
120 /* SETENV */
121 #if HAVE_SETENV
122 #define SETENV(name, value, overwrite) setenv(name,value,overwrite)
123 #elif HAVE_PUTENV
124 #define SETENV(name, value, overwrite) \
126 fstring envvar; \
127 slprintf(envvar, sizeof(fstring), "%s=%s", name, value); \
128 putenv(envvar); \
130 #else
131 #define SETENV(name, value, overwrite) ;
132 #endif
134 #endif /* _WINBINDD_H */