[PATCH] bug 9830: fix panic in nt_printer_publish_ads
Guenther Deschner
gd at samba.org
Thu Apr 25 09:17:16 MDT 2013
Hi David,
looks good. Pushed to autobuild. Thanks!
Guenther
On Thu, Apr 25, 2013 at 04:41:17PM +0200, David Disseldorp wrote:
> 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 at samba.org>
> ---
> source3/printing/nt_printing_ads.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/source3/printing/nt_printing_ads.c b/source3/printing/nt_printing_ads.c
> index b99a972..3a2baf40 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);
> --
> 1.8.1.4
>
--
Günther Deschner GPG-ID: 8EE11688
Red Hat gdeschner at redhat.com
Samba Team gd at samba.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20130425/5c2adddc/attachment.pgp>
More information about the samba-technical
mailing list