summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libads/ldap_printer.c10
-rw-r--r--source3/utils/net_ads.c3
2 files changed, 12 insertions, 1 deletions
diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c
index 50233140f0..f5168b05af 100644
--- a/source3/libads/ldap_printer.c
+++ b/source3/libads/ldap_printer.c
@@ -41,8 +41,18 @@
servername));
return status;
}
+ if (ads_count_replies(ads, *res) != 1) {
+ return ADS_ERROR(LDAP_NO_SUCH_OBJECT);
+ }
srv_dn = ldap_get_dn(ads->ld, *res);
+ if (srv_dn == NULL) {
+ return ADS_ERROR(LDAP_NO_MEMORY);
+ }
srv_cn = ldap_explode_dn(srv_dn, 1);
+ if (srv_cn == NULL) {
+ ldap_memfree(srv_dn);
+ return ADS_ERROR(LDAP_INVALID_DN_SYNTAX);
+ }
ads_msgfree(ads, *res);
asprintf(&s, "(cn=%s-%s)", srv_cn[0], printer);
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 2593a59603..53d9f65d6b 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1634,7 +1634,8 @@ static int net_ads_printer_info(int argc, const char **argv)
rc = ads_find_printer_on_server(ads, &res, printername, servername);
if (!ADS_ERR_OK(rc)) {
- d_fprintf(stderr, "ads_find_printer_on_server: %s\n", ads_errstr(rc));
+ d_fprintf(stderr, "Server '%s' not found: %s\n",
+ servername, ads_errstr(rc));
ads_msgfree(ads, res);
ads_destroy(&ads);
return -1;