1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

ssh2userauth: stop hardcoding the successor layer name.

Not that we ever actually _support_ trying to authenticate for any SSH
subprotocol other than "ssh-connection", or any plans to add such
support. But it's inelegant to hardcode it at all when we have it
right there in the successor layer's vtable.
This commit is contained in:
Simon Tatham 2018-10-09 18:11:17 +01:00
parent 5ea3a24b0f
commit 1b67ec2963

View File

@ -406,7 +406,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, "ssh-connection");/* service requested */ put_stringz(s->pktout, s->successor_layer->vt->name);
put_stringz(s->pktout, "none"); /* method */ put_stringz(s->pktout, "none"); /* method */
pq_push(s->ppl.out_pq, s->pktout); pq_push(s->ppl.out_pq, s->pktout);
s->type = AUTH_TYPE_NONE; s->type = AUTH_TYPE_NONE;
@ -627,8 +627,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout( s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, "ssh-connection"); put_stringz(s->pktout, s->successor_layer->vt->name);
/* service requested */
put_stringz(s->pktout, "publickey"); put_stringz(s->pktout, "publickey");
/* method */ /* method */
put_bool(s->pktout, FALSE); /* no signature included */ put_bool(s->pktout, FALSE); /* no signature included */
@ -659,8 +658,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout( s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, "ssh-connection"); put_stringz(s->pktout, s->successor_layer->vt->name);
/* service requested */
put_stringz(s->pktout, "publickey"); put_stringz(s->pktout, "publickey");
/* method */ /* method */
put_bool(s->pktout, TRUE); /* signature included */ put_bool(s->pktout, TRUE); /* signature included */
@ -734,8 +732,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout( s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, "ssh-connection"); put_stringz(s->pktout, s->successor_layer->vt->name);
/* service requested */
put_stringz(s->pktout, "publickey"); /* method */ put_stringz(s->pktout, "publickey"); /* method */
put_bool(s->pktout, FALSE); put_bool(s->pktout, FALSE);
/* no signature included */ /* no signature included */
@ -843,8 +840,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout( s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, "ssh-connection"); put_stringz(s->pktout, s->successor_layer->vt->name);
/* service requested */
put_stringz(s->pktout, "publickey"); /* method */ put_stringz(s->pktout, "publickey"); /* method */
put_bool(s->pktout, TRUE); /* signature follows */ put_bool(s->pktout, TRUE); /* signature follows */
put_stringz(s->pktout, ssh_key_ssh_id(key->key)); put_stringz(s->pktout, ssh_key_ssh_id(key->key));
@ -901,7 +897,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout( s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, "ssh-connection"); put_stringz(s->pktout, s->successor_layer->vt->name);
put_stringz(s->pktout, "gssapi-with-mic"); put_stringz(s->pktout, "gssapi-with-mic");
ppl_logevent(("Attempting GSSAPI authentication")); ppl_logevent(("Attempting GSSAPI authentication"));
@ -1057,8 +1053,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout( s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, "ssh-connection"); put_stringz(s->pktout, s->successor_layer->vt->name);
/* service requested */
put_stringz(s->pktout, "keyboard-interactive"); put_stringz(s->pktout, "keyboard-interactive");
/* method */ /* method */
put_stringz(s->pktout, ""); /* lang */ put_stringz(s->pktout, ""); /* lang */
@ -1272,8 +1267,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout( s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, "ssh-connection"); put_stringz(s->pktout, s->successor_layer->vt->name);
/* service requested */
put_stringz(s->pktout, "password"); put_stringz(s->pktout, "password");
put_bool(s->pktout, FALSE); put_bool(s->pktout, FALSE);
put_stringz(s->pktout, s->password); put_stringz(s->pktout, s->password);
@ -1407,8 +1401,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout( s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->username);
put_stringz(s->pktout, "ssh-connection"); put_stringz(s->pktout, s->successor_layer->vt->name);
/* service requested */
put_stringz(s->pktout, "password"); put_stringz(s->pktout, "password");
put_bool(s->pktout, TRUE); put_bool(s->pktout, TRUE);
put_stringz(s->pktout, s->password); put_stringz(s->pktout, s->password);
@ -1611,7 +1604,7 @@ static PktOut *ssh2_userauth_gss_packet(
put_stringpl(sb, s->session_id); put_stringpl(sb, s->session_id);
put_byte(sb, SSH2_MSG_USERAUTH_REQUEST); put_byte(sb, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(sb, s->username); put_stringz(sb, s->username);
put_stringz(sb, "ssh-connection"); put_stringz(sb, s->successor_layer->vt->name);
put_stringz(sb, authtype); put_stringz(sb, authtype);
/* Compute the mic */ /* Compute the mic */
@ -1626,7 +1619,7 @@ static PktOut *ssh2_userauth_gss_packet(
} else { } else {
p = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST); p = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(p, s->username); put_stringz(p, s->username);
put_stringz(p, "ssh-connection"); put_stringz(p, s->successor_layer->vt->name);
put_stringz(p, authtype); put_stringz(p, authtype);
} }
put_string(p, mic.value, mic.length); put_string(p, mic.value, mic.length);