From 1f0be3e1199170b599652905021a57e966ef12a9 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 22 Jun 2017 10:25:09 +0200 Subject: [PATCH] s4:torture: Do not segfault in torture_rpc_spoolss_printer_teardown_common() Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner Reviewed-by: Ralph Boehme Reviewed-by: Stefan Metzmacher Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Fri Jun 23 21:00:19 CEST 2017 on sn-devel-144 --- source4/torture/rpc/spoolss.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 20d2f14c113..14a43b97f6d 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -8572,10 +8572,14 @@ static bool torture_rpc_spoolss_printer_teardown_common(struct torture_context * { bool found = false; struct dcerpc_pipe *p = t->spoolss_pipe; - struct dcerpc_binding_handle *b = p->binding_handle; - const char *printer_name = t->info2.printername; + struct dcerpc_binding_handle *b = NULL; const char *server_name_slash; + if (p == NULL) { + return true; + } + b = p->binding_handle; + server_name_slash = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); if (t->added_driver) { @@ -8594,7 +8598,8 @@ static bool torture_rpc_spoolss_printer_teardown_common(struct torture_context * "failed to delete printer driver via spoolss"); } - if (p && !t->wellknown) { + if (!t->wellknown) { + const char *printer_name = t->info2.printername; torture_assert(tctx, test_DeletePrinter(tctx, b, &t->handle), -- 2.47.2