History log of /openbsd-current/lib/libc/gen/authenticate.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.29 24-Oct-2021 deraadt

For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef.
ok millert


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.28 04-Dec-2019 deraadt

libc's authentication privsep layer performed insufficient username
validation. Repair work mostly by markus and millert, first of all
solving the primary problem, then adding some additional validation
points. And then futher validation in login and su.
This will be 6.5/021_libcauth.patch.sig and 6.6/010_libcauth.patch.sig
Reported by Qualys


Revision tags: OPENBSD_6_6_BASE
# 1.27 28-Jun-2019 deraadt

branches: 1.27.2;
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.26 26-May-2016 millert

branches: 1.26.12;
Use S_ISDIR instead of doing it by hand. No binary change.


Revision tags: OPENBSD_5_9_BASE
# 1.25 24-Nov-2015 millert

Use reentrant versions of getpw{nam,uid} and getgr{nam,gid} within
libc to avoid reusing the static buffers returned by the non-reentrant
versions. Since this is inside libc we can use constants for the
buffer sizes instead of having to call sysconf().
OK guenther@ deraadt@


# 1.24 14-Sep-2015 tedu

remove null check before free. from Michael McConville
ok semarie


# 1.23 12-Sep-2015 guenther

Wrap <bsd_auth.h> so that calls go direct and the symbols are all weak


# 1.22 31-Aug-2015 guenther

Add framework for resolving (pun intended) libc namespace issues, using
wrapper .h files and asm labels to let internal calls resolve directly and
not be overridable or use the PLT. Then, apply that framework to most of
the functions in stdio.h, string.h, err.h, and wchar.h. Delete the
should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here.

tests clean on i386, amd64, sparc64, powerpc, and mips64

naming feedback from kettenis@ and millert@
ok kettenis@


# 1.21 27-Aug-2015 dlg

use explicit_bzero to clear some memory that had creds in it instead of
memset.

ok deraadt@ millert@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.20 24-Nov-2013 deraadt

most obvious unsigned char casts for ctype
ok jca krw ingo


# 1.19 30-Sep-2013 millert

Use PATH_MAX, NAME_MAX and LOGIN_NAME_MAX not MAXPATHNAMELEN,
MAXNAMLEN or MAXLOGNAME where possible. OK deraadt@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.18 15-Jan-2009 millert

Remove support for kerb4 '.' instance separator, kerb4 is dead. OK jacekm@


Revision tags: OPENBSD_4_4_BASE
# 1.17 04-Apr-2008 millert

Zero out the password/response argument in the simplified BSD auth
interafces. Otherwise, we end up with an extra copy in memory when
auth_call() forks that is not possible to clear.


Revision tags: OPENBSD_4_3_BASE
# 1.16 17-Sep-2007 moritz

Check snprintf(3) return value for error or truncation.
Mostly path construction, where truncation could be bad.

ok and input from deraadt@ millert@ ray@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.15 19-Dec-2005 millert

Use strlcpy() return value in bound check instead of using an
extra strlen(). This has been in my tree for a long time.


Revision tags: OPENBSD_3_8_BASE
# 1.14 26-Jun-2005 millert

add missing va_end(); Andrey Matveev


Revision tags: OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.13 15-Oct-2002 millert

cast NULL varargs sentinel to char * so it is 64 bit on alpha & sparc64


Revision tags: OPENBSD_3_2_BASE
# 1.12 14-Jul-2002 deraadt

indent, and double free fix; millert ok


# 1.11 23-Jun-2002 deraadt

uid_t is unsigned


# 1.10 24-May-2002 deraadt

try to use strlcpy and snprintf more; ok various


Revision tags: OPENBSD_3_1_BASE
# 1.9 20-Mar-2002 mpech

fix memleak.

millert@ ok


# 1.8 13-Mar-2002 millert

Convert indentation whitespace -> tabs and kill $@%^#! ^M's


# 1.7 05-Feb-2002 mpech

o) Fix memory leak in _auth_checklogin(), auth_approval(), auth_close() and
auth_clean().

Spotted via ftpd. We could use ftpd as a simple debug tool for bsdauth and
login_cap routines. :)

millert@ help&OK


# 1.6 26-Oct-2001 markus

run the approve for accounts with expiration time, too. ok millert@


Revision tags: OPENBSD_3_0_BASE
# 1.5 09-Jul-2001 deraadt

a first pass at -Wall


# 1.4 02-Jul-2001 millert

Convert warn/warnx -> _warn/_warnx
Should not really spew to stderr from libc but right now there
is no other way to get a sensible error message to the user.


# 1.3 24-Jun-2001 millert

When splitting instance from username, treat '/' as a separator as
well (for Kerb5).


# 1.2 03-Jun-2001 millert

Don't bail out early for users w/o passwd file entries since we may
want to cons up a fake prompt for challenge/response auth methods.
markus@ OK'd.


Revision tags: OPENBSD_2_9_BASE
# 1.1 21-Nov-2000 millert

BSD authentication routines from BSDI. Presently this is not used but
the login_* helper programs and other support will be committed in the
near future.


# 1.28 04-Dec-2019 deraadt

libc's authentication privsep layer performed insufficient username
validation. Repair work mostly by markus and millert, first of all
solving the primary problem, then adding some additional validation
points. And then futher validation in login and su.
This will be 6.5/021_libcauth.patch.sig and 6.6/010_libcauth.patch.sig
Reported by Qualys


Revision tags: OPENBSD_6_6_BASE
# 1.27 28-Jun-2019 deraadt

branches: 1.27.2;
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.26 26-May-2016 millert

branches: 1.26.12;
Use S_ISDIR instead of doing it by hand. No binary change.


Revision tags: OPENBSD_5_9_BASE
# 1.25 24-Nov-2015 millert

Use reentrant versions of getpw{nam,uid} and getgr{nam,gid} within
libc to avoid reusing the static buffers returned by the non-reentrant
versions. Since this is inside libc we can use constants for the
buffer sizes instead of having to call sysconf().
OK guenther@ deraadt@


# 1.24 14-Sep-2015 tedu

remove null check before free. from Michael McConville
ok semarie


# 1.23 12-Sep-2015 guenther

Wrap <bsd_auth.h> so that calls go direct and the symbols are all weak


# 1.22 31-Aug-2015 guenther

Add framework for resolving (pun intended) libc namespace issues, using
wrapper .h files and asm labels to let internal calls resolve directly and
not be overridable or use the PLT. Then, apply that framework to most of
the functions in stdio.h, string.h, err.h, and wchar.h. Delete the
should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here.

tests clean on i386, amd64, sparc64, powerpc, and mips64

naming feedback from kettenis@ and millert@
ok kettenis@


# 1.21 27-Aug-2015 dlg

use explicit_bzero to clear some memory that had creds in it instead of
memset.

ok deraadt@ millert@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.20 24-Nov-2013 deraadt

most obvious unsigned char casts for ctype
ok jca krw ingo


# 1.19 30-Sep-2013 millert

Use PATH_MAX, NAME_MAX and LOGIN_NAME_MAX not MAXPATHNAMELEN,
MAXNAMLEN or MAXLOGNAME where possible. OK deraadt@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.18 15-Jan-2009 millert

Remove support for kerb4 '.' instance separator, kerb4 is dead. OK jacekm@


Revision tags: OPENBSD_4_4_BASE
# 1.17 04-Apr-2008 millert

Zero out the password/response argument in the simplified BSD auth
interafces. Otherwise, we end up with an extra copy in memory when
auth_call() forks that is not possible to clear.


Revision tags: OPENBSD_4_3_BASE
# 1.16 17-Sep-2007 moritz

Check snprintf(3) return value for error or truncation.
Mostly path construction, where truncation could be bad.

ok and input from deraadt@ millert@ ray@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.15 19-Dec-2005 millert

Use strlcpy() return value in bound check instead of using an
extra strlen(). This has been in my tree for a long time.


Revision tags: OPENBSD_3_8_BASE
# 1.14 26-Jun-2005 millert

add missing va_end(); Andrey Matveev


Revision tags: OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.13 15-Oct-2002 millert

cast NULL varargs sentinel to char * so it is 64 bit on alpha & sparc64


Revision tags: OPENBSD_3_2_BASE
# 1.12 14-Jul-2002 deraadt

indent, and double free fix; millert ok


# 1.11 23-Jun-2002 deraadt

uid_t is unsigned


# 1.10 24-May-2002 deraadt

try to use strlcpy and snprintf more; ok various


Revision tags: OPENBSD_3_1_BASE
# 1.9 20-Mar-2002 mpech

fix memleak.

millert@ ok


# 1.8 13-Mar-2002 millert

Convert indentation whitespace -> tabs and kill $@%^#! ^M's


# 1.7 05-Feb-2002 mpech

o) Fix memory leak in _auth_checklogin(), auth_approval(), auth_close() and
auth_clean().

Spotted via ftpd. We could use ftpd as a simple debug tool for bsdauth and
login_cap routines. :)

millert@ help&OK


# 1.6 26-Oct-2001 markus

run the approve for accounts with expiration time, too. ok millert@


Revision tags: OPENBSD_3_0_BASE
# 1.5 09-Jul-2001 deraadt

a first pass at -Wall


# 1.4 02-Jul-2001 millert

Convert warn/warnx -> _warn/_warnx
Should not really spew to stderr from libc but right now there
is no other way to get a sensible error message to the user.


# 1.3 24-Jun-2001 millert

When splitting instance from username, treat '/' as a separator as
well (for Kerb5).


# 1.2 03-Jun-2001 millert

Don't bail out early for users w/o passwd file entries since we may
want to cons up a fake prompt for challenge/response auth methods.
markus@ OK'd.


Revision tags: OPENBSD_2_9_BASE
# 1.1 21-Nov-2000 millert

BSD authentication routines from BSDI. Presently this is not used but
the login_* helper programs and other support will be committed in the
near future.


# 1.27 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.26 26-May-2016 millert

Use S_ISDIR instead of doing it by hand. No binary change.


Revision tags: OPENBSD_5_9_BASE
# 1.25 24-Nov-2015 millert

Use reentrant versions of getpw{nam,uid} and getgr{nam,gid} within
libc to avoid reusing the static buffers returned by the non-reentrant
versions. Since this is inside libc we can use constants for the
buffer sizes instead of having to call sysconf().
OK guenther@ deraadt@


# 1.24 14-Sep-2015 tedu

remove null check before free. from Michael McConville
ok semarie


# 1.23 12-Sep-2015 guenther

Wrap <bsd_auth.h> so that calls go direct and the symbols are all weak


# 1.22 31-Aug-2015 guenther

Add framework for resolving (pun intended) libc namespace issues, using
wrapper .h files and asm labels to let internal calls resolve directly and
not be overridable or use the PLT. Then, apply that framework to most of
the functions in stdio.h, string.h, err.h, and wchar.h. Delete the
should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here.

tests clean on i386, amd64, sparc64, powerpc, and mips64

naming feedback from kettenis@ and millert@
ok kettenis@


# 1.21 27-Aug-2015 dlg

use explicit_bzero to clear some memory that had creds in it instead of
memset.

ok deraadt@ millert@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.20 24-Nov-2013 deraadt

most obvious unsigned char casts for ctype
ok jca krw ingo


# 1.19 30-Sep-2013 millert

Use PATH_MAX, NAME_MAX and LOGIN_NAME_MAX not MAXPATHNAMELEN,
MAXNAMLEN or MAXLOGNAME where possible. OK deraadt@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.18 15-Jan-2009 millert

Remove support for kerb4 '.' instance separator, kerb4 is dead. OK jacekm@


Revision tags: OPENBSD_4_4_BASE
# 1.17 04-Apr-2008 millert

Zero out the password/response argument in the simplified BSD auth
interafces. Otherwise, we end up with an extra copy in memory when
auth_call() forks that is not possible to clear.


Revision tags: OPENBSD_4_3_BASE
# 1.16 17-Sep-2007 moritz

Check snprintf(3) return value for error or truncation.
Mostly path construction, where truncation could be bad.

ok and input from deraadt@ millert@ ray@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.15 19-Dec-2005 millert

Use strlcpy() return value in bound check instead of using an
extra strlen(). This has been in my tree for a long time.


Revision tags: OPENBSD_3_8_BASE
# 1.14 26-Jun-2005 millert

add missing va_end(); Andrey Matveev


Revision tags: OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.13 15-Oct-2002 millert

cast NULL varargs sentinel to char * so it is 64 bit on alpha & sparc64


Revision tags: OPENBSD_3_2_BASE
# 1.12 14-Jul-2002 deraadt

indent, and double free fix; millert ok


# 1.11 23-Jun-2002 deraadt

uid_t is unsigned


# 1.10 24-May-2002 deraadt

try to use strlcpy and snprintf more; ok various


Revision tags: OPENBSD_3_1_BASE
# 1.9 20-Mar-2002 mpech

fix memleak.

millert@ ok


# 1.8 13-Mar-2002 millert

Convert indentation whitespace -> tabs and kill $@%^#! ^M's


# 1.7 05-Feb-2002 mpech

o) Fix memory leak in _auth_checklogin(), auth_approval(), auth_close() and
auth_clean().

Spotted via ftpd. We could use ftpd as a simple debug tool for bsdauth and
login_cap routines. :)

millert@ help&OK


# 1.6 26-Oct-2001 markus

run the approve for accounts with expiration time, too. ok millert@


Revision tags: OPENBSD_3_0_BASE
# 1.5 09-Jul-2001 deraadt

a first pass at -Wall


# 1.4 02-Jul-2001 millert

Convert warn/warnx -> _warn/_warnx
Should not really spew to stderr from libc but right now there
is no other way to get a sensible error message to the user.


# 1.3 24-Jun-2001 millert

When splitting instance from username, treat '/' as a separator as
well (for Kerb5).


# 1.2 03-Jun-2001 millert

Don't bail out early for users w/o passwd file entries since we may
want to cons up a fake prompt for challenge/response auth methods.
markus@ OK'd.


Revision tags: OPENBSD_2_9_BASE
# 1.1 21-Nov-2000 millert

BSD authentication routines from BSDI. Presently this is not used but
the login_* helper programs and other support will be committed in the
near future.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.26 26-May-2016 millert

Use S_ISDIR instead of doing it by hand. No binary change.


Revision tags: OPENBSD_5_9_BASE
# 1.25 24-Nov-2015 millert

Use reentrant versions of getpw{nam,uid} and getgr{nam,gid} within
libc to avoid reusing the static buffers returned by the non-reentrant
versions. Since this is inside libc we can use constants for the
buffer sizes instead of having to call sysconf().
OK guenther@ deraadt@


# 1.24 14-Sep-2015 tedu

remove null check before free. from Michael McConville
ok semarie


# 1.23 12-Sep-2015 guenther

Wrap <bsd_auth.h> so that calls go direct and the symbols are all weak


# 1.22 31-Aug-2015 guenther

Add framework for resolving (pun intended) libc namespace issues, using
wrapper .h files and asm labels to let internal calls resolve directly and
not be overridable or use the PLT. Then, apply that framework to most of
the functions in stdio.h, string.h, err.h, and wchar.h. Delete the
should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here.

tests clean on i386, amd64, sparc64, powerpc, and mips64

naming feedback from kettenis@ and millert@
ok kettenis@


# 1.21 27-Aug-2015 dlg

use explicit_bzero to clear some memory that had creds in it instead of
memset.

ok deraadt@ millert@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.20 24-Nov-2013 deraadt

most obvious unsigned char casts for ctype
ok jca krw ingo


# 1.19 30-Sep-2013 millert

Use PATH_MAX, NAME_MAX and LOGIN_NAME_MAX not MAXPATHNAMELEN,
MAXNAMLEN or MAXLOGNAME where possible. OK deraadt@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.18 15-Jan-2009 millert

Remove support for kerb4 '.' instance separator, kerb4 is dead. OK jacekm@


Revision tags: OPENBSD_4_4_BASE
# 1.17 04-Apr-2008 millert

Zero out the password/response argument in the simplified BSD auth
interafces. Otherwise, we end up with an extra copy in memory when
auth_call() forks that is not possible to clear.


Revision tags: OPENBSD_4_3_BASE
# 1.16 17-Sep-2007 moritz

Check snprintf(3) return value for error or truncation.
Mostly path construction, where truncation could be bad.

ok and input from deraadt@ millert@ ray@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.15 19-Dec-2005 millert

Use strlcpy() return value in bound check instead of using an
extra strlen(). This has been in my tree for a long time.


Revision tags: OPENBSD_3_8_BASE
# 1.14 26-Jun-2005 millert

add missing va_end(); Andrey Matveev


Revision tags: OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.13 15-Oct-2002 millert

cast NULL varargs sentinel to char * so it is 64 bit on alpha & sparc64


Revision tags: OPENBSD_3_2_BASE
# 1.12 14-Jul-2002 deraadt

indent, and double free fix; millert ok


# 1.11 23-Jun-2002 deraadt

uid_t is unsigned


# 1.10 24-May-2002 deraadt

try to use strlcpy and snprintf more; ok various


Revision tags: OPENBSD_3_1_BASE
# 1.9 20-Mar-2002 mpech

fix memleak.

millert@ ok


# 1.8 13-Mar-2002 millert

Convert indentation whitespace -> tabs and kill $@%^#! ^M's


# 1.7 05-Feb-2002 mpech

o) Fix memory leak in _auth_checklogin(), auth_approval(), auth_close() and
auth_clean().

Spotted via ftpd. We could use ftpd as a simple debug tool for bsdauth and
login_cap routines. :)

millert@ help&OK


# 1.6 26-Oct-2001 markus

run the approve for accounts with expiration time, too. ok millert@


Revision tags: OPENBSD_3_0_BASE
# 1.5 09-Jul-2001 deraadt

a first pass at -Wall


# 1.4 02-Jul-2001 millert

Convert warn/warnx -> _warn/_warnx
Should not really spew to stderr from libc but right now there
is no other way to get a sensible error message to the user.


# 1.3 24-Jun-2001 millert

When splitting instance from username, treat '/' as a separator as
well (for Kerb5).


# 1.2 03-Jun-2001 millert

Don't bail out early for users w/o passwd file entries since we may
want to cons up a fake prompt for challenge/response auth methods.
markus@ OK'd.


Revision tags: OPENBSD_2_9_BASE
# 1.1 21-Nov-2000 millert

BSD authentication routines from BSDI. Presently this is not used but
the login_* helper programs and other support will be committed in the
near future.