nm-l2tp / NetworkManager-l2tp

L2TP and L2TP/IPsec support for NetworkManager
GNU General Public License v2.0
489 stars 84 forks source link

User name with space #218

Closed PaliPalo closed 9 months ago

PaliPalo commented 9 months ago

Hello,

VPN Connection failed when the username contains a space within. The solution should be to enclose the username between double quotes (e.g. "user name") as stated in pppd man page:

An options file is parsed into a series of words, delimited by whitespace. Whitespace can be included in a word by enclosing the word in double-quotes ("). A backslash () quotes the following character. A hash (#) starts a comment, which continues until the end of the line. There is no restriction on using the file or call options within an options file.

The source code line should be changed as write_config_option(fd, "user \"%s\"\n", value);

https://github.com/nm-l2tp/NetworkManager-l2tp/blob/fdf5d98e86c5f0a97f9649fa3e23b3c001a93340/src/nm-l2tp-service.c#L1328

I tried this modification with a personal version from this repository and succeed to connect with a such username.

Thanks for your work !

dkosovic commented 9 months ago

Thanks for the bug report and suggested fix.

I might also look into using nm_utils_str_utf8safe_escape() from NetworkManager's libnma to backslash escape the username as some other VPN clients are also using nm_utils_str_utf8safe_escape().