nterr: Add mem_ctx for return string from get_nt_error_c_code()
[ddiss/samba.git] / source3 / include / proto.h
index 27989738d6fabef45aeb5300cc4357a8d57f2698..a6e9cf9b5db0bff4e5b9a3f830a6a6d0b4c7aa3c 100644 (file)
@@ -72,22 +72,16 @@ int bitmap_find(struct bitmap *bm, unsigned ofs);
 
 /* The following definitions come from lib/charcnv.c  */
 
-void lazy_initialize_conv(void);
 void gfree_charcnv(void);
 void init_iconv(void);
-size_t convert_string(charset_t from, charset_t to,
+bool convert_string(charset_t from, charset_t to,
                      void const *src, size_t srclen, 
-                     void *dest, size_t destlen);
-size_t convert_string_error(charset_t from, charset_t to,
+                     void *dest, size_t destlen,
+                     size_t *converted_size);
+bool convert_string_error(charset_t from, charset_t to,
                            void const *src, size_t srclen,
                            void *dest, size_t destlen,
                            size_t *converted_size);
-size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
-char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
-char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
-size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
-char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
-char *strlower_talloc(TALLOC_CTX *ctx, const char *s);
 size_t ucs2_align(const void *base_ptr, const void *p, int flags);
 size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
 size_t push_ascii_fstring(void *dest, const char *src);
@@ -95,20 +89,6 @@ size_t push_ascii_nstring(void *dest, const char *src);
 size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
 size_t pull_ascii_fstring(char *dest, const void *src);
 size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
-size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
-size_t push_utf8_fstring(void *dest, const char *src);
-bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
-                     size_t *converted_size);
-size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
-size_t pull_ucs2_fstring(char *dest, const void *src);
-bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
-                     size_t *converted_size);
-bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
-                     size_t *converted_size);
-bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
-                     size_t *converted_size);
-bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
-                      size_t *converted_size);
 size_t push_string_check_fn(void *dest, const char *src,
                            size_t dest_len, int flags);
 size_t push_string_base(const char *base, uint16 flags2,
@@ -129,6 +109,9 @@ size_t pull_string_talloc(TALLOC_CTX *ctx,
                        size_t src_len,
                        int flags);
 size_t align_string(const void *base_ptr, const char *p, int flags);
+size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
+int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
+int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
 
 /* The following definitions come from lib/conn_tdb.c  */
 
@@ -544,16 +527,6 @@ int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
-int sys_getpeereid( int s, uid_t *uid);
-int sys_getnameinfo(const struct sockaddr *psa,
-                       socklen_t salen,
-                       char *host,
-                       size_t hostlen,
-                       char *service,
-                       size_t servlen,
-                       int flags);
-int sys_connect(int fd, const struct sockaddr * addr);
-
 /* The following definitions come from lib/system_smbd.c  */
 
 bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
@@ -637,45 +610,12 @@ void gfree_all( void );
 const char *my_netbios_names(int i);
 bool set_netbios_aliases(const char **str_array);
 bool init_names(void);
-struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
-const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
-void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
-                                   const char *username);
-const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
-void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
-                                 const char *domain);
-void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
-                                   const char *password);
-const char *get_cmdline_auth_info_password(const 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(const struct user_auth_info *auth_info);
-void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
-                                     bool b);
-bool get_cmdline_auth_info_use_ccache(const 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(const struct user_auth_info *auth_info);
-void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
-                                       bool b);
-bool get_cmdline_auth_info_fallback_after_kerberos(const 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(const struct user_auth_info *auth_info);
-bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
-bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
-struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
-                                                const struct user_auth_info *info);
-bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
-void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
                     bool fake_dir_create_times);
 bool socket_exist(const char *fname);
 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
 SMB_OFF_T get_file_size(char *file_name);
-char *attrib_string(uint16 mode);
-void show_msg(char *buf);
+void show_msg(const char *buf);
 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
 void smb_setlen(char *buf,int len);
 int set_message_bcc(char *buf,int num_bytes);
@@ -781,6 +721,42 @@ bool tevent_req_poll_ntstatus(struct tevent_req *req,
                              NTSTATUS *status);
 bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
 int timeval_to_msec(struct timeval t);
+char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
+
+/* The following definitions come from lib/util_cmdline.c  */
+
+struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
+const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
+void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
+                                   const char *username);
+const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
+void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
+                                 const char *domain);
+void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
+                                   const char *password);
+const char *get_cmdline_auth_info_password(const 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(const struct user_auth_info *auth_info);
+void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
+                                     bool b);
+bool get_cmdline_auth_info_use_ccache(const 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(const struct user_auth_info *auth_info);
+void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
+                                       bool b);
+bool get_cmdline_auth_info_fallback_after_kerberos(const 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(const struct user_auth_info *auth_info);
+bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
+bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
+struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
+                                                const struct user_auth_info *info);
+bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
+void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
 
 /* The following definitions come from lib/util_builtin.c  */
 
@@ -935,6 +911,7 @@ struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
 int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
 int poll_one_fd(int fd, int events, int timeout, int *revents);
 int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
+struct tstream_context;
 struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
                                            struct tevent_context *ev,
                                            struct tstream_context *stream,
@@ -954,34 +931,16 @@ int StrnCaseCmp(const char *s, const char *t, size_t len);
 bool strnequal(const char *s1,const char *s2,size_t n);
 bool strcsequal(const char *s1,const char *s2);
 void strnorm(char *s, int case_default);
-bool strisnormal(const char *s, int case_default);
 char *push_skip_string(char *buf);
 char *skip_string(const char *base, size_t len, char *buf);
 size_t str_charnum(const char *s);
-size_t str_ascii_charnum(const char *s);
 bool trim_char(char *s,char cfront,char cback);
 bool strhasupper(const char *s);
 bool strhaslower(const char *s);
-char *safe_strcpy_fn(char *dest,
-               const char *src,
-               size_t maxlength);
-char *safe_strcat_fn(char *dest,
-               const char *src,
-               size_t maxlength);
-char *alpha_strcpy(char *dest,
-               const char *src,
-               const char *other_safe_chars,
-               size_t maxlength);
 char *StrnCpy(char *dest,const char *src,size_t n);
 bool in_list(const char *s, const char *list, bool casesensitive);
 void string_free(char **s);
 bool string_set(char **dest,const char *src);
-void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
-                bool remove_unsafe_characters, bool replace_once,
-                bool allow_trailing_dollar);
-void string_sub_once(char *s, const char *pattern,
-               const char *insert, size_t len);
-void string_sub(char *s,const char *pattern, const char *insert, size_t len);
 void fstring_sub(char *s,const char *pattern,const char *insert);
 char *realloc_string_sub2(char *string,
                        const char *pattern,
@@ -1027,12 +986,8 @@ char *ipstr_list_make(char **ipstr_list,
                        int ip_count);
 int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
 void ipstr_list_free(char* ipstr_list);
-DATA_BLOB base64_decode_data_blob(const char *s);
-void base64_decode_inplace(char *s);
-char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
-SMB_OFF_T conv_str_size(const char * str);
-void string_append(char **left, const char *right);
+uint64_t conv_str_size(const char * str);
 bool add_string_to_array(TALLOC_CTX *mem_ctx,
                         const char *str, const char ***strings,
                         int *num);
@@ -1049,48 +1004,6 @@ char *escape_shell_string(const char *src);
 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
 char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
 
-/* The following definitions come from lib/util_unistr.c  */
-
-void gfree_case_tables(void);
-void load_case_tables(void);
-size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
-char *skip_unibuf(char *src, size_t len);
-int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
-int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
-bool isvalid83_w(smb_ucs2_t c);
-size_t strlen_w(const smb_ucs2_t *src);
-size_t strnlen_w(const smb_ucs2_t *src, size_t max);
-smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
-smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c);
-smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
-smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n);
-smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins);
-bool strlower_w(smb_ucs2_t *s);
-bool strupper_w(smb_ucs2_t *s);
-void strnorm_w(smb_ucs2_t *s, int case_default);
-int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
-int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
-int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
-int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
-bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
-bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
-smb_ucs2_t *strdup_w(const smb_ucs2_t *src);
-smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len);
-smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
-smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
-smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src);
-void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
-bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
-                                 const smb_ucs2_t *back);
-int strcmp_wa(const smb_ucs2_t *a, const char *b);
-int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
-smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
-smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
-int toupper_ascii(int c);
-int tolower_ascii(int c);
-int isupper_ascii(int c);
-int islower_ascii(int c);
-
 /* The following definitions come from lib/version.c  */
 
 const char *samba_version_string(void);
@@ -1181,7 +1094,7 @@ struct cli_state *get_ipc_connect(char *server,
                                struct sockaddr_storage *server_ss,
                                const struct user_auth_info *user_info);
 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
-                               struct ip_service *mb_ip,
+                               struct sockaddr_storage *mb_ip,
                                const struct user_auth_info *user_info,
                                char **pp_workgroup_out);
 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
@@ -1242,9 +1155,6 @@ bool cli_state_seqnum_remove(struct cli_state *cli,
                             uint16_t mid);
 bool cli_receive_smb(struct cli_state *cli);
 bool cli_send_smb(struct cli_state *cli);
-bool cli_send_smb_direct_writeX(struct cli_state *cli,
-                               const char *p,
-                               size_t extradata);
 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
 void cli_setup_packet(struct cli_state *cli);
 void cli_setup_bcc(struct cli_state *cli, void *p);
@@ -1704,13 +1614,6 @@ NTSTATUS cli_force_encryption(struct cli_state *c,
                        const char *password,
                        const char *domain);
 
-/* The following definitions come from libsmb/clikrb5.c  */
-
-bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx, 
-                          DATA_BLOB *edata, 
-                          DATA_BLOB *edata_out);
-bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
-
 /* The following definitions come from libsmb/clilist.c  */
 
 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
@@ -1804,9 +1707,6 @@ NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
                  void *priv, SMB_OFF_T *received);
 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
                 off_t offset, size_t size);
-ssize_t cli_write(struct cli_state *cli,
-                uint16_t fnum, uint16 write_mode,
-                const char *buf, off_t offset, size_t size);
 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
                      off_t offset, size_t size1, size_t *ptotal);
 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
@@ -1824,6 +1724,10 @@ struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
                                       off_t offset, size_t size);
 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
 
+NTSTATUS cli_writeall(struct cli_state *cli, uint16_t fnum, uint16_t mode,
+                     const uint8_t *buf, off_t offset, size_t size,
+                     size_t *pwritten);
+
 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
                                 struct cli_state *cli,
                                 uint16_t fnum, uint16_t mode,
@@ -2027,7 +1931,8 @@ NTSTATUS name_query(const char *name, int name_type,
                    int *num_addrs, uint8_t *flags);
 NTSTATUS name_resolve_bcast(const char *name,
                        int name_type,
-                       struct ip_service **return_iplist,
+                       TALLOC_CTX *mem_ctx,
+                       struct sockaddr_storage **return_iplist,
                        int *return_count);
 NTSTATUS resolve_wins(const char *name,
                int name_type,
@@ -2071,7 +1976,6 @@ bool get_dc_name(const char *domain,
 
 const char *nt_errstr(NTSTATUS nt_code);
 const char *get_friendly_nt_error_msg(NTSTATUS nt_code);
-const char *get_nt_error_c_code(NTSTATUS nt_code);
 NTSTATUS nt_status_string_to_code(const char *nt_status_str);
 NTSTATUS nt_status_squash(NTSTATUS nt_status);
 
@@ -2182,12 +2086,6 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
                                     struct dom_sid **sids );
 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
 
-/* The following definitions come from modules/vfs_default.c  */
-
-ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
-ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
-NTSTATUS vfs_default_init(void);
-
 /* The following definitions come from param/loadparm.c  */
 
 char *lp_smb_ports(void);
@@ -2688,236 +2586,6 @@ void set_server_role(void);
 uint32 get_int_param( const char* param );
 char* get_string_param( const char* param );
 
-/* The following definitions come from profile/profile.c  */
-
-void set_profile_level(int level, struct server_id src);
-bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
-
-/* The following definitions come from librpc/rpc/rpc_common.c  */
-
-bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
-const struct ndr_interface_table *get_iface_from_syntax(
-       const struct ndr_syntax_id *syntax);
-const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
-                                     const struct ndr_syntax_id *syntax);
-
-/* The following definitions come from rpc_server/rpc_ncacn_np.c  */
-struct auth_serversupplied_info;
-struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
-                                             const struct ndr_syntax_id *syntax,
-                                             struct client_address *client_id,
-                                             const struct auth_serversupplied_info *session_info,
-                                             struct messaging_context *msg_ctx);
-NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
-                              const struct ndr_interface_table *ndr_table,
-                              struct client_address *client_id,
-                              const struct auth_serversupplied_info *session_info,
-                              struct messaging_context *msg_ctx,
-                              struct dcerpc_binding_handle **binding_handle);
-NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx,
-                               const struct ndr_syntax_id *abstract_syntax,
-                               const struct auth_serversupplied_info *serversupplied_info,
-                               struct client_address *client_id,
-                               struct messaging_context *msg_ctx,
-                               struct rpc_pipe_client **presult);
-NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
-                                const struct ndr_syntax_id *syntax,
-                                const struct auth_serversupplied_info *session_info,
-                                struct client_address *client_id,
-                                struct messaging_context *msg_ctx,
-                                struct rpc_pipe_client **cli_pipe);
-
-/* The following definitions come from rpc_client/cli_pipe_schannel.c  */
-
-NTSTATUS get_schannel_session_key(struct cli_state *cli,
-                                 const char *domain,
-                                 uint32 *pneg_flags,
-                                 struct rpc_pipe_client **presult);
-
-/* The following definitions come from rpc_client/rpc_transport_np.c  */
-
-struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
-                                             struct event_context *ev,
-                                             struct cli_state *cli,
-                                             const struct ndr_syntax_id *abstract_syntax);
-NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req,
-                                   TALLOC_CTX *mem_ctx,
-                                   struct rpc_cli_transport **presult);
-NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli,
-                              const struct ndr_syntax_id *abstract_syntax,
-                              struct rpc_cli_transport **presult);
-
-/* The following definitions come from rpc_client/rpc_transport_sock.c  */
-
-NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
-                                struct rpc_cli_transport **presult);
-
-/* The following definitions come from rpc_client/rpc_transport_tstream.c  */
-
-NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
-                               struct tstream_context **stream,
-                               struct rpc_cli_transport **presult);
-struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
-
-/* The following definitions come from rpc_server/srv_eventlog_nt.c  */
-
-/* The following definitions come from rpc_server/rpc_handles.c  */
-
-size_t num_pipe_handles(struct pipes_struct *p);
-bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *syntax);
-bool create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
-bool find_policy_by_hnd(struct pipes_struct *p, const struct policy_handle *hnd,
-                       void **data_p);
-bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd);
-void close_policy_by_pipe(struct pipes_struct *p);
-bool pipe_access_check(struct pipes_struct *p);
-
-void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
-                           uint32_t access_granted, size_t data_size,
-                           const char *type, NTSTATUS *pstatus);
-#define policy_handle_create(_p, _hnd, _access, _type, _pstatus) \
-       (_type *)_policy_handle_create((_p), (_hnd), (_access), sizeof(_type), #_type, \
-                                      (_pstatus))
-
-void *_policy_handle_find(struct pipes_struct *p,
-                         const struct policy_handle *hnd,
-                         uint32_t access_required, uint32_t *paccess_granted,
-                         const char *name, const char *location,
-                         NTSTATUS *pstatus);
-#define policy_handle_find(_p, _hnd, _access_required, _access_granted, _type, _pstatus) \
-       (_type *)_policy_handle_find((_p), (_hnd), (_access_required), \
-                                    (_access_granted), #_type, __location__, (_pstatus))
-
-
-/* The following definitions come from rpc_server/srv_rpc_register.c  */
-
-struct rpc_srv_callbacks {
-       bool (*init)(void *private_data);
-       bool (*shutdown)(void *private_data);
-       void *private_data;
-};
-
-struct api_struct;
-NTSTATUS rpc_srv_register(int version, const char *clnt,
-                         const char *srv,
-                         const struct ndr_interface_table *iface,
-                         const struct api_struct *cmds, int size,
-                         const struct rpc_srv_callbacks *rpc_srv_cb);
-
-NTSTATUS rpc_srv_unregister(const struct ndr_interface_table *iface);
-
-/* The following definitions come from rpc_server/srv_pipe.c  */
-
-bool create_next_pdu(struct pipes_struct *p);
-bool api_pipe_bind_auth3(struct pipes_struct *p, struct ncacn_packet *pkt);
-bool setup_fault_pdu(struct pipes_struct *p, NTSTATUS status);
-NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
-                                   const char *srv,
-                                   const struct ndr_syntax_id *interface,
-                                   const struct api_struct *cmds, int size);
-bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax);
-
-/* The following definitions come from rpc_server/srv_pipe_hnd.c  */
-
-struct pipes_struct *get_first_internal_pipe(void);
-struct pipes_struct *get_next_internal_pipe(struct pipes_struct *p);
-bool check_open_pipes(void);
-int close_internal_rpc_pipe_hnd(struct pipes_struct *p);
-
-bool fsp_is_np(struct files_struct *fsp);
-struct tsocket_address;
-NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
-                const struct tsocket_address *local_address,
-                const struct tsocket_address *remote_address,
-                struct client_address *client_id,
-                struct auth_serversupplied_info *session_info,
-                struct messaging_context *msg_ctx,
-                struct fake_file_handle **phandle);
-bool np_read_in_progress(struct fake_file_handle *handle);
-struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
-                                struct fake_file_handle *handle,
-                                const uint8_t *data, size_t len);
-NTSTATUS np_write_recv(struct tevent_req *req, ssize_t *pnwritten);
-struct tevent_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
-                               struct fake_file_handle *handle,
-                               uint8_t *data, size_t len);
-NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
-                     bool *is_data_outstanding);
-
-ssize_t process_incoming_data(struct pipes_struct *p, char *data, size_t n);
-
-/* The following definitions come from rpc_server/srv_spoolss_nt.c  */
-void srv_spoolss_cleanup(void);
-
-void do_drv_upgrade_printer(struct messaging_context *msg,
-                           void *private_data,
-                           uint32_t msg_type,
-                           struct server_id server_id,
-                           DATA_BLOB *data);
-void update_monitored_printq_cache(struct messaging_context *msg_ctx);
-
-/* The following definitions come from rpc_server/srv_srvsvc_nt.c  */
-
-char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
-
-/* The following definitions come from rpc_server/srv_svcctl_nt.c  */
-
-bool init_service_op_table( void );
-bool shutdown_service_op_table(void);
-
-/* The following definitions come from rpcclient/cmd_dfs.c  */
-
-
-/* The following definitions come from rpcclient/cmd_dssetup.c  */
-
-
-/* The following definitions come from rpcclient/cmd_echo.c  */
-
-
-/* The following definitions come from rpcclient/cmd_lsarpc.c  */
-
-
-/* The following definitions come from rpcclient/cmd_netlogon.c  */
-
-
-/* The following definitions come from rpcclient/cmd_ntsvcs.c  */
-
-
-/* The following definitions come from rpcclient/cmd_samr.c  */
-
-
-/* The following definitions come from rpcclient/cmd_shutdown.c  */
-
-
-/* The following definitions come from rpcclient/cmd_spoolss.c  */
-
-
-/* The following definitions come from rpcclient/cmd_srvsvc.c  */
-
-
-/* The following definitions come from rpcclient/cmd_test.c  */
-
-
-/* The following definitions come from rpcclient/cmd_wkssvc.c  */
-
-
-/* The following definitions come from rpcclient/rpcclient.c  */
-
-
-/* The following definitions come from services/svc_netlogon.c  */
-
-
-/* The following definitions come from services/svc_rcinit.c  */
-
-
-/* The following definitions come from services/svc_spoolss.c  */
-
-
-/* The following definitions come from services/svc_winreg.c  */
-
-
-/* The following definitions come from services/svc_wins.c  */
-
 /* The following definitions come from lib/server_contexts.c  */
 struct tevent_context *server_event_context(void);
 void server_event_context_free(void);
@@ -2942,13 +2610,6 @@ int sessionid_traverse_read(int (*fn)(const char *key,
 char *stdin_new_passwd( void);
 char *get_pass( const char *prompt, bool stdin_get);
 
-/* The following definitions come from winbindd/nss_info.c  */
-
-
-/* The following definitions come from winbindd/nss_info_template.c  */
-
-NTSTATUS nss_info_template_init( void );
-
 /* The following definitions come from lib/avahi.c */
 
 struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
@@ -2979,7 +2640,7 @@ NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
 NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
                         const char *called_name, int called_type,
                         const char *calling_name, int calling_type,
-                        int *pfd, uint16_t *ret_port);
+                        int *pfd, uint16_t *ret_port, int sec_timeout);
 
 struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
                                            struct tevent_context *ev,
@@ -2998,6 +2659,7 @@ NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
                             int *calling_types,
                             size_t num_addrs,
                             uint16_t port,
+                            int sec_timeout,
                             int *pfd, size_t *chosen_index,
                             uint16_t *chosen_port);