# First try to see if we already have this entry
found = False
- try:
- msg = idmapdb.search(expression='objectSid=%s' % str(sid))
- if msg.count == 1:
- found = True
- except Exception, e:
- raise e
+ msg = idmapdb.search(expression='objectSid=%s' % str(sid))
+ if msg.count == 1:
+ found = True
if found:
- print msg.count
- print dir(msg)
try:
m = ldb.Message()
m.dn = ldb.Dn(idmapdb, msg[0]['dn'])
except ldb.LdbError, e:
logger.warn('Could not modify idmap entry for sid=%s, id=%s, type=%s (%s)',
str(sid), str(xid), xid_type, str(e))
- except Exception, e:
- raise e
else:
try:
idmapdb.add({"dn": "CN=%s" % str(sid),
found = False
else:
raise ldb.LdbError(ecode, emsg)
- except Exception, e:
- raise e
if found:
logger.warn('Group already exists sid=%s, groupname=%s existing_groupname=%s, Ignoring.',
samdb.modify(m)
except ldb.LdbError, e:
logger.warn("Could not add member to group '%s'", groupmap.nt_name)
- except Exception, e:
- raise(e)
def import_wins(samba4_winsdb, samba3_winsdb):
# Get domain sid
try:
domainsid = passdb.get_global_sam_sid()
- except:
+ except passdb.error:
raise Exception("Can't find domain sid for '%s', Exiting." % domainname)
# Get machine account, sid, rid