[Freeipa-devel] [PATCH] 0015 Only split CSV strings once (updated)

Petr Viktorin pviktori at redhat.com
Mon Feb 27 13:01:55 UTC 2012


It seems I didn't communicate the problem and my solution clearly 
enough, so let me try again. (Also, I learned from the discussions!)

Currently, both the client and the server parse CSV options. The client 
does *not* re-encode the CSV before sending; the parsing is really done 
twice. This means e.g. that you need 3 backslashes to escape a literal 
comma: after the client-side split, '\\\,' becomes '\,'; which after the 
server-side split becomes ','.


Since CSV is specific to the command-line, and the client is responsible 
for translating command-line input to XML-RPC (which has its own syntax 
for lists), the ideal fix will be to move CSV processing entirely to the 
client.
This will be a rather invasive change, mainly because some parts of the 
UI now expect the server-side parsing (but they don't escape CSV, so 
values containing commas or backslashes are broken). So it won't make it 
to the upcoming release. My patch provides a quick fix: when a call 
comes from the command-line client, disable the server-side parsing.

I can't get away from moving split_csv() (which is not idempotent) out 
of normalize() (which is, and gets called lots of times); this is the 
patch's major change in therms of LOC.


I'll note again that this only affects values with backslashes or double 
quotes. Exactly these options are currently broken (=need double 
escaping). The "normal" uses of CSV are completely unaffected.


Attaching updated patch; the change vs. the original is that the "don't 
parse again" flag is now only set at the server, when a XMLRPC call is 
received, making the client fully forward-compatible (the flag doesn't 
get sent through the wire).


The ticket is https://fedorahosted.org/freeipa/ticket/2227, but this 
patch is only the first step in fixing it.

-- 
Petr³
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-pviktori-0015-02-Only-split-CSV-strings-once.patch
Type: text/x-patch
Size: 9356 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120227/beaf278a/attachment.bin>


More information about the Freeipa-devel mailing list