summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2013-04-25 16:41:17 +0200
committerGünther Deschner <gd@samba.org>2013-04-25 19:01:55 +0200
commitb1574ebb0b0b119659ae06a8ef42e8ae161e0988 (patch)
treea38e774b2eb6f76c55c0ca665aba11c93a60edc9 /source3
parent727c611fe3c903d905871a46909ed1e7639add15 (diff)
downloadsamba-b1574ebb0b0b119659ae06a8ef42e8ae161e0988.tar.gz
samba-b1574ebb0b0b119659ae06a8ef42e8ae161e0988.tar.bz2
samba-b1574ebb0b0b119659ae06a8ef42e8ae161e0988.zip
bug 9830: fix panic in nt_printer_publish_ads
Check for ads_find_machine_acct() errors, to ensure a NULL LDAPMessage pointer doesn't get passed to ldap_get_dn(). Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-By: Günther Deschner <gd@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Thu Apr 25 19:01:55 CEST 2013 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/printing/nt_printing_ads.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/printing/nt_printing_ads.c b/source3/printing/nt_printing_ads.c
index b99a972980..3a2baf40f5 100644
--- a/source3/printing/nt_printing_ads.c
+++ b/source3/printing/nt_printing_ads.c
@@ -192,17 +192,23 @@ static WERROR nt_printer_publish_ads(struct messaging_context *msg_ctx,
DEBUG(5, ("publishing printer %s\n", printer));
/* figure out where to publish */
- ads_find_machine_acct(ads, &res, lp_netbios_name());
+ ads_rc = ads_find_machine_acct(ads, &res, lp_netbios_name());
+ if (!ADS_ERR_OK(ads_rc)) {
+ DEBUG(0, ("failed to find machine account for %s\n",
+ lp_netbios_name()));
+ TALLOC_FREE(ctx);
+ return WERR_NOT_FOUND;
+ }
/* We use ldap_get_dn here as we need the answer
* in utf8 to call ldap_explode_dn(). JRA. */
srv_dn_utf8 = ldap_get_dn((LDAP *)ads->ldap.ld, (LDAPMessage *)res);
+ ads_msgfree(ads, res);
if (!srv_dn_utf8) {
TALLOC_FREE(ctx);
return WERR_SERVER_UNAVAILABLE;
}
- ads_msgfree(ads, res);
srv_cn_utf8 = ldap_explode_dn(srv_dn_utf8, 1);
if (!srv_cn_utf8) {
TALLOC_FREE(ctx);