Merge branch 'master' of ssh://git.samba.org/data/git/samba
[bbaumbach/samba-autobuild/.git] / source3 / include / proto.h
index 69194ec6b2f69179a539a529189afca974f4efde..22183118e26cda8240d5ff4f6b955383afe7c1cc 100644 (file)
@@ -441,7 +441,7 @@ int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr);
 int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
 bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
                         uint32_t *val);
-bool dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
+int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
 uint32_t dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
                                     uint32_t *oldval, uint32_t change_val);
 int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
@@ -501,46 +501,6 @@ void display_set_stderr(void);
 NTSTATUS map_nt_error_from_unix(int unix_error);
 int map_errno_from_nt_status(NTSTATUS status);
 
-/* The following definitions come from lib/events.c  */
-
-struct timed_event *event_add_timed(struct event_context *event_ctx,
-                               TALLOC_CTX *mem_ctx,
-                               struct timeval when,
-                               const char *event_name,
-                               void (*handler)(struct event_context *event_ctx,
-                                               struct timed_event *te,
-                                               const struct timeval *now,
-                                               void *private_data),
-                               void *private_data);
-struct fd_event *event_add_fd(struct event_context *event_ctx,
-                             TALLOC_CTX *mem_ctx,
-                             int fd, uint16_t flags,
-                             void (*handler)(struct event_context *event_ctx,
-                                             struct fd_event *event,
-                                             uint16 flags,
-                                             void *private_data),
-                             void *private_data);
-void event_fd_set_writeable(struct fd_event *fde);
-void event_fd_set_not_writeable(struct fd_event *fde);
-void event_fd_set_readable(struct fd_event *fde);
-void event_fd_set_not_readable(struct fd_event *fde);
-bool event_add_to_select_args(struct event_context *event_ctx,
-                             const struct timeval *now,
-                             fd_set *read_fds, fd_set *write_fds,
-                             struct timeval *timeout, int *maxfd);
-bool events_pending(struct event_context *event_ctx);
-bool run_events(struct event_context *event_ctx,
-               int selrtn, fd_set *read_fds, fd_set *write_fds);
-struct timeval *get_timed_events_timeout(struct event_context *event_ctx,
-                                        struct timeval *to_ret);
-int event_loop_once(struct event_context *ev);
-struct event_context *event_context_init(TALLOC_CTX *mem_ctx);
-int set_event_dispatch_time(struct event_context *event_ctx,
-                           const char *event_name, struct timeval when);
-int cancel_named_event(struct event_context *event_ctx,
-                      const char *event_name);
-void dump_event_list(struct event_context *event_ctx);
-
 /* The following definitions come from lib/fault.c  */
 void fault_setup(void (*fn)(void *));
 void dump_core_setup(const char *progname);
@@ -637,6 +597,7 @@ void pidfile_create(const char *program_name);
 
 /* The following definitions come from lib/popt_common.c  */
 
+void popt_common_set_auth_info(struct user_auth_info *auth_info);
 
 /* The following definitions come from lib/privileges.c  */
 
@@ -968,6 +929,7 @@ void *sys_memalign( size_t align, size_t size );
 int sys_usleep(long usecs);
 ssize_t sys_read(int fd, void *buf, size_t count);
 ssize_t sys_write(int fd, const void *buf, size_t count);
+ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
 ssize_t sys_send(int s, const void *msg, size_t len, int flags);
@@ -1139,25 +1101,30 @@ void gfree_all( void );
 const char *my_netbios_names(int i);
 bool set_netbios_aliases(const char **str_array);
 bool init_names(void);
-const char *get_cmdline_auth_info_username(void);
-void set_cmdline_auth_info_username(const char *username);
-const char *get_cmdline_auth_info_password(void);
-void set_cmdline_auth_info_password(const char *password);
-bool set_cmdline_auth_info_signing_state(const char *arg);
-int get_cmdline_auth_info_signing_state(void);
-void set_cmdline_auth_info_use_kerberos(bool b);
-bool get_cmdline_auth_info_use_kerberos(void);
-void set_cmdline_auth_info_use_krb5_ticket(void);
-void set_cmdline_auth_info_smb_encrypt(void);
-void set_cmdline_auth_info_use_machine_account(void);
-bool get_cmdline_auth_info_got_pass(void);
-bool get_cmdline_auth_info_smb_encrypt(void);
-bool get_cmdline_auth_info_use_machine_account(void);
-bool get_cmdline_auth_info_copy(struct user_auth_info *info);
-bool set_cmdline_auth_info_machine_account_creds(void);
+struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
+const char *get_cmdline_auth_info_username(struct user_auth_info *auth_info);
+void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
+                                   const char *username);
+void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
+                                   const char *password);
+const char *get_cmdline_auth_info_password(struct user_auth_info *auth_info);
+bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
+                                        const char *arg);
+int get_cmdline_auth_info_signing_state(struct user_auth_info *auth_info);
+void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
+                                       bool b);
+bool get_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info);
+void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
+void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
+void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
+bool get_cmdline_auth_info_got_pass(struct user_auth_info *auth_info);
+bool get_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
+bool get_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
+struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
+                                                struct user_auth_info *info);
+bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
 bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
                             gid_t **gids, size_t *num_gids);
-const char *get_numlist(const char *p, uint32 **num, int *count);
 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
 bool socket_exist(const char *fname);
 bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st);
@@ -1176,6 +1143,7 @@ int set_blocking(int fd, bool set);
 void smb_msleep(unsigned int t);
 void become_daemon(bool Fork, bool no_process_group);
 bool reinit_after_fork(struct messaging_context *msg_ctx,
+                      struct event_context *ev_ctx,
                       bool parent_longlived);
 bool yesno(const char *p);
 void *malloc_(size_t size);
@@ -1223,9 +1191,8 @@ char *modules_path(const char *name);
 char *data_path(const char *name);
 char *state_path(const char *name);
 const char *shlib_ext(void);
-char *parent_dirname(const char *path);
-bool parent_dirname_talloc(TALLOC_CTX *mem_ctx, const char *dir,
-                          char **parent, const char **name);
+bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
+                   const char **name);
 bool ms_has_wild(const char *s);
 bool ms_has_wild_w(const smb_ucs2_t *s);
 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
@@ -1433,6 +1400,7 @@ NTSTATUS read_socket_with_timeout(int fd, char *buf,
                                  size_t *size_ret);
 NTSTATUS read_data(int fd, char *buffer, size_t N);
 ssize_t write_data(int fd, const char *buffer, size_t N);
+ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
 bool send_keepalive(int client);
 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
                                          unsigned int timeout,
@@ -1450,10 +1418,21 @@ int open_socket_in(int type,
                int dlevel,
                const struct sockaddr_storage *psock,
                bool rebind);
-int open_socket_out(int type,
-               const struct sockaddr_storage *pss,
-               uint16_t port,
-               int timeout);
+NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
+                        int timeout, int *pfd);
+struct async_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
+                                      struct event_context *ev,
+                                      const struct sockaddr_storage *pss,
+                                      uint16_t port,
+                                      int timeout);
+NTSTATUS open_socket_out_recv(struct async_req *req, int *pfd);
+struct async_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
+                                            struct event_context *ev,
+                                            struct timeval wait_time,
+                                            const struct sockaddr_storage *pss,
+                                            uint16_t port,
+                                            int timeout);
+NTSTATUS open_socket_out_defer_recv(struct async_req *req, int *pfd);
 bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs,
                         int timeout, int *fd_index, int *fd);
 int open_udp_socket(const char *host, int port);
@@ -2300,30 +2279,9 @@ _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool
 _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
 const char *ndr_errstr(enum ndr_err_code err);
 
-/* The following definitions come from librpc/ndr/ndr_sec_helper.c  */
-
-size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags);
-size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags);
-size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags);
-size_t ndr_size_security_ace(const struct security_ace *ace, int flags);
-size_t ndr_size_security_acl(const struct security_acl *acl, int flags);
-size_t ndr_size_security_descriptor(const struct security_descriptor *sd, int flags);
-void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
-void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
-void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
-void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
-
 /* The following definitions come from librpc/ndr/sid.c  */
 
-enum ndr_err_code ndr_push_dom_sid(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *r);
-enum ndr_err_code ndr_pull_dom_sid(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *r);
 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
-enum ndr_err_code ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
-enum ndr_err_code ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
-enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
-enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
-enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
-enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
 
 /* The following definitions come from librpc/rpc/binding.c  */
 
@@ -2365,8 +2323,12 @@ bool cli_ulogoff(struct cli_state *cli);
 bool cli_send_tconX(struct cli_state *cli, 
                    const char *share, const char *dev, const char *pass, int passlen);
 bool cli_tdis(struct cli_state *cli);
-void cli_negprot_send(struct cli_state *cli);
-bool cli_negprot(struct cli_state *cli);
+void cli_negprot_sendsync(struct cli_state *cli);
+NTSTATUS cli_negprot(struct cli_state *cli);
+struct async_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
+                                  struct event_context *ev,
+                                  struct cli_state *cli);
+NTSTATUS cli_negprot_recv(struct async_req *req);
 bool cli_session_request(struct cli_state *cli,
                         struct nmb_name *calling, struct nmb_name *called);
 NTSTATUS cli_connect(struct cli_state *cli,
@@ -2419,7 +2381,7 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
                                bool force_encrypt);
 void cli_cm_shutdown(void);
 void cli_cm_display(void);
-void cli_cm_set_credentials(void);
+void cli_cm_set_credentials(struct user_auth_info *auth_info);
 void cli_cm_set_port(int port_number);
 void cli_cm_set_dest_name_type(int type);
 void cli_cm_set_signing_state(int state);
@@ -2797,6 +2759,25 @@ ssize_t cli_write(struct cli_state *cli,
                 const char *buf, off_t offset, size_t size);
 ssize_t cli_smbwrite(struct cli_state *cli,
                     int fnum, char *buf, off_t offset, size_t size1);
+struct async_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
+                                     struct event_context *ev,
+                                     struct cli_state *cli, uint16_t fnum,
+                                     uint16_t mode, const uint8_t *buf,
+                                     off_t offset, size_t size);
+NTSTATUS cli_write_andx_recv(struct async_req *req, size_t *pwritten);
+
+struct async_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
+                               struct cli_state *cli,
+                               uint16_t fnum, uint16_t mode,
+                               off_t start_offset, size_t window_size,
+                               size_t (*source)(uint8_t *buf, size_t n,
+                                                void *priv),
+                               void *priv);
+NTSTATUS cli_push_recv(struct async_req *req);
+NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
+                 off_t start_offset, size_t window_size,
+                 size_t (*source)(uint8_t *buf, size_t n, void *priv),
+                 void *priv);
 
 /* The following definitions come from libsmb/clisecdesc.c  */
 
@@ -4253,7 +4234,7 @@ const char *lp_ldap_machine_suffix(void);
 const char *lp_ldap_user_suffix(void);
 const char *lp_ldap_group_suffix(void);
 const char *lp_ldap_idmap_suffix(void);
-void *lp_local_ptr(int snum, void *ptr);
+void *lp_local_ptr_by_snum(int snum, void *ptr);
 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
 void init_locals(void);
 bool lp_is_default(int snum, struct parm_struct *parm);
@@ -4416,8 +4397,9 @@ NTSTATUS local_password_change(const char *user_name,
                                const char *new_passwd, 
                                char **pp_err_str,
                                char **pp_msg_str);
-bool init_sam_from_buffer_v3(struct samu *sampass, uint8 *buf, uint32 buflen);
-uint32 init_buffer_from_sam_v3 (uint8 **buf, struct samu *sampass, bool size_only);
+bool init_samu_from_buffer(struct samu *sampass, uint32_t level,
+                          uint8 *buf, uint32 buflen);
+uint32 init_buffer_from_samu (uint8 **buf, struct samu *sampass, bool size_only);
 bool pdb_copy_sam_account(struct samu *dst, struct samu *src );
 bool pdb_update_bad_password_count(struct samu *sampass, bool *updated);
 bool pdb_update_autolock_flag(struct samu *sampass, bool *updated);
@@ -4871,7 +4853,8 @@ bool sysv_cache_reload(void);
 
 NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
                        const char *fname,
-                       uint16_t current_vuid, files_struct *fsp);
+                       uint16_t current_vuid, files_struct *fsp,
+                       SMB_STRUCT_STAT *psbuf);
 void print_fsp_end(files_struct *fsp, enum file_close_type close_type);
 
 /* The following definitions come from printing/printing.c  */
@@ -6024,11 +6007,6 @@ bool make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer)
 uint32 str_len_uni(UNISTR *source);
 bool policy_handle_is_valid(const POLICY_HND *hnd);
 
-/* The following definitions come from rpc_parse/parse_ntsvcs.c  */
-
-bool ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u, prs_struct *ps, int depth);
-bool ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u, prs_struct *ps, int depth);
-
 /* The following definitions come from rpc_parse/parse_prs.c  */
 
 void prs_dump(const char *name, int v, prs_struct *ps);
@@ -6555,15 +6533,6 @@ bool close_policy_hnd(pipes_struct *p, POLICY_HND *hnd);
 void close_policy_by_pipe(pipes_struct *p);
 bool pipe_access_check(pipes_struct *p);
 
-/* The following definitions come from rpc_server/srv_ntsvcs.c  */
-
-void ntsvcs2_get_pipe_fns( struct api_struct **fns, int *n_fns );
-NTSTATUS rpc_ntsvcs2_init(void);
-
-/* The following definitions come from rpc_server/srv_ntsvcs_nt.c  */
-
-WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, NTSVCS_R_GET_DEVICE_LIST *r_u );
-
 /* The following definitions come from rpc_server/srv_pipe.c  */
 
 bool create_next_pdu(pipes_struct *p);
@@ -7500,8 +7469,6 @@ struct idle_event *event_add_idle(struct event_context *event_ctx,
                                  void *private_data);
 NTSTATUS allow_new_trans(struct trans_state *list, int mid);
 void respond_to_all_remaining_local_messages(void);
-bool create_outbuf(TALLOC_CTX *mem_ctx, const char *inbuf, char **outbuf,
-                  uint8_t num_words, uint32_t num_bytes);
 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
 const char *smb_fn_name(int type);
 void add_to_common_flags2(uint32 v);
@@ -7681,7 +7648,6 @@ void init_sec_ctx(void);
 
 int smbd_server_fd(void);
 int get_client_fd(void);
-int client_get_tcp_info(struct sockaddr_in *server, struct sockaddr_in *client);
 struct event_context *smbd_event_context(void);
 struct messaging_context *smbd_messaging_context(void);
 struct memcache *smbd_memcache(void);
@@ -7976,4 +7942,14 @@ NTSTATUS idmap_sid_to_gid(const char *domname, DOM_SID *sid, gid_t *gid);
 
 NTSTATUS nss_info_template_init( void );
 
+/* Misc protos */
+
+struct async_req *wb_trans_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
+                               struct wb_context *wb_ctx, bool need_priv,
+                               const struct winbindd_request *wb_req);
+NTSTATUS wb_trans_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
+                      struct winbindd_response **presponse);
+struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx);
+
+
 #endif /*  _PROTO_H_  */