summaryrefslogtreecommitdiff
path: root/source3/libsmb/clientgen.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2022-08-23 17:13:58 -0700
committerJeremy Allison <jra@samba.org>2022-09-15 18:43:32 +0000
commitc3c716498502e5f1a833a469e0a4936a9668338e (patch)
tree5a9e289b048f11dcce1a23400d90f26627b73d3e /source3/libsmb/clientgen.c
parentdfd7c6ca784d3bfd79aa1c238b22e3e9a778334c (diff)
downloadsamba-c3c716498502e5f1a833a469e0a4936a9668338e.tar.gz
s3: libsmb: Add pair cli_state_save_tcon_share()/cli_state_restore_tcon_share().
Wraps cli_state_save_tcon()//cli_state_restore_tcon() but also returns cli->sharename. We are going to replace all uses of cli_state_save_tcon()/cli_state_restore_tcon() so we also save/restore the cli->share for DFS purposes. Signed-off-by: Jeremy Allison <jra@samba.org> Reviwed-by: Noel Power <npower@samba.org>
Diffstat (limited to 'source3/libsmb/clientgen.c')
-rw-r--r--source3/libsmb/clientgen.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 5f0b9daf333..d0e416eea37 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -394,6 +394,19 @@ struct smbXcli_tcon *cli_state_save_tcon(struct cli_state *cli)
return tcon_ret;
}
+void cli_state_save_tcon_share(struct cli_state *cli,
+ struct smbXcli_tcon **_tcon_ret,
+ char **_sharename_ret)
+{
+ *_tcon_ret = cli_state_save_tcon(cli);
+ /*
+ * No talloc_copy as cli->share is already
+ * allocated off cli.
+ */
+ *_sharename_ret = cli->share;
+ cli->share = NULL;
+}
+
void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon)
{
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
@@ -405,6 +418,16 @@ void cli_state_restore_tcon(struct cli_state *cli, struct smbXcli_tcon *tcon)
}
}
+void cli_state_restore_tcon_share(struct cli_state *cli,
+ struct smbXcli_tcon *tcon,
+ char *share)
+{
+ /* cli->share will have been replaced by a cli_tree_connect() call. */
+ TALLOC_FREE(cli->share);
+ cli->share = share;
+ cli_state_restore_tcon(cli, tcon);
+}
+
uint16_t cli_state_get_uid(struct cli_state *cli)
{
return smb1cli_session_current_id(cli->smb1.session);