mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
r17453: Fix msdfs RPC management (this broke with the autogenerated dfs rpcs).
* 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
(This used to be commit f9bef1f08f
)
This commit is contained in:
parent
70660495b3
commit
11673dc07a
@ -53,6 +53,7 @@ struct referral {
|
||||
struct junction_map {
|
||||
pstring service_name;
|
||||
pstring volume_name;
|
||||
pstring comment;
|
||||
int referral_count;
|
||||
struct referral* referral_list;
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user