summaryrefslogtreecommitdiffstats
path: root/source3/libads/ldap_printer.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libads/ldap_printer.c')
-rw-r--r--source3/libads/ldap_printer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c
index 50233140f0b..f5168b05af0 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);