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
Родитель 5ea3a24b0f
Коммит 1b67ec2963
1 изменённых файлов: 11 добавлений и 18 удалений

Просмотреть файл

@ -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);
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 */
pq_push(s->ppl.out_pq, s->pktout);
s->type = AUTH_TYPE_NONE;
@ -627,8 +627,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
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, "publickey");
/* method */
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->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
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, "publickey");
/* method */
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->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
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, "publickey"); /* method */
put_bool(s->pktout, FALSE);
/* no signature included */
@ -843,8 +840,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
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, "publickey"); /* method */
put_bool(s->pktout, TRUE); /* signature follows */
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->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
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");
ppl_logevent(("Attempting GSSAPI authentication"));
@ -1057,8 +1053,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
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, "keyboard-interactive");
/* method */
put_stringz(s->pktout, ""); /* lang */
@ -1272,8 +1267,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->pktout = ssh_bpp_new_pktout(
s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
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, "password");
put_bool(s->pktout, FALSE);
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->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
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, "password");
put_bool(s->pktout, TRUE);
put_stringz(s->pktout, s->password);
@ -1611,7 +1604,7 @@ static PktOut *ssh2_userauth_gss_packet(
put_stringpl(sb, s->session_id);
put_byte(sb, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(sb, s->username);
put_stringz(sb, "ssh-connection");
put_stringz(sb, s->successor_layer->vt->name);
put_stringz(sb, authtype);
/* Compute the mic */
@ -1626,7 +1619,7 @@ static PktOut *ssh2_userauth_gss_packet(
} else {
p = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_USERAUTH_REQUEST);
put_stringz(p, s->username);
put_stringz(p, "ssh-connection");
put_stringz(p, s->successor_layer->vt->name);
put_stringz(p, authtype);
}
put_string(p, mic.value, mic.length);