r23623: Fix rpcclient and rpc_server with new DFS idl.
authorGünther Deschner <gd@samba.org>
Wed, 27 Jun 2007 09:23:50 +0000 (09:23 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:23:37 +0000 (12:23 -0500)
Guenther
(This used to be commit bffe33dd261fdcf9ef8f9f232c15559661843c7c)

source3/rpc_server/srv_dfs_nt.c
source3/rpcclient/cmd_dfs.c

index d114a0799481f8c0ac93ba3a25e9d28ba89ce048..eb159bdc647747cf8454aee31b4fb0847c9a93da 100644 (file)
 
 void _dfs_GetManagerVersion(pipes_struct *p, struct dfs_GetManagerVersion *r)
 {
-       if(lp_host_msdfs()) 
-               *r->out.exist_flag = 1;
-       else
-               *r->out.exist_flag = 0;
+       if (lp_host_msdfs()) {
+               *r->out.version = DFS_MANAGER_VERSION_NT4;
+       } else {
+               *r->out.version = 0;
+       }
 }
 
 WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r)
@@ -109,22 +110,22 @@ WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r)
                return WERR_ACCESS_DENIED;
        }
 
-       if (r->in.server && r->in.share) {
-               pstrcpy(altpath, r->in.server);
+       if (r->in.servername && r->in.sharename) {
+               pstrcpy(altpath, r->in.servername);
                pstrcat(altpath, "\\");
-               pstrcat(altpath, r->in.share);
+               pstrcat(altpath, r->in.sharename);
                strlower_m(altpath);
        }
 
        DEBUG(5,("init_reply_dfs_remove: Request to remove %s -> %s\\%s.\n",
-               r->in.path, r->in.server, r->in.share));
+               r->in.dfs_entry_path, r->in.servername, r->in.sharename));
 
-       if(!NT_STATUS_IS_OK(get_referred_path(p->mem_ctx, r->in.path, &jn, &consumedcnt, &self_ref))) {
+       if(!NT_STATUS_IS_OK(get_referred_path(p->mem_ctx, r->in.dfs_entry_path, &jn, &consumedcnt, &self_ref))) {
                return WERR_DFS_NO_SUCH_VOL;
        }
 
        /* if no server-share pair given, remove the msdfs link completely */
-       if(!r->in.server && !r->in.share) {
+       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;
@@ -324,11 +325,11 @@ WERROR _dfs_GetInfo(pipes_struct *p, struct dfs_GetInfo *r)
        BOOL self_ref = False;
        BOOL ret;
 
-       if(!create_junction(r->in.path, &jn))
+       if(!create_junction(r->in.dfs_entry_path, &jn))
                return WERR_DFS_NO_SUCH_SERVER;
   
        /* The following call can change the cwd. */
-       if(!NT_STATUS_IS_OK(get_referred_path(p->mem_ctx, r->in.path, &jn, &consumedcnt, &self_ref)) || consumedcnt < strlen(r->in.path)) {
+       if(!NT_STATUS_IS_OK(get_referred_path(p->mem_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;
        }
index 7e898ddc52a3d5b7acbe85654690911a809f2ed5..8564e93bd3bab243c77916a62f06fa875f1d929f 100644 (file)
 
 /* Check DFS is supported by the remote server */
 
-static NTSTATUS cmd_dfs_exist(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                              int argc, const char **argv)
+static NTSTATUS cmd_dfs_version(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
+                               int argc, const char **argv)
 {
-       uint32 dfs_exists;
+       enum dfs_ManagerVersion version;
        NTSTATUS result;
 
        if (argc != 1) {
@@ -36,12 +36,19 @@ static NTSTATUS cmd_dfs_exist(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
                return NT_STATUS_OK;
        }
 
-       result = rpccli_dfs_GetManagerVersion(cli, mem_ctx, &dfs_exists);
+       result = rpccli_dfs_GetManagerVersion(cli, mem_ctx, &version);
 
-       if (NT_STATUS_IS_OK(result))
-               printf("dfs is %spresent\n", dfs_exists ? "" : "not ");
+       if (!NT_STATUS_IS_OK(result)) {
+               return result;
+       }
 
-       return result;
+       if (version > 0) {
+               printf("dfs is present (%d)\n", version);
+       } else {
+               printf("dfs is not present\n");
+       }
+
+       return NT_STATUS_OK;
 }
 
 static NTSTATUS cmd_dfs_add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
@@ -183,7 +190,6 @@ static NTSTATUS cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
 
        NTSTATUS result;
        uint32 total = 0;
-       uint32 unknown = 0;
 
        if (argc > 2) {
                printf("Usage: %s [info_level]\n", argv[0]);
@@ -207,7 +213,7 @@ static NTSTATUS cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
        }
 
        result = rpccli_dfs_Enum(cli, mem_ctx, str.level, 0xFFFFFFFF, &str,
-                                &unknown, &total);
+                                &total);
 
        if (NT_STATUS_IS_OK(result))
                display_dfs_enumstruct(&str);
@@ -297,7 +303,7 @@ struct cmd_set dfs_commands[] = {
 
        { "DFS" },
 
-       { "dfsexist",  RPC_RTYPE_NTSTATUS, cmd_dfs_exist,   NULL, PI_NETDFS, NULL, "Query DFS support",    "" },
+       { "dfsversion",  RPC_RTYPE_NTSTATUS, cmd_dfs_version,   NULL, PI_NETDFS, NULL, "Query DFS support",    "" },
        { "dfsadd",    RPC_RTYPE_NTSTATUS, cmd_dfs_add,     NULL, PI_NETDFS, NULL, "Add a DFS share",      "" },
        { "dfsremove", RPC_RTYPE_NTSTATUS, cmd_dfs_remove,  NULL, PI_NETDFS, NULL, "Remove a DFS share",   "" },
        { "dfsgetinfo",RPC_RTYPE_NTSTATUS, cmd_dfs_getinfo, NULL, PI_NETDFS, NULL, "Query DFS share info", "" },