Bug 218154

Summary: Cannot use [bcdef] characters at escape sequence of jail.conf(5)
Product: Base System Reporter: Masahiro Konishi <kakkoko>
Component: binAssignee: Jamie Gritton <jamie>
Status: Closed FIXED    
Severity: Affects Some People CC: jamie, kevans
Priority: --- Keywords: patch
Version: 11.0-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch to usr.sbin/jail/jaillex.l
none
patch to usr.sbin/jail/jaillex.l none

Description Masahiro Konishi 2017-03-27 03:01:31 UTC
Created attachment 181220 [details]
patch to usr.sbin/jail/jaillex.l

jail.conf(5) accepts escape sequence like "foo\x2Dbar" but you cannot use [bcdef] characters in it.

It's easy to understand at usr.sbin/jail/jaillex.l:

if (s[1] >= '0' && s[1] <= '9')
	*d = *++s - '0';
else if (s[1] >= 'A' && s[1] <= 'F')
	*d = *++s + (0xA - 'A');
else if (s[1] >= 'a' && s[1] <= 'a')
                                ~~~  oops...
	*d = *++s + (0xa - 'a');
Comment 1 Masahiro Konishi 2017-03-27 03:08:38 UTC
Created attachment 181221 [details]
patch to usr.sbin/jail/jaillex.l
Comment 2 Jamie Gritton freebsd_committer freebsd_triage 2017-03-27 13:27:51 UTC
I don't think this one needs a lot of discussion :-).  I'll close it as soon as the MFCs are in.
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-03-27 13:28:33 UTC
A commit references this bug:

Author: jamie
Date: Mon Mar 27 13:27:39 UTC 2017
New revision: 316022
URL: https://svnweb.freebsd.org/changeset/base/316022

Log:
  Fix hexadecimal escape codes in jail.conf(5).

  PR:		218154
  Submitted by:	Masahiro Konishi <mkonishi@sea.plala.or.jp>
  MFC after:	3 days

Changes:
  head/usr.sbin/jail/jaillex.l
Comment 4 Kyle Evans freebsd_committer freebsd_triage 2017-03-27 13:32:10 UTC
(In reply to commit-hook from comment #3)

Hi,

I believe https://svnweb.freebsd.org/base/head/usr.sbin/jail/jaillex.l?view=markup&pathrev=316022#l219 should have had 'f' instead of 'F'?
Comment 5 Jamie Gritton freebsd_committer freebsd_triage 2017-03-27 13:38:06 UTC
Indeed it should - I was too quick to put it in.
Comment 6 Kyle Evans freebsd_committer freebsd_triage 2017-03-27 13:38:53 UTC
(In reply to Jamie Gritton from comment #5)

=) Cheers!
Comment 7 commit-hook freebsd_committer freebsd_triage 2017-03-30 01:38:31 UTC
A commit references this bug:

Author: jamie
Date: Thu Mar 30 01:37:34 UTC 2017
New revision: 316192
URL: https://svnweb.freebsd.org/changeset/base/316192

Log:
  MFC r316022,r316023:

    Fix hexadecimal escape codes in jail.conf(5).

  PR:		218154
  Submitted by:	Masahiro Konishi <mkonishi@sea.plala.or.jp>

Changes:
_U  stable/11/
  stable/11/usr.sbin/jail/jaillex.l
Comment 8 commit-hook freebsd_committer freebsd_triage 2017-03-30 01:39:35 UTC
A commit references this bug:

Author: jamie
Date: Thu Mar 30 01:37:37 UTC 2017
New revision: 316193
URL: https://svnweb.freebsd.org/changeset/base/316193

Log:
  MFC r316022,r316023:

    Fix hexadecimal escape codes in jail.conf(5).

  PR:		218154
  Submitted by:	Masahiro Konishi <mkonishi@sea.plala.or.jp>

Changes:
_U  stable/10/
  stable/10/usr.sbin/jail/jaillex.l