spoolss: purge the printer name cache on name change
authorDavid Disseldorp <ddiss@samba.org>
Tue, 31 Mar 2015 23:03:13 +0000 (01:03 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 14 Apr 2015 03:37:50 +0000 (05:37 +0200)
Currently the name cache is only cleared on printer deletion. This means
that if a printer undergoes a name change, the old name remains in the
cache and can be subsequently used incorrecly if another printer takes
the same name as the old.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11210

Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 14 05:37:50 CEST 2015 on sn-devel-104

source3/rpc_server/spoolss/srv_spoolss_nt.c

index d61b072c0482e16d85cad8a2b8d7e6d0281e3a9a..65a805a9dff03945c14feaedc4e97264669edb66 100644 (file)
@@ -6479,6 +6479,9 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
                                                 snum, printer->sharename ?
                                                 printer->sharename : "");
                }
+
+               /* name change, purge any cache entries for the old */
+               prune_printername_cache();
        }
 
        if (printer->printername != NULL &&
@@ -6515,6 +6518,9 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
                        notify_printer_printername(server_event_context(),
                                                   msg_ctx, snum, p ? p : "");
                }
+
+               /* name change, purge any cache entries for the old */
+               prune_printername_cache();
        }
 
        if (printer->portname != NULL &&