[PATCH] provision: use ASCII quotes

Philipp Gesang philipp.gesang at intra2net.com
Tue Mar 12 14:57:36 UTC 2019


Hi,

provisioning on a C locale breaks for me on devel master / commit
a68e8af2d1, running under Python 3. Error output see the bottom
of the mail. The problem is that open(…).read() trips over the
Unicode quotes in the license blurb of extended-rights.ldif.

The attached patch removes those quotes.

I performed a test against the ldif files in the Samba source
tree and this is the only one affected. Interestingly, not all
Python versions are affected:

    - custom system, Python 3.3.2 → breaks,
    - Centos 7/1711, Python 3.6.6 from EPEL → breaks,
    - Fedora 29, Python 3.7.2 → no error.

In Python 3.7.2 I needed to force ASCII encoding on open() to
reproduce the issue which I assume is due to this recent change:
https://bugs.python.org/issue28180

Best regards,
Philipp

# LC_ALL=C /usr/bin/samba-tool domain provision \
    --server-role=dc \
    --dns-backend=SAMBA_INTERNAL \
    --realm="zombo.com" \
    --domain="ZOMBO" \
    </dev/null 
INFO 2019-03-12 14:59:30,733 pid:18715 /usr/lib64/python3.6/site-packages/samba/netcmd/domain.py #448: Administrator password will be set randomly!
INFO 2019-03-12 14:59:30,739 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #2079: Looking up IPv4 addresses
WARNING 2019-03-12 14:59:30,741 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #2089: No IPv4 address will be assigned
INFO 2019-03-12 14:59:30,741 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #2096: Looking up IPv6 addresses
WARNING 2019-03-12 14:59:30,743 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #2103: No IPv6 address will be assigned
INFO 2019-03-12 14:59:31,036 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #2273: Setting up secrets.ldb
INFO 2019-03-12 14:59:31,070 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #2279: Setting up the registry
INFO 2019-03-12 14:59:31,091 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #2282: Setting up the privileges database
INFO 2019-03-12 14:59:31,154 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #2285: Setting up idmap db
INFO 2019-03-12 14:59:31,195 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #2292: Setting up SAM db
INFO 2019-03-12 14:59:31,205 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #882: Setting up sam.ldb partitions and settings
INFO 2019-03-12 14:59:31,206 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #894: Setting up sam.ldb rootDSE
INFO 2019-03-12 14:59:31,213 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #1297: Pre-loading the Samba 4 and AD schema
Unable to determine the DomainSID, can not enforce uniqueness constraint on local domainSIDs

INFO 2019-03-12 14:59:31,237 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #1374: Adding DomainDN: DC=zombo,DC=com
INFO 2019-03-12 14:59:31,250 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #1406: Adding configuration container
INFO 2019-03-12 14:59:31,263 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #1415: Setting up sam.ldb schema
INFO 2019-03-12 14:59:32,264 pid:18715 /usr/lib64/python3.6/site-packages/samba/provision/__init__.py #1435: Setting up sam.ldb configuration data
ERROR(<class 'UnicodeDecodeError'>): uncaught exception - 'ascii' codec can't decode byte 0xe2 in position 513: ordinal not in range(128)
  File "/usr/lib64/python3.6/site-packages/samba/netcmd/__init__.py", line 184, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib64/python3.6/site-packages/samba/netcmd/domain.py", line 536, in run
    backend_store=backend_store)
  File "/usr/lib64/python3.6/site-packages/samba/provision/__init__.py", line 2331, in provision
    backend_store=backend_store)
  File "/usr/lib64/python3.6/site-packages/samba/provision/__init__.py", line 1919, in provision_fill
    backend_store=backend_store)
  File "/usr/lib64/python3.6/site-packages/samba/provision/__init__.py", line 1473, in fill_samdb
    "INC2012": incl_2012,
  File "/usr/lib64/python3.6/site-packages/samba/provision/common.py", line 54, in setup_add_ldif
    data = read_and_sub_file(ldif_path, subst_vars)
  File "/usr/lib64/python3.6/site-packages/samba/__init__.py", line 283, in read_and_sub_file
    data = open(file_name, 'r').read()
  File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]

-------------- next part --------------
From 659289c9ffa009acdfcc357a04060af204e40679 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <philipp.gesang at intra2net.com>
Date: Tue, 12 Mar 2019 15:51:16 +0100
Subject: [PATCH] provision: use ASCII quotes

Remove some Unicode quotes that cause problems under the C
locale.

Signed-off-by: Philipp Gesang <philipp.gesang at intra2net.com>
---
 source4/setup/extended-rights.ldif | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/setup/extended-rights.ldif b/source4/setup/extended-rights.ldif
index ef4c3049601..67417b7d020 100644
--- a/source4/setup/extended-rights.ldif
+++ b/source4/setup/extended-rights.ldif
@@ -11,7 +11,7 @@
 #
 
 # Technical Documentation. Microsoft publishes Open Specifications
-# documentation (“this documentation”) for protocols, file formats,
+# documentation ("this documentation") for protocols, file formats,
 # data portability, computer languages, and standards
 # support. Additionally, overview documents cover inter-protocol
 # relationships and interactions.
-- 
2.20.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20190312/2fb40294/signature.sig>


More information about the samba-technical mailing list