History log of /openbsd-current/usr.bin/ssh/log.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.62 27-Jun-2024 djm

retire unused API


Revision tags: OPENBSD_7_5_BASE
# 1.61 06-Dec-2023 djm

short circuit debug log processing early if we're not going to
log anything. From Kobe Housen


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.60 16-Sep-2021 djm

allow log_stderr==2 to prefix log messages with argv[0]

use this to make scp's SFTP mode error messages more scp-like

prompted by and ok deraadt@


# 1.59 07-May-2021 djm

include pid in LogVerbose spam


Revision tags: OPENBSD_6_9_BASE
# 1.58 15-Apr-2021 markus

do not pass file/func to monitor; noted by Ilja van Sprundel; ok djm@


# 1.57 03-Apr-2021 djm

highly polished whitespace, mostly fixing spaces-for-tab and bad
indentation on continuation lines. Prompted by GHPR#185


# 1.56 04-Dec-2020 djm

make program name be const


# 1.55 18-Oct-2020 djm

variants of the log methods that append a ssherr.h string from
a supplied error code; ok markus@


# 1.54 17-Oct-2020 djm

make the log functions that exit (sshlogdie(), sshfatal(), etc) have
identical signatures. Makes things a bit more consistent...


# 1.53 16-Oct-2020 djm

revised log infrastructure for OpenSSH

log functions receive function, filename and line number of caller.
We can use this to selectively enable logging via pattern-lists.

ok markus@


Revision tags: OPENBSD_6_8_BASE
# 1.52 03-Jul-2020 djm

when redirecting sshd's log output to a file, undo this redirection
after the session child process is forked(); ok dtucker@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


# 1.61 06-Dec-2023 djm

short circuit debug log processing early if we're not going to
log anything. From Kobe Housen


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.60 16-Sep-2021 djm

allow log_stderr==2 to prefix log messages with argv[0]

use this to make scp's SFTP mode error messages more scp-like

prompted by and ok deraadt@


# 1.59 07-May-2021 djm

include pid in LogVerbose spam


Revision tags: OPENBSD_6_9_BASE
# 1.58 15-Apr-2021 markus

do not pass file/func to monitor; noted by Ilja van Sprundel; ok djm@


# 1.57 03-Apr-2021 djm

highly polished whitespace, mostly fixing spaces-for-tab and bad
indentation on continuation lines. Prompted by GHPR#185


# 1.56 04-Dec-2020 djm

make program name be const


# 1.55 18-Oct-2020 djm

variants of the log methods that append a ssherr.h string from
a supplied error code; ok markus@


# 1.54 17-Oct-2020 djm

make the log functions that exit (sshlogdie(), sshfatal(), etc) have
identical signatures. Makes things a bit more consistent...


# 1.53 16-Oct-2020 djm

revised log infrastructure for OpenSSH

log functions receive function, filename and line number of caller.
We can use this to selectively enable logging via pattern-lists.

ok markus@


Revision tags: OPENBSD_6_8_BASE
# 1.52 03-Jul-2020 djm

when redirecting sshd's log output to a file, undo this redirection
after the session child process is forked(); ok dtucker@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


# 1.60 16-Sep-2021 djm

allow log_stderr==2 to prefix log messages with argv[0]

use this to make scp's SFTP mode error messages more scp-like

prompted by and ok deraadt@


# 1.59 07-May-2021 djm

include pid in LogVerbose spam


Revision tags: OPENBSD_6_9_BASE
# 1.58 15-Apr-2021 markus

do not pass file/func to monitor; noted by Ilja van Sprundel; ok djm@


# 1.57 03-Apr-2021 djm

highly polished whitespace, mostly fixing spaces-for-tab and bad
indentation on continuation lines. Prompted by GHPR#185


# 1.56 04-Dec-2020 djm

make program name be const


# 1.55 18-Oct-2020 djm

variants of the log methods that append a ssherr.h string from
a supplied error code; ok markus@


# 1.54 17-Oct-2020 djm

make the log functions that exit (sshlogdie(), sshfatal(), etc) have
identical signatures. Makes things a bit more consistent...


# 1.53 16-Oct-2020 djm

revised log infrastructure for OpenSSH

log functions receive function, filename and line number of caller.
We can use this to selectively enable logging via pattern-lists.

ok markus@


Revision tags: OPENBSD_6_8_BASE
# 1.52 03-Jul-2020 djm

when redirecting sshd's log output to a file, undo this redirection
after the session child process is forked(); ok dtucker@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


# 1.59 07-May-2021 djm

include pid in LogVerbose spam


Revision tags: OPENBSD_6_9_BASE
# 1.58 15-Apr-2021 markus

do not pass file/func to monitor; noted by Ilja van Sprundel; ok djm@


# 1.57 03-Apr-2021 djm

highly polished whitespace, mostly fixing spaces-for-tab and bad
indentation on continuation lines. Prompted by GHPR#185


# 1.56 04-Dec-2020 djm

make program name be const


# 1.55 18-Oct-2020 djm

variants of the log methods that append a ssherr.h string from
a supplied error code; ok markus@


# 1.54 17-Oct-2020 djm

make the log functions that exit (sshlogdie(), sshfatal(), etc) have
identical signatures. Makes things a bit more consistent...


# 1.53 16-Oct-2020 djm

revised log infrastructure for OpenSSH

log functions receive function, filename and line number of caller.
We can use this to selectively enable logging via pattern-lists.

ok markus@


Revision tags: OPENBSD_6_8_BASE
# 1.52 03-Jul-2020 djm

when redirecting sshd's log output to a file, undo this redirection
after the session child process is forked(); ok dtucker@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


# 1.58 15-Apr-2021 markus

do not pass file/func to monitor; noted by Ilja van Sprundel; ok djm@


# 1.57 03-Apr-2021 djm

highly polished whitespace, mostly fixing spaces-for-tab and bad
indentation on continuation lines. Prompted by GHPR#185


# 1.56 04-Dec-2020 djm

make program name be const


# 1.55 18-Oct-2020 djm

variants of the log methods that append a ssherr.h string from
a supplied error code; ok markus@


# 1.54 17-Oct-2020 djm

make the log functions that exit (sshlogdie(), sshfatal(), etc) have
identical signatures. Makes things a bit more consistent...


# 1.53 16-Oct-2020 djm

revised log infrastructure for OpenSSH

log functions receive function, filename and line number of caller.
We can use this to selectively enable logging via pattern-lists.

ok markus@


Revision tags: OPENBSD_6_8_BASE
# 1.52 03-Jul-2020 djm

when redirecting sshd's log output to a file, undo this redirection
after the session child process is forked(); ok dtucker@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


# 1.57 03-Apr-2021 djm

highly polished whitespace, mostly fixing spaces-for-tab and bad
indentation on continuation lines. Prompted by GHPR#185


# 1.56 04-Dec-2020 djm

make program name be const


# 1.55 18-Oct-2020 djm

variants of the log methods that append a ssherr.h string from
a supplied error code; ok markus@


# 1.54 17-Oct-2020 djm

make the log functions that exit (sshlogdie(), sshfatal(), etc) have
identical signatures. Makes things a bit more consistent...


# 1.53 16-Oct-2020 djm

revised log infrastructure for OpenSSH

log functions receive function, filename and line number of caller.
We can use this to selectively enable logging via pattern-lists.

ok markus@


Revision tags: OPENBSD_6_8_BASE
# 1.52 03-Jul-2020 djm

when redirecting sshd's log output to a file, undo this redirection
after the session child process is forked(); ok dtucker@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


# 1.56 04-Dec-2020 djm

make program name be const


# 1.55 18-Oct-2020 djm

variants of the log methods that append a ssherr.h string from
a supplied error code; ok markus@


# 1.54 17-Oct-2020 djm

make the log functions that exit (sshlogdie(), sshfatal(), etc) have
identical signatures. Makes things a bit more consistent...


# 1.53 16-Oct-2020 djm

revised log infrastructure for OpenSSH

log functions receive function, filename and line number of caller.
We can use this to selectively enable logging via pattern-lists.

ok markus@


Revision tags: OPENBSD_6_8_BASE
# 1.52 03-Jul-2020 djm

when redirecting sshd's log output to a file, undo this redirection
after the session child process is forked(); ok dtucker@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


# 1.55 18-Oct-2020 djm

variants of the log methods that append a ssherr.h string from
a supplied error code; ok markus@


# 1.54 17-Oct-2020 djm

make the log functions that exit (sshlogdie(), sshfatal(), etc) have
identical signatures. Makes things a bit more consistent...


# 1.53 16-Oct-2020 djm

revised log infrastructure for OpenSSH

log functions receive function, filename and line number of caller.
We can use this to selectively enable logging via pattern-lists.

ok markus@


Revision tags: OPENBSD_6_8_BASE
# 1.52 03-Jul-2020 djm

when redirecting sshd's log output to a file, undo this redirection
after the session child process is forked(); ok dtucker@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


# 1.52 03-Jul-2020 djm

when redirecting sshd's log output to a file, undo this redirection
after the session child process is forked(); ok dtucker@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


# 1.51 27-Jul-2018 markus

avoid expensive channel_open_message() calls; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.


Revision tags: OPENBSD_6_2_BASE
# 1.50 17-May-2017 djm

allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717


Revision tags: OPENBSD_6_1_BASE
# 1.49 10-Mar-2017 djm

don't truncate off \r\n from long stderr lines; bz#2688, reported by
Brian Dyson; ok dtucker@


Revision tags: OPENBSD_6_0_BASE
# 1.48 15-Jul-2016 dtucker

Reduce the syslog level of some relatively common protocol events
from LOG_CRIT by replacing fatal() calls with logdie(). Part of
bz#2585, ok djm@


# 1.47 29-Apr-2016 djm

close ControlPersist background process stderr when not in
debug mode or when logging to a file or syslog.
bz#1988 ok dtucker


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.46 08-Jul-2015 markus

xmalloc.h is unused


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.45 16-May-2013 dtucker

Fix some "unused result" warnings found via clang and -portable. ok markus@


# 1.44 07-Apr-2013 dtucker

Add -E option to ssh and sshd to append debugging logs to a specified file
instead of stderr or syslog. ok markus@, man page help jmc@


Revision tags: OPENBSD_5_3_BASE
# 1.43 06-Sep-2012 dtucker

Add ~v and ~V escape sequences to raise and lower the logging level
respectively. Man page help from jmc, ok deraadt jmc


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.42 17-Jun-2011 djm

make the pre-auth privsep slave log via a socketpair shared with the
monitor rather than /var/empty/dev/log; ok dtucker@ deraadt@ markus@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.41 10-Jun-2008 dtucker

Add extended test mode (-T) and connection parameters for test mode (-C).
-T causes sshd to write its effective configuration to stdout and exit.
-C causes any relevant Match rules to be applied before output. The
combination allows tesing of the parser and config files. ok deraadt djm


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.40 17-May-2007 djm

save and restore errno when logging; ok deraadt@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.39 18-Aug-2006 deraadt

make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus


# 1.38 03-Aug-2006 deraadt

almost entirely get rid of the culture of ".h files that include .h files"
ok djm, sort of ok stevesk
makes the pain stop in one easy step


# 1.37 01-Aug-2006 stevesk

move #include <stdio.h> out of includes.h


# 1.36 26-Jul-2006 stevesk

move #include <stdlib.h> out of includes.h


# 1.35 22-Jul-2006 stevesk

move #include <string.h> out of includes.h


# 1.34 17-Jul-2006 stevesk

move #include <unistd.h> out of includes.h


# 1.33 10-Jul-2006 stevesk

move #include <stdarg.h> out of includes.h; ok markus@


# 1.32 08-Jul-2006 stevesk

move user includes after /usr/include files


# 1.31 25-Mar-2006 djm

Put $OpenBSD$ tags back (as comments) to replace the RCSID()s that
Theo nuked - our scripts to sync -portable need them in the files


# 1.30 19-Mar-2006 deraadt

RCSID() can die


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.29 23-Sep-2003 markus

branches: 1.29.8; 1.29.10;
replace fatal_cleanup() and linked list of fatal callbacks with static
cleanup_exit() function. re-refine cleanup_exit() where appropriate,
allocate sshd's authctxt eary to allow simpler cleanup in sshd.
tested by many, ok deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.28 24-May-2003 djm

branches: 1.28.2;
pass logged data through strnvis; ok markus


# 1.27 18-May-2003 deraadt

use syslog_r() in a signal handler called place; markus ok


# 1.26 08-Apr-2003 itojun

rename log() into logit() to avoid name conflict. markus ok, from netbsd


Revision tags: OPENBSD_3_3_BASE
# 1.25 11-Jan-2003 markus

branches: 1.25.2;
set fatal_cleanups to NULL in fatal_remove_all_cleanups(); dtucker@zip.com.au


Revision tags: OPENBSD_3_2_BASE
# 1.24 19-Jul-2002 markus

branches: 1.24.2;
remove fatal cleanups after fork; based on discussions with and code
from solar.


# 1.23 06-Jul-2002 deraadt

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.22 22-Feb-2002 markus

branches: 1.22.2;
overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@


# 1.21 04-Feb-2002 markus

add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@


# 1.20 17-Jan-2002 stevesk

casts to silence enum type warnings for bugzilla bug 37; ok markus@


# 1.19 19-Dec-2001 deraadt

basic KNF done while i was looking for something else


Revision tags: OPENBSD_3_0_BASE
# 1.18 26-Jun-2001 markus

branches: 1.18.2;
remove comments from .h, since they are cut&paste from the .c files
and out of sync


Revision tags: OPENBSD_2_9_BASE
# 1.17 04-Mar-2001 millert

branches: 1.17.2;
log functions should not be passed strings that end in newline as they
get passed on to syslog() and when logging to stderr, do_log() appends
its own newline.


# 1.16 03-Mar-2001 markus

log*.c -> log.c


# 1.15 21-Jan-2001 markus

split ssh.h and try to cleanup the #include mess. remove unnecessary #includes.
rename util.[ch] -> misc.[ch]


# 1.14 18-Jan-2001 markus

log() is at pri=LOG_INFO, since LOG_NOTICE goes to /dev/console on many systems


# 1.13 07-Jan-2001 markus

rename SYSLOG_LEVEL_INFO->SYSLOG_LEVEL_NOTICE
syslog priority changes:
fatal() LOG_ERR -> LOG_CRIT
log() LOG_INFO -> LOG_NOTICE


# 1.12 19-Dec-2000 markus

replace 'unsigned bla' with 'u_bla' everywhere. also, replace 'char unsigned'
with u_char.


Revision tags: OPENBSD_2_8_BASE
# 1.11 30-Sep-2000 markus

branches: 1.11.2;
allow loglevel debug


# 1.10 12-Sep-2000 markus

multiple debug levels


# 1.9 07-Sep-2000 markus

some more Copyright fixes


# 1.8 07-Sep-2000 deraadt

cleanup copyright notices on all files. I have attempted to be accurate with
the details. everything is now under Tatu's licence (which I copied from his
readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd
developers under a 2-term bsd licence. We're not changing any rules, just
being accurate.


Revision tags: OPENBSD_2_7_BASE
# 1.7 04-Jan-2000 markus

branches: 1.7.2;
ipv6 support: mostly gethostbyname->getaddrinfo/getnameinfo, new features:
sshd allows multiple ListenAddress and Port options. note that libwrap is
not IPv6-ready. (based on patches from <kick@kyoto.wide.ad.jp> and
fujiwara@rcac.tdi.co.jp)


# 1.6 24-Nov-1999 markus

KNF, final part 3


# 1.5 24-Nov-1999 deraadt

much more KNF


# 1.4 23-Nov-1999 markus

KNF part 1


# 1.3 22-Nov-1999 markus

syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE


# 1.2 19-Nov-1999 markus

bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.


# 1.1 10-Nov-1999 markus

add LogLevel {QUIET, FATAL, ERROR, INFO, CHAT, DEBUG} to ssh/sshd,
obsoletes QuietMode and FascistLogging in sshd.