- (djm) CVS OpenBSD sync:

- markus@cvs.openbsd.org  2000/09/26 13:59:59
     [clientloop.c]
     use debug2
   - markus@cvs.openbsd.org  2000/09/27 15:41:34
     [auth2.c sshconnect2.c]
     use key_type()
   - markus@cvs.openbsd.org  2000/09/28 12:03:18
     [channels.c]
     debug -> debug2 cleanup
This commit is contained in:
Damien Miller 2000-09-30 14:20:03 +11:00
parent cf3888d396
commit d344494346
5 changed files with 38 additions and 29 deletions

View File

@ -6,6 +6,16 @@
- (djm) Ignore SIGPIPEs from serverloop to child. Fixes crashes with - (djm) Ignore SIGPIPEs from serverloop to child. Fixes crashes with
very short lived X connections. Bug report from Tobias Oetiker very short lived X connections. Bug report from Tobias Oetiker
<oetiker@ee.ethz.ch>. Fix from Markus Friedl <markus@cvs.openbsd.org> <oetiker@ee.ethz.ch>. Fix from Markus Friedl <markus@cvs.openbsd.org>
- (djm) CVS OpenBSD sync:
- markus@cvs.openbsd.org 2000/09/26 13:59:59
[clientloop.c]
use debug2
- markus@cvs.openbsd.org 2000/09/27 15:41:34
[auth2.c sshconnect2.c]
use key_type()
- markus@cvs.openbsd.org 2000/09/28 12:03:18
[channels.c]
debug -> debug2 cleanup
20000929 20000929
- (djm) Fix SSH2 not terminating until all background tasks done problem. - (djm) Fix SSH2 not terminating until all background tasks done problem.

14
auth2.c
View File

@ -23,7 +23,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: auth2.c,v 1.15 2000/09/21 11:25:32 markus Exp $"); RCSID("$OpenBSD: auth2.c,v 1.16 2000/09/27 21:41:34 markus Exp $");
#include <openssl/dsa.h> #include <openssl/dsa.h>
#include <openssl/rsa.h> #include <openssl/rsa.h>
@ -472,8 +472,10 @@ user_dsa_key_allowed(struct passwd *pw, Key *key)
if (fstat(fileno(f), &st) < 0 || if (fstat(fileno(f), &st) < 0 ||
(st.st_uid != 0 && st.st_uid != pw->pw_uid) || (st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
(st.st_mode & 022) != 0) { (st.st_mode & 022) != 0) {
snprintf(buf, sizeof buf, "DSA authentication refused for %.100s: " snprintf(buf, sizeof buf,
"bad ownership or modes for '%s'.", pw->pw_name, file); "%s authentication refused for %.100s: "
"bad ownership or modes for '%s'.",
key_type(key), pw->pw_name, file);
fail = 1; fail = 1;
} else { } else {
/* Check path to SSH_USER_PERMITTED_KEYS */ /* Check path to SSH_USER_PERMITTED_KEYS */
@ -488,9 +490,9 @@ user_dsa_key_allowed(struct passwd *pw, Key *key)
(st.st_uid != 0 && st.st_uid != pw->pw_uid) || (st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
(st.st_mode & 022) != 0) { (st.st_mode & 022) != 0) {
snprintf(buf, sizeof buf, snprintf(buf, sizeof buf,
"DSA authentication refused for %.100s: " "%s authentication refused for %.100s: "
"bad ownership or modes for '%s'.", "bad ownership or modes for '%s'.",
pw->pw_name, line); key_type(key), pw->pw_name, line);
fail = 1; fail = 1;
break; break;
} }
@ -504,7 +506,7 @@ user_dsa_key_allowed(struct passwd *pw, Key *key)
} }
} }
found_key = 0; found_key = 0;
found = key_new(KEY_DSA); found = key_new(key->type);
while (fgets(line, sizeof(line), f)) { while (fgets(line, sizeof(line), f)) {
char *cp, *options = NULL; char *cp, *options = NULL;

View File

@ -40,7 +40,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: channels.c,v 1.69 2000/09/21 11:25:33 markus Exp $"); RCSID("$OpenBSD: channels.c,v 1.70 2000/09/28 18:03:18 markus Exp $");
#include "ssh.h" #include "ssh.h"
#include "packet.h" #include "packet.h"
@ -234,7 +234,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
/* There are no free slots. Take last+1 slot and expand the array. */ /* There are no free slots. Take last+1 slot and expand the array. */
found = channels_alloc; found = channels_alloc;
channels_alloc += 10; channels_alloc += 10;
debug("channel: expanding %d", channels_alloc); debug2("channel: expanding %d", channels_alloc);
channels = xrealloc(channels, channels_alloc * sizeof(Channel)); channels = xrealloc(channels, channels_alloc * sizeof(Channel));
for (i = found; i < channels_alloc; i++) for (i = found; i < channels_alloc; i++)
channels[i].type = SSH_CHANNEL_FREE; channels[i].type = SSH_CHANNEL_FREE;
@ -737,7 +737,7 @@ channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset)
buffer_len(&c->extended) > 0) { buffer_len(&c->extended) > 0) {
len = write(c->efd, buffer_ptr(&c->extended), len = write(c->efd, buffer_ptr(&c->extended),
buffer_len(&c->extended)); buffer_len(&c->extended));
debug("channel %d: written %d to efd %d", debug2("channel %d: written %d to efd %d",
c->self, len, c->efd); c->self, len, c->efd);
if (len > 0) { if (len > 0) {
buffer_consume(&c->extended, len); buffer_consume(&c->extended, len);
@ -746,7 +746,7 @@ channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset)
} else if (c->extended_usage == CHAN_EXTENDED_READ && } else if (c->extended_usage == CHAN_EXTENDED_READ &&
FD_ISSET(c->efd, readset)) { FD_ISSET(c->efd, readset)) {
len = read(c->efd, buf, sizeof(buf)); len = read(c->efd, buf, sizeof(buf));
debug("channel %d: read %d from efd %d", debug2("channel %d: read %d from efd %d",
c->self, len, c->efd); c->self, len, c->efd);
if (len == 0) { if (len == 0) {
debug("channel %d: closing efd %d", debug("channel %d: closing efd %d",
@ -769,7 +769,7 @@ channel_check_window(Channel *c, fd_set * readset, fd_set * writeset)
packet_put_int(c->remote_id); packet_put_int(c->remote_id);
packet_put_int(c->local_consumed); packet_put_int(c->local_consumed);
packet_send(); packet_send();
debug("channel %d: window %d sent adjust %d", debug2("channel %d: window %d sent adjust %d",
c->self, c->local_window, c->self, c->local_window,
c->local_consumed); c->local_consumed);
c->local_window += c->local_consumed; c->local_window += c->local_consumed;
@ -1076,7 +1076,7 @@ channel_input_extended_data(int type, int plen, void *ctxt)
xfree(data); xfree(data);
return; return;
} }
debug("channel %d: rcvd ext data %d", c->self, data_len); debug2("channel %d: rcvd ext data %d", c->self, data_len);
c->local_window -= data_len; c->local_window -= data_len;
buffer_append(&c->extended, data, data_len); buffer_append(&c->extended, data, data_len);
xfree(data); xfree(data);
@ -1218,9 +1218,9 @@ channel_input_open_confirmation(int type, int plen, void *ctxt)
c->remote_maxpacket = packet_get_int(); c->remote_maxpacket = packet_get_int();
packet_done(); packet_done();
if (c->cb_fn != NULL && c->cb_event == type) { if (c->cb_fn != NULL && c->cb_event == type) {
debug("callback start"); debug2("callback start");
c->cb_fn(c->self, c->cb_arg); c->cb_fn(c->self, c->cb_arg);
debug("callback done"); debug2("callback done");
} }
debug("channel %d: open confirm rwindow %d rmax %d", c->self, debug("channel %d: open confirm rwindow %d rmax %d", c->self,
c->remote_window, c->remote_maxpacket); c->remote_window, c->remote_maxpacket);
@ -1269,13 +1269,13 @@ channel_input_channel_request(int type, int plen, void *ctxt)
packet_disconnect("Received request for " packet_disconnect("Received request for "
"non-open channel %d.", id); "non-open channel %d.", id);
if (c->cb_fn != NULL && c->cb_event == type) { if (c->cb_fn != NULL && c->cb_event == type) {
debug("callback start"); debug2("callback start");
c->cb_fn(c->self, c->cb_arg); c->cb_fn(c->self, c->cb_arg);
debug("callback done"); debug2("callback done");
} else { } else {
char *service = packet_get_string(NULL); char *service = packet_get_string(NULL);
debug("channel: %d rcvd request for %s", c->self, service); debug("channel: %d rcvd request for %s", c->self, service);
debug("cb_fn %p cb_event %d", c->cb_fn , c->cb_event); debug("cb_fn %p cb_event %d", c->cb_fn , c->cb_event);
xfree(service); xfree(service);
} }
} }
@ -1300,7 +1300,7 @@ channel_input_window_adjust(int type, int plen, void *ctxt)
} }
adjust = packet_get_int(); adjust = packet_get_int();
packet_done(); packet_done();
debug("channel %d: rcvd adjust %d", id, adjust); debug2("channel %d: rcvd adjust %d", id, adjust);
c->remote_window += adjust; c->remote_window += adjust;
} }

View File

@ -59,7 +59,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: clientloop.c,v 1.36 2000/09/21 11:25:33 markus Exp $"); RCSID("$OpenBSD: clientloop.c,v 1.37 2000/09/26 19:59:58 markus Exp $");
#include "xmalloc.h" #include "xmalloc.h"
#include "ssh.h" #include "ssh.h"
@ -333,7 +333,7 @@ client_check_window_change()
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) < 0) if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) < 0)
return; return;
debug("client_check_window_change: changed"); debug2("client_check_window_change: changed");
if (compat20) { if (compat20) {
channel_request_start(session_ident, "window-change", 0); channel_request_start(session_ident, "window-change", 0);
@ -360,8 +360,6 @@ client_check_window_change()
void void
client_wait_until_can_do_something(fd_set * readset, fd_set * writeset) client_wait_until_can_do_something(fd_set * readset, fd_set * writeset)
{ {
/*debug("client_wait_until_can_do_something"); */
/* Initialize select masks. */ /* Initialize select masks. */
FD_ZERO(readset); FD_ZERO(readset);
FD_ZERO(writeset); FD_ZERO(writeset);
@ -480,7 +478,6 @@ client_process_net_input(fd_set * readset)
if (FD_ISSET(connection_in, readset)) { if (FD_ISSET(connection_in, readset)) {
/* Read as much as possible. */ /* Read as much as possible. */
len = read(connection_in, buf, sizeof(buf)); len = read(connection_in, buf, sizeof(buf));
/*debug("read connection_in len %d", len); XXX */
if (len == 0) { if (len == 0) {
/* Received EOF. The remote host has closed the connection. */ /* Received EOF. The remote host has closed the connection. */
snprintf(buf, sizeof buf, "Connection to %.300s closed by remote host.\r\n", snprintf(buf, sizeof buf, "Connection to %.300s closed by remote host.\r\n",
@ -852,7 +849,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
client_process_buffered_input_packets(); client_process_buffered_input_packets();
if (compat20 && !channel_still_open()) { if (compat20 && !channel_still_open()) {
debug("!channel_still_open."); debug2("!channel_still_open.");
break; break;
} }
@ -1042,7 +1039,7 @@ client_input_channel_open(int type, int plen, void *ctxt)
int originator_port; int originator_port;
originator = packet_get_string(NULL); originator = packet_get_string(NULL);
if (datafellows & SSH_BUG_X11FWD) { if (datafellows & SSH_BUG_X11FWD) {
debug("buggy server: x11 request w/o originator_port"); debug2("buggy server: x11 request w/o originator_port");
originator_port = 0; originator_port = 0;
} else { } else {
originator_port = packet_get_int(); originator_port = packet_get_int();
@ -1172,7 +1169,7 @@ client_input_channel_req(int id, void *arg)
void void
client_set_session_ident(int id) client_set_session_ident(int id)
{ {
debug("client_set_session_ident: id %d", id); debug2("client_set_session_ident: id %d", id);
session_ident = id; session_ident = id;
channel_register_callback(id, SSH2_MSG_CHANNEL_REQUEST, channel_register_callback(id, SSH2_MSG_CHANNEL_REQUEST,
client_input_channel_req, (void *)0); client_input_channel_req, (void *)0);

View File

@ -23,7 +23,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: sshconnect2.c,v 1.20 2000/09/21 11:25:07 markus Exp $"); RCSID("$OpenBSD: sshconnect2.c,v 1.21 2000/09/27 21:41:34 markus Exp $");
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/rsa.h> #include <openssl/rsa.h>
@ -534,8 +534,8 @@ userauth_pubkey_identity(Authctxt *authctxt, char *filename)
char *passphrase; char *passphrase;
char prompt[300]; char prompt[300];
snprintf(prompt, sizeof prompt, snprintf(prompt, sizeof prompt,
"Enter passphrase for DSA key '%.100s': ", "Enter passphrase for %s key '%.100s': ",
filename); key_type(k), filename);
for (i = 0; i < options.number_of_password_prompts; i++) { for (i = 0; i < options.number_of_password_prompts; i++) {
passphrase = read_passphrase(prompt, 0); passphrase = read_passphrase(prompt, 0);
if (strcmp(passphrase, "") != 0) { if (strcmp(passphrase, "") != 0) {