From f33224dbcfb69d5c503b2037c91efba4d85e56fb Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 23 Dec 2015 11:32:04 +0100 Subject: [PATCH] net: Fix Coverity ID 241039 Unchecked return value Signed-off-by: Volker Lendecke Reviewed-by: Uri Simchoni Autobuild-User(master): Uri Simchoni Autobuild-Date(master): Wed Dec 23 17:17:53 CET 2015 on sn-devel-144 --- source3/utils/net_ads.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 5cc07a0abb6..ace5b27d81b 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -1910,6 +1910,7 @@ static int net_ads_printer_publish(struct net_context *c, int argc, const char * char *prt_dn, *srv_dn, **srv_cn; char *srv_cn_escaped = NULL, *printername_escaped = NULL; LDAPMessage *res = NULL; + bool ok; if (argc < 1 || c->display_usage) { d_printf("%s\n%s", @@ -1937,7 +1938,14 @@ static int net_ads_printer_publish(struct net_context *c, int argc, const char * /* Get printer data from SPOOLSS */ - resolve_name(servername, &server_ss, 0x20, false); + ok = resolve_name(servername, &server_ss, 0x20, false); + if (!ok) { + d_fprintf(stderr, _("Could not find server %s\n"), + servername); + ads_destroy(&ads); + talloc_destroy(mem_ctx); + return -1; + } nt_status = cli_full_connection(&cli, lp_netbios_name(), servername, &server_ss, 0,