summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-04-16 11:18:38 +1000
committerDamien Miller <djm@mindrot.org>2000-04-16 11:18:38 +1000
commit4af51306d9a51459a5bef922df1037f876ae51fe (patch)
tree09ecfc215fce82345a3259f8a0f384b9a67906f0 /sshd.c
parent5d1705ecf9bd3216dc99a84242bcdf2e7297d307 (diff)
- OpenBSD CVS updates.
[ssh.1 ssh.c] - ssh -2 [auth.c channels.c clientloop.c packet.c packet.h serverloop.c] [session.c sshconnect.c] - check payload for (illegal) extra data [ALL] - whitespace cleanup
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/sshd.c b/sshd.c
index cd5760ecb..cc6bee96a 100644
--- a/sshd.c
+++ b/sshd.c
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: sshd.c,v 1.104 2000/04/12 09:39:10 markus Exp $"); 17RCSID("$OpenBSD: sshd.c,v 1.105 2000/04/14 10:30:33 markus Exp $");
18 18
19#include "xmalloc.h" 19#include "xmalloc.h"
20#include "rsa.h" 20#include "rsa.h"
@@ -67,7 +67,7 @@ ServerOptions options;
67/* Name of the server configuration file. */ 67/* Name of the server configuration file. */
68char *config_file_name = SERVER_CONFIG_FILE; 68char *config_file_name = SERVER_CONFIG_FILE;
69 69
70/* 70/*
71 * Flag indicating whether IPv4 or IPv6. This can be set on the command line. 71 * Flag indicating whether IPv4 or IPv6. This can be set on the command line.
72 * Default value is AF_UNSPEC means both IPv4 and IPv6. 72 * Default value is AF_UNSPEC means both IPv4 and IPv6.
73 */ 73 */
@@ -162,7 +162,7 @@ close_listen_socks(void)
162 * the effect is to reread the configuration file (and to regenerate 162 * the effect is to reread the configuration file (and to regenerate
163 * the server key). 163 * the server key).
164 */ 164 */
165void 165void
166sighup_handler(int sig) 166sighup_handler(int sig)
167{ 167{
168 received_sighup = 1; 168 received_sighup = 1;
@@ -173,7 +173,7 @@ sighup_handler(int sig)
173 * Called from the main program after receiving SIGHUP. 173 * Called from the main program after receiving SIGHUP.
174 * Restarts the server. 174 * Restarts the server.
175 */ 175 */
176void 176void
177sighup_restart() 177sighup_restart()
178{ 178{
179 log("Received SIGHUP; restarting."); 179 log("Received SIGHUP; restarting.");
@@ -188,7 +188,7 @@ sighup_restart()
188 * These close the listen socket; not closing it seems to cause "Address 188 * These close the listen socket; not closing it seems to cause "Address
189 * already in use" problems on some machines, which is inconvenient. 189 * already in use" problems on some machines, which is inconvenient.
190 */ 190 */
191void 191void
192sigterm_handler(int sig) 192sigterm_handler(int sig)
193{ 193{
194 log("Received signal %d; terminating.", sig); 194 log("Received signal %d; terminating.", sig);
@@ -200,7 +200,7 @@ sigterm_handler(int sig)
200 * SIGCHLD handler. This is called whenever a child dies. This will then 200 * SIGCHLD handler. This is called whenever a child dies. This will then
201 * reap any zombies left by exited c. 201 * reap any zombies left by exited c.
202 */ 202 */
203void 203void
204main_sigchld_handler(int sig) 204main_sigchld_handler(int sig)
205{ 205{
206 int save_errno = errno; 206 int save_errno = errno;
@@ -216,7 +216,7 @@ main_sigchld_handler(int sig)
216/* 216/*
217 * Signal handler for the alarm after the login grace period has expired. 217 * Signal handler for the alarm after the login grace period has expired.
218 */ 218 */
219void 219void
220grace_alarm_handler(int sig) 220grace_alarm_handler(int sig)
221{ 221{
222 /* Close the connection. */ 222 /* Close the connection. */
@@ -233,7 +233,7 @@ grace_alarm_handler(int sig)
233 * Thus there should be no concurrency control/asynchronous execution 233 * Thus there should be no concurrency control/asynchronous execution
234 * problems. 234 * problems.
235 */ 235 */
236void 236void
237key_regeneration_alarm(int sig) 237key_regeneration_alarm(int sig)
238{ 238{
239 int save_errno = errno; 239 int save_errno = errno;
@@ -266,15 +266,15 @@ key_regeneration_alarm(int sig)
266char * 266char *
267chop(char *s) 267chop(char *s)
268{ 268{
269 char *t = s; 269 char *t = s;
270 while (*t) { 270 while (*t) {
271 if(*t == '\n' || *t == '\r') { 271 if(*t == '\n' || *t == '\r') {
272 *t = '\0'; 272 *t = '\0';
273 return s; 273 return s;
274 } 274 }
275 t++; 275 t++;
276 } 276 }
277 return s; 277 return s;
278 278
279} 279}
280 280
@@ -337,7 +337,7 @@ sshd_exchange_identification(int sock_in, int sock_out)
337 */ 337 */
338 if (sscanf(client_version_string, "SSH-%d.%d-%[^\n]\n", 338 if (sscanf(client_version_string, "SSH-%d.%d-%[^\n]\n",
339 &remote_major, &remote_minor, remote_version) != 3) { 339 &remote_major, &remote_minor, remote_version) != 3) {
340 s = "Protocol mismatch.\n"; 340 s = "Protocol mismatch.\n";
341 (void) atomicio(write, sock_out, s, strlen(s)); 341 (void) atomicio(write, sock_out, s, strlen(s));
342 close(sock_in); 342 close(sock_in);
343 close(sock_out); 343 close(sock_out);
@@ -377,7 +377,7 @@ sshd_exchange_identification(int sock_in, int sock_out)
377 break; 377 break;
378 } 378 }
379 /* FALLTHROUGH */ 379 /* FALLTHROUGH */
380 default: 380 default:
381 mismatch = 1; 381 mismatch = 1;
382 break; 382 break;
383 } 383 }
@@ -719,8 +719,8 @@ main(int ac, char **av)
719 for (i = 0; i < num_listen_socks; i++) 719 for (i = 0; i < num_listen_socks; i++)
720 if (listen_socks[i] > maxfd) 720 if (listen_socks[i] > maxfd)
721 maxfd = listen_socks[i]; 721 maxfd = listen_socks[i];
722 fdsetsz = howmany(maxfd, NFDBITS) * sizeof(fd_mask); 722 fdsetsz = howmany(maxfd, NFDBITS) * sizeof(fd_mask);
723 fdset = (fd_set *)xmalloc(fdsetsz); 723 fdset = (fd_set *)xmalloc(fdsetsz);
724 724
725 /* 725 /*
726 * Stay listening for connections until the system crashes or 726 * Stay listening for connections until the system crashes or
@@ -1018,7 +1018,7 @@ do_ssh1_kex()
1018 /* Get cipher type and check whether we accept this. */ 1018 /* Get cipher type and check whether we accept this. */
1019 cipher_type = packet_get_char(); 1019 cipher_type = packet_get_char();
1020 1020
1021 if (!(cipher_mask() & (1 << cipher_type))) 1021 if (!(cipher_mask() & (1 << cipher_type)))
1022 packet_disconnect("Warning: client selects unsupported cipher."); 1022 packet_disconnect("Warning: client selects unsupported cipher.");
1023 1023
1024 /* Get check bytes from the packet. These must match those we 1024 /* Get check bytes from the packet. These must match those we
@@ -1145,7 +1145,7 @@ do_ssh2_kex()
1145/* KEXINIT */ 1145/* KEXINIT */
1146 1146
1147 if (options.ciphers != NULL) { 1147 if (options.ciphers != NULL) {
1148 myproposal[PROPOSAL_ENC_ALGS_CTOS] = 1148 myproposal[PROPOSAL_ENC_ALGS_CTOS] =
1149 myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers; 1149 myproposal[PROPOSAL_ENC_ALGS_STOC] = options.ciphers;
1150 } 1150 }
1151 1151
@@ -1258,10 +1258,10 @@ do_ssh2_kex()
1258 xfree(client_kexinit); 1258 xfree(client_kexinit);
1259 xfree(server_kexinit); 1259 xfree(server_kexinit);
1260#ifdef DEBUG_KEXDH 1260#ifdef DEBUG_KEXDH
1261 fprintf(stderr, "hash == "); 1261 fprintf(stderr, "hash == ");
1262 for (i = 0; i< 20; i++) 1262 for (i = 0; i< 20; i++)
1263 fprintf(stderr, "%02x", (hash[i])&0xff); 1263 fprintf(stderr, "%02x", (hash[i])&0xff);
1264 fprintf(stderr, "\n"); 1264 fprintf(stderr, "\n");
1265#endif 1265#endif
1266 /* sign H */ 1266 /* sign H */
1267 dsa_sign(server_host_key, &signature, &slen, hash, 20); 1267 dsa_sign(server_host_key, &signature, &slen, hash, 20);