summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-03-26 13:59:20 +1100
committerDamien Miller <djm@mindrot.org>2006-03-26 13:59:20 +1100
commitf0b15dfc525227f06a1404231cca2171c62d1178 (patch)
tree84a50508a28e7f1815a497cfa97c088365eafd7f /sshd.c
parentc91e556d8a2cf97a5d7075154d39eb8fd4098fe4 (diff)
downloadopenssh-git-f0b15dfc525227f06a1404231cca2171c62d1178.tar.gz
- deraadt@cvs.openbsd.org 2006/03/19 18:56:41
[clientloop.c progressmeter.c serverloop.c sshd.c] ARGSUSED for signal handlers
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c57
1 files changed, 37 insertions, 20 deletions
diff --git a/sshd.c b/sshd.c
index e6b1f549..cfd38906 100644
--- a/sshd.c
+++ b/sshd.c
@@ -257,6 +257,8 @@ close_startup_pipes(void)
* the effect is to reread the configuration file (and to regenerate
* the server key).
*/
+
+/*ARGSUSED*/
static void
sighup_handler(int sig)
{
@@ -271,6 +273,7 @@ sighup_handler(int sig)
* Called from the main program after receiving SIGHUP.
* Restarts the server.
*/
+/*ARGSUSED*/
static void
sighup_restart(void)
{
@@ -286,6 +289,7 @@ sighup_restart(void)
/*
* Generic signal handler for terminating signals in the master daemon.
*/
+/*ARGSUSED*/
static void
sigterm_handler(int sig)
{
@@ -296,6 +300,7 @@ sigterm_handler(int sig)
* SIGCHLD handler. This is called whenever a child dies. This will then
* reap any zombies left by exited children.
*/
+/*ARGSUSED*/
static void
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.
*/
+/*ARGSUSED*/
static void
grace_alarm_handler(int sig)
{
@@ -356,6 +362,7 @@ generate_ephemeral_server_key(void)
arc4random_stir();
}
+/*ARGSUSED*/
static void
key_regeneration_alarm(int sig)
{
@@ -976,7 +983,8 @@ main(int ac, char **av)
options.log_level = SYSLOG_LEVEL_QUIET;
break;
case 'b':
- options.server_key_bits = atoi(optarg);
+ options.server_key_bits = (int)strtonum(optarg, 256,
+ 32768, NULL);
break;
case 'p':
options.ports_from_cmdline = 1;
@@ -1013,7 +1021,7 @@ main(int ac, char **av)
test_flag = 1;
break;
case 'u':
- utmp_len = atoi(optarg);
+ utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL);
if (utmp_len > MAXHOSTNAMELEN) {
fprintf(stderr, "Invalid utmp length.\n");
exit(1);
@@ -1169,10 +1177,9 @@ main(int ac, char **av)
}
if (use_privsep) {
- struct passwd *pw;
struct stat st;
- if ((pw = getpwnam(SSH_PRIVSEP_USER)) == NULL)
+ if (getpwnam(SSH_PRIVSEP_USER) == NULL)
fatal("Privilege separation user %s does not exist",
SSH_PRIVSEP_USER);
if ((stat(_PATH_PRIVSEP_CHROOT_DIR, &st) == -1) ||
@@ -1444,8 +1451,8 @@ main(int ac, char **av)
if (!FD_ISSET(listen_socks[i], fdset))
continue;
fromlen = sizeof(from);
- newsock = accept(listen_socks[i], (struct sockaddr *)&from,
- &fromlen);
+ newsock = accept(listen_socks[i],
+ (struct sockaddr *)&from, &fromlen);
if (newsock < 0) {
if (errno != EINTR && errno != EWOULDBLOCK)
error("accept: %.100s", strerror(errno));
@@ -1516,10 +1523,11 @@ main(int ac, char **av)
*/
if ((pid = fork()) == 0) {
/*
- * Child. Close the listening and max_startup
- * sockets. Start using the accepted socket.
- * Reinitialize logging (since our pid has
- * changed). We break out of the loop to handle
+ * Child. Close the listening and
+ * max_startup sockets. Start using
+ * the accepted socket. Reinitialize
+ * logging (since our pid has changed).
+ * We break out of the loop to handle
* the connection.
*/
startup_pipe = startup_p[1];
@@ -1527,7 +1535,10 @@ main(int ac, char **av)
close_listen_socks();
sock_in = 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)
close(config_s[0]);
break;
@@ -1548,7 +1559,10 @@ main(int ac, char **av)
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) &&
key_used == 0) {
/* Schedule server key regeneration alarm. */
@@ -1558,8 +1572,6 @@ main(int ac, char **av)
}
arc4random_stir();
-
- /* Close the new socket (the child is now taking care of it). */
close(newsock);
}
/* child process check (or debug mode) */
@@ -1794,11 +1806,14 @@ ssh1_session_key(BIGNUM *session_key_int)
{
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. */
if (BN_num_bits(sensitive_data.server_key->rsa->n) <
- BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) + SSH_KEY_BITS_RESERVED) {
- fatal("do_connection: %s: server_key %d < host_key %d + SSH_KEY_BITS_RESERVED %d",
+ BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) +
+ SSH_KEY_BITS_RESERVED) {
+ fatal("do_connection: %s: "
+ "server_key %d < host_key %d + SSH_KEY_BITS_RESERVED %d",
get_remote_ipaddr(),
BN_num_bits(sensitive_data.server_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 {
/* Host key has bigger modulus (or they are equal). */
if (BN_num_bits(sensitive_data.ssh1_host_key->rsa->n) <
- BN_num_bits(sensitive_data.server_key->rsa->n) + SSH_KEY_BITS_RESERVED) {
- fatal("do_connection: %s: host_key %d < server_key %d + SSH_KEY_BITS_RESERVED %d",
+ BN_num_bits(sensitive_data.server_key->rsa->n) +
+ SSH_KEY_BITS_RESERVED) {
+ fatal("do_connection: %s: "
+ "host_key %d < server_key %d + SSH_KEY_BITS_RESERVED %d",
get_remote_ipaddr(),
BN_num_bits(sensitive_data.ssh1_host_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_STOC] = "none,zlib@openssh.com";
}
-
+
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = list_hostkey_types();
/* start key exchange */