Bug 13788 - bug in cmd line parsing in samba-tool dns add SRV/MX/SOA field
Summary: bug in cmd line parsing in samba-tool dns add SRV/MX/SOA field
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Python (show other bugs)
Version: 4.10.0rc2
Hardware: All All
: P5 normal (vote)
Target Milestone: 4.12
Assignee: Björn Jacke
QA Contact: Samba QA Contact
Depends on:
Reported: 2019-02-15 09:58 UTC by Denis Cardon
Modified: 2020-01-14 21:28 UTC (History)
1 user (show)

See Also:

patch fixing incorrect use of split(' ') (1.40 KB, patch)
2019-02-15 10:29 UTC, Denis Cardon
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Cardon 2019-02-15 09:58:44 UTC
netcmd/dns.py, line 420, 428, 438

the parsing of arguments is done as this:
 tmp = data.split(' ') 

This syntax does not allow to have two spaces between the different values, thus the following line fails with error "ERROR: Data requires 4 elements - server, port, priority, weight" (look at the two space characters between server name and port):

samba-tool dns add dc1 ad.test.fr _kerberos._tcp SRV "dc2.ad.test   88   0 100 "

The aforementioned line should be :
 tmp = data.split()

as this syntax allow one or more space between two arguments.
Comment 1 Denis Cardon 2019-02-15 10:29:35 UTC
Created attachment 14849 [details]
patch fixing incorrect use of split(' ')

bug is present in master and former release. patch applies (with offset 1) on 4.9.4.
Comment 2 Denis Cardon 2019-02-15 15:28:26 UTC
fix pushed to master https://lists.samba.org/archive/samba-technical/2019-February/132537.html
Comment 3 Douglas Bagnall 2019-02-24 05:56:39 UTC
thanks Denis!
Comment 4 Björn Jacke 2020-01-13 17:31:48 UTC
This bug was closed but neer made it to master due to a autobuild error with it. Autobuild was testing a DNS zone called "\n.COM" to be valid by our tests, this was causing this patch to fail. A DNS zone should obviously not start with a newline character though. I reomved that \n.COM test and added a test for multiple spaces instead and made a merge request: https://gitlab.com/samba-team/samba/merge_requests/1049
Comment 5 Björn Jacke 2020-01-14 21:28:26 UTC
fixed in master with af7a0e3371e1ae219239a91cb665097abbd50f3e