s3:libsmb: Remove signing_state from cli_full_connection_creds_send()
[samba.git] / source3 / libsmb / proto.h
index 2bd61b1d2c24ccc55788b56627984f5deafdf101..bef04d32638fcd42b24d370c9da9e17f211aedd2 100644 (file)
@@ -86,12 +86,12 @@ NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
 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,
-                       int signing_state, int flags, struct cli_state **pcli);
+                       enum smb_signing_setting signing_state, int flags, struct cli_state **pcli);
 NTSTATUS cli_start_connection(struct cli_state **output_cli,
                              const char *my_name,
                              const char *dest_host,
                              const struct sockaddr_storage *dest_ss, int port,
-                             int signing_state, int flags);
+                             enum smb_signing_setting signing_state, int flags);
 NTSTATUS cli_smb1_setup_encryption(struct cli_state *cli,
                                   struct cli_credentials *creds);
 struct tevent_req *cli_full_connection_creds_send(
@@ -100,7 +100,7 @@ struct tevent_req *cli_full_connection_creds_send(
        const struct sockaddr_storage *dest_ss, int port,
        const char *service, const char *service_type,
        struct cli_credentials *creds,
-       int flags, int signing_state);
+       int flags);
 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,
@@ -110,15 +110,7 @@ NTSTATUS cli_full_connection_creds(struct cli_state **output_cli,
                                   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,
-                            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);
+                                  enum smb_signing_setting signing_state);
 NTSTATUS cli_raw_tcon(struct cli_state *cli,
                      const char *service, const char *pass, const char *dev,
                      uint16_t *max_xmit, uint16_t *tid);
@@ -129,20 +121,12 @@ struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
                                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,
-                                       const struct user_auth_info *user_info,
-                                       char **pp_workgroup_out);
 
 /* 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,
-                       const char *domain,
-                       const char *sharename);
 NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
                                struct cli_state *referring_cli,
                                const char *server,
@@ -150,6 +134,7 @@ NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
                                const struct user_auth_info *auth_info,
                                bool force_encrypt,
                                int max_protocol,
+                               const struct sockaddr_storage *dest_ss,
                                int port,
                                int name_type,
                                struct cli_state **pcli);
@@ -186,14 +171,13 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
 
 /* 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);
 extern struct GUID cli_state_client_guid;
 struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
                                   int fd,
                                   const char *remote_name,
-                                  int signing_state,
+                                  enum smb_signing_setting signing_state,
                                   int flags);
 void cli_nt_pipes_close(struct cli_state *cli);
 void cli_shutdown(struct cli_state *cli);
@@ -217,7 +201,6 @@ struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                                 DATA_BLOB data);
 NTSTATUS cli_echo_recv(struct tevent_req *req);
 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
-bool is_andx_req(uint8_t cmd);
 NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
                 uint8_t smb_command, uint8_t additional_flags,
                 uint8_t wct, uint16_t *vwv,
@@ -228,7 +211,6 @@ NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
 
 /* The following definitions come from libsmb/clierror.c  */
 
-const char *cli_errstr(struct cli_state *cli);
 NTSTATUS cli_nt_error(struct cli_state *cli);
 void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode);
 int cli_errno(struct cli_state *cli);
@@ -252,6 +234,15 @@ NTSTATUS cli_setpathinfo(struct cli_state *cli,
                         const char *path,
                         uint8_t *data,
                         size_t data_len);
+struct tevent_req *cli_setfileinfo_send(
+       TALLOC_CTX *mem_ctx,
+       struct tevent_context *ev,
+       struct cli_state *cli,
+       uint16_t fnum,
+       uint16_t level,
+       uint8_t *data,
+       size_t data_len);
+NTSTATUS cli_setfileinfo_recv(struct tevent_req *req);
 
 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
@@ -265,12 +256,14 @@ NTSTATUS cli_posix_symlink(struct cli_state *cli,
 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
                                        struct cli_state *cli,
-                                       const char *fname,
-                                       size_t len);
-NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
-                               char *retpath, size_t len);
-NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
-                       char *linkpath, size_t len);
+                                       const char *fname);
+NTSTATUS cli_posix_readlink_recv(
+       struct tevent_req *req, TALLOC_CTX *mem_ctx, char **target);
+NTSTATUS cli_posix_readlink(
+       struct cli_state *cli,
+       const char *fname,
+       TALLOC_CTX *mem_ctx,
+       char **target);
 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
                                        struct tevent_context *ev,
                                        struct cli_state *cli,
@@ -307,11 +300,11 @@ NTSTATUS cli_posix_setacl(struct cli_state *cli,
                        const void *acl_buf,
                        size_t acl_buf_size);
 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
-                                       struct tevent_context *ev,
-                                       struct cli_state *cli,
-                                       const char *fname);
-NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
-                               SMB_STRUCT_STAT *sbuf);
+                                      struct tevent_context *ev,
+                                      struct cli_state *cli,
+                                      const char *fname,
+                                      SMB_STRUCT_STAT *sbuf);
+NTSTATUS cli_posix_stat_recv(struct tevent_req *req);
 NTSTATUS cli_posix_stat(struct cli_state *cli,
                        const char *fname,
                        SMB_STRUCT_STAT *sbuf);
@@ -352,21 +345,25 @@ struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
 
-struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
-                                struct tevent_context *ev,
-                                struct cli_state *cli,
-                                const char *fname_src,
-                                const char *fname_dst);
-NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
-NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
+struct tevent_req *cli_hardlink_send(
+       TALLOC_CTX *mem_ctx,
+       struct tevent_context *ev,
+       struct cli_state *cli,
+       const char *fname_src,
+       const char *fname_dst);
+NTSTATUS cli_hardlink_recv(struct tevent_req *req);
+NTSTATUS cli_hardlink(
+       struct cli_state *cli,
+       const char *fname_src,
+       const char *fname_dst);
 
 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
                                 struct tevent_context *ev,
                                 struct cli_state *cli,
                                 const char *fname,
-                                uint16_t mayhave_attrs);
+                                uint32_t mayhave_attrs);
 NTSTATUS cli_unlink_recv(struct tevent_req *req);
-NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
+NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint32_t mayhave_attrs);
 
 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
                                  struct tevent_context *ev,
@@ -397,6 +394,7 @@ struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
                                     uint32_t ShareAccess,
                                     uint32_t CreateDisposition,
                                     uint32_t CreateOptions,
+                                    uint32_t ImpersonationLevel,
                                     uint8_t SecurityFlags);
 NTSTATUS cli_ntcreate_recv(struct tevent_req *req,
                        uint16_t *pfnum,
@@ -442,6 +440,49 @@ NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
                      uint32_t offset, uint32_t len,
                      int timeout, unsigned char locktype);
+struct smb1_lock_element {
+       uint16_t pid;
+       uint64_t offset;
+       uint64_t length;
+};
+
+struct tevent_req *cli_lockingx_create(
+       TALLOC_CTX *mem_ctx,
+       struct tevent_context *ev,
+       struct cli_state *cli,
+       uint16_t fnum,
+       uint8_t typeoflock,
+       uint8_t newoplocklevel,
+       int32_t timeout,
+       uint16_t num_unlocks,
+       const struct smb1_lock_element *unlocks,
+       uint16_t num_locks,
+       const struct smb1_lock_element *locks,
+       struct tevent_req **psmbreq);
+struct tevent_req *cli_lockingx_send(
+       TALLOC_CTX *mem_ctx,
+       struct tevent_context *ev,
+       struct cli_state *cli,
+       uint16_t fnum,
+       uint8_t typeoflock,
+       uint8_t newoplocklevel,
+       int32_t timeout,
+       uint16_t num_unlocks,
+       const struct smb1_lock_element *unlocks,
+       uint16_t num_locks,
+       const struct smb1_lock_element *locks);
+NTSTATUS cli_lockingx_recv(struct tevent_req *req);
+NTSTATUS cli_lockingx(
+       struct cli_state *cli,
+       uint16_t fnum,
+       uint8_t typeoflock,
+       uint8_t newoplocklevel,
+       int32_t timeout,
+       uint16_t num_unlocks,
+       const struct smb1_lock_element *unlocks,
+       uint16_t num_locks,
+       const struct smb1_lock_element *locks);
+
 NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
                    uint32_t len, int timeout, enum brl_type lock_type);
 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
@@ -452,17 +493,6 @@ struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
                                 uint64_t len);
 NTSTATUS cli_unlock_recv(struct tevent_req *req);
 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
-NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
-                   uint64_t offset, uint64_t len, int timeout,
-                   enum brl_type lock_type);
-struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
-                                struct tevent_context *ev,
-                                struct cli_state *cli,
-                                uint16_t fnum,
-                                uint64_t offset,
-                                uint64_t len);
-NTSTATUS cli_unlock64_recv(struct tevent_req *req);
-NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
                                         struct tevent_context *ev,
                                         struct cli_state *cli,
@@ -488,18 +518,11 @@ struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
                                struct cli_state *cli,
                                 uint16_t fnum);
 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
-                        uint16_t *attr,
+                        uint32_t *pattr,
                         off_t *size,
                         time_t *change_time,
                         time_t *access_time,
                         time_t *write_time);
-NTSTATUS cli_getattrE(struct cli_state *cli,
-                       uint16_t fnum,
-                       uint16_t *attr,
-                       off_t *size,
-                       time_t *change_time,
-                       time_t *access_time,
-                       time_t *write_time);
 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
                                struct tevent_context *ev,
                                struct cli_state *cli,
@@ -518,24 +541,24 @@ struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
                                struct cli_state *cli,
                                const char *fname);
 NTSTATUS cli_getatr_recv(struct tevent_req *req,
-                               uint16_t *attr,
+                               uint32_t *pattr,
                                off_t *size,
                                time_t *write_time);
 NTSTATUS cli_getatr(struct cli_state *cli,
                        const char *fname,
-                       uint16_t *attr,
+                       uint32_t *pattr,
                        off_t *size,
                        time_t *write_time);
 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
                                struct tevent_context *ev,
                                struct cli_state *cli,
                                const char *fname,
-                               uint16_t attr,
+                               uint32_t attr,
                                time_t mtime);
 NTSTATUS cli_setatr_recv(struct tevent_req *req);
 NTSTATUS cli_setatr(struct cli_state *cli,
                 const char *fname,
-                uint16_t attr,
+                uint32_t attr,
                 time_t mtime);
 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
                                  struct tevent_context *ev,
@@ -722,11 +745,14 @@ NTSTATUS cli_posix_whoami(struct cli_state *cli,
 
 /* The following definitions come from libsmb/clilist.c  */
 
-NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16_t attribute,
+NTSTATUS is_bad_finfo_name(const struct cli_state *cli,
+                       const struct file_info *finfo);
+
+NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint32_t attribute,
                      NTSTATUS (*fn)(const char *, struct file_info *,
                                 const char *, void *), void *state);
 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
-                       uint16_t attribute, int info_level,
+                       uint32_t attribute, int info_level,
                        NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
                                   const char *mask, void *private_data),
                        void *private_data);
@@ -734,11 +760,11 @@ struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
                                 struct tevent_context *ev,
                                 struct cli_state *cli,
                                 const char *mask,
-                                uint16_t attribute,
+                                uint32_t attribute,
                                 uint16_t info_level);
 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                       struct file_info **finfo, size_t *num_finfo);
-NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16_t attribute,
+NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint32_t attribute,
                  NTSTATUS (*fn)(const char *, struct file_info *, const char *,
                             void *), void *state);
 
@@ -839,6 +865,16 @@ NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
                  off_t start_offset, off_t size, size_t window_size,
                  NTSTATUS (*sink)(char *buf, size_t n, void *priv),
                  void *priv, off_t *received);
+NTSTATUS cli_read_sink(char *buf, size_t n, void *priv);
+struct tevent_req *cli_read_send(
+       TALLOC_CTX *mem_ctx,
+       struct tevent_context *ev,
+       struct cli_state *cli,
+       uint16_t fnum,
+       char *buf,
+       off_t offset,
+       size_t size);
+NTSTATUS cli_read_recv(struct tevent_req *req, size_t *received);
 NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
                  char *buf, off_t offset, size_t size,
                  size_t *nread);
@@ -859,6 +895,23 @@ 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);
 
+struct tevent_req *cli_write_send(TALLOC_CTX *mem_ctx,
+                                 struct tevent_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_recv(struct tevent_req *req, size_t *pwritten);
+
+struct tevent_req *cli_writeall_send(
+       TALLOC_CTX *mem_ctx,
+       struct tevent_context *ev,
+       struct cli_state *cli,
+       uint16_t fnum,
+       uint16_t mode,
+       const uint8_t *buf,
+       off_t offset,
+       size_t size);
+NTSTATUS cli_writeall_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);
@@ -899,15 +952,12 @@ NTSTATUS cli_set_security_descriptor(struct cli_state *cli,
 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
                         const struct security_descriptor *sd);
 
+NTSTATUS cli_query_mxac(struct cli_state *cli,
+                       const char *filename,
+                       uint32_t *mxac);
+
 /* The following definitions come from libsmb/clistr.c  */
 
-size_t clistr_pull_talloc(TALLOC_CTX *ctx,
-                         const char *base,
-                         uint16_t flags2,
-                         char **pp_dest,
-                         const void *src,
-                         int src_len,
-                         int flags);
 bool clistr_is_previous_version_path(const char *path,
                        const char **startp,
                        const char **endp,