summaryrefslogtreecommitdiff
path: root/python/samba/gp_parse/gp_csv.py
AgeCommit message (Collapse)AuthorFilesLines
2020-08-11python compat: remove text_typeDouglas Bagnall1-3/+2
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2020-08-11python compat: reduce use of 'if PY3:'Douglas Bagnall1-1/+0
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2019-03-12py3: io.open takes a numeric buffering argument at index 2Garming Sam1-1/+1
It's unsure why this doesn't fail generically, but it fails on my machine sometimes... Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-11-05python/samba/gp_parse: PY2/PY3 Decode only when necessaryNoel Power1-3/+6
In python2 we decode str types in load_xml, in python3 these are str class(s) which we cannot decode. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-11-05python/samab/gp_parse: remove unused codeNoel Power1-68/+0
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-11-05python/samba/gp_parse: Use csv.reader for parsing cvs filesNoel Power1-3/+2
The previous version here was using UnicodeReader which was wrapping the UTF8Recoder class and passing that to csv.reader. It looks like the intention was to read a bytestream in a certain encoding and then reencode it to a different encoding. And then UnicodeReader creates unicode from the newly encoded stream. This is unnecssary, we know the encoding of the bytesstream and codec.getreader will happily consume the bytstream and give back unicode. The unicode can be fed directly into csv.writer. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-11-05python/samba/gp_parse: PY3 open file non-binary mode for write_binaryNoel Power1-6/+4
Although this is unintuitive it's because we are writing unicode not bytes (both in PY2 & PY3). using the 'b' mode causes an error in PY3. In PY3 we can define the encoding, but not in PY2. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-11-05python/samba/gp_parse: PY3 file -> openNoel Power1-2/+2
'file' no longer exists in PY3 replace with 'open' Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-16gp_csv: Add CSV generalization metadataGarming Sam1-1/+9
There are user identifiers and ACLs which may be stored in the audit CSV. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-08-16gp_csv: Parse the audit.csv file which records audit settingsGarming Sam1-0/+164
Based on the setting, the csv will omit certain fields. Using this we can later infer as to how to generalize the ACLs and SIDs. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>