freebsd-skq/lib/libjail
kevans 3758ef9ee4 jail_getid(3): validate jid string input
Currently, if jail_getid(3) is passed in a numeric string, it assumes that
this is a jid string and passes it back converted to an int without checking
that it's a valid/existing jid. This breaks consumers that might use
jail_getid(3) to see if it can trivially grab a jid from a name if that name
happens to be numeric but not actually the name/jid of the jail. Instead of
returning -1 for the jail not existing, it'll return the int version of the
input and the consumer will not fallback to trying other methods.

Pass the numeric input to jail_get(2) as the jid for validation, rather than
the name. This works well- the kernel enforces that jid=name if name is
numeric, so doing the safe thing and checking numeric input as a jid will
still DTRT based on the description of jail_getid.

Reported by:	Wes Maag
Reviewed by:	jamie, Wes Maag
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D20388
2019-05-24 01:28:07 +00:00
..
jail_getid.c jail_getid(3): validate jid string input 2019-05-24 01:28:07 +00:00
jail.3
jail.c Rename fuse(4) to fusefs(4) 2019-03-20 21:48:43 +00:00
jail.h lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
Makefile
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00