net: Fix Coverity ID 241039 Unchecked return value
authorVolker Lendecke <vl@samba.org>
Wed, 23 Dec 2015 10:32:04 +0000 (11:32 +0100)
committerUri Simchoni <uri@samba.org>
Wed, 23 Dec 2015 16:17:53 +0000 (17:17 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Wed Dec 23 17:17:53 CET 2015 on sn-devel-144

source3/utils/net_ads.c

index 5cc07a0abb695b16f4267c3f58c12394f2ab7d33..ace5b27d81bcf114306e4f90e744eabe1e327e6a 100644 (file)
@@ -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,