r17453: Fix msdfs RPC management (this broke with the autogenerated dfs rpcs).
authorGünther Deschner <gd@samba.org>
Tue, 8 Aug 2006 11:00:16 +0000 (11:00 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:38:34 +0000 (11:38 -0500)
* Remove "unknown" from dfs_Enum (samba4 dfs IDL updates to follow).

* When encountering an unsupported infolevel the rpc server must reply
with a dfs_info_0 structure and WERR_OK (observed from w2k3 when talking
to nt4).

Guenther

source/include/msdfs.h
source/include/rpc_dfs.h
source/rpc_client/cli_dfs.c
source/rpc_parse/parse_dfs.c
source/rpc_server/srv_dfs_nt.c
source/rpcclient/cmd_dfs.c
source/smbd/msdfs.c

index f7aa494cd2cb2504b95331b1500471971469c074..e9fef5430edc84c6bb082ef61ab0b6db78158f0b 100644 (file)
@@ -53,6 +53,7 @@ struct referral {
 struct junction_map {
        pstring service_name;
        pstring volume_name;
+       pstring comment;
        int referral_count;
        struct referral* referral_list;
 };
index adf25c9938bc027f828c63afe29e35529520a46e..9aba123deed32195e9d812bee909ce8aec209fc2 100644 (file)
@@ -243,8 +243,6 @@ typedef struct netdfs_q_dfs_Enum {
        uint32 bufsize;
        uint32 ptr0_info;
        NETDFS_DFS_ENUMSTRUCT info;
-       uint32 ptr0_unknown;
-       uint32 unknown;
        uint32 ptr0_total;
        uint32 total;
 } NETDFS_Q_DFS_ENUM;
index 8b94d6ed9d4ac11a3c71f2023dcbc401f46a4f21..f93ce29dbfaa48746d1b82bc00766b26a08932b4 100644 (file)
@@ -142,7 +142,7 @@ NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co
        return werror_to_ntstatus(r.status);
 }
 
-NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *unknown, uint32 *total)
+NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total)
 {
        prs_struct qbuf, rbuf;
        NETDFS_Q_DFS_ENUM q;
@@ -153,7 +153,7 @@ NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint3
        
        /* Marshall data and send request */
        
-       if (!init_netdfs_q_dfs_Enum(&q, level, bufsize, info, unknown, total))
+       if (!init_netdfs_q_dfs_Enum(&q, level, bufsize, info, total))
                return NT_STATUS_INVALID_PARAMETER;
        
        CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ENUM,
index fb0d2fe5a79d03b61cebb1ab21e6f426e21a8f0e..acf80c6dbd3e93f568fbabca0553d406a320b82f 100644 (file)
@@ -1862,7 +1862,7 @@ BOOL netdfs_io_r_dfs_GetInfo(const char *desc, NETDFS_R_DFS_GETINFO *v, prs_stru
        return True;
 }
 
-BOOL init_netdfs_q_dfs_Enum(NETDFS_Q_DFS_ENUM *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *unknown, uint32 *total)
+BOOL init_netdfs_q_dfs_Enum(NETDFS_Q_DFS_ENUM *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total)
 {
        DEBUG(5,("init_netdfs_q_dfs_Enum\n"));
        
@@ -1877,13 +1877,6 @@ BOOL init_netdfs_q_dfs_Enum(NETDFS_Q_DFS_ENUM *v, uint32 level, uint32 bufsize,
                v->ptr0_info = 0;
        }
        
-       if (unknown) {
-               v->ptr0_unknown = 1;
-               v->unknown = *unknown;
-       } else {
-               v->ptr0_unknown = 0;
-       }
-       
        if (total) {
                v->ptr0_total = 1;
                v->total = *total;
@@ -1917,17 +1910,6 @@ BOOL netdfs_io_q_dfs_Enum(const char *desc, NETDFS_Q_DFS_ENUM *v, prs_struct *ps
                        return False;
        }
        
-       if (!prs_align_custom(ps, 4))
-               return False;
-       
-       if (!prs_uint32("ptr0_unknown", ps, depth, &v->ptr0_unknown))
-               return False;
-       
-       if (v->ptr0_unknown) {
-               if (!prs_uint32("unknown", ps, depth, &v->unknown))
-                       return False;
-       }
-       
        if (!prs_align_custom(ps, 4))
                return False;
        
index c7f8e05d91cfebf0072ef68e1d75ed062658964c..abdd9e8f23aab580af672add151ec1e993fa31a6 100644 (file)
@@ -200,6 +200,7 @@ static BOOL init_reply_dfs_info_2(struct junction_map* j, NETDFS_DFS_INFO2* dfs2
                j->service_name, j->volume_name);
        init_unistr2(&dfs2->path, str, UNI_STR_TERMINATE);
        dfs2->ptr0_comment = 0;
+       init_unistr2(&dfs2->comment, j->comment, UNI_STR_TERMINATE);
        dfs2->state = 1; /* set up state of dfs junction as OK */
        dfs2->num_stores = j->referral_count;
        return True;
@@ -219,7 +220,7 @@ static BOOL init_reply_dfs_info_3(TALLOC_CTX *ctx, struct junction_map* j, NETDF
 
        init_unistr2(&dfs3->path, str, UNI_STR_TERMINATE);
        dfs3->ptr0_comment = 1;
-       init_unistr2(&dfs3->comment, "", UNI_STR_TERMINATE);
+       init_unistr2(&dfs3->comment, j->comment, UNI_STR_TERMINATE);
        dfs3->state = 1;
        dfs3->num_stores = dfs3->size_stores = j->referral_count;
        dfs3->ptr0_stores = 1;
@@ -254,6 +255,14 @@ static BOOL init_reply_dfs_info_3(TALLOC_CTX *ctx, struct junction_map* j, NETDF
        return True;
 }
 
+static BOOL init_reply_dfs_info_100(struct junction_map* j, NETDFS_DFS_INFO100* dfs100)
+{
+       dfs100->ptr0_comment = 1;
+       init_unistr2(&dfs100->comment, j->comment, UNI_STR_TERMINATE);
+       return True;
+}
+
+
 WERROR _dfs_Enum(pipes_struct *p, NETDFS_Q_DFS_ENUM *q_u, NETDFS_R_DFS_ENUM *r_u)
 {
        uint32 level = q_u->level;
@@ -264,7 +273,7 @@ WERROR _dfs_Enum(pipes_struct *p, NETDFS_Q_DFS_ENUM *q_u, NETDFS_R_DFS_ENUM *r_u
        num_jn = enum_msdfs_links(p->mem_ctx, jn, ARRAY_SIZE(jn));
        vfs_ChDir(p->conn,p->conn->connectpath);
     
-       DEBUG(5,("make_reply_dfs_enum: %d junctions found in Dfs, doing level %d\n", num_jn, level));
+       DEBUG(5,("_dfs_Enum: %d junctions found in Dfs, doing level %d\n", num_jn, level));
 
        r_u->ptr0_info = q_u->ptr0_info;
        r_u->ptr0_total = q_u->ptr0_total;
@@ -330,7 +339,7 @@ WERROR _dfs_GetInfo(pipes_struct *p, NETDFS_Q_DFS_GETINFO *q_u,
        uint32 level = q_u->level;
        int consumedcnt = sizeof(pstring);
        pstring path;
-       BOOL ret;
+       BOOL ret = False;
        struct junction_map jn;
 
        unistr2_to_ascii(path, uni_path, sizeof(path)-1);
@@ -352,8 +361,12 @@ WERROR _dfs_GetInfo(pipes_struct *p, NETDFS_Q_DFS_GETINFO *q_u,
                case 1: ret = init_reply_dfs_info_1(&jn, &r_u->info.u.info1); break;
                case 2: ret = init_reply_dfs_info_2(&jn, &r_u->info.u.info2); break;
                case 3: ret = init_reply_dfs_info_3(p->mem_ctx, &jn, &r_u->info.u.info3); break;
+               case 100: ret = init_reply_dfs_info_100(&jn, &r_u->info.u.info100); break;
                default:
-                       ret = False;
+                       r_u->info.ptr0 = 1;
+                       r_u->info.switch_value = 0;
+                       r_u->status = WERR_OK;
+                       ret = True;
                        break;
        }
 
index b4d43bda5ee5339a0acac079ca43c16487c28dc8..75543df267eda3b59600067b604fefcd85cb9e03 100644 (file)
@@ -190,7 +190,7 @@ static NTSTATUS cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
        NETDFS_DFS_ENUMINFO_CTR ctr;
        NTSTATUS result;
        uint32 info_level = 1;
-       uint32 unknown = 0, total = 0;
+       uint32 total = 0;
 
        if (argc > 2) {
                printf("Usage: %s [info_level]\n", argv[0]);
@@ -204,7 +204,7 @@ static NTSTATUS cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
        init_netdfs_dfs_EnumStruct(&str, info_level, ctr);
        str.e.ptr0 = 1;
 
-       result = rpccli_dfs_Enum(cli, mem_ctx, info_level, 0xFFFFFFFF, &str, &unknown, &total);
+       result = rpccli_dfs_Enum(cli, mem_ctx, info_level, 0xFFFFFFFF, &str, &total);
 
        if (NT_STATUS_IS_OK(result))
                display_dfs_enumstruct(&str);
index 2edad311ea48ef0e98edffbdeb29f54f22e32e36..44415ddd16ff84bca08afb8488874747f863e18a 100644 (file)
@@ -901,6 +901,7 @@ BOOL create_junction(char *pathname, struct junction_map *jucn)
 
        pstrcpy(jucn->service_name,dp.servicename);
        pstrcpy(jucn->volume_name,dp.reqpath);
+       pstrcpy(jucn->comment, lp_comment(lp_servicenumber(dp.servicename)));
        return True;
 }