From fba833d0557969fe0c1c943465c1b1f833fe1bdb Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 24 Sep 2011 05:42:48 +0200 Subject: s3: Remove the smbd_server_conn ref from get_referred_path --- source3/rpc_server/dfs/srv_dfs_nt.c | 16 ++++++++++------ source3/smbd/msdfs.c | 11 ++++++----- source3/smbd/proto.h | 1 + 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c index d77989db2f..56f4de551d 100644 --- a/source3/rpc_server/dfs/srv_dfs_nt.c +++ b/source3/rpc_server/dfs/srv_dfs_nt.c @@ -75,8 +75,8 @@ WERROR _dfs_Add(struct pipes_struct *p, struct dfs_Add *r) } /* The following call can change the cwd. */ - status = get_referred_path(ctx, r->in.path, jn, - &consumedcnt, &self_ref); + status = get_referred_path(ctx, r->in.path, smbd_server_conn, jn, + &consumedcnt, &self_ref); if(!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); } @@ -118,6 +118,7 @@ WERROR _dfs_Remove(struct pipes_struct *p, struct dfs_Remove *r) bool found = False; TALLOC_CTX *ctx = talloc_tos(); char *altpath = NULL; + NTSTATUS status; if (p->session_info->unix_token->uid != sec_initial_uid()) { DEBUG(10,("_dfs_remove: uid != 0. Access denied.\n")); @@ -141,8 +142,9 @@ WERROR _dfs_Remove(struct pipes_struct *p, struct dfs_Remove *r) r->in.dfs_entry_path, r->in.servername, r->in.sharename)); } - if(!NT_STATUS_IS_OK(get_referred_path(ctx, r->in.dfs_entry_path, jn, - &consumedcnt, &self_ref))) { + status = get_referred_path(ctx, r->in.dfs_entry_path, smbd_server_conn, + jn, &consumedcnt, &self_ref); + if(!NT_STATUS_IS_OK(status)) { return WERR_DFS_NO_SUCH_VOL; } @@ -353,6 +355,7 @@ WERROR _dfs_GetInfo(struct pipes_struct *p, struct dfs_GetInfo *r) bool self_ref = False; TALLOC_CTX *ctx = talloc_tos(); bool ret; + NTSTATUS status; jn = talloc_zero(ctx, struct junction_map); if (!jn) { @@ -364,8 +367,9 @@ WERROR _dfs_GetInfo(struct pipes_struct *p, struct dfs_GetInfo *r) } /* The following call can change the cwd. */ - if(!NT_STATUS_IS_OK(get_referred_path(ctx, r->in.dfs_entry_path, - jn, &consumedcnt, &self_ref)) || + status = get_referred_path(ctx, r->in.dfs_entry_path, smbd_server_conn, + jn, &consumedcnt, &self_ref); + if(!NT_STATUS_IS_OK(status) || consumedcnt < strlen(r->in.dfs_entry_path)) { return WERR_DFS_NO_SUCH_VOL; } diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index abb0ebce5c..9602e792ac 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -850,6 +850,7 @@ static NTSTATUS self_ref(TALLOC_CTX *ctx, NTSTATUS get_referred_path(TALLOC_CTX *ctx, const char *dfs_path, + struct smbd_server_connection *sconn, struct junction_map *jucn, int *consumedcntp, bool *self_referralp) @@ -868,8 +869,8 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx, *self_referralp = False; - status = parse_dfs_path(NULL, dfs_path, False, - !smbd_server_conn->using_smb2, pdp, &dummy); + status = parse_dfs_path(NULL, dfs_path, False, !sconn->using_smb2, + pdp, &dummy); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -972,7 +973,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx, return NT_STATUS_OK; } - status = create_conn_struct(ctx, smbd_server_conn, &conn, snum, + status = create_conn_struct(ctx, sconn, &conn, snum, lp_pathname(snum), NULL, &oldpath); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(pdp); @@ -1276,8 +1277,8 @@ int setup_dfs_referral(connection_struct *orig_conn, } /* The following call can change cwd. */ - *pstatus = get_referred_path(ctx, pathnamep, junction, - &consumedcnt, &self_referral); + *pstatus = get_referred_path(ctx, pathnamep, smbd_server_conn, + junction, &consumedcnt, &self_referral); if (!NT_STATUS_IS_OK(*pstatus)) { vfs_ChDir(orig_conn,orig_conn->connectpath); talloc_destroy(ctx); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index ab7d0a8013..1c8fd1f556 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -448,6 +448,7 @@ bool is_msdfs_link(connection_struct *conn, struct junction_map; NTSTATUS get_referred_path(TALLOC_CTX *ctx, const char *dfs_path, + struct smbd_server_connection *sconn, struct junction_map *jucn, int *consumedcntp, bool *self_referralp); -- cgit