diff options
author | Gerald Carter <jerry@samba.org> | 2003-07-14 19:51:34 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-07-14 19:51:34 +0000 |
commit | eb2b68302205e6dc217a4abdef494c45e9fc3cc0 (patch) | |
tree | 72f7919404c171d0dc3b8c6d00c711bc3a69f25a /source3/rpc_server | |
parent | 4b28f274b604511b482f19fa134a0bf8f9eaab43 (diff) | |
download | samba-eb2b68302205e6dc217a4abdef494c45e9fc3cc0.tar.gz samba-eb2b68302205e6dc217a4abdef494c45e9fc3cc0.tar.bz2 samba-eb2b68302205e6dc217a4abdef494c45e9fc3cc0.zip |
fix cache coherency bug in print handle print_info_2 cache.
Needs to be rewritten to use a reference counter, but this
will work for now.
also the memory allocation in the printing code needs to be cleaned
up to use talloc exclusively.
(This used to be commit 3d293027563b36411b7f84ed9d8f47f926271c6f)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 2b68e34b2d..2d316051af 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -273,7 +273,34 @@ static Printer_entry *find_printer_index_by_hnd(pipes_struct *p, POLICY_HND *hnd } /**************************************************************************** - find printer index by handle + look for a printer object cached on an open printer handle +****************************************************************************/ + +WERROR find_printer_in_print_hnd_cache( TALLOC_CTX *ctx, NT_PRINTER_INFO_LEVEL_2 **info2, + const char *printername ) +{ + Printer_entry *p; + + DEBUG(10,("find_printer_in_print_hnd_cache: printer [%s]\n", printername)); + + for ( p=printers_list; p; p=p->next ) + { + if ( p->printer_type==PRINTER_HANDLE_IS_PRINTER + && p->printer_info + && StrCaseCmp(p->dev.handlename, printername) == 0 ) + { + DEBUG(10,("Found printer\n")); + *info2 = dup_printer_2( ctx, p->printer_info->info_2 ); + if ( *info2 ) + return WERR_OK; + } + } + + return WERR_INVALID_PRINTER_NAME; +} + +/**************************************************************************** + destroy any cached printer_info_2 structures on open handles ****************************************************************************/ void invalidate_printer_hnd_cache( char *printername ) |