summaryrefslogtreecommitdiff
path: root/source3/libads/ldap_printer.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-10-02 12:06:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:15:04 -0500
commitac080e3184abcc177f9f8e8bf2f3537739b9e8ad (patch)
tree78e8d94acd628ff2bec5413151219d2e52864ad3 /source3/libads/ldap_printer.c
parent6b80d173eda176594cc9cc36511ba62079964cfd (diff)
downloadsamba-ac080e3184abcc177f9f8e8bf2f3537739b9e8ad.tar.gz
samba-ac080e3184abcc177f9f8e8bf2f3537739b9e8ad.tar.bz2
samba-ac080e3184abcc177f9f8e8bf2f3537739b9e8ad.zip
r19039: Do not segfault in "net ads printer info" when a requested printserver
does not exist. Guenther (This used to be commit 359315021df3a4dbfe5142e529e3efdbc49e405c)
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 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);