Copyright (C) Tim Potter 2000
Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
-
+
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nsswitch/winbind_struct_protocol.h"
#include "nsswitch/libwbclient/wbclient.h"
+#include "librpc/gen_ndr/wbint.h"
#ifdef HAVE_LIBNSCD
#include <libnscd.h>
#define WB_REPLACE_CHAR '_'
-struct winbindd_fd_event {
- struct winbindd_fd_event *next, *prev;
- int fd;
- int flags; /* see EVENT_FD_* flags */
- void (*handler)(struct winbindd_fd_event *fde, int flags);
- void *data;
- size_t length, done;
- void (*finished)(void *private_data, bool success);
- void *private_data;
-};
-
struct sid_ctr {
DOM_SID *sid;
bool finished;
struct winbindd_cli_state *prev, *next; /* Linked list pointers */
int sock; /* Open socket from client */
pid_t pid; /* pid of client */
- bool finished; /* Can delete from list */
- bool write_extra_data; /* Write extra_data field */
time_t last_access; /* Time of last access (read or write) */
bool privileged; /* Is the client 'privileged' */
TALLOC_CTX *mem_ctx; /* memory per request */
+ NTSTATUS (*recv_fn)(struct tevent_req *req,
+ struct winbindd_response *presp);
struct winbindd_request *request; /* Request from client */
- struct winbindd_request _request;
struct tevent_queue *out_queue;
- struct winbindd_response response; /* Respose to client */
+ struct winbindd_response *response; /* Respose to client */
bool getpwent_initialized; /* Has getpwent_state been
* initialized? */
bool getgrent_initialized; /* Has getgrent_state been
* initialized? */
- struct getent_state *getpwent_state; /* State for getpwent() */
struct getent_state *getgrent_state; /* State for getgrent() */
+
+ struct getpwent_state *pwent_state; /* State for getpwent() */
+ struct getgrent_state *grent_state; /* State for getgrent() */
};
/* State between get{pw,gr}ent() calls */
fstring domain_name;
};
+struct getpwent_state {
+ struct winbindd_domain *domain;
+ int next_user;
+ int num_users;
+ struct wbint_userinfo *users;
+};
+
+struct getgrent_state {
+ struct winbindd_domain *domain;
+ int next_group;
+ int num_groups;
+ struct wbint_Principal *groups;
+};
+
/* Storage for cached getpwent() user entries */
struct getpwent_user {
DOM_SID group_sid;
};
-/* Server state structure */
-
-typedef struct {
- char *acct_name;
- char *full_name;
- char *homedir;
- char *shell;
- gid_t primary_gid; /* allow the nss_info
- backend to set the primary group */
- DOM_SID user_sid; /* NT user and primary group SIDs */
- DOM_SID group_sid;
-} WINBIND_USERINFO;
-
/* Our connection to the DC */
struct winbindd_cm_conn {
struct policy_handle sam_connect_handle, sam_domain_handle;
struct rpc_pipe_client *lsa_pipe;
+ struct rpc_pipe_client *lsa_pipe_tcp;
struct policy_handle lsa_policy;
struct rpc_pipe_client *netlogon_pipe;
int sock;
struct tevent_queue *queue;
+ struct rpc_pipe_client *rpccli;
struct timed_event *lockout_policy_event;
struct timed_event *machine_password_change_event;
always correct) */
bool consistent;
- /* get a list of users, returning a WINBIND_USERINFO for each one */
+ /* get a list of users, returning a wbint_userinfo for each one */
NTSTATUS (*query_user_list)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
- WINBIND_USERINFO **info);
+ struct wbint_userinfo **info);
/* get a list of domain groups */
NTSTATUS (*enum_dom_groups)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
struct acct_info **info);
-
+
/* convert one user or group name to a sid */
NTSTATUS (*name_to_sid)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
- enum winbindd_cmd orig_cmd,
const char *domain_name,
const char *name,
+ uint32_t flags,
DOM_SID *sid,
enum lsa_SidType *type);
NTSTATUS (*query_user)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *user_sid,
- WINBIND_USERINFO *user_info);
+ struct wbint_userinfo *user_info);
/* lookup all groups that a user is a member of. The backend
can also choose to lookup by username or rid for this
NTSTATUS (*lookup_groupmem)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *group_sid,
+ enum lsa_SidType type,
uint32 *num_names,
DOM_SID **sid_mem, char ***names,
uint32 **name_types);