summaryrefslogtreecommitdiffstats
path: root/source/rpc_server
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-07-14 19:51:34 +0000
committerGerald Carter <jerry@samba.org>2003-07-14 19:51:34 +0000
commit3d293027563b36411b7f84ed9d8f47f926271c6f (patch)
tree559b85d9bb1cc631ed64981833fada9e98854f81 /source/rpc_server
parent3f63bcb47182f69a7524bf9fcd0198aa116a9c45 (diff)
downloadsamba-3d293027563b36411b7f84ed9d8f47f926271c6f.tar.gz
samba-3d293027563b36411b7f84ed9d8f47f926271c6f.tar.xz
samba-3d293027563b36411b7f84ed9d8f47f926271c6f.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.
Diffstat (limited to 'source/rpc_server')
-rw-r--r--source/rpc_server/srv_spoolss_nt.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c
index 2b68e34b2d8..2d316051af2 100644
--- a/source/rpc_server/srv_spoolss_nt.c
+++ b/source/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 )