From: Noel Power Date: Fri, 23 Feb 2018 13:07:55 +0000 (+0000) Subject: samba python libs: convert 'O1234' format to python3 compatible '0o1234' X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=15c72e0dd80d37fa5f0af1e52f5f95b0712b6c51;p=metze%2Fsamba%2Fwip.git samba python libs: convert 'O1234' format to python3 compatible '0o1234' Signed-off-by: Noel Power Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index 558587c31247..ed49391aba50 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -1213,7 +1213,7 @@ def getpolicypath(sysvolpath, dnsdomain, guid): def create_gpo_struct(policy_path): if not os.path.exists(policy_path): - os.makedirs(policy_path, 0775) + os.makedirs(policy_path, 0o775) f = open(os.path.join(policy_path, "GPT.INI"), 'w') try: f.write("[General]\r\nVersion=0") @@ -1221,10 +1221,10 @@ def create_gpo_struct(policy_path): f.close() p = os.path.join(policy_path, "MACHINE") if not os.path.exists(p): - os.makedirs(p, 0775) + os.makedirs(p, 0o775) p = os.path.join(policy_path, "USER") if not os.path.exists(p): - os.makedirs(p, 0775) + os.makedirs(p, 0o775) def create_default_gpo(sysvolpath, dnsdomain, policyguid, policyguid_dc): @@ -1613,7 +1613,7 @@ def setsysvolacl(samdb, netlogon, sysvol, uid, gid, domainsid, dnsdomain, file = tempfile.NamedTemporaryFile(dir=os.path.abspath(sysvol)) try: try: - smbd.set_simple_acl(file.name, 0755, gid) + smbd.set_simple_acl(file.name, 0o755, gid) except OSError: if not smbd.have_posix_acls(): # This clue is only strictly correct for RPM and @@ -2160,7 +2160,7 @@ def provision(logger, session_info, smbconf=None, setup_encrypted_secrets_key(paths.encrypted_secrets_key_path) if paths.sysvol and not os.path.exists(paths.sysvol): - os.makedirs(paths.sysvol, 0775) + os.makedirs(paths.sysvol, 0o775) ldapi_url = "ldapi://%s" % urllib.quote(paths.s4_ldapi_path, safe="") @@ -2240,7 +2240,7 @@ def provision(logger, session_info, smbconf=None, raise MissingShareError("sysvol", paths.smbconf) if not os.path.isdir(paths.netlogon): - os.makedirs(paths.netlogon, 0755) + os.makedirs(paths.netlogon, 0o755) if adminpass is None: adminpass = samba.generate_random_password(12, 32) @@ -2312,7 +2312,7 @@ def provision(logger, session_info, smbconf=None, # chown the dns.keytab in the bind-dns directory if paths.bind_gid is not None: try: - os.chmod(paths.binddns_dir, 0770) + os.chmod(paths.binddns_dir, 0o770) os.chown(paths.binddns_dir, -1, paths.bind_gid) except OSError: if not os.environ.has_key('SAMBA_SELFTEST'): @@ -2320,7 +2320,7 @@ def provision(logger, session_info, smbconf=None, paths.binddns_dir, paths.bind_gid) try: - os.chmod(bind_dns_keytab_path, 0640) + os.chmod(bind_dns_keytab_path, 0o640) os.chown(bind_dns_keytab_path, -1, paths.bind_gid) except OSError: if not os.environ.has_key('SAMBA_SELFTEST'): diff --git a/python/samba/provision/backend.py b/python/samba/provision/backend.py index 2dbd4f786b10..278e69f649de 100644 --- a/python/samba/provision/backend.py +++ b/python/samba/provision/backend.py @@ -223,7 +223,7 @@ class LDAPBackend(ProvisionBackend): self.slapd_path) if not os.path.isdir(self.ldapdir): - os.makedirs(self.ldapdir, 0700) + os.makedirs(self.ldapdir, 0o700) # Put the LDIF of the schema into a database so we can search on # it to generate schema-dependent configurations in Fedora DS and @@ -259,7 +259,7 @@ class LDAPBackend(ProvisionBackend): finally: f.close() - os.chmod(ldap_backend_script, 0755) + os.chmod(ldap_backend_script, 0o755) # Now start the slapd, so we can provision onto it. We keep the # subprocess context around, to kill this off at the successful @@ -346,7 +346,7 @@ class OpenLDAPBackend(LDAPBackend): :param dbdir: Database directory. """ if not os.path.exists(dbdir): - os.makedirs(dbdir, 0700) + os.makedirs(dbdir, 0o700) def provision(self): from samba.provision import ProvisioningError, setup_path @@ -578,7 +578,7 @@ class OpenLDAPBackend(LDAPBackend): # Wipe the old sam.ldb databases away shutil.rmtree(self.olcdir, True) - os.makedirs(self.olcdir, 0770) + os.makedirs(self.olcdir, 0o770) # If we were just looking for crashes up to this point, it's a # good time to exit before we realise we don't have OpenLDAP on diff --git a/python/samba/provision/sambadns.py b/python/samba/provision/sambadns.py index 3a1df89096cb..4cc15b067006 100644 --- a/python/samba/provision/sambadns.py +++ b/python/samba/provision/sambadns.py @@ -694,13 +694,13 @@ def create_dns_dir(logger, paths): except OSError: pass - os.mkdir(dns_dir, 0770) + os.mkdir(dns_dir, 0o770) if paths.bind_gid is not None: try: os.chown(dns_dir, -1, paths.bind_gid) # chmod needed to cope with umask - os.chmod(dns_dir, 0770) + os.chmod(dns_dir, 0o770) except OSError: if not os.environ.has_key('SAMBA_SELFTEST'): logger.error("Failed to chown %s to bind gid %u" % ( @@ -767,7 +767,7 @@ def create_zone_file(lp, logger, paths, targetdir, dnsdomain, try: os.chown(paths.dns, -1, paths.bind_gid) # chmod needed to cope with umask - os.chmod(paths.dns, 0664) + os.chmod(paths.dns, 0o664) except OSError: if not os.environ.has_key('SAMBA_SELFTEST'): logger.error("Failed to chown %s to bind gid %u" % ( @@ -873,12 +873,12 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid): for d in dirs: dpath = os.path.join(dirname, d) os.chown(dpath, -1, paths.bind_gid) - os.chmod(dpath, 0770) + os.chmod(dpath, 0o770) for f in files: if f.endswith('.ldb') or f.endswith('.tdb'): fpath = os.path.join(dirname, f) os.chown(fpath, -1, paths.bind_gid) - os.chmod(fpath, 0660) + os.chmod(fpath, 0o660) except OSError: if not os.environ.has_key('SAMBA_SELFTEST'): logger.error(