From bcb4d421b237c3d2bb3ffe10965f3a67bfa17c3d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 24 May 2018 17:55:02 +0200 Subject: [PATCH] smbd: convert count_dfs_links() to use create_conn_struct_tos_cwd() Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- source3/smbd/msdfs.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index fcf7b9c3dda..57e5b207239 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -1555,9 +1555,9 @@ static int count_dfs_links(TALLOC_CTX *ctx, int snum) char *talloced = NULL; const char *connect_path = lp_path(frame, snum); const char *msdfs_proxy = lp_msdfs_proxy(frame, snum); - connection_struct *conn; + struct conn_struct_tos *c = NULL; + connection_struct *conn = NULL; NTSTATUS status; - struct smb_filename *cwd_fname = NULL; struct smb_filename *smb_fname = NULL; if(*connect_path == '\0') { @@ -1569,20 +1569,18 @@ static int count_dfs_links(TALLOC_CTX *ctx, int snum) * Fake up a connection struct for the VFS layer. */ - status = create_conn_struct_cwd(frame, - server_event_context(), - server_messaging_context(), - &conn, - snum, - connect_path, - NULL, - &cwd_fname); + status = create_conn_struct_tos_cwd(server_messaging_context(), + snum, + connect_path, + NULL, + &c); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("create_conn_struct failed: %s\n", nt_errstr(status))); TALLOC_FREE(frame); return 0; } + conn = c->conn; /* Count a link for the msdfs root - convention */ cnt = 1; @@ -1628,9 +1626,6 @@ static int count_dfs_links(TALLOC_CTX *ctx, int snum) SMB_VFS_CLOSEDIR(conn,dirp); out: - vfs_ChDir(conn, cwd_fname); - SMB_VFS_DISCONNECT(conn); - conn_free(conn); TALLOC_FREE(frame); return cnt; } -- 2.47.3