diff --git a/ldap2smb.py b/ldap2smb.py index 49c60c3..9090de4 100644 --- a/ldap2smb.py +++ b/ldap2smb.py @@ -18,7 +18,6 @@ creds.set_password('Jps55Sk8An9y2nVL') samdb = SamDB(url='/var/lib/samba/private/sam.ldb', session_info=system_session(),credentials=creds, lp=lp) data_file="user.json" -attributes_list = [] with open(data_file, "r") as file: ldap_users = json.load(file) @@ -36,7 +35,17 @@ with open(data_file, "r") as file: smb_uid_number = ldap_users["params"]["attributes"]["uidNumber"] smb_gid_number = ldap_users["params"]["attributes"]["gidNumber"] - samdb.newuser(username=smb_username,password=smb_passwd,givenname=smb_givenname,surname=smb_surname,homedirectory=smb_homedir,mailaddress=smb_mail,uidnumber=smb_uid_number,gidnumber=smb_gid_number,useusernameascn=True) + samdb.newuser( + username=smb_username, + password=smb_passwd, + givenname=smb_givenname, + surname=smb_surname, + homedirectory=smb_homedir, + mailaddress=smb_mail, + uidnumber=smb_uid_number, + gidnumber=smb_gid_number, + useusernameascn=True + ) query = "(objectclass=user)" result = samdb.search('DC=nantes,DC=omero-fbi,DC=fr', expression=query, scope=ldb.SCOPE_SUBTREE)