Add infrastructure to transfer winbindd_request/response asynchronously
[kai/samba.git] / source3 / winbindd / winbindd_proto.h
index c5b7b079316e8d15e6fa3b4ca00d92c8906fb8de..3869ac57712b6c7423bf3a5bc67a40fad0be5ba8 100644 (file)
@@ -48,8 +48,6 @@ int count_all_current_connections(void);
 bool claim_connection(connection_struct *conn, const char *name,
                      uint32 msg_flags);
 bool register_message_flags(bool doreg, uint32 msg_flags);
-bool store_pipe_opendb( smb_np_struct *p );
-bool delete_pipe_opendb( smb_np_struct *p );
 
 /* The following definitions come from winbindd/winbindd.c  */
 
@@ -65,10 +63,31 @@ void setup_async_write(struct fd_event *event, void *data, size_t length,
                       void *private_data);
 void request_error(struct winbindd_cli_state *state);
 void request_ok(struct winbindd_cli_state *state);
-void winbind_check_sighup(const char *logfile);
+void winbind_check_sighup(const char *lfile);
 void winbind_check_sigterm(bool in_parent);
 int main(int argc, char **argv, char **envp);
 
+/* The following definitions come from winbindd/winbindd_reqtrans.c  */
+
+struct async_req *wb_req_read_send(TALLOC_CTX *mem_ctx,
+                                  struct event_context *ev,
+                                  int fd, size_t max_extra_data);
+NTSTATUS wb_req_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
+                         struct winbindd_request **preq);
+struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
+                                   struct event_context *ev, int fd,
+                                   struct winbindd_request *wb_req);
+NTSTATUS wb_req_write_recv(struct async_req *req);
+
+struct async_req *wb_resp_read_send(TALLOC_CTX *mem_ctx,
+                                   struct event_context *ev, int fd);
+NTSTATUS wb_resp_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
+                          struct winbindd_response **presp);
+struct async_req *wb_resp_write_send(TALLOC_CTX *mem_ctx,
+                                    struct event_context *ev, int fd,
+                                    struct winbindd_response *wb_resp);
+NTSTATUS wb_resp_write_recv(struct async_req *req);
+
 /* The following definitions come from winbindd/winbindd_ads.c  */
 
 
@@ -355,6 +374,11 @@ void winbindd_set_mapping_async(TALLOC_CTX *mem_ctx, const struct id_map *map,
                             void *private_data);
 enum winbindd_result winbindd_dual_set_mapping(struct winbindd_domain *domain,
                                            struct winbindd_cli_state *state);
+void winbindd_remove_mapping_async(TALLOC_CTX *mem_ctx, const struct id_map *map,
+                            void (*cont)(void *private_data, bool success),
+                            void *private_data);
+enum winbindd_result winbindd_dual_remove_mapping(struct winbindd_domain *domain,
+                                           struct winbindd_cli_state *state);
 void winbindd_set_hwm_async(TALLOC_CTX *mem_ctx, const struct unixid *xid,
                             void (*cont)(void *private_data, bool success),
                             void *private_data);
@@ -464,40 +488,6 @@ enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domai
 /* The following definitions come from winbindd/winbindd_reconnect.c  */
 
 
-/* The following definitions come from winbindd/winbindd_rpc.c  */
-
-NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain,
-                          TALLOC_CTX *mem_ctx,
-                          enum winbindd_cmd original_cmd,
-                          const char *domain_name,
-                          const char *name,
-                          DOM_SID *sid,
-                          enum lsa_SidType *type);
-NTSTATUS msrpc_sid_to_name(struct winbindd_domain *domain,
-                           TALLOC_CTX *mem_ctx,
-                           const DOM_SID *sid,
-                           char **domain_name,
-                           char **name,
-                           enum lsa_SidType *type);
-NTSTATUS msrpc_rids_to_names(struct winbindd_domain *domain,
-                            TALLOC_CTX *mem_ctx,
-                            const DOM_SID *sid,
-                            uint32 *rids,
-                            size_t num_rids,
-                            char **domain_name,
-                            char ***names,
-                            enum lsa_SidType **types);
-NTSTATUS msrpc_lookup_useraliases(struct winbindd_domain *domain,
-                                 TALLOC_CTX *mem_ctx,
-                                 uint32 num_sids, const DOM_SID *sids,
-                                 uint32 *num_aliases, uint32 **alias_rids);
-NTSTATUS msrpc_lockout_policy(struct winbindd_domain *domain,
-                             TALLOC_CTX *mem_ctx,
-                             struct samr_DomInfo12 *lockout_policy);
-NTSTATUS msrpc_password_policy(struct winbindd_domain *domain,
-                              TALLOC_CTX *mem_ctx,
-                              struct samr_DomInfo1 *password_policy);
-
 /* The following definitions come from winbindd/winbindd_sid.c  */
 
 void winbindd_lookupsid(struct winbindd_cli_state *state);
@@ -507,6 +497,7 @@ void winbindd_sid_to_uid(struct winbindd_cli_state *state);
 void winbindd_sid_to_gid(struct winbindd_cli_state *state);
 void winbindd_sids_to_unixids(struct winbindd_cli_state *state);
 void winbindd_set_mapping(struct winbindd_cli_state *state);
+void winbindd_remove_mapping(struct winbindd_cli_state *state);
 void winbindd_set_hwm(struct winbindd_cli_state *state);
 void winbindd_uid_to_sid(struct winbindd_cli_state *state);
 void winbindd_gid_to_sid(struct winbindd_cli_state *state);
@@ -566,8 +557,13 @@ void free_getent_state(struct getent_state *state);
 bool parse_domain_user(const char *domuser, fstring domain, fstring user);
 bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const char *domuser,
                              char **domain, char **user);
+void parse_add_domuser(void *buf, char *domuser, int *len);
 bool canonicalize_username(fstring username_inout, fstring domain, fstring user);
 void fill_domain_username(fstring name, const char *domain, const char *user, bool can_assume);
+char *fill_domain_username_talloc(TALLOC_CTX *ctx,
+                                 const char *domain,
+                                 const char *user,
+                                 bool can_assume);
 const char *get_winbind_pipe_dir(void) ;
 char *get_winbind_priv_pipe_dir(void) ;
 int open_winbindd_socket(void);
@@ -582,8 +578,22 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
                                  TALLOC_CTX *mem_ctx,
                                  const DOM_SID *user_sid,
                                  uint32 *p_num_groups, DOM_SID **user_sids);
-void ws_name_replace( char *name, char replace );
-void ws_name_return( char *name, char replace );
+
+NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
+                           struct winbindd_domain *domain,
+                           char *name,
+                           char **normalized);
+NTSTATUS normalize_name_unmap(TALLOC_CTX *mem_ctx,
+                             char *name,
+                             char **normalized);
+
+NTSTATUS resolve_username_to_alias(TALLOC_CTX *mem_ctx,
+                                  struct winbindd_domain *domain,
+                                  const char *name, char **alias);
+NTSTATUS resolve_alias_to_username(TALLOC_CTX *mem_ctx,
+                                  struct winbindd_domain *domain,
+                                  const char *alias, char **name);
+
 bool winbindd_can_contact_domain(struct winbindd_domain *domain);
 bool winbindd_internal_child(struct winbindd_child *child);
 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);