s3: Remove the smbd_server_conn ref from get_referred_path
authorVolker Lendecke <vl@samba.org>
Sat, 24 Sep 2011 03:42:48 +0000 (05:42 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 26 Sep 2011 12:59:12 +0000 (14:59 +0200)
source3/rpc_server/dfs/srv_dfs_nt.c
source3/smbd/msdfs.c
source3/smbd/proto.h

index d77989db2fd32e8ef7da537be027cb6ff206f657..56f4de551da3c7516637c4a6bc121ac596b037bf 100644 (file)
@@ -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;
        }
index abb0ebce5c2f29d839634de464b33a926fdec370..9602e792ac8cdb02b198903756a64ada08e5d114 100644 (file)
@@ -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);
index ab7d0a80136a3f99e653e20ad70cc91f89c7492f..1c8fd1f5569af0a343043f40366064347a95b41f 100644 (file)
@@ -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);