diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | channels.c | 22 | ||||
-rw-r--r-- | fatal.c | 1 | ||||
-rw-r--r-- | kex.c | 6 | ||||
-rw-r--r-- | packet.c | 8 | ||||
-rw-r--r-- | serverloop.c | 1 |
6 files changed, 27 insertions, 16 deletions
@@ -98,6 +98,9 @@ | |||
98 | - deraadt@cvs.openbsd.org 2006/03/20 18:42:27 | 98 | - deraadt@cvs.openbsd.org 2006/03/20 18:42:27 |
99 | [canohost.c match.c ssh.c sshconnect.c] | 99 | [canohost.c match.c ssh.c sshconnect.c] |
100 | be strict with tolower() casting | 100 | be strict with tolower() casting |
101 | - deraadt@cvs.openbsd.org 2006/03/20 18:48:34 | ||
102 | [channels.c fatal.c kex.c packet.c serverloop.c] | ||
103 | spacing | ||
101 | 104 | ||
102 | 20060325 | 105 | 20060325 |
103 | - OpenBSD CVS Sync | 106 | - OpenBSD CVS Sync |
@@ -4355,4 +4358,4 @@ | |||
4355 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | 4358 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM |
4356 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | 4359 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu |
4357 | 4360 | ||
4358 | $Id: ChangeLog,v 1.4270 2006/03/26 03:09:54 djm Exp $ | 4361 | $Id: ChangeLog,v 1.4271 2006/03/26 03:10:14 djm Exp $ |
diff --git a/channels.c b/channels.c index 239da8e9b..1ff7152a8 100644 --- a/channels.c +++ b/channels.c | |||
@@ -192,7 +192,6 @@ channel_lookup(int id) | |||
192 | * Register filedescriptors for a channel, used when allocating a channel or | 192 | * Register filedescriptors for a channel, used when allocating a channel or |
193 | * when the channel consumer/producer is ready, e.g. shell exec'd | 193 | * when the channel consumer/producer is ready, e.g. shell exec'd |
194 | */ | 194 | */ |
195 | |||
196 | static void | 195 | static void |
197 | channel_register_fds(Channel *c, int rfd, int wfd, int efd, | 196 | channel_register_fds(Channel *c, int rfd, int wfd, int efd, |
198 | int extusage, int nonblock) | 197 | int extusage, int nonblock) |
@@ -239,7 +238,6 @@ channel_register_fds(Channel *c, int rfd, int wfd, int efd, | |||
239 | * Allocate a new channel object and set its type and socket. This will cause | 238 | * Allocate a new channel object and set its type and socket. This will cause |
240 | * remote_name to be freed. | 239 | * remote_name to be freed. |
241 | */ | 240 | */ |
242 | |||
243 | Channel * | 241 | Channel * |
244 | channel_new(char *ctype, int type, int rfd, int wfd, int efd, | 242 | channel_new(char *ctype, int type, int rfd, int wfd, int efd, |
245 | u_int window, u_int maxpack, int extusage, char *remote_name, int nonblock) | 243 | u_int window, u_int maxpack, int extusage, char *remote_name, int nonblock) |
@@ -341,7 +339,6 @@ channel_close_fd(int *fdp) | |||
341 | } | 339 | } |
342 | 340 | ||
343 | /* Close all channel fd/socket. */ | 341 | /* Close all channel fd/socket. */ |
344 | |||
345 | static void | 342 | static void |
346 | channel_close_fds(Channel *c) | 343 | channel_close_fds(Channel *c) |
347 | { | 344 | { |
@@ -356,7 +353,6 @@ channel_close_fds(Channel *c) | |||
356 | } | 353 | } |
357 | 354 | ||
358 | /* Free the channel and close its fd/socket. */ | 355 | /* Free the channel and close its fd/socket. */ |
359 | |||
360 | void | 356 | void |
361 | channel_free(Channel *c) | 357 | channel_free(Channel *c) |
362 | { | 358 | { |
@@ -403,7 +399,6 @@ channel_free_all(void) | |||
403 | * Closes the sockets/fds of all channels. This is used to close extra file | 399 | * Closes the sockets/fds of all channels. This is used to close extra file |
404 | * descriptors after a fork. | 400 | * descriptors after a fork. |
405 | */ | 401 | */ |
406 | |||
407 | void | 402 | void |
408 | channel_close_all(void) | 403 | channel_close_all(void) |
409 | { | 404 | { |
@@ -417,7 +412,6 @@ channel_close_all(void) | |||
417 | /* | 412 | /* |
418 | * Stop listening to channels. | 413 | * Stop listening to channels. |
419 | */ | 414 | */ |
420 | |||
421 | void | 415 | void |
422 | channel_stop_listening(void) | 416 | channel_stop_listening(void) |
423 | { | 417 | { |
@@ -444,7 +438,6 @@ channel_stop_listening(void) | |||
444 | * Returns true if no channel has too much buffered data, and false if one or | 438 | * Returns true if no channel has too much buffered data, and false if one or |
445 | * more channel is overfull. | 439 | * more channel is overfull. |
446 | */ | 440 | */ |
447 | |||
448 | int | 441 | int |
449 | channel_not_very_much_buffered_data(void) | 442 | channel_not_very_much_buffered_data(void) |
450 | { | 443 | { |
@@ -474,7 +467,6 @@ channel_not_very_much_buffered_data(void) | |||
474 | } | 467 | } |
475 | 468 | ||
476 | /* Returns true if any channel is still open. */ | 469 | /* Returns true if any channel is still open. */ |
477 | |||
478 | int | 470 | int |
479 | channel_still_open(void) | 471 | channel_still_open(void) |
480 | { | 472 | { |
@@ -517,7 +509,6 @@ channel_still_open(void) | |||
517 | } | 509 | } |
518 | 510 | ||
519 | /* Returns the id of an open channel suitable for keepaliving */ | 511 | /* Returns the id of an open channel suitable for keepaliving */ |
520 | |||
521 | int | 512 | int |
522 | channel_find_open(void) | 513 | channel_find_open(void) |
523 | { | 514 | { |
@@ -562,7 +553,6 @@ channel_find_open(void) | |||
562 | * suitable for sending to the client. The message contains crlf pairs for | 553 | * suitable for sending to the client. The message contains crlf pairs for |
563 | * newlines. | 554 | * newlines. |
564 | */ | 555 | */ |
565 | |||
566 | char * | 556 | char * |
567 | channel_open_message(void) | 557 | channel_open_message(void) |
568 | { | 558 | { |
@@ -647,6 +637,7 @@ channel_request_start(int id, char *service, int wantconfirm) | |||
647 | packet_put_cstring(service); | 637 | packet_put_cstring(service); |
648 | packet_put_char(wantconfirm); | 638 | packet_put_char(wantconfirm); |
649 | } | 639 | } |
640 | |||
650 | void | 641 | void |
651 | channel_register_confirm(int id, channel_callback_fn *fn, void *ctx) | 642 | channel_register_confirm(int id, channel_callback_fn *fn, void *ctx) |
652 | { | 643 | { |
@@ -659,6 +650,7 @@ channel_register_confirm(int id, channel_callback_fn *fn, void *ctx) | |||
659 | c->confirm = fn; | 650 | c->confirm = fn; |
660 | c->confirm_ctx = ctx; | 651 | c->confirm_ctx = ctx; |
661 | } | 652 | } |
653 | |||
662 | void | 654 | void |
663 | channel_register_cleanup(int id, channel_callback_fn *fn, int do_close) | 655 | channel_register_cleanup(int id, channel_callback_fn *fn, int do_close) |
664 | { | 656 | { |
@@ -671,6 +663,7 @@ channel_register_cleanup(int id, channel_callback_fn *fn, int do_close) | |||
671 | c->detach_user = fn; | 663 | c->detach_user = fn; |
672 | c->detach_close = do_close; | 664 | c->detach_close = do_close; |
673 | } | 665 | } |
666 | |||
674 | void | 667 | void |
675 | channel_cancel_cleanup(int id) | 668 | channel_cancel_cleanup(int id) |
676 | { | 669 | { |
@@ -683,6 +676,7 @@ channel_cancel_cleanup(int id) | |||
683 | c->detach_user = NULL; | 676 | c->detach_user = NULL; |
684 | c->detach_close = 0; | 677 | c->detach_close = 0; |
685 | } | 678 | } |
679 | |||
686 | void | 680 | void |
687 | channel_register_filter(int id, channel_infilter_fn *ifn, | 681 | channel_register_filter(int id, channel_infilter_fn *ifn, |
688 | channel_outfilter_fn *ofn) | 682 | channel_outfilter_fn *ofn) |
@@ -1455,6 +1449,7 @@ channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset) | |||
1455 | } | 1449 | } |
1456 | return 1; | 1450 | return 1; |
1457 | } | 1451 | } |
1452 | |||
1458 | static int | 1453 | static int |
1459 | channel_handle_wfd(Channel *c, fd_set *readset, fd_set *writeset) | 1454 | channel_handle_wfd(Channel *c, fd_set *readset, fd_set *writeset) |
1460 | { | 1455 | { |
@@ -1542,6 +1537,7 @@ channel_handle_wfd(Channel *c, fd_set *readset, fd_set *writeset) | |||
1542 | } | 1537 | } |
1543 | return 1; | 1538 | return 1; |
1544 | } | 1539 | } |
1540 | |||
1545 | static int | 1541 | static int |
1546 | channel_handle_efd(Channel *c, fd_set *readset, fd_set *writeset) | 1542 | channel_handle_efd(Channel *c, fd_set *readset, fd_set *writeset) |
1547 | { | 1543 | { |
@@ -1585,6 +1581,7 @@ channel_handle_efd(Channel *c, fd_set *readset, fd_set *writeset) | |||
1585 | } | 1581 | } |
1586 | return 1; | 1582 | return 1; |
1587 | } | 1583 | } |
1584 | |||
1588 | static int | 1585 | static int |
1589 | channel_handle_ctl(Channel *c, fd_set *readset, fd_set *writeset) | 1586 | channel_handle_ctl(Channel *c, fd_set *readset, fd_set *writeset) |
1590 | { | 1587 | { |
@@ -1612,6 +1609,7 @@ channel_handle_ctl(Channel *c, fd_set *readset, fd_set *writeset) | |||
1612 | } | 1609 | } |
1613 | return 1; | 1610 | return 1; |
1614 | } | 1611 | } |
1612 | |||
1615 | static int | 1613 | static int |
1616 | channel_check_window(Channel *c) | 1614 | channel_check_window(Channel *c) |
1617 | { | 1615 | { |
@@ -1823,7 +1821,6 @@ channel_after_select(fd_set *readset, fd_set *writeset) | |||
1823 | 1821 | ||
1824 | 1822 | ||
1825 | /* If there is data to send to the connection, enqueue some of it now. */ | 1823 | /* If there is data to send to the connection, enqueue some of it now. */ |
1826 | |||
1827 | void | 1824 | void |
1828 | channel_output_poll(void) | 1825 | channel_output_poll(void) |
1829 | { | 1826 | { |
@@ -1943,7 +1940,6 @@ channel_output_poll(void) | |||
1943 | 1940 | ||
1944 | 1941 | ||
1945 | /* -- protocol input */ | 1942 | /* -- protocol input */ |
1946 | |||
1947 | void | 1943 | void |
1948 | channel_input_data(int type, u_int32_t seq, void *ctxt) | 1944 | channel_input_data(int type, u_int32_t seq, void *ctxt) |
1949 | { | 1945 | { |
@@ -2557,7 +2553,6 @@ channel_request_rforward_cancel(const char *host, u_short port) | |||
2557 | * listening for the port, and sends back a success reply (or disconnect | 2553 | * listening for the port, and sends back a success reply (or disconnect |
2558 | * message if there was an error). This never returns if there was an error. | 2554 | * message if there was an error). This never returns if there was an error. |
2559 | */ | 2555 | */ |
2560 | |||
2561 | void | 2556 | void |
2562 | channel_input_port_forward_request(int is_root, int gateway_ports) | 2557 | channel_input_port_forward_request(int is_root, int gateway_ports) |
2563 | { | 2558 | { |
@@ -2628,7 +2623,6 @@ channel_clear_permitted_opens(void) | |||
2628 | 2623 | ||
2629 | } | 2624 | } |
2630 | 2625 | ||
2631 | |||
2632 | /* return socket to remote host, port */ | 2626 | /* return socket to remote host, port */ |
2633 | static int | 2627 | static int |
2634 | connect_to(const char *host, u_short port) | 2628 | connect_to(const char *host, u_short port) |
@@ -32,6 +32,7 @@ void | |||
32 | fatal(const char *fmt,...) | 32 | fatal(const char *fmt,...) |
33 | { | 33 | { |
34 | va_list args; | 34 | va_list args; |
35 | |||
35 | va_start(args, fmt); | 36 | va_start(args, fmt); |
36 | do_log(SYSLOG_LEVEL_FATAL, fmt, args); | 37 | do_log(SYSLOG_LEVEL_FATAL, fmt, args); |
37 | va_end(args); | 38 | va_end(args); |
@@ -261,6 +261,7 @@ choose_enc(Enc *enc, char *client, char *server) | |||
261 | enc->key_len = cipher_keylen(enc->cipher); | 261 | enc->key_len = cipher_keylen(enc->cipher); |
262 | enc->block_size = cipher_blocksize(enc->cipher); | 262 | enc->block_size = cipher_blocksize(enc->cipher); |
263 | } | 263 | } |
264 | |||
264 | static void | 265 | static void |
265 | choose_mac(Mac *mac, char *client, char *server) | 266 | choose_mac(Mac *mac, char *client, char *server) |
266 | { | 267 | { |
@@ -276,6 +277,7 @@ choose_mac(Mac *mac, char *client, char *server) | |||
276 | mac->key = NULL; | 277 | mac->key = NULL; |
277 | mac->enabled = 0; | 278 | mac->enabled = 0; |
278 | } | 279 | } |
280 | |||
279 | static void | 281 | static void |
280 | choose_comp(Comp *comp, char *client, char *server) | 282 | choose_comp(Comp *comp, char *client, char *server) |
281 | { | 283 | { |
@@ -293,6 +295,7 @@ choose_comp(Comp *comp, char *client, char *server) | |||
293 | } | 295 | } |
294 | comp->name = name; | 296 | comp->name = name; |
295 | } | 297 | } |
298 | |||
296 | static void | 299 | static void |
297 | choose_kex(Kex *k, char *client, char *server) | 300 | choose_kex(Kex *k, char *client, char *server) |
298 | { | 301 | { |
@@ -485,7 +488,8 @@ kex_derive_keys(Kex *kex, u_char *hash, u_int hashlen, BIGNUM *shared_secret) | |||
485 | for (mode = 0; mode < MODE_MAX; mode++) { | 488 | for (mode = 0; mode < MODE_MAX; mode++) { |
486 | current_keys[mode] = kex->newkeys[mode]; | 489 | current_keys[mode] = kex->newkeys[mode]; |
487 | kex->newkeys[mode] = NULL; | 490 | kex->newkeys[mode] = NULL; |
488 | ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN); | 491 | ctos = (!kex->server && mode == MODE_OUT) || |
492 | (kex->server && mode == MODE_IN); | ||
489 | current_keys[mode]->enc.iv = keys[ctos ? 0 : 1]; | 493 | current_keys[mode]->enc.iv = keys[ctos ? 0 : 1]; |
490 | current_keys[mode]->enc.key = keys[ctos ? 2 : 3]; | 494 | current_keys[mode]->enc.key = keys[ctos ? 2 : 3]; |
491 | current_keys[mode]->mac.key = keys[ctos ? 4 : 5]; | 495 | current_keys[mode]->mac.key = keys[ctos ? 4 : 5]; |
@@ -259,6 +259,7 @@ packet_get_keyiv_len(int mode) | |||
259 | 259 | ||
260 | return (cipher_get_keyiv_len(cc)); | 260 | return (cipher_get_keyiv_len(cc)); |
261 | } | 261 | } |
262 | |||
262 | void | 263 | void |
263 | packet_set_iv(int mode, u_char *dat) | 264 | packet_set_iv(int mode, u_char *dat) |
264 | { | 265 | { |
@@ -271,6 +272,7 @@ packet_set_iv(int mode, u_char *dat) | |||
271 | 272 | ||
272 | cipher_set_keyiv(cc, dat); | 273 | cipher_set_keyiv(cc, dat); |
273 | } | 274 | } |
275 | |||
274 | int | 276 | int |
275 | packet_get_ssh1_cipher(void) | 277 | packet_get_ssh1_cipher(void) |
276 | { | 278 | { |
@@ -472,31 +474,37 @@ packet_put_char(int value) | |||
472 | 474 | ||
473 | buffer_append(&outgoing_packet, &ch, 1); | 475 | buffer_append(&outgoing_packet, &ch, 1); |
474 | } | 476 | } |
477 | |||
475 | void | 478 | void |
476 | packet_put_int(u_int value) | 479 | packet_put_int(u_int value) |
477 | { | 480 | { |
478 | buffer_put_int(&outgoing_packet, value); | 481 | buffer_put_int(&outgoing_packet, value); |
479 | } | 482 | } |
483 | |||
480 | void | 484 | void |
481 | packet_put_string(const void *buf, u_int len) | 485 | packet_put_string(const void *buf, u_int len) |
482 | { | 486 | { |
483 | buffer_put_string(&outgoing_packet, buf, len); | 487 | buffer_put_string(&outgoing_packet, buf, len); |
484 | } | 488 | } |
489 | |||
485 | void | 490 | void |
486 | packet_put_cstring(const char *str) | 491 | packet_put_cstring(const char *str) |
487 | { | 492 | { |
488 | buffer_put_cstring(&outgoing_packet, str); | 493 | buffer_put_cstring(&outgoing_packet, str); |
489 | } | 494 | } |
495 | |||
490 | void | 496 | void |
491 | packet_put_raw(const void *buf, u_int len) | 497 | packet_put_raw(const void *buf, u_int len) |
492 | { | 498 | { |
493 | buffer_append(&outgoing_packet, buf, len); | 499 | buffer_append(&outgoing_packet, buf, len); |
494 | } | 500 | } |
501 | |||
495 | void | 502 | void |
496 | packet_put_bignum(BIGNUM * value) | 503 | packet_put_bignum(BIGNUM * value) |
497 | { | 504 | { |
498 | buffer_put_bignum(&outgoing_packet, value); | 505 | buffer_put_bignum(&outgoing_packet, value); |
499 | } | 506 | } |
507 | |||
500 | void | 508 | void |
501 | packet_put_bignum2(BIGNUM * value) | 509 | packet_put_bignum2(BIGNUM * value) |
502 | { | 510 | { |
diff --git a/serverloop.c b/serverloop.c index 3bc0c5a76..36c40ec59 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -1102,6 +1102,7 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1102 | } | 1102 | } |
1103 | xfree(rtype); | 1103 | xfree(rtype); |
1104 | } | 1104 | } |
1105 | |||
1105 | static void | 1106 | static void |
1106 | server_input_channel_req(int type, u_int32_t seq, void *ctxt) | 1107 | server_input_channel_req(int type, u_int32_t seq, void *ctxt) |
1107 | { | 1108 | { |