diff options
author | Günther Deschner <gd@samba.org> | 2008-11-19 14:33:36 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-12-17 23:52:41 +0100 |
commit | 5445ee2a55d5eadb41d17348ff5f5a09cfb8a3e0 (patch) | |
tree | ad97853a5ff7d561d3e21f81569eb8bd168f2dbf /source3 | |
parent | 93c61a814a5a79505a0bd2675a67cb3d6a4fdbe3 (diff) | |
download | samba-5445ee2a55d5eadb41d17348ff5f5a09cfb8a3e0.tar.gz samba-5445ee2a55d5eadb41d17348ff5f5a09cfb8a3e0.tar.bz2 samba-5445ee2a55d5eadb41d17348ff5f5a09cfb8a3e0.zip |
s3-ntsvcs: use pidl for _PNP_GetDeviceList.
Guenther
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_server/srv_ntsvcs.c | 18 | ||||
-rw-r--r-- | source3/rpc_server/srv_ntsvcs_nt.c | 51 |
2 files changed, 30 insertions, 39 deletions
diff --git a/source3/rpc_server/srv_ntsvcs.c b/source3/rpc_server/srv_ntsvcs.c index 840da3eec4..c37d2dda7e 100644 --- a/source3/rpc_server/srv_ntsvcs.c +++ b/source3/rpc_server/srv_ntsvcs.c @@ -65,23 +65,7 @@ static bool api_ntsvcs_get_device_list_size(pipes_struct *p) static bool api_ntsvcs_get_device_list(pipes_struct *p) { - NTSVCS_Q_GET_DEVICE_LIST q_u; - NTSVCS_R_GET_DEVICE_LIST r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if(!ntsvcs_io_q_get_device_list("", &q_u, data, 0)) - return False; - - r_u.status = _ntsvcs_get_device_list(p, &q_u, &r_u); - - if(!ntsvcs_io_r_get_device_list("", &r_u, rdata, 0)) - return False; - - return True; + return proxy_ntsvcs_call(p, NDR_PNP_GETDEVICELIST); } /******************************************************************* diff --git a/source3/rpc_server/srv_ntsvcs_nt.c b/source3/rpc_server/srv_ntsvcs_nt.c index f2c85bbd3e..681c543c24 100644 --- a/source3/rpc_server/srv_ntsvcs_nt.c +++ b/source3/rpc_server/srv_ntsvcs_nt.c @@ -65,29 +65,46 @@ WERROR _PNP_GetDeviceListSize(pipes_struct *p, return WERR_OK; } +/**************************************************************** + _PNP_GetDeviceList +****************************************************************/ -/******************************************************************** -********************************************************************/ - -WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, NTSVCS_R_GET_DEVICE_LIST *r_u ) +WERROR _PNP_GetDeviceList(pipes_struct *p, + struct PNP_GetDeviceList *r) { - fstring device; char *devicepath; + uint32_t size = 0; - if ( !q_u->devicename ) - return WERR_ACCESS_DENIED; + DATA_BLOB blob; + struct lsa_StringLarge s; + enum ndr_err_code ndr_err; - rpcstr_pull(device, q_u->devicename->buffer, sizeof(device), q_u->devicename->uni_str_len*2, 0); + if ( !r->in.filter ) + return WERR_ACCESS_DENIED; - if (!(devicepath = get_device_path(p->mem_ctx, device))) { + if (!(devicepath = get_device_path(p->mem_ctx, r->in.filter))) { return WERR_NOMEM; } + size = strlen(devicepath) + 2; + + if (*r->in.length < size) { + return WERR_CM_BUFFER_SMALL; + } + + s.string = r->in.filter; + /* This has to be DOUBLE NULL terminated */ + ndr_err = ndr_push_struct_blob(&blob, p->mem_ctx, NULL, &s, + (ndr_push_flags_fn_t)ndr_push_lsa_StringLarge); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return ntstatus_to_werror(ndr_map_error2ntstatus(ndr_err)); + } - init_unistr2( &r_u->devicepath, devicepath, UNI_STR_DBLTERMINATE ); - TALLOC_FREE(devicepath); - r_u->needed = r_u->devicepath.uni_str_len; + r->out.buffer = (uint16_t *)talloc_memdup(p->mem_ctx, blob.data, blob.length); + if (!r->out.buffer) { + return WERR_NOMEM; + } return WERR_OK; } @@ -271,16 +288,6 @@ WERROR _PNP_EnumerateSubKeys(pipes_struct *p, /**************************************************************** ****************************************************************/ -WERROR _PNP_GetDeviceList(pipes_struct *p, - struct PNP_GetDeviceList *r) -{ - p->rng_fault_state = true; - return WERR_NOT_SUPPORTED; -} - -/**************************************************************** -****************************************************************/ - WERROR _PNP_GetDepth(pipes_struct *p, struct PNP_GetDepth *r) { |