1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

s3: libsmb: Add cli_dfs_is_already_full_path() function.

Returns true if it's already a fully qualified DFS path.

Not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
Jeremy Allison 2022-08-19 14:59:04 -07:00
parent 070b73e3f9
commit 26b4a6951b
2 changed files with 41 additions and 0 deletions

View File

@ -588,6 +588,46 @@ static char *cli_dfs_make_full_path(TALLOC_CTX *ctx,
dir);
}
/********************************************************************
Check if a path has already been converted to DFS.
********************************************************************/
bool cli_dfs_is_already_full_path(struct cli_state *cli, const char *path)
{
const char *server = smbXcli_conn_remote_name(cli->conn);
size_t server_len = strlen(server);
bool found_server = false;
const char *share = cli->share;
size_t share_len = strlen(share);
bool found_share = false;
if (!IS_DIRECTORY_SEP(path[0])) {
return false;
}
path++;
found_server = (strncasecmp_m(path, server, server_len) == 0);
if (!found_server) {
return false;
}
path += server_len;
if (!IS_DIRECTORY_SEP(path[0])) {
return false;
}
path++;
found_share = (strncasecmp_m(path, share, share_len) == 0);
if (!found_share) {
return false;
}
path += share_len;
if (path[0] == '\0') {
return true;
}
if (IS_DIRECTORY_SEP(path[0])) {
return true;
}
return false;
}
/********************************************************************
Get the dfs referral link.
********************************************************************/

View File

@ -135,6 +135,7 @@ NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
struct cli_state **pcli);
void cli_cm_display(struct cli_state *c);
struct client_dfs_referral;
bool cli_dfs_is_already_full_path(struct cli_state *cli, const char *path);
NTSTATUS cli_dfs_get_referral_ex(TALLOC_CTX *ctx,
struct cli_state *cli,
const char *path,