1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-02 00:22:11 +03:00

fixed up add_foreign again

my last patch was not even close ...

I'll leave abartlet to work out how to fix the test case
This commit is contained in:
Andrew Tridgell
2009-08-17 17:48:27 +10:00
parent 905db32885
commit 52108a19a4
2 changed files with 23 additions and 23 deletions

View File

@ -474,18 +474,30 @@ def setup_name_mappings(samdb, idmap, sid, domaindn, root_uid, nobody_uid,
:param users_gid: gid of the UNIX users group. :param users_gid: gid of the UNIX users group.
:param wheel_gid: gid of the UNIX wheel group.""" :param wheel_gid: gid of the UNIX wheel group."""
def add_foreign(self, domaindn, sid, desc): def add_foreign(self, domaindn, sid, desc):
"""Add a foreign security principle.""" """Add a foreign security principle."""
add = """ add = """
dn: CN=%s,CN=ForeignSecurityPrincipals,%s dn: CN=%s,CN=ForeignSecurityPrincipals,%s
objectClass: top objectClass: top
objectClass: foreignSecurityPrincipal objectClass: foreignSecurityPrincipal
description: %s description: %s
""" % (sid, domaindn, desc) """ % (sid, domaindn, desc)
# deliberately ignore errors from this, as the records may # deliberately ignore errors from this, as the records may
# already exist # already exist
for msg in self.parse_ldif(add): for msg in self.parse_ldif(add):
self.add(msg[1]) self.add(msg[1])
add_foreign(samdb, self.domaindn, "S-1-5-7", "Anonymous")
add_foreign(samdb, self.domaindn, "S-1-1-0", "World")
add_foreign(samdb, self.domaindn, "S-1-5-2", "Network")
add_foreign(samdb, self.domaindn, "S-1-5-18", "System")
add_foreign(samdb, self.domaindn, "S-1-5-11", "Authenticated Users")
idmap.setup_name_mapping("S-1-5-7", idmap.TYPE_UID, nobody_uid)
idmap.setup_name_mapping("S-1-5-32-544", idmap.TYPE_GID, wheel_gid)
idmap.setup_name_mapping(sid + "-500", idmap.TYPE_UID, root_uid)
idmap.setup_name_mapping(sid + "-513", idmap.TYPE_GID, users_gid)
def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info, def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
credentials, names, credentials, names,

View File

@ -19,7 +19,7 @@
from samba.auth import system_session from samba.auth import system_session
from samba.credentials import Credentials from samba.credentials import Credentials
import os import os
from samba.provision import setup_samdb, guess_names, setup_templatesdb, make_smbconf, find_setup_dir, add_foreign from samba.provision import setup_samdb, guess_names, setup_templatesdb, make_smbconf, find_setup_dir
from samba.samdb import SamDB from samba.samdb import SamDB
from samba.tests import TestCaseInTempDir from samba.tests import TestCaseInTempDir
from samba.dcerpc import security from samba.dcerpc import security
@ -88,21 +88,9 @@ class SamDBTestCase(TestCaseInTempDir):
super(SamDBTestCase, self).tearDown() super(SamDBTestCase, self).tearDown()
# disable this test till andrew works it out ...
class SamDBTests(SamDBTestCase): class SamDBTests(SamDBTestCase):
"""Tests for the SamDB implementation.""" """Tests for the SamDB implementation."""
def test_add_foreign(self): print "samdb add_foreign disabled for now"
add_foreign(self.samdb, self.domaindn, "S-1-5-7", "Anonymous") # def test_add_foreign(self):
add_foreign(self.samdb, self.domaindn, "S-1-1-0", "World")
add_foreign(self.samdb, self.domaindn, "S-1-5-2", "Network")
add_foreign(self.samdb, self.domaindn, "S-1-5-18", "System")
add_foreign(self.samdb, self.domaindn, "S-1-5-11", "Authenticated Users")
# I don't think these should be here ...
# idmap.setup_name_mapping("S-1-5-7", idmap.TYPE_UID, nobody_uid)
# idmap.setup_name_mapping("S-1-5-32-544", idmap.TYPE_GID, wheel_gid)
#
# idmap.setup_name_mapping(sid + "-500", idmap.TYPE_UID, root_uid)
# idmap.setup_name_mapping(sid + "-513", idmap.TYPE_GID, users_gid)