summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_srvsvc.c25
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c48
2 files changed, 26 insertions, 47 deletions
diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c
index 7579e109d4..96bc3735b4 100644
--- a/source3/rpc_server/srv_srvsvc.c
+++ b/source3/rpc_server/srv_srvsvc.c
@@ -231,30 +231,9 @@ static bool api_srv_net_remote_tod(pipes_struct *p)
RPC to enumerate disks available on a server e.g. C:, D: ...
*******************************************************************/
-static bool api_srv_net_disk_enum(pipes_struct *p)
+static bool api_srv_net_disk_enum(pipes_struct *p)
{
- SRV_Q_NET_DISK_ENUM q_u;
- SRV_R_NET_DISK_ENUM r_u;
- prs_struct *data = &p->in_data.data;
- prs_struct *rdata = &p->out_data.rdata;
-
- ZERO_STRUCT(q_u);
- ZERO_STRUCT(r_u);
-
- /* Unmarshall the net server disk enum. */
- if(!srv_io_q_net_disk_enum("", &q_u, data, 0)) {
- DEBUG(0,("api_srv_net_disk_enum: Failed to unmarshall SRV_Q_NET_DISK_ENUM.\n"));
- return False;
- }
-
- r_u.status = _srv_net_disk_enum(p, &q_u, &r_u);
-
- if(!srv_io_r_net_disk_enum("", &r_u, rdata, 0)) {
- DEBUG(0,("api_srv_net_disk_enum: Failed to marshall SRV_R_NET_DISK_ENUM.\n"));
- return False;
- }
-
- return True;
+ return proxy_srvsvc_call(p, NDR_SRVSVC_NETDISKENUM);
}
/*******************************************************************
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index 7c2efc946d..eb304aa60c 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -2359,45 +2359,51 @@ static const char *next_server_disk_enum(uint32 *resume)
return disk;
}
-WERROR _srv_net_disk_enum(pipes_struct *p, SRV_Q_NET_DISK_ENUM *q_u, SRV_R_NET_DISK_ENUM *r_u)
+/********************************************************************
+ _srvsvc_NetDiskEnum
+********************************************************************/
+
+WERROR _srvsvc_NetDiskEnum(pipes_struct *p,
+ struct srvsvc_NetDiskEnum *r)
{
uint32 i;
const char *disk_name;
TALLOC_CTX *ctx = p->mem_ctx;
- uint32 resume=get_enum_hnd(&q_u->enum_hnd);
-
- r_u->status=WERR_OK;
-
- r_u->total_entries = init_server_disk_enum(&resume);
+ WERROR werr;
+ uint32_t resume = r->in.resume_handle ? *r->in.resume_handle : 0;
- r_u->disk_enum_ctr.unknown = 0;
+ werr = WERR_OK;
- if(!(r_u->disk_enum_ctr.disk_info = TALLOC_ARRAY(ctx, DISK_INFO, MAX_SERVER_DISK_ENTRIES))) {
- return WERR_NOMEM;
- }
+ *r->out.totalentries = init_server_disk_enum(&resume);
- r_u->disk_enum_ctr.disk_info_ptr = r_u->disk_enum_ctr.disk_info ? 1 : 0;
+ r->out.info->disks = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetDiskInfo0,
+ MAX_SERVER_DISK_ENTRIES);
+ W_ERROR_HAVE_NO_MEMORY(r->out.info->disks);
- /*allow one DISK_INFO for null terminator*/
+ /*allow one struct srvsvc_NetDiskInfo0 for null terminator*/
for(i = 0; i < MAX_SERVER_DISK_ENTRIES -1 && (disk_name = next_server_disk_enum(&resume)); i++) {
- r_u->disk_enum_ctr.entries_read++;
+ r->out.info->count++;
/*copy disk name into a unicode string*/
- init_unistr3(&r_u->disk_enum_ctr.disk_info[i].disk_name, disk_name);
+ r->out.info->disks[i].disk = talloc_strdup(ctx, disk_name);
+ W_ERROR_HAVE_NO_MEMORY(r->out.info->disks[i].disk);
}
/* add a terminating null string. Is this there if there is more data to come? */
- r_u->disk_enum_ctr.entries_read++;
+ r->out.info->count++;
- init_unistr3(&r_u->disk_enum_ctr.disk_info[i].disk_name, "");
+ r->out.info->disks[i].disk = talloc_strdup(ctx, "");
+ W_ERROR_HAVE_NO_MEMORY(r->out.info->disks[i].disk);
- init_enum_hnd(&r_u->enum_hnd, resume);
+ if (r->out.resume_handle) {
+ *r->out.resume_handle = resume;
+ }
- return r_u->status;
+ return werr;
}
/********************************************************************
@@ -2515,12 +2521,6 @@ WERROR _srvsvc_NetShareCheck(pipes_struct *p, struct srvsvc_NetShareCheck *r)
return WERR_NOT_SUPPORTED;
}
-WERROR _srvsvc_NetDiskEnum(pipes_struct *p, struct srvsvc_NetDiskEnum *r)
-{
- p->rng_fault_state = True;
- return WERR_NOT_SUPPORTED;
-}
-
WERROR _srvsvc_NetServerStatisticsGet(pipes_struct *p, struct srvsvc_NetServerStatisticsGet *r)
{
p->rng_fault_state = True;