[Bug 236204] Cannot use comma in setenv in login.conf

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Jun 16 08:43:10 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236204

Michael Osipov <michael.osipov at siemens.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|12.0-STABLE                 |12.1-STABLE

--- Comment #3 from Michael Osipov <michael.osipov at siemens.com> ---
I think I have traced down the cause: cap_mkdb uses cgetnext() whose manpage
says:
>      String capability values may contain any character.  Non-printable ASCII
>      codes, new lines, and colons may be conveniently represented by the use
>      of escape sequences:
> 
>      ^X        ('X' & 037)          control-X
>      \b, \B    (ASCII 010)          backspace
>      \t, \T    (ASCII 011)          tab
>      \n, \N    (ASCII 012)          line feed (newline)
>      \f, \F    (ASCII 014)          form feed
>      \r, \R    (ASCII 015)          carriage return
>      \e, \E    (ASCII 027)          escape
>      \c, \C    (:)                  colon
>      \\        (\)                  back slash
>      \^        (^)                  caret
>      \nnn      (ASCII octal nnn)

While I have tried to do \054, it is still not working because the setenv magic
is performed with login_getcaplist() in
> ./lib/libutil/login_class.c:    const char      **set_env = login_getcaplist(lc, "setenv", ",");

So also the \054 is converted to comma, the subsequent call adds its own
sematics to split the setenv capability with comma. So it would require
something like \O which is used in login_class only and
 if ((np = substvar(p, pwd, hlen, pch, nlen)) != NULL) {
     setenv(*set_env, np, 1);
     free(np);
 }

and np needs to be processed for \O to replace with a comma. If I understand
./lib/libc/gen/getcap.c correctly the blackslash is retained by "*mp++ =
*(bp-1)" if the escape char is unknown.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list