s3/libsmb: adjust smb2 code for new idl structs & generated ndr push/pull funcs.
[samba.git] / source3 / libsmb / proto.h
index 1372dee3cac373cdf9d00f3aa3a67a728a39654b..2bd61b1d2c24ccc55788b56627984f5deafdf101 100644 (file)
 #ifndef _LIBSMB_PROTO_H_
 #define _LIBSMB_PROTO_H_
 
-#include "ads.h"
 #include "auth_info.h"
 
 struct smb_trans_enc_state;
+struct cli_credentials;
+struct cli_state;
+struct file_info;
+struct print_job_info;
 
 /* The following definitions come from libsmb/cliconnect.c  */
 
-struct tevent_req *cli_session_setup_send(TALLOC_CTX *mem_ctx,
-                                         struct tevent_context *ev,
-                                         struct cli_state *cli,
-                                         const char *user,
-                                         const char *pass, int passlen,
-                                         const char *ntpass, int ntpasslen,
-                                         const char *workgroup);
-NTSTATUS cli_session_setup_recv(struct tevent_req *req);
-NTSTATUS cli_session_setup(struct cli_state *cli,
-                          const char *user,
-                          const char *pass, int passlen,
-                          const char *ntpass, int ntpasslen,
-                          const char *workgroup);
+struct cli_credentials *cli_session_creds_init(TALLOC_CTX *mem_ctx,
+                                              const char *username,
+                                              const char *domain,
+                                              const char *realm,
+                                              const char *password,
+                                              bool use_kerberos,
+                                              bool fallback_after_kerberos,
+                                              bool use_ccache,
+                                              bool password_is_nt_hash);
+NTSTATUS cli_session_creds_prepare_krb5(struct cli_state *cli,
+                                       struct cli_credentials *creds);
+struct tevent_req *cli_session_setup_creds_send(TALLOC_CTX *mem_ctx,
+                                       struct tevent_context *ev,
+                                       struct cli_state *cli,
+                                       struct cli_credentials *creds);
+NTSTATUS cli_session_setup_creds_recv(struct tevent_req *req);
+NTSTATUS cli_session_setup_creds(struct cli_state *cli,
+                                struct cli_credentials *creds);
+NTSTATUS cli_session_setup_anon(struct cli_state *cli);
 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
                                                  struct tevent_context *ev,
                                                  struct cli_state *cli,
@@ -69,8 +78,11 @@ struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
                       const char *dev, const char *pass, int passlen);
+NTSTATUS cli_tree_connect_creds(struct cli_state *cli,
+                               const char *share, const char *dev,
+                               struct cli_credentials *creds);
 NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
-                         const char *dev, const char *pass, int passlen);
+                         const char *dev, const char *pass);
 NTSTATUS cli_tdis(struct cli_state *cli);
 NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
                        uint16_t port, int name_type, const char *myname,
@@ -80,15 +92,25 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli,
                              const char *dest_host,
                              const struct sockaddr_storage *dest_ss, int port,
                              int signing_state, int flags);
-struct tevent_req *cli_full_connection_send(
+NTSTATUS cli_smb1_setup_encryption(struct cli_state *cli,
+                                  struct cli_credentials *creds);
+struct tevent_req *cli_full_connection_creds_send(
        TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        const char *my_name, const char *dest_host,
        const struct sockaddr_storage *dest_ss, int port,
        const char *service, const char *service_type,
-       const char *user, const char *domain,
-       const char *password, int flags, int signing_state);
-NTSTATUS cli_full_connection_recv(struct tevent_req *req,
-                                 struct cli_state **output_cli);
+       struct cli_credentials *creds,
+       int flags, int signing_state);
+NTSTATUS cli_full_connection_creds_recv(struct tevent_req *req,
+                                       struct cli_state **output_cli);
+NTSTATUS cli_full_connection_creds(struct cli_state **output_cli,
+                                  const char *my_name,
+                                  const char *dest_host,
+                                  const struct sockaddr_storage *dest_ss, int port,
+                                  const char *service, const char *service_type,
+                                  struct cli_credentials *creds,
+                                  int flags,
+                                  int signing_state);
 NTSTATUS cli_full_connection(struct cli_state **output_cli,
                             const char *my_name,
                             const char *dest_host,
@@ -113,6 +135,9 @@ struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
 
 /* The following definitions come from libsmb/clidfs.c  */
 
+NTSTATUS cli_cm_force_encryption_creds(struct cli_state *c,
+                                      struct cli_credentials *creds,
+                                      const char *sharename);
 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
                        const char *username,
                        const char *password,
@@ -123,7 +148,6 @@ NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
                                const char *server,
                                const char *share,
                                const struct user_auth_info *auth_info,
-                               bool show_hdr,
                                bool force_encrypt,
                                int max_protocol,
                                int port,
@@ -131,6 +155,13 @@ NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
                                struct cli_state **pcli);
 void cli_cm_display(struct cli_state *c);
 struct client_dfs_referral;
+NTSTATUS cli_dfs_get_referral_ex(TALLOC_CTX *ctx,
+                       struct cli_state *cli,
+                       const char *path,
+                       uint16_t max_referral_level,
+                       struct client_dfs_referral **refs,
+                       size_t *num_refs,
+                       size_t *consumed);
 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
                        struct cli_state *cli,
                        const char *path,
@@ -151,32 +182,31 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
                        char **pp_newserver,
                        char **pp_newshare,
                        bool force_encrypt,
-                       const char *username,
-                       const char *password,
-                       const char *domain);
+                       struct cli_credentials *creds);
 
 /* The following definitions come from libsmb/clientgen.c  */
 
 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
 bool cli_set_backup_intent(struct cli_state *cli, bool flag);
-void cli_setup_packet_buf(struct cli_state *cli, char *buf);
 extern struct GUID cli_state_client_guid;
 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
                                   int fd,
                                   const char *remote_name,
-                                  const char *remote_realm,
                                   int signing_state,
                                   int flags);
 void cli_nt_pipes_close(struct cli_state *cli);
 void cli_shutdown(struct cli_state *cli);
-const char *cli_state_remote_realm(struct cli_state *cli);
 uint16_t cli_state_get_vc_num(struct cli_state *cli);
 uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
 uint32_t cli_getpid(struct cli_state *cli);
+bool cli_state_is_encryption_on(struct cli_state *cli);
 bool cli_state_has_tcon(struct cli_state *cli);
-uint16_t cli_state_get_tid(struct cli_state *cli);
-uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
+uint32_t cli_state_get_tid(struct cli_state *cli);
+uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid);
+struct smbXcli_tcon;
+struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli);
+void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon);
 uint16_t cli_state_get_uid(struct cli_state *cli);
 uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
@@ -304,12 +334,16 @@ NTSTATUS cli_posix_chown(struct cli_state *cli,
                        uid_t uid,
                        gid_t gid);
 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
-                                struct tevent_context *ev,
-                                struct cli_state *cli,
-                                const char *fname_src,
-                                const char *fname_dst);
+                                  struct tevent_context *ev,
+                                  struct cli_state *cli,
+                                  const char *fname_src,
+                                  const char *fname_dst,
+                                  bool replace);
 NTSTATUS cli_rename_recv(struct tevent_req *req);
-NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
+NTSTATUS cli_rename(struct cli_state *cli,
+                   const char *fname_src,
+                   const char *fname_dst,
+                   bool replace);
 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
                                 struct tevent_context *ev,
                                 struct cli_state *cli,
@@ -378,15 +412,6 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
                      uint8_t SecurityFlags,
                      uint16_t *pfid,
                      struct smb_create_returns *cr);
-uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
-                           size_t str_len, size_t *pconverted_size);
-uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
-                             const uint8_t *bytes, size_t num_bytes);
-uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
-                              const char *str, size_t str_len,
-                              size_t *pconverted_size);
-uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
-                                const uint8_t *bytes, size_t num_bytes);
 struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx,
                                   struct tevent_context *ev,
                                   struct cli_state *cli, const char *fname,
@@ -398,7 +423,7 @@ struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev
 NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
 NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
-struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
+struct tevent_req *cli_smb1_close_create(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev,
                                    struct cli_state *cli, uint16_t fnum,
                                    struct tevent_req **psubreq);
@@ -673,15 +698,6 @@ NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
                               uint64_t *total_file_nodes,
                               uint64_t *free_file_nodes,
                               uint64_t *fs_identifier);
-NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
-                               const char *user,
-                               const char *pass,
-                               const char *domain);
-NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
-NTSTATUS cli_force_encryption(struct cli_state *c,
-                       const char *username,
-                       const char *password,
-                       const char *domain);
 struct tevent_req *cli_posix_whoami_send(TALLOC_CTX *mem_ctx,
                        struct tevent_context *ev,
                        struct cli_state *cli);
@@ -781,6 +797,10 @@ NTSTATUS build_user_quota_buffer(SMB_NTQUOTA_LIST *qt_list,
                                 TALLOC_CTX *mem_ctx,
                                 DATA_BLOB *outbuf,
                                 SMB_NTQUOTA_LIST **end_ptr);
+NTSTATUS build_fs_quota_buffer(TALLOC_CTX *mem_ctx,
+                              const SMB_NTQUOTA_STRUCT *pqt,
+                              DATA_BLOB *blob,
+                              uint32_t maxlen);
 NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
                            SMB_NTQUOTA_STRUCT *pqt);
 NTSTATUS cli_set_user_quota(struct cli_state *cli,
@@ -954,4 +974,17 @@ NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
                       TALLOC_CTX *mem_ctx, char **psubstitute_name,
                      char **pprint_name, uint32_t *pflags);
 
+NTSTATUS fill_quota_buffer(TALLOC_CTX *mem_ctx,
+                          SMB_NTQUOTA_LIST *tmp_list,
+                          bool return_single,
+                          uint32_t max_data,
+                          DATA_BLOB *blob,
+                          SMB_NTQUOTA_LIST **end_ptr);
+/* The following definitions come from libsmb/passchange.c  */
+
+NTSTATUS remote_password_change(const char *remote_machine,
+                               const char *domain, const char *user_name,
+                               const char *old_passwd, const char *new_passwd,
+                               char **err_str);
+
 #endif /* _LIBSMB_PROTO_H_ */