Bug 11600 - samba_upgradedns fails if "Default Domain Policy" was renamed
Summary: samba_upgradedns fails if "Default Domain Policy" was renamed
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: DNS server (internal) (show other bugs)
Version: 4.1.20
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Kai Blin
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-13 12:43 UTC by Achim Gottinger
Modified: 2015-11-15 09:18 UTC (History)
2 users (show)

See Also:


Attachments
Bug fix patch (1.87 KB, patch)
2015-11-13 13:36 UTC, Rowland Penny
no flags Details
new bug fix patch (1.79 KB, patch)
2015-11-13 14:23 UTC, Rowland Penny
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Achim Gottinger 2015-11-13 12:43:09 UTC
If the GPO "Default Domain Policy" was renamed running samba_upgradedns fails with 

and get an python error pointing to /usr/lib/python2.7/dist-packages/samba/provision/__init__.py line 271

Reading domain information
Traceback (most recent call last):
  File "/usr/sbin/samba_upgradedns", line 261, in <module>
    paths, lp.configfile, lp)
  File "/usr/lib/python2.7/dist-packages/samba/provision/__init__.py", line 271, in find_provision_key_parameters
    names.policyid = str(res7[0]["cn"]).replace("{","").replace("}","")
IndexError: list index out of range

This is the code snippet failing
----------------------------------------
    res7 = samdb.search(expression="(displayName=Default Domain Policy)",
                        base="CN=Policies,CN=System," + basedn,
                        scope=ldb.SCOPE_ONELEVEL, attrs=["cn","displayName"])
    names.policyid = str(res7[0]["cn"]).replace("{","").replace("}","") 
----------------------------------------
Comment 1 Rowland Penny 2015-11-13 13:36:14 UTC
Created attachment 11595 [details]
Bug fix patch

This patch changes the search from using the 'displayName' attribute to using the 'name' attribute, it also does the same for the 'Default Domain Controllers Policy' search.
Comment 2 Rowland Penny 2015-11-13 14:23:35 UTC
Created attachment 11596 [details]
new bug fix patch

New patch as requested