diff options
author | Jeremy Allison <jra@samba.org> | 2007-04-29 19:54:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:45 -0500 |
commit | 08a730e2ef8df7325f59c288fca9c61b56454642 (patch) | |
tree | f0e7856a25e3ece1ed732cba86c930a05eafbf2b /source3/rpc_server | |
parent | 71aa8a1ec2fe17761335381db5b38bd410147cac (diff) | |
download | samba-08a730e2ef8df7325f59c288fca9c61b56454642.tar.gz samba-08a730e2ef8df7325f59c288fca9c61b56454642.tar.bz2 samba-08a730e2ef8df7325f59c288fca9c61b56454642.zip |
r22574: Fix reply when we have no dfs shares.
Jeremy.
(This used to be commit f95bf093f9303131618b1de8f9b783ba19644bb3)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_dfs_nt.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/source3/rpc_server/srv_dfs_nt.c b/source3/rpc_server/srv_dfs_nt.c index 56c1ce00ab..d114a07994 100644 --- a/source3/rpc_server/srv_dfs_nt.c +++ b/source3/rpc_server/srv_dfs_nt.c @@ -211,11 +211,14 @@ static BOOL init_reply_dfs_info_3(TALLOC_CTX *mem_ctx, struct junction_map* j, s dfs3->num_stores = j->referral_count; /* also enumerate the stores */ - dfs3->stores = TALLOC_ARRAY(mem_ctx, struct dfs_StorageInfo, j->referral_count); - if (!dfs3->stores) - return False; - - memset(dfs3->stores, '\0', j->referral_count * sizeof(struct dfs_StorageInfo)); + if (j->referral_count) { + dfs3->stores = TALLOC_ARRAY(mem_ctx, struct dfs_StorageInfo, j->referral_count); + if (!dfs3->stores) + return False; + memset(dfs3->stores, '\0', j->referral_count * sizeof(struct dfs_StorageInfo)); + } else { + dfs3->stores = NULL; + } for(ii=0;ii<j->referral_count;ii++) { char* p; @@ -262,20 +265,32 @@ WERROR _dfs_Enum(pipes_struct *p, struct dfs_Enum *r) /* Create the return array */ switch (r->in.level) { case 1: - if ((r->out.info->e.info1->s = TALLOC_ARRAY(p->mem_ctx, struct dfs_Info1, num_jn)) == NULL) { - return WERR_NOMEM; + if (num_jn) { + if ((r->out.info->e.info1->s = TALLOC_ARRAY(p->mem_ctx, struct dfs_Info1, num_jn)) == NULL) { + return WERR_NOMEM; + } + } else { + r->out.info->e.info1->s = NULL; } r->out.info->e.info1->count = num_jn; break; case 2: - if ((r->out.info->e.info2->s = TALLOC_ARRAY(p->mem_ctx, struct dfs_Info2, num_jn)) == NULL) { - return WERR_NOMEM; + if (num_jn) { + if ((r->out.info->e.info2->s = TALLOC_ARRAY(p->mem_ctx, struct dfs_Info2, num_jn)) == NULL) { + return WERR_NOMEM; + } + } else { + r->out.info->e.info2->s = NULL; } r->out.info->e.info2->count = num_jn; break; case 3: - if ((r->out.info->e.info3->s = TALLOC_ARRAY(p->mem_ctx, struct dfs_Info3, num_jn)) == NULL) { - return WERR_NOMEM; + if (num_jn) { + if ((r->out.info->e.info3->s = TALLOC_ARRAY(p->mem_ctx, struct dfs_Info3, num_jn)) == NULL) { + return WERR_NOMEM; + } + } else { + r->out.info->e.info3->s = NULL; } r->out.info->e.info3->count = num_jn; break; @@ -301,7 +316,7 @@ WERROR _dfs_Enum(pipes_struct *p, struct dfs_Enum *r) return WERR_OK; } - + WERROR _dfs_GetInfo(pipes_struct *p, struct dfs_GetInfo *r) { int consumedcnt = sizeof(pstring); |