s3-netlogon: enable RPC-NETLOGON-ADMIN test against s3.
[samba.git] / source3 / rpc_server / srv_dfs_nt.c
index 974523dded8dae099492238185ef32d606e4b1fb..bef8d83103901ff468cfa38eb9f2d2d55712c298 100644 (file)
@@ -44,12 +44,11 @@ WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r)
        struct referral *old_referral_list = NULL;
        bool self_ref = False;
        int consumedcnt = 0;
-       bool exists = False;
        char *altpath = NULL;
        NTSTATUS status;
        TALLOC_CTX *ctx = talloc_tos();
 
-       if (p->pipe_user.ut.uid != sec_initial_uid()) {
+       if (p->server_info->utok.uid != sec_initial_uid()) {
                DEBUG(10,("_dfs_add: uid != 0. Access denied.\n"));
                return WERR_ACCESS_DENIED;
        }
@@ -76,12 +75,9 @@ WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r)
                return ntstatus_to_werror(status);
        }
 
-       exists = True;
        jn->referral_count += 1;
        old_referral_list = jn->referral_list;
 
-       vfs_ChDir(p->conn,p->conn->connectpath);
-
        if (jn->referral_count < 1) {
                return WERR_NOMEM;
        }
@@ -101,11 +97,9 @@ WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r)
        jn->referral_list[jn->referral_count-1].ttl = REFERRAL_TTL;
        jn->referral_list[jn->referral_count-1].alternate_path = altpath;
 
-       if(!create_msdfs_link(jn, exists)) {
-               vfs_ChDir(p->conn,p->conn->connectpath);
+       if(!create_msdfs_link(jn)) {
                return WERR_DFS_CANT_CREATE_JUNCT;
        }
-       vfs_ChDir(p->conn,p->conn->connectpath);
 
        return WERR_OK;
 }
@@ -119,7 +113,7 @@ WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r)
        TALLOC_CTX *ctx = talloc_tos();
        char *altpath = NULL;
 
-       if (p->pipe_user.ut.uid != sec_initial_uid()) {
+       if (p->server_info->utok.uid != sec_initial_uid()) {
                DEBUG(10,("_dfs_remove: uid != 0. Access denied.\n"));
                return WERR_ACCESS_DENIED;
        }
@@ -149,10 +143,8 @@ WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r)
        /* if no server-share pair given, remove the msdfs link completely */
        if(!r->in.servername && !r->in.sharename) {
                if(!remove_msdfs_link(jn)) {
-                       vfs_ChDir(p->conn,p->conn->connectpath);
                        return WERR_DFS_NO_SUCH_VOL;
                }
-               vfs_ChDir(p->conn,p->conn->connectpath);
        } else {
                int i=0;
                /* compare each referral in the list with the one to remove */
@@ -180,16 +172,13 @@ WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r)
                /* Only one referral, remove it */
                if(jn->referral_count == 1) {
                        if(!remove_msdfs_link(jn)) {
-                               vfs_ChDir(p->conn,p->conn->connectpath);
                                return WERR_DFS_NO_SUCH_VOL;
                        }
                } else {
-                       if(!create_msdfs_link(jn, True)) {
-                               vfs_ChDir(p->conn,p->conn->connectpath);
+                       if(!create_msdfs_link(jn)) {
                                return WERR_DFS_CANT_CREATE_JUNCT;
                        }
                }
-               vfs_ChDir(p->conn,p->conn->connectpath);
        }
 
        return WERR_OK;
@@ -289,7 +278,6 @@ WERROR _dfs_Enum(pipes_struct *p, struct dfs_Enum *r)
                num_jn = 0;
                jn = NULL;
        }
-       vfs_ChDir(p->conn,p->conn->connectpath);
 
        DEBUG(5,("_dfs_Enum: %u junctions found in Dfs, doing level %d\n",
                                (unsigned int)num_jn, r->in.level));
@@ -372,12 +360,9 @@ WERROR _dfs_GetInfo(pipes_struct *p, struct dfs_GetInfo *r)
        if(!NT_STATUS_IS_OK(get_referred_path(ctx, r->in.dfs_entry_path,
                                        jn, &consumedcnt, &self_ref)) ||
                        consumedcnt < strlen(r->in.dfs_entry_path)) {
-               vfs_ChDir(p->conn,p->conn->connectpath);
                return WERR_DFS_NO_SUCH_VOL;
        }
 
-       vfs_ChDir(p->conn,p->conn->connectpath);
-
        switch (r->in.level) {
                case 1:
                        r->out.info->info1 = TALLOC_ZERO_P(ctx,struct dfs_Info1);