diff options
author | Volker Lendecke <vl@samba.org> | 2010-09-06 20:58:45 -0700 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2010-09-07 09:40:26 +0200 |
commit | 7612760c2226bc43c68f1a7e3b2985d0a22bf277 (patch) | |
tree | 0bc4fde52a5106f04fc37c4404626ffebb372758 /source3 | |
parent | 7ca69f7462f741860d514a78e3198db634db2a6b (diff) | |
download | samba-7612760c2226bc43c68f1a7e3b2985d0a22bf277.tar.gz samba-7612760c2226bc43c68f1a7e3b2985d0a22bf277.tar.bz2 samba-7612760c2226bc43c68f1a7e3b2985d0a22bf277.zip |
s3: Prune the printername cache when a printer is deleted
Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 281de00511..34f9643483 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -98,6 +98,8 @@ struct xcv_api_table { WERROR(*fn) (TALLOC_CTX *mem_ctx, NT_USER_TOKEN *token, DATA_BLOB *in, DATA_BLOB *out, uint32_t *needed); }; +static void prune_printername_cache(void); + /******************************************************************** * Canonicalize servername. ********************************************************************/ @@ -388,8 +390,13 @@ static WERROR delete_printer_handle(struct pipes_struct *p, struct policy_handle return WERR_BADFID; } - return delete_printer_hook(p->mem_ctx, p->server_info->ptok, - Printer->sharename, p->msg_ctx); + result = delete_printer_hook(p->mem_ctx, p->server_info->ptok, + Printer->sharename, p->msg_ctx); + if (!W_ERROR_IS_OK(result)) { + return result; + } + prune_printername_cache(); + return WERR_OK; } /**************************************************************************** @@ -447,6 +454,17 @@ static bool set_printer_hnd_printertype(Printer_entry *Printer, const char *hand return true; } +static void prune_printername_cache_fn(const char *key, const char *value, + time_t timeout, void *private_data) +{ + gencache_del(key); +} + +static void prune_printername_cache(void) +{ + gencache_iterate(prune_printername_cache_fn, NULL, "PRINTERNAME/*"); +} + /**************************************************************************** Set printer handle name.. Accept names like \\server, \\server\printer, \\server\SHARE, & "\\server\,XcvMonitor Standard TCP/IP Port" See |