mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3:libsmb: get rid of cli_state_protocol
Signed-off-by: Luk Claes <luk@debian.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
4f6f4ea93c
commit
d8c0646a5d
@ -428,7 +428,7 @@ static int do_cd(const char *new_dir)
|
||||
/* Use a trans2_qpathinfo to test directories for modern servers.
|
||||
Except Win9x doesn't support the qpathinfo_basic() call..... */
|
||||
|
||||
if (cli_state_protocol(targetcli) > PROTOCOL_LANMAN2 && !targetcli->win95) {
|
||||
if (smbXcli_conn_protocol(targetcli->conn) > PROTOCOL_LANMAN2 && !targetcli->win95) {
|
||||
|
||||
status = cli_qpathinfo_basic(targetcli, targetpath, &sbuf,
|
||||
&attributes);
|
||||
|
@ -146,7 +146,7 @@ struct tevent_req *tstream_cli_np_open_send(TALLOC_CTX *mem_ctx,
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
|
||||
if (cli_state_protocol(cli) < PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_SMB2_02) {
|
||||
state->is_smb1 = true;
|
||||
}
|
||||
|
||||
|
@ -1185,7 +1185,7 @@ static struct tevent_req *cli_sesssetup_blob_send(TALLOC_CTX *mem_ctx,
|
||||
state->blob = blob;
|
||||
state->cli = cli;
|
||||
|
||||
if (cli_state_protocol(cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
usable_space = UINT16_MAX;
|
||||
} else {
|
||||
usable_space = cli_state_available_size(cli,
|
||||
@ -1217,7 +1217,7 @@ static bool cli_sesssetup_blob_next(struct cli_sesssetup_blob_state *state,
|
||||
|
||||
thistime = MIN(state->blob.length, state->max_blob_size);
|
||||
|
||||
if (cli_state_protocol(state->cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
|
||||
state->smb2_blob.data = state->blob.data;
|
||||
state->smb2_blob.length = thistime;
|
||||
@ -1298,7 +1298,7 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
|
||||
uint8_t *inbuf;
|
||||
ssize_t ret;
|
||||
|
||||
if (cli_state_protocol(state->cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
status = smb2cli_session_setup_recv(subreq, state,
|
||||
&state->recv_iov,
|
||||
&state->ret_blob);
|
||||
@ -1316,7 +1316,7 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
|
||||
|
||||
state->status = status;
|
||||
|
||||
if (cli_state_protocol(state->cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
goto next;
|
||||
}
|
||||
|
||||
@ -1481,7 +1481,7 @@ static struct tevent_req *cli_session_setup_kerberos_send(
|
||||
state->negTokenTarg.length);
|
||||
#endif
|
||||
|
||||
if (cli_state_protocol(cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
state->cli->smb2.session = smbXcli_session_create(cli,
|
||||
cli->conn);
|
||||
if (tevent_req_nomem(state->cli->smb2.session, req)) {
|
||||
@ -1517,7 +1517,7 @@ static void cli_session_setup_kerberos_done(struct tevent_req *subreq)
|
||||
|
||||
cli_set_session_key(state->cli, state->session_key_krb5);
|
||||
|
||||
if (cli_state_protocol(state->cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
struct smbXcli_session *session = state->cli->smb2.session;
|
||||
status = smb2cli_session_set_session_key(session,
|
||||
state->session_key_krb5,
|
||||
@ -1659,7 +1659,7 @@ static struct tevent_req *cli_session_setup_ntlmssp_send(
|
||||
state->blob_out = spnego_gen_negTokenInit(state, OIDs_ntlm, &blob_out, NULL);
|
||||
data_blob_free(&blob_out);
|
||||
|
||||
if (cli_state_protocol(cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
state->cli->smb2.session = smbXcli_session_create(cli,
|
||||
cli->conn);
|
||||
if (tevent_req_nomem(state->cli->smb2.session, req)) {
|
||||
@ -1708,7 +1708,7 @@ static void cli_session_setup_ntlmssp_done(struct tevent_req *subreq)
|
||||
cli_set_session_key(
|
||||
state->cli, state->ntlmssp_state->session_key);
|
||||
|
||||
if (cli_state_protocol(state->cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
struct smbXcli_session *session = state->cli->smb2.session;
|
||||
|
||||
if (ntlmssp_is_anonymous(state->ntlmssp_state)) {
|
||||
@ -2041,7 +2041,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
|
||||
workgroup = user2;
|
||||
}
|
||||
|
||||
if (cli_state_protocol(cli) < PROTOCOL_LANMAN1) {
|
||||
if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_LANMAN1) {
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
@ -2051,7 +2051,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
|
||||
|
||||
/* if its an older server then we have to use the older request format */
|
||||
|
||||
if (cli_state_protocol(cli) < PROTOCOL_NT1) {
|
||||
if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_NT1) {
|
||||
if (!lp_client_lanman_auth() && passlen != 24 && (*pass)) {
|
||||
DEBUG(1, ("Server requested LM password but 'client lanman auth = no'"
|
||||
" or 'client ntlmv2 auth = yes'\n"));
|
||||
@ -2069,7 +2069,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
|
||||
workgroup);
|
||||
}
|
||||
|
||||
if (cli_state_protocol(cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
const char *remote_realm = cli_state_remote_realm(cli);
|
||||
ADS_STATUS status = cli_session_setup_spnego(cli, user, pass,
|
||||
workgroup,
|
||||
@ -2447,7 +2447,7 @@ static void cli_tcon_andx_done(struct tevent_req *subreq)
|
||||
}
|
||||
}
|
||||
|
||||
if ((cli_state_protocol(cli) >= PROTOCOL_NT1) && (num_bytes == 3)) {
|
||||
if ((smbXcli_conn_protocol(cli->conn) >= PROTOCOL_NT1) && (num_bytes == 3)) {
|
||||
/* almost certainly win95 - enable bug fixes */
|
||||
cli->win95 = True;
|
||||
}
|
||||
@ -2459,7 +2459,7 @@ static void cli_tcon_andx_done(struct tevent_req *subreq)
|
||||
|
||||
cli->dfsroot = false;
|
||||
|
||||
if ((wct > 2) && (cli_state_protocol(cli) >= PROTOCOL_LANMAN2)) {
|
||||
if ((wct > 2) && (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_LANMAN2)) {
|
||||
cli->dfsroot = ((SVAL(vwv+2, 0) & SMB_SHARE_IN_DFS) != 0);
|
||||
}
|
||||
|
||||
@ -2519,7 +2519,7 @@ NTSTATUS cli_tree_connect(struct cli_state *cli, const char *share,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (cli_state_protocol(cli) >= PROTOCOL_SMB2_02) {
|
||||
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
|
||||
return smb2cli_tcon(cli, share);
|
||||
}
|
||||
|
||||
|
@ -865,7 +865,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
|
||||
dfs_auth_info,
|
||||
false,
|
||||
cli_state_encryption_on(rootcli),
|
||||
cli_state_protocol(rootcli),
|
||||
smbXcli_conn_protocol(rootcli->conn),
|
||||
0,
|
||||
0x20,
|
||||
&cli_ipc);
|
||||
@ -916,7 +916,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
|
||||
dfs_auth_info,
|
||||
false,
|
||||
cli_state_encryption_on(rootcli),
|
||||
cli_state_protocol(rootcli),
|
||||
smbXcli_conn_protocol(rootcli->conn),
|
||||
0,
|
||||
0x20,
|
||||
targetcli);
|
||||
|
@ -435,11 +435,6 @@ bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive)
|
||||
return ret;
|
||||
}
|
||||
|
||||
enum protocol_types cli_state_protocol(struct cli_state *cli)
|
||||
{
|
||||
return smbXcli_conn_protocol(cli->conn);
|
||||
}
|
||||
|
||||
uint32_t cli_state_capabilities(struct cli_state *cli)
|
||||
{
|
||||
return smb1cli_conn_capabilities(cli->conn);
|
||||
|
@ -879,7 +879,7 @@ struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cli_state_protocol(cli) <= PROTOCOL_LANMAN1) {
|
||||
if (smbXcli_conn_protocol(cli->conn) <= PROTOCOL_LANMAN1) {
|
||||
subreq = cli_list_old_send(state, ev, cli, mask, attribute);
|
||||
state->recv_fn = cli_list_old_recv;
|
||||
} else {
|
||||
|
@ -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);
|
||||
enum protocol_types cli_state_protocol(struct cli_state *cli);
|
||||
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);
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "printing/printer_list.h"
|
||||
#include "../lib/tsocket/tsocket.h"
|
||||
#include "rpc_client/cli_winreg_spoolss.h"
|
||||
#include "../libcli/smb/smbXcli_base.h"
|
||||
|
||||
/* macros stolen from s4 spoolss server */
|
||||
#define SPOOLSS_BUFFER_UNION(fn,info,level) \
|
||||
@ -2499,7 +2500,7 @@ static bool spoolss_connect_to_client(struct rpc_pipe_client **pp_pipe,
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( cli_state_protocol(the_cli) != PROTOCOL_NT1 ) {
|
||||
if ( smbXcli_conn_protocol(the_cli->conn) != PROTOCOL_NT1 ) {
|
||||
DEBUG(0,("spoolss_connect_to_client: machine %s didn't negotiate NT protocol.\n", remote_machine));
|
||||
cli_shutdown(the_cli);
|
||||
return false;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "trans2.h"
|
||||
#include "libsmb/libsmb.h"
|
||||
#include "libsmb/nmblib.h"
|
||||
#include "../libcli/smb/smbXcli_base.h"
|
||||
|
||||
static fstring password;
|
||||
static fstring username;
|
||||
@ -144,7 +145,7 @@ static bool reg_match_one(struct cli_state *cli, const char *pattern, const char
|
||||
|
||||
if (strcmp(file,"..") == 0) file = ".";
|
||||
|
||||
return ms_fnmatch(pattern, file, cli_state_protocol(cli), False) == 0;
|
||||
return ms_fnmatch(pattern, file, smbXcli_conn_protocol(cli->conn), False) == 0;
|
||||
}
|
||||
|
||||
static char *reg_test(struct cli_state *cli, const char *pattern, const char *long_name, const char *short_name)
|
||||
|
@ -7108,7 +7108,7 @@ bool net_rpc_check(struct net_context *c, unsigned flags)
|
||||
status = cli_negprot(cli, PROTOCOL_NT1);
|
||||
if (!NT_STATUS_IS_OK(status))
|
||||
goto done;
|
||||
if (cli_state_protocol(cli) < PROTOCOL_NT1)
|
||||
if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_NT1)
|
||||
goto done;
|
||||
|
||||
ret = true;
|
||||
|
@ -834,10 +834,10 @@ static NTSTATUS cm_prepare_connection(const struct winbindd_domain *domain,
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (cli_state_protocol(*cli) >= PROTOCOL_NT1 &&
|
||||
if (smbXcli_conn_protocol((*cli)->conn) >= PROTOCOL_NT1 &&
|
||||
cli_state_capabilities(*cli) & CAP_EXTENDED_SECURITY) {
|
||||
try_spnego = true;
|
||||
} else if (cli_state_protocol(*cli) >= PROTOCOL_SMB2_02) {
|
||||
} else if (smbXcli_conn_protocol((*cli)->conn) >= PROTOCOL_SMB2_02) {
|
||||
try_spnego = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user