From 9cc8cb5134b0a4ebf5e985f7319ded295f308c90 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Nov 2001 20:33:35 +0000 Subject: merge from APPLIANCE_HEAD (This used to be commit f8b18b25944135c196c8134100f601e84c583382) --- source3/rpc_server/srv_spoolss_nt.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 7f54867eb4..1d54c92bce 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -6006,10 +6006,6 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S ZERO_STRUCT(printer); - *out_max_value_len=0; - *out_value=NULL; - *out_value_len=0; - *out_type=0; *out_max_data_len=0; @@ -6071,18 +6067,6 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S param_index++; } - /* - * I think this is correct, it doesn't break APW and - * allows Gerald's Win32 test programs to work correctly, - * but may need altering.... JRA. - */ - - if (param_index == 0) { - /* No parameters found. */ - free_a_printer(&printer, 2); - return WERR_NO_MORE_ITEMS; - } - /* the value is an UNICODE string but realvaluesize is the length in bytes including the leading 0 */ *out_value_len=2*(1+biggest_valuesize); *out_data_len=biggest_datasize; @@ -6099,8 +6083,28 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S */ if (!get_specific_param_by_index(*printer, 2, idx, value, &data, &type, &data_len)) { + SAFE_FREE(data); free_a_printer(&printer, 2); + + /* out_value should default to "" or else NT4 has + problems unmarshalling the response */ + + *out_max_value_len=(in_value_len/sizeof(uint16)); + if((*out_value=(uint16 *)malloc(in_value_len*sizeof(uint8))) == NULL) + return WERR_NOMEM; + + ZERO_STRUCTP(*out_value); + *out_value_len = rpcstr_push((char *)*out_value, "", in_value_len, 0); + + /* the data is counted in bytes */ + *out_max_data_len = in_data_len; + *out_data_len = in_data_len; + if((*data_out=(uint8 *)malloc(in_data_len*sizeof(uint8))) == NULL) + return WERR_NOMEM; + + memset(*data_out,'\0',in_data_len); + return WERR_NO_MORE_ITEMS; } -- cgit