From 3c9c06ac05635dc0af3b29b15c3f568cbf57afdd Mon Sep 17 00:00:00 2001 From: Luk Claes Date: Sat, 19 May 2012 18:23:40 +0200 Subject: s3:libsmb: get rid of cli_state_capabilities Signed-off-by: Luk Claes Signed-off-by: Stefan Metzmacher --- source3/include/smb_macros.h | 2 +- source3/libsmb/async_smb.c | 4 ++-- source3/libsmb/cliconnect.c | 4 ++-- source3/libsmb/clidfs.c | 6 +++--- source3/libsmb/clientgen.c | 5 ----- source3/libsmb/clifile.c | 4 ++-- source3/libsmb/clilist.c | 2 +- source3/libsmb/clireadwrite.c | 8 ++++---- source3/libsmb/clitrans.c | 4 ++-- source3/libsmb/libsmb_file.c | 4 ++-- source3/libsmb/libsmb_server.c | 2 +- source3/libsmb/libsmb_stat.c | 4 ++-- source3/libsmb/proto.h | 1 - source3/torture/torture.c | 2 +- source3/winbindd/winbindd_cm.c | 2 +- 15 files changed, 24 insertions(+), 30 deletions(-) (limited to 'source3') diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index ef4b9bfccd..048e560024 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -171,7 +171,7 @@ copy an IP address from one buffer to another Return True if a server has CIFS UNIX capabilities. ********************************************************************/ -#define SERVER_HAS_UNIX_CIFS(c) (cli_state_capabilities(c) & CAP_UNIX) +#define SERVER_HAS_UNIX_CIFS(c) (smb1cli_conn_capabilities(c->conn) & CAP_UNIX) /**************************************************************************** Make a filename into unix format. diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 8ca19111bf..2d4d3fed60 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -107,7 +107,7 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx, additional_flags |= FLAG_CASELESS_PATHNAMES; } - if ((cli_state_capabilities(cli) & CAP_DFS) && cli->dfsroot) { + if ((smb1cli_conn_capabilities(cli->conn) & CAP_DFS) && cli->dfsroot) { additional_flags2 |= FLAGS2_DFS_PATHNAMES; } @@ -170,7 +170,7 @@ struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, additional_flags |= FLAG_CASELESS_PATHNAMES; } - if ((cli_state_capabilities(cli) & CAP_DFS) && cli->dfsroot) { + if ((smb1cli_conn_capabilities(cli->conn) & CAP_DFS) && cli->dfsroot) { additional_flags2 |= FLAGS2_DFS_PATHNAMES; } diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index f61665b253..3a4850d3d6 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -346,7 +346,7 @@ static NTSTATUS cli_session_setup_lanman2(struct cli_state *cli, const char *use static uint32_t cli_session_setup_capabilities(struct cli_state *cli, uint32_t sesssetup_capabilities) { - uint32_t client_capabilities = cli_state_capabilities(cli); + uint32_t client_capabilities = smb1cli_conn_capabilities(cli->conn); /* * We only send capabilities based on the mask for: @@ -2108,7 +2108,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli, /* if the server supports extended security then use SPNEGO */ - if (cli_state_capabilities(cli) & CAP_EXTENDED_SECURITY) { + if (smb1cli_conn_capabilities(cli->conn) & CAP_EXTENDED_SECURITY) { const char *remote_realm = cli_state_remote_realm(cli); ADS_STATUS status = cli_session_setup_spnego(cli, user, pass, workgroup, diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 97b6ec0d48..1eaec45eab 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -208,7 +208,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, here before trying to connect to the original share. cli_check_msdfs_proxy() will fail if it is a normal share. */ - if ((cli_state_capabilities(c) & CAP_DFS) && + if ((smb1cli_conn_capabilities(c->conn) & CAP_DFS) && cli_check_msdfs_proxy(ctx, c, sharename, &newserver, &newshare, force_encrypt, @@ -596,10 +596,10 @@ static bool cli_dfs_check_error(struct cli_state *cli, NTSTATUS expected, { /* only deal with DS when we negotiated NT_STATUS codes and UNICODE */ - if (!(cli_state_capabilities(cli) & CAP_UNICODE)) { + if (!(smb1cli_conn_capabilities(cli->conn) & CAP_UNICODE)) { return false; } - if (!(cli_state_capabilities(cli) & CAP_STATUS32)) { + if (!(smb1cli_conn_capabilities(cli->conn) & CAP_STATUS32)) { return false; } if (NT_STATUS_EQUAL(status, expected)) { diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 6f81ddde2d..ac59e8b315 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -435,11 +435,6 @@ bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive) return ret; } -uint32_t cli_state_capabilities(struct cli_state *cli) -{ - return smb1cli_conn_capabilities(cli->conn); -} - uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs) { uint32_t ret = smb1cli_conn_max_xmit(cli->conn); diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 38b95e2457..fc5f5d7024 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -2839,7 +2839,7 @@ NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum, int ltype; NTSTATUS status; - if (! (cli_state_capabilities(cli) & CAP_LARGE_FILES)) { + if (! (smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_FILES)) { return cli_lock32(cli, fnum, offset, len, timeout, lock_type); } @@ -2956,7 +2956,7 @@ NTSTATUS cli_unlock64(struct cli_state *cli, struct tevent_req *req; NTSTATUS status = NT_STATUS_OK; - if (! (cli_state_capabilities(cli) & CAP_LARGE_FILES)) { + if (! (smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_FILES)) { return cli_unlock(cli, fnum, offset, len); } diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 103d044f56..aa8012cb30 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -950,7 +950,7 @@ NTSTATUS cli_list(struct cli_state *cli, const char *mask, uint16 attribute, goto fail; } - info_level = (cli_state_capabilities(cli) & CAP_NT_SMBS) + info_level = (smb1cli_conn_capabilities(cli->conn) & CAP_NT_SMBS) ? SMB_FIND_FILE_BOTH_DIRECTORY_INFO : SMB_FIND_INFO_STANDARD; req = cli_list_send(frame, ev, cli, mask, attribute, info_level); diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 8f137c0e81..ac200c7ffd 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -52,7 +52,7 @@ static size_t cli_read_max_bufsize(struct cli_state *cli) } return useable_space; - } else if (cli_state_capabilities(cli) & CAP_LARGE_READX) { + } else if (smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_READX) { /* * Note: CAP_LARGE_READX also works with signing */ @@ -86,7 +86,7 @@ static size_t cli_write_max_bufsize(struct cli_state *cli, if (cli->server_posix_capabilities & CIFS_UNIX_LARGE_WRITE_CAP) { useable_space = 0xFFFFFF - data_offset; - } else if (cli_state_capabilities(cli) & CAP_LARGE_WRITEX) { + } else if (smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_WRITEX) { useable_space = 0x1FFFF - data_offset; } else { return min_space; @@ -155,7 +155,7 @@ struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx, SSVAL(state->vwv + 8, 0, 0); SSVAL(state->vwv + 9, 0, 0); - if (cli_state_capabilities(cli) & CAP_LARGE_FILES) { + if (smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_FILES) { SIVAL(state->vwv + 10, 0, (((uint64_t)offset)>>32) & 0xffffffff); wct = 12; @@ -840,7 +840,7 @@ struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx, { struct tevent_req *req, *subreq; struct cli_write_andx_state *state; - bool bigoffset = ((cli_state_capabilities(cli) & CAP_LARGE_FILES) != 0); + bool bigoffset = ((smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_FILES) != 0); uint8_t wct = bigoffset ? 14 : 12; size_t max_write = cli_write_max_bufsize(cli, mode, wct); uint16_t *vwv; diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index 53c53f119e..5dd7008c59 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -80,7 +80,7 @@ struct tevent_req *cli_trans_send( additional_flags |= FLAG_CASELESS_PATHNAMES; } - if ((cli_state_capabilities(cli) & CAP_DFS) && cli->dfsroot) { + if ((smb1cli_conn_capabilities(cli->conn) & CAP_DFS) && cli->dfsroot) { additional_flags2 |= FLAGS2_DFS_PATHNAMES; } @@ -174,7 +174,7 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli, additional_flags |= FLAG_CASELESS_PATHNAMES; } - if ((cli_state_capabilities(cli) & CAP_DFS) && cli->dfsroot) { + if ((smb1cli_conn_capabilities(cli->conn) & CAP_DFS) && cli->dfsroot) { additional_flags2 |= FLAGS2_DFS_PATHNAMES; } diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index c09011bb0a..9521542cb2 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -26,7 +26,7 @@ #include "libsmb/libsmb.h" #include "libsmbclient.h" #include "libsmb_internal.h" - +#include "../libcli/smb/smbXcli_base.h" /* * Routine to open() a file ... @@ -551,7 +551,7 @@ SMBC_getatr(SMBCCTX * context, } /* if this is NT then don't bother with the getatr */ - if (cli_state_capabilities(targetcli) & CAP_NT_SMBS) { + if (smb1cli_conn_capabilities(targetcli->conn) & CAP_NT_SMBS) { errno = EPERM; TALLOC_FREE(frame); return False; diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c index f9a7599bdb..ccbb6f1aa5 100644 --- a/source3/libsmb/libsmb_server.c +++ b/source3/libsmb/libsmb_server.c @@ -489,7 +489,7 @@ SMBC_server_internal(TALLOC_CTX *ctx, here before trying to connect to the original share. cli_check_msdfs_proxy() will fail if it is a normal share. */ - if ((cli_state_capabilities(c) & CAP_DFS) && + if ((smb1cli_conn_capabilities(c->conn) & CAP_DFS) && cli_check_msdfs_proxy(ctx, c, share, &newserver, &newshare, /* FIXME: cli_check_msdfs_proxy() does diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c index 2a08b30d70..5cfbcb842c 100644 --- a/source3/libsmb/libsmb_stat.c +++ b/source3/libsmb/libsmb_stat.c @@ -26,7 +26,7 @@ #include "libsmb/libsmb.h" #include "libsmbclient.h" #include "libsmb_internal.h" - +#include "../libcli/smb/smbXcli_base.h" /* * Generate an inode number from file name for those things that need it @@ -465,7 +465,7 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, } /* See if DFS is supported */ - if ((cli_state_capabilities(cli) & CAP_DFS) && cli->dfsroot) { + if ((smb1cli_conn_capabilities(cli->conn) & CAP_DFS) && cli->dfsroot) { flags |= SMBC_VFS_FEATURE_DFS; } diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index de69be2919..9662b92d6a 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -182,7 +182,6 @@ uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid); 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); -uint32_t cli_state_capabilities(struct cli_state *cli); uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs); uint16_t cli_state_max_requests(struct cli_state *cli); const uint8_t *cli_state_server_challenge(struct cli_state *cli); diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 7137cde512..bad3986188 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -4521,7 +4521,7 @@ static bool run_properties(int dummy) smbXcli_conn_set_sockopt(cli->conn, sockops); - d_printf("Capabilities 0x%08x\n", cli_state_capabilities(cli)); + d_printf("Capabilities 0x%08x\n", smb1cli_conn_capabilities(cli->conn)); if (!torture_close_connection(cli)) { correct = False; diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 41795dd1af..d190bb39a1 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -835,7 +835,7 @@ static NTSTATUS cm_prepare_connection(const struct winbindd_domain *domain, } if (smbXcli_conn_protocol((*cli)->conn) >= PROTOCOL_NT1 && - cli_state_capabilities(*cli) & CAP_EXTENDED_SECURITY) { + smb1cli_conn_capabilities((*cli)->conn) & CAP_EXTENDED_SECURITY) { try_spnego = true; } else if (smbXcli_conn_protocol((*cli)->conn) >= PROTOCOL_SMB2_02) { try_spnego = true; -- cgit