summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-04-19 18:21:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:19 -0500
commit55da6e7f90d2a48a69ee37140f946131c6a03de6 (patch)
treee8bcae1a96ff5f3b1d480f449a8beff739adc290 /source4/rpc_server
parente5f44e48daadff09e7598176e13a7b5c6d288e6b (diff)
downloadsamba-55da6e7f90d2a48a69ee37140f946131c6a03de6.tar.gz
samba-55da6e7f90d2a48a69ee37140f946131c6a03de6.tar.bz2
samba-55da6e7f90d2a48a69ee37140f946131c6a03de6.zip
r286: use talloc_array_p() instead of talloc()
add some more WERR_NOT_SUPPORTED stubs to pass our torture tests (wkssvc and srvsvc) metze (This used to be commit f8605b39ab58f8db22358122eafccc8a1cc60004)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/srvsvc/dcesrv_srvsvc.c65
-rw-r--r--source4/rpc_server/wkssvc/dcesrv_wkssvc.c23
2 files changed, 79 insertions, 9 deletions
diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
index 2cf886c12b..1e5a2105d0 100644
--- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
+++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
@@ -360,7 +360,7 @@ static NTSTATUS srvsvc_NetSessEnum(struct dcesrv_call_state *dce_call, TALLOC_CT
WERR_TALLOC_CHECK(r->out.ctr.ctr0);
r->out.ctr.ctr0->count = 0;
- r->out.ctr.ctr0->array = talloc(mem_ctx, r->out.ctr.ctr0->count*sizeof(struct srvsvc_NetSessInfo0));
+ r->out.ctr.ctr0->array = NULL;
r->out.result = WERR_NOT_SUPPORTED;
break;
@@ -497,7 +497,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO
if (r->out.ctr.ctr0->count == 0) break;
- r->out.ctr.ctr0->array = talloc(mem_ctx, r->out.ctr.ctr0->count*sizeof(struct srvsvc_NetShareInfo0));
+ r->out.ctr.ctr0->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo0, r->out.ctr.ctr0->count);
WERR_TALLOC_CHECK(r->out.ctr.ctr0->array);
for (i=0;i<r->out.ctr.ctr0->count;i++) {
@@ -519,7 +519,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO
if (r->out.ctr.ctr1->count == 0) break;
- r->out.ctr.ctr1->array = talloc(mem_ctx, r->out.ctr.ctr1->count*sizeof(struct srvsvc_NetShareInfo1));
+ r->out.ctr.ctr1->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo1, r->out.ctr.ctr1->count);
WERR_TALLOC_CHECK(r->out.ctr.ctr1->array);
for (i=0;i<r->out.ctr.ctr1->count;i++) {
@@ -542,7 +542,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO
if (r->out.ctr.ctr2->count == 0) break;
- r->out.ctr.ctr2->array = talloc(mem_ctx, r->out.ctr.ctr2->count*sizeof(struct srvsvc_NetShareInfo2));
+ r->out.ctr.ctr2->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo2, r->out.ctr.ctr2->count);
WERR_TALLOC_CHECK(r->out.ctr.ctr2->array);
for (i=0;i<r->out.ctr.ctr2->count;i++) {
@@ -570,7 +570,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO
if (r->out.ctr.ctr501->count == 0) break;
- r->out.ctr.ctr501->array = talloc(mem_ctx, r->out.ctr.ctr501->count*sizeof(struct srvsvc_NetShareInfo501));
+ r->out.ctr.ctr501->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo501, r->out.ctr.ctr501->count);
WERR_TALLOC_CHECK(r->out.ctr.ctr501->array);
for (i=0;i<r->out.ctr.ctr501->count;i++) {
@@ -594,7 +594,7 @@ static NTSTATUS srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, TALLO
if (r->out.ctr.ctr502->count == 0) break;
- r->out.ctr.ctr502->array = talloc(mem_ctx, r->out.ctr.ctr502->count*sizeof(struct srvsvc_NetShareInfo502));
+ r->out.ctr.ctr502->array = talloc_array_p(mem_ctx, struct srvsvc_NetShareInfo502, r->out.ctr.ctr502->count);
WERR_TALLOC_CHECK(r->out.ctr.ctr502->array);
for (i=0;i<r->out.ctr.ctr502->count;i++) {
@@ -790,8 +790,57 @@ static NTSTATUS srvsvc_NETRSERVERTRANSPORTADD(struct dcesrv_call_state *dce_call
static NTSTATUS srvsvc_NetTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct srvsvc_NetTransportEnum *r)
{
- ZERO_STRUCT(r->out);
- r->out.result = WERR_NOT_SUPPORTED;
+ r->out.level = r->in.level;
+ r->out.totalentries = 0;
+ r->out.resume_handle = NULL;
+ r->out.result = WERR_OK;
+
+ switch (r->in.level) {
+ case 0: {
+ r->out.ctr.ctr0 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr0);
+ WERR_TALLOC_CHECK(r->out.ctr.ctr0);
+
+ r->out.ctr.ctr0->count = 0;
+ r->out.ctr.ctr0->array = NULL;
+
+ r->out.result = WERR_NOT_SUPPORTED;
+ break;
+ }
+ case 1: {
+ r->out.ctr.ctr1 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr1);
+ WERR_TALLOC_CHECK(r->out.ctr.ctr1);
+
+ r->out.ctr.ctr1->count = 0;
+ r->out.ctr.ctr1->array = NULL;
+
+ r->out.result = WERR_NOT_SUPPORTED;
+ break;
+ }
+ case 2: {
+ r->out.ctr.ctr2 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr2);
+ WERR_TALLOC_CHECK(r->out.ctr.ctr2);
+
+ r->out.ctr.ctr2->count = 0;
+ r->out.ctr.ctr2->array = NULL;
+
+ r->out.result = WERR_NOT_SUPPORTED;
+ break;
+ }
+ case 3: {
+ r->out.ctr.ctr3 = talloc_p(mem_ctx, struct srvsvc_NetTransportCtr3);
+ WERR_TALLOC_CHECK(r->out.ctr.ctr3);
+
+ r->out.ctr.ctr3->count = 0;
+ r->out.ctr.ctr3->array = NULL;
+
+ r->out.result = WERR_NOT_SUPPORTED;
+ break;
+ }
+ default:
+ r->out.result = WERR_UNKNOWN_LEVEL;
+ break;
+ }
+
return NT_STATUS_OK;
}
diff --git a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
index 39bd6bfea8..9a94c0c5da 100644
--- a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
+++ b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
@@ -126,7 +126,28 @@ static NTSTATUS WKSSVC_NETRWKSTAUSERSETINFO(struct dcesrv_call_state *dce_call,
static NTSTATUS wkssvc_NetWkstaTransportEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct wkssvc_NetWkstaTransportEnum *r)
{
- return NT_STATUS_NOT_IMPLEMENTED;
+ r->out.level = r->in.level;
+ r->out.totalentries = 0;
+ r->out.resume_handle = NULL;
+ r->out.result = WERR_OK;
+
+ switch (r->in.level) {
+ case 0: {
+ r->out.ctr.ctr0 = talloc_p(mem_ctx, struct wkssvc_NetWkstaTransportCtr0);
+ WERR_TALLOC_CHECK(r->out.ctr.ctr0);
+
+ r->out.ctr.ctr0->count = 0;
+ r->out.ctr.ctr0->array = NULL;
+
+ r->out.result = WERR_NOT_SUPPORTED;
+ break;
+ }
+ default:
+ r->out.result = WERR_UNKNOWN_LEVEL;
+ break;
+ }
+
+ return NT_STATUS_OK;
}