summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-01-16 11:39:20 +0100
committerVolker Lendecke <vl@samba.org>2008-01-16 11:39:20 +0100
commit594a1645482cd4f993df7d63f5037a159de03442 (patch)
treec844b50c5c3f2a6466db1a1b92955367a07c653a
parent41c72bd80465122d836fe19a784982bf5cb82cdd (diff)
downloadsamba-594a1645482cd4f993df7d63f5037a159de03442.tar.gz
samba-594a1645482cd4f993df7d63f5037a159de03442.tar.bz2
samba-594a1645482cd4f993df7d63f5037a159de03442.zip
Fix a crash bug in nt_printer_publish_ads
Reported by Martin Zielinski <mz@seh.de> (This used to be commit 4db26c803de52d3efccc940efc55f14131a057f5)
-rw-r--r--source3/printing/nt_printing.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index bba55c0e4a..d5803b711b 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -3315,8 +3315,13 @@ static WERROR nt_printer_publish_ads(ADS_STRUCT *ads,
/* publish it */
ads_rc = ads_mod_printer_entry(ads, prt_dn, ctx, &mods);
- if (ads_rc.err.rc == LDAP_NO_SUCH_OBJECT)
+ if (ads_rc.err.rc == LDAP_NO_SUCH_OBJECT) {
+ int i;
+ for (i=0; mods[i] != 0; i++)
+ ;
+ mods[i] = (LDAPMod *)-1;
ads_rc = ads_add_printer_entry(ads, prt_dn, ctx, &mods);
+ }
if (!ADS_ERR_OK(ads_rc))
DEBUG(3, ("error publishing %s: %s\n", printer->info_2->sharename, ads_errstr(ads_rc)));