diff options
author | Jean-François Micouleau <jfm@samba.org> | 2000-03-06 11:13:40 +0000 |
---|---|---|
committer | Jean-François Micouleau <jfm@samba.org> | 2000-03-06 11:13:40 +0000 |
commit | 78d7ba5ca021518ec5c088eb492b36710e556c31 (patch) | |
tree | 6e1181444ca5220bb185861bb8f68376d30670a9 /source3/rpc_server/srv_spoolss_nt.c | |
parent | 5eae8c7b0225aa4f4818edc1becbf399bb4cd42e (diff) | |
download | samba-78d7ba5ca021518ec5c088eb492b36710e556c31.tar.gz samba-78d7ba5ca021518ec5c088eb492b36710e556c31.tar.bz2 samba-78d7ba5ca021518ec5c088eb492b36710e556c31.zip |
changed prs_unistr to parse empty and non-empty strings the same way.
fixed typo in SPOOLSS_SYNT
some cleanup of unused functions
wrote make_spoolss_enumprinter and make_spoolss_openprinterex for
rpcclient as I'm trying to keep in sync the parsing code between HEAD and
TNG.
Will commit changes to TNG after lunch.
J.F.
(This used to be commit 025cdb345f6de287a41d4449b2662dbc5e762bf2)
Diffstat (limited to 'source3/rpc_server/srv_spoolss_nt.c')
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 90a0ef6d60..9d465ca145 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -384,6 +384,7 @@ static BOOL alloc_buffer_size(NEW_BUFFER *buffer, uint32 buffer_size) { prs_struct *ps; uint32 extra_space; + uint32 old_offset; ps=&(buffer->prs); @@ -392,10 +393,19 @@ static BOOL alloc_buffer_size(NEW_BUFFER *buffer, uint32 buffer_size) extra_space=0; else extra_space = buffer_size - prs_data_size(ps); + + /* + * save the offset and move to the end of the buffer + * prs_grow() checks the extra_space against the offset + */ + old_offset=prs_offset(ps); + prs_set_offset(ps, prs_data_size(ps)); if (!prs_grow(ps, extra_space)) return False; + prs_set_offset(ps, old_offset); + buffer->string_at_end=prs_data_size(ps); return True; @@ -412,7 +422,6 @@ uint32 _spoolss_open_printer_ex( const UNISTR2 *printername, POLICY_HND *handle) { fstring name; - fstring datatype; clear_handle(handle); @@ -962,9 +971,7 @@ static void spoolss_notify_status(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_ print_status_struct status; memset(&status, 0, sizeof(status)); - count=get_printqueue(snum, NULL, &q, &status); - data->notify_data.value[0]=(uint32) status.status; if (q) free(q); } @@ -978,7 +985,6 @@ static void spoolss_notify_cjobs(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_q print_status_struct status; memset(&status, 0, sizeof(status)); - data->notify_data.value[0]=get_printqueue(snum, NULL, &q, &status); if (q) free(q); } @@ -1869,6 +1875,8 @@ static BOOL enum_all_printers_info_2(NEW_BUFFER *buffer, uint32 offered, uint32 for (i=0; i<*returned; i++) (*needed) += spoolss_size_printer_info_2(printers[i]); + DEBUG(4,("we need [%d] bytes\n", *needed)); + if (!alloc_buffer_size(buffer, *needed)) return ERROR_INSUFFICIENT_BUFFER; @@ -1906,7 +1914,7 @@ static uint32 enumprinters_level1( uint32 flags, fstring name, if (flags && PRINTER_ENUM_REMOTE) return enum_all_printers_info_1(buffer, offered, needed, returned); - + return NT_STATUS_INVALID_LEVEL; } /******************************************************************** @@ -2675,7 +2683,6 @@ static uint32 update_printer(const POLICY_HND *handle, uint32 level, int snum; NT_PRINTER_INFO_LEVEL printer; NT_DEVICEMODE *nt_devmode; - uint32 status = 0x0; Printer_entry *Printer = find_printer_index_by_hnd(handle); nt_devmode=NULL; |