On 13/11/15 10:20, mourik jan heupink wrote:> Hi Rowland, Achim, list, > >> The search would probably be better something like this: >> >> res7 >> samdb.search(expression="(name={31B2F340-016D-11D2-945F-00C04FB984F9})", >> base="CN=Policies,CN=System," + basedn, >> scope=ldb.SCOPE_ONELEVEL, >> attrs=["cn","displayName"]) >> names.policyid = str(res7[0]["cn"]).replace("{","").replace("}","") >> >> which is the same as: >> >> ldbsearch -H /usr/local/samba/private/sam.ldb -b >> "cn=Policies,cn=System,dc=samdom,dc=example,dc=com" -s one >> '(name={31B2F340-016D-11D2-945F-00C04FB984F9})' cn displayName >> >> which returns: >> >> # record 1 >> dn: >> CN={31B2F340-016D-11D2-945F-00C04FB984F9},CN=Policies,CN=System,DC=samdom,DC=example,DC=com >> >> >> cn: {31B2F340-016D-11D2-945F-00C04FB984F9} >> displayName: Default Domain Policy >> >> Rowland > > Yes, that is much better, and also is similar to the way windows > searches for these policies: > > https://support.microsoft.com/en-us/kb/556025 > > MJ >If Achim opens a bug report on this, I will propose a patch to fix it. Rowland
Am 13.11.2015 um 11:30 schrieb Rowland Penny:> On 13/11/15 10:20, mourik jan heupink wrote: >> Hi Rowland, Achim, list, >> >>> The search would probably be better something like this: >>> >>> res7 >>> samdb.search(expression="(name={31B2F340-016D-11D2-945F-00C04FB984F9})", >>> >>> base="CN=Policies,CN=System," + basedn, >>> scope=ldb.SCOPE_ONELEVEL, >>> attrs=["cn","displayName"]) >>> names.policyid = >>> str(res7[0]["cn"]).replace("{","").replace("}","") >>> >>> which is the same as: >>> >>> ldbsearch -H /usr/local/samba/private/sam.ldb -b >>> "cn=Policies,cn=System,dc=samdom,dc=example,dc=com" -s one >>> '(name={31B2F340-016D-11D2-945F-00C04FB984F9})' cn displayName >>> >>> which returns: >>> >>> # record 1 >>> dn: >>> CN={31B2F340-016D-11D2-945F-00C04FB984F9},CN=Policies,CN=System,DC=samdom,DC=example,DC=com >>> >>> >>> cn: {31B2F340-016D-11D2-945F-00C04FB984F9} >>> displayName: Default Domain Policy >>> >>> Rowland >> >> Yes, that is much better, and also is similar to the way windows >> searches for these policies: >> >> https://support.microsoft.com/en-us/kb/556025 >> >> MJ >> > > If Achim opens a bug report on this, I will propose a patch to fix it. > > Rowland > >Hello Rowland, Searching for the ID as proposed you would fix the issue. The code usually is used during domain provision so the gpo was just created. Here is the bug report https://bugzilla.samba.org/show_bug.cgi?id=11600 Achim
On 13/11/15 12:45, Achim Gottinger wrote:> > > Am 13.11.2015 um 11:30 schrieb Rowland Penny: >> On 13/11/15 10:20, mourik jan heupink wrote: >>> Hi Rowland, Achim, list, >>> >>>> The search would probably be better something like this: >>>> >>>> res7 >>>> samdb.search(expression="(name={31B2F340-016D-11D2-945F-00C04FB984F9})", >>>> >>>> base="CN=Policies,CN=System," + basedn, >>>> scope=ldb.SCOPE_ONELEVEL, >>>> attrs=["cn","displayName"]) >>>> names.policyid = >>>> str(res7[0]["cn"]).replace("{","").replace("}","") >>>> >>>> which is the same as: >>>> >>>> ldbsearch -H /usr/local/samba/private/sam.ldb -b >>>> "cn=Policies,cn=System,dc=samdom,dc=example,dc=com" -s one >>>> '(name={31B2F340-016D-11D2-945F-00C04FB984F9})' cn displayName >>>> >>>> which returns: >>>> >>>> # record 1 >>>> dn: >>>> CN={31B2F340-016D-11D2-945F-00C04FB984F9},CN=Policies,CN=System,DC=samdom,DC=example,DC=com >>>> >>>> >>>> cn: {31B2F340-016D-11D2-945F-00C04FB984F9} >>>> displayName: Default Domain Policy >>>> >>>> Rowland >>> >>> Yes, that is much better, and also is similar to the way windows >>> searches for these policies: >>> >>> https://support.microsoft.com/en-us/kb/556025 >>> >>> MJ >>> >> >> If Achim opens a bug report on this, I will propose a patch to fix it. >> >> Rowland >> >> > > Hello Rowland, > > Searching for the ID as proposed you would fix the issue. The code > usually is used during domain provision so the gpo was just created. > > Here is the bug report https://bugzilla.samba.org/show_bug.cgi?id=11600 > > Achim > >OK, done. Rowland