[clientloop.c progressmeter.c serverloop.c sshd.c]
     ARGSUSED for signal handlers
This commit is contained in:
Damien Miller 2006-03-26 13:59:20 +11:00
parent c91e556d8a
commit f0b15dfc52
5 changed files with 47 additions and 24 deletions

View File

@ -43,6 +43,9 @@
- deraadt@cvs.openbsd.org 2006/03/19 18:53:12 - deraadt@cvs.openbsd.org 2006/03/19 18:53:12
[kex.c kex.h monitor.c myproposal.h session.c] [kex.c kex.h monitor.c myproposal.h session.c]
spacing spacing
- deraadt@cvs.openbsd.org 2006/03/19 18:56:41
[clientloop.c progressmeter.c serverloop.c sshd.c]
ARGSUSED for signal handlers
20060325 20060325
- OpenBSD CVS Sync - OpenBSD CVS Sync
@ -4300,4 +4303,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4253 2006/03/26 02:58:55 djm Exp $ $Id: ChangeLog,v 1.4254 2006/03/26 02:59:20 djm Exp $

View File

@ -190,7 +190,7 @@ enter_non_blocking(void)
* Signal handler for the window change signal (SIGWINCH). This just sets a * Signal handler for the window change signal (SIGWINCH). This just sets a
* flag indicating that the window has changed. * flag indicating that the window has changed.
*/ */
/*ARGSUSED */
static void static void
window_change_handler(int sig) window_change_handler(int sig)
{ {
@ -202,7 +202,7 @@ window_change_handler(int sig)
* Signal handler for signals that cause the program to terminate. These * Signal handler for signals that cause the program to terminate. These
* signals must be trapped to restore terminal modes. * signals must be trapped to restore terminal modes.
*/ */
/*ARGSUSED */
static void static void
signal_handler(int sig) signal_handler(int sig)
{ {

View File

@ -272,6 +272,7 @@ stop_progress_meter(void)
atomicio(vwrite, STDOUT_FILENO, "\n", 1); atomicio(vwrite, STDOUT_FILENO, "\n", 1);
} }
/*ARGSUSED*/
static void static void
sig_winch(int sig) sig_winch(int sig)
{ {

View File

@ -147,6 +147,7 @@ notify_done(fd_set *readset)
debug2("notify_done: reading"); debug2("notify_done: reading");
} }
/*ARGSUSED*/
static void static void
sigchld_handler(int sig) sigchld_handler(int sig)
{ {
@ -159,6 +160,7 @@ sigchld_handler(int sig)
errno = save_errno; errno = save_errno;
} }
/*ARGSUSED*/
static void static void
sigterm_handler(int sig) sigterm_handler(int sig)
{ {
@ -942,7 +944,7 @@ server_request_tun(void)
tun = packet_get_int(); tun = packet_get_int();
if (forced_tun_device != -1) { if (forced_tun_device != -1) {
if (tun != SSH_TUNID_ANY && forced_tun_device != tun) if (tun != SSH_TUNID_ANY && forced_tun_device != tun)
goto done; goto done;
tun = forced_tun_device; tun = forced_tun_device;
} }

57
sshd.c
View File

@ -257,6 +257,8 @@ close_startup_pipes(void)
* the effect is to reread the configuration file (and to regenerate * the effect is to reread the configuration file (and to regenerate
* the server key). * the server key).
*/ */
/*ARGSUSED*/
static void static void
sighup_handler(int sig) sighup_handler(int sig)
{ {
@ -271,6 +273,7 @@ sighup_handler(int sig)
* Called from the main program after receiving SIGHUP. * Called from the main program after receiving SIGHUP.
* Restarts the server. * Restarts the server.
*/ */
/*ARGSUSED*/
static void static void
sighup_restart(void) sighup_restart(void)
{ {
@ -286,6 +289,7 @@ sighup_restart(void)
/* /*
* Generic signal handler for terminating signals in the master daemon. * Generic signal handler for terminating signals in the master daemon.
*/ */
/*ARGSUSED*/
static void static void
sigterm_handler(int sig) sigterm_handler(int sig)
{ {
@ -296,6 +300,7 @@ sigterm_handler(int sig)
* SIGCHLD handler. This is called whenever a child dies. This will then * SIGCHLD handler. This is called whenever a child dies. This will then
* reap any zombies left by exited children. * reap any zombies left by exited children.
*/ */
/*ARGSUSED*/
static void static void
main_sigchld_handler(int sig) main_sigchld_handler(int sig)
{ {
@ -314,6 +319,7 @@ main_sigchld_handler(int sig)
/* /*
* Signal handler for the alarm after the login grace period has expired. * Signal handler for the alarm after the login grace period has expired.
*/ */
/*ARGSUSED*/
static void static void
grace_alarm_handler(int sig) grace_alarm_handler(int sig)
{ {
@ -356,6 +362,7 @@ generate_ephemeral_server_key(void)
arc4random_stir(); arc4random_stir();
} }
/*ARGSUSED*/
static void static void
key_regeneration_alarm(int sig) key_regeneration_alarm(int sig)
{ {
@ -976,7 +983,8 @@ main(int ac, char **av)
options.log_level = SYSLOG_LEVEL_QUIET; options.log_level = SYSLOG_LEVEL_QUIET;
break; break;
case 'b': case 'b':
options.server_key_bits = atoi(optarg); options.server_key_bits = (int)strtonum(optarg, 256,
32768, NULL);
break; break;
case 'p': case 'p':
options.ports_from_cmdline = 1; options.ports_from_cmdline = 1;
@ -1013,7 +1021,7 @@ main(int ac, char **av)
test_flag = 1; test_flag = 1;
break; break;
case 'u': case 'u':
utmp_len = atoi(optarg); utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL);
if (utmp_len > MAXHOSTNAMELEN) { if (utmp_len > MAXHOSTNAMELEN) {
fprintf(stderr, "Invalid utmp length.\n"); fprintf(stderr, "Invalid utmp length.\n");
exit(1); exit(1);
@ -1169,10 +1177,9 @@ main(int ac, char **av)
} }
if (use_privsep) { if (use_privsep) {
struct passwd *pw;
struct stat st; struct stat st;
if ((pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) if (getpwnam(SSH_PRIVSEP_USER) == NULL)
fatal("Privilege separation user %s does not exist", fatal("Privilege separation user %s does not exist",
SSH_PRIVSEP_USER); SSH_PRIVSEP_USER);
if ((stat(_PATH_PRIVSEP_CHROOT_DIR, &st) == -1) || if ((stat(_PATH_PRIVSEP_CHROOT_DIR, &st) == -1) ||
@ -1444,8 +1451,8 @@ main(int ac, char **av)
if (!FD_ISSET(listen_socks[i], fdset)) if (!FD_ISSET(listen_socks[i], fdset))
continue; continue;
fromlen = sizeof(from); fromlen = sizeof(from);
newsock = accept(listen_socks[i], (struct sockaddr *)&from, newsock = accept(listen_socks[i],
&fromlen); (struct sockaddr *)&from, &fromlen);
if (newsock < 0) { if (newsock < 0) {
if (errno != EINTR && errno != EWOULDBLOCK) if (errno != EINTR && errno != EWOULDBLOCK)
error("accept: %.100s", strerror(errno)); error("accept: %.100s", strerror(errno));
@ -1516,10 +1523,11 @@ main(int ac, char **av)
*/ */
if ((pid = fork()) == 0) { if ((pid = fork()) == 0) {
/* /*
* Child. Close the listening and max_startup * Child. Close the listening and
* sockets. Start using the accepted socket. * max_startup sockets. Start using
* Reinitialize logging (since our pid has * the accepted socket. Reinitialize
* changed). We break out of the loop to handle * logging (since our pid has changed).
* We break out of the loop to handle
* the connection. * the connection.
*/ */
startup_pipe = startup_p[1]; startup_pipe = startup_p[1];
@ -1527,7 +1535,10 @@ main(int ac, char **av)
close_listen_socks(); close_listen_socks();
sock_in = newsock; sock_in = newsock;
sock_out = newsock; sock_out = newsock;
log_init(__progname, options.log_level, options.log_facility, log_stderr); log_init(__progname,
options.log_level,
options.log_facility,
log_stderr);
if (rexec_flag) if (rexec_flag)
close(config_s[0]); close(config_s[0]);
break; break;
@ -1548,7 +1559,10 @@ main(int ac, char **av)
close(config_s[1]); close(config_s[1]);
} }
/* Mark that the key has been used (it was "given" to the child). */ /*
* Mark that the key has been used (it
* was "given" to the child).
*/
if ((options.protocol & SSH_PROTO_1) && if ((options.protocol & SSH_PROTO_1) &&
key_used == 0) { key_used == 0) {
/* Schedule server key regeneration alarm. */ /* Schedule server key regeneration alarm. */
@ -1558,8 +1572,6 @@ main(int ac, char **av)
} }
arc4random_stir(); arc4random_stir();
/* Close the new socket (the child is now taking care of it). */
close(newsock); close(newsock);
} }
/* child process check (or debug mode) */ /* child process check (or debug mode) */
@ -1794,11 +1806,14 @@ ssh1_session_key(BIGNUM *session_key_int)
{ {
int rsafail = 0; int rsafail = 0;
if (BN_cmp(sensitive_data.server_key->rsa->n, sensitive_data.ssh1_host_key->rsa->n) > 0) { if (BN_cmp(sensitive_data.server_key->rsa->n,
sensitive_data.ssh1_host_key->rsa->n) > 0) {
/* Server key has bigger modulus. */ /* Server key has bigger modulus. */
if (BN_num_bits(sensitive_data.server_key->rsa->n) < if (BN_num_bits(sensitive_data.server_key->rsa->n) <
BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) + SSH_KEY_BITS_RESERVED) { BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) +
fatal("do_connection: %s: server_key %d < host_key %d + SSH_KEY_BITS_RESERVED %d", SSH_KEY_BITS_RESERVED) {
fatal("do_connection: %s: "
"server_key %d < host_key %d + SSH_KEY_BITS_RESERVED %d",
get_remote_ipaddr(), get_remote_ipaddr(),
BN_num_bits(sensitive_data.server_key->rsa->n), BN_num_bits(sensitive_data.server_key->rsa->n),
BN_num_bits(sensitive_data.ssh1_host_key->rsa->n), BN_num_bits(sensitive_data.ssh1_host_key->rsa->n),
@ -1813,8 +1828,10 @@ ssh1_session_key(BIGNUM *session_key_int)
} else { } else {
/* Host key has bigger modulus (or they are equal). */ /* Host key has bigger modulus (or they are equal). */
if (BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) < if (BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) <
BN_num_bits(sensitive_data.server_key->rsa->n) + SSH_KEY_BITS_RESERVED) { BN_num_bits(sensitive_data.server_key->rsa->n) +
fatal("do_connection: %s: host_key %d < server_key %d + SSH_KEY_BITS_RESERVED %d", SSH_KEY_BITS_RESERVED) {
fatal("do_connection: %s: "
"host_key %d < server_key %d + SSH_KEY_BITS_RESERVED %d",
get_remote_ipaddr(), get_remote_ipaddr(),
BN_num_bits(sensitive_data.ssh1_host_key->rsa->n), BN_num_bits(sensitive_data.ssh1_host_key->rsa->n),
BN_num_bits(sensitive_data.server_key->rsa->n), BN_num_bits(sensitive_data.server_key->rsa->n),
@ -2035,7 +2052,7 @@ do_ssh2_kex(void)
myproposal[PROPOSAL_COMP_ALGS_CTOS] = myproposal[PROPOSAL_COMP_ALGS_CTOS] =
myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,zlib@openssh.com"; myproposal[PROPOSAL_COMP_ALGS_STOC] = "none,zlib@openssh.com";
} }
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = list_hostkey_types(); myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = list_hostkey_types();
/* start key exchange */ /* start key exchange */