mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
libsmb: Factor out cli_conn_have_dfs() from cli_resolve_path()
This also does the checks from cli_dfs_check_error(), which can be removed in the next step. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
f05020df6b
commit
d93e0f0978
@ -840,6 +840,31 @@ NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
|
||||
consumed);
|
||||
}
|
||||
|
||||
static bool cli_conn_have_dfs(struct cli_state *cli)
|
||||
{
|
||||
struct smbXcli_conn *conn = cli->conn;
|
||||
struct smbXcli_tcon *tcon = NULL;
|
||||
bool ok;
|
||||
|
||||
if (smbXcli_conn_protocol(conn) < PROTOCOL_SMB2_02) {
|
||||
uint32_t capabilities = smb1cli_conn_capabilities(conn);
|
||||
|
||||
if ((capabilities & CAP_STATUS32) == 0) {
|
||||
return false;
|
||||
}
|
||||
if ((capabilities & CAP_UNICODE) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
tcon = cli->smb1.tcon;
|
||||
} else {
|
||||
tcon = cli->smb2.tcon;
|
||||
}
|
||||
|
||||
ok = smbXcli_tcon_is_dfs_share(tcon);
|
||||
return ok;
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
********************************************************************/
|
||||
struct cli_dfs_path_split {
|
||||
@ -873,22 +898,14 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
uint32_t attributes;
|
||||
NTSTATUS status;
|
||||
struct smbXcli_tcon *root_tcon = NULL;
|
||||
struct smbXcli_tcon *target_tcon = NULL;
|
||||
struct cli_dfs_path_split *dfs_refs = NULL;
|
||||
bool ok;
|
||||
|
||||
if ( !rootcli || !path || !targetcli ) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Don't do anything if this is not a DFS root. */
|
||||
|
||||
if (smbXcli_conn_protocol(rootcli->conn) >= PROTOCOL_SMB2_02) {
|
||||
root_tcon = rootcli->smb2.tcon;
|
||||
} else {
|
||||
root_tcon = rootcli->smb1.tcon;
|
||||
}
|
||||
|
||||
/*
|
||||
* Avoid more than one leading directory separator
|
||||
*/
|
||||
@ -896,7 +913,8 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
|
||||
path++;
|
||||
}
|
||||
|
||||
if (!smbXcli_tcon_is_dfs_share(root_tcon)) {
|
||||
ok = cli_conn_have_dfs(rootcli);
|
||||
if (!ok) {
|
||||
*targetcli = rootcli;
|
||||
*pp_targetpath = talloc_strdup(ctx, path);
|
||||
if (!*pp_targetpath) {
|
||||
|
Loading…
Reference in New Issue
Block a user