On 12/18/25 14:42, Daniel P. Berrangé wrote:
> On Thu, Dec 18, 2025 at 02:20:28PM +0100, Michal Prívozník via Devel wrote:
>> On 12/18/25 13:35, Ján Tomko wrote:
>>> On a Tuesday in 2025, Michal Privoznik via Devel wrote:
>>>> From: Michal Privoznik <[email protected]>
>>>>
>>>> According to [1] there are only few characters allowed in the
>>>> path to the daemon socket (alphanum and some punctuation;
>>>> notably, space is missing on the list). The rest must be escaped
>>>> by '%NN' notation. Fortunately, g_uri_escape_string() with some
>>>> carefully selected input values is able to escape the path.
>>>
>>>> Almost - it considers tilde valid but DBus doesn't. Well, let's
>>>> hope nobody has tilde in domain name.
>>>
>>> https://www.rfc-editor.org/rfc/rfc3986.html#appendix-A
>>> Well, g_uri_escape_string does what it says:
>>>    unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
>>>
>>> Whether dbus is wrong or not, libvirt should escape the tilde too.
>>
>> Okay, I'll try to fix that in v2. But honestly, I think this is so
>> narrow corner case that it feels almost useless work.
> 
> IIUC,  systemd's naming rules were designed to match the dbus naming
> rules, since systemd units are exposed over dbus.
> 
> We already have virSystemdEscapeName that escapes everything that is
> NOT a-z, A-Z, 0-9, :, -, _, ., \   which seems like what we need here
> too.
> 
> Rename virSystemdEscapeName to virDBusEscapeName and use it everywhere ?

The former escapes using \xNN (which could be changed by passing an
argument), but what is worse, it escapes forward slash and a dot if it's
at the beginning. But I think I have implementation that matches DBus.

Michal

Reply via email to