diff options
author | Colin Watson <cjwatson@debian.org> | 2010-03-31 00:48:57 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2010-03-31 00:48:57 +0100 |
commit | d1a87e462e1db89f19cd960588d0c6b287cb5ccc (patch) | |
tree | f0d13e1687800f36a3c4322b94ac5230ad17bdbf /authfd.c | |
parent | 964476f91b66c475d5b8fa1e8b28d39a97a1b56e (diff) | |
parent | 004a7fb9c6a00b13dc98f56599918a54a3506d10 (diff) |
merge 5.4p1
Diffstat (limited to 'authfd.c')
-rw-r--r-- | authfd.c | 30 |
1 files changed, 22 insertions, 8 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: authfd.c,v 1.80 2006/08/03 03:34:41 deraadt Exp $ */ | 1 | /* $OpenBSD: authfd.c,v 1.82 2010/02/26 20:29:54 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -483,6 +483,16 @@ ssh_encode_identity_ssh2(Buffer *b, Key *key, const char *comment) | |||
483 | buffer_put_bignum2(b, key->rsa->p); | 483 | buffer_put_bignum2(b, key->rsa->p); |
484 | buffer_put_bignum2(b, key->rsa->q); | 484 | buffer_put_bignum2(b, key->rsa->q); |
485 | break; | 485 | break; |
486 | case KEY_RSA_CERT: | ||
487 | if (key->cert == NULL || buffer_len(&key->cert->certblob) == 0) | ||
488 | fatal("%s: no cert/certblob", __func__); | ||
489 | buffer_put_string(b, buffer_ptr(&key->cert->certblob), | ||
490 | buffer_len(&key->cert->certblob)); | ||
491 | buffer_put_bignum2(b, key->rsa->d); | ||
492 | buffer_put_bignum2(b, key->rsa->iqmp); | ||
493 | buffer_put_bignum2(b, key->rsa->p); | ||
494 | buffer_put_bignum2(b, key->rsa->q); | ||
495 | break; | ||
486 | case KEY_DSA: | 496 | case KEY_DSA: |
487 | buffer_put_bignum2(b, key->dsa->p); | 497 | buffer_put_bignum2(b, key->dsa->p); |
488 | buffer_put_bignum2(b, key->dsa->q); | 498 | buffer_put_bignum2(b, key->dsa->q); |
@@ -490,6 +500,13 @@ ssh_encode_identity_ssh2(Buffer *b, Key *key, const char *comment) | |||
490 | buffer_put_bignum2(b, key->dsa->pub_key); | 500 | buffer_put_bignum2(b, key->dsa->pub_key); |
491 | buffer_put_bignum2(b, key->dsa->priv_key); | 501 | buffer_put_bignum2(b, key->dsa->priv_key); |
492 | break; | 502 | break; |
503 | case KEY_DSA_CERT: | ||
504 | if (key->cert == NULL || buffer_len(&key->cert->certblob) == 0) | ||
505 | fatal("%s: no cert/certblob", __func__); | ||
506 | buffer_put_string(b, buffer_ptr(&key->cert->certblob), | ||
507 | buffer_len(&key->cert->certblob)); | ||
508 | buffer_put_bignum2(b, key->dsa->priv_key); | ||
509 | break; | ||
493 | } | 510 | } |
494 | buffer_put_cstring(b, comment); | 511 | buffer_put_cstring(b, comment); |
495 | } | 512 | } |
@@ -517,7 +534,9 @@ ssh_add_identity_constrained(AuthenticationConnection *auth, Key *key, | |||
517 | ssh_encode_identity_rsa1(&msg, key->rsa, comment); | 534 | ssh_encode_identity_rsa1(&msg, key->rsa, comment); |
518 | break; | 535 | break; |
519 | case KEY_RSA: | 536 | case KEY_RSA: |
537 | case KEY_RSA_CERT: | ||
520 | case KEY_DSA: | 538 | case KEY_DSA: |
539 | case KEY_DSA_CERT: | ||
521 | type = constrained ? | 540 | type = constrained ? |
522 | SSH2_AGENTC_ADD_ID_CONSTRAINED : | 541 | SSH2_AGENTC_ADD_ID_CONSTRAINED : |
523 | SSH2_AGENTC_ADD_IDENTITY; | 542 | SSH2_AGENTC_ADD_IDENTITY; |
@@ -545,12 +564,6 @@ ssh_add_identity_constrained(AuthenticationConnection *auth, Key *key, | |||
545 | return decode_reply(type); | 564 | return decode_reply(type); |
546 | } | 565 | } |
547 | 566 | ||
548 | int | ||
549 | ssh_add_identity(AuthenticationConnection *auth, Key *key, const char *comment) | ||
550 | { | ||
551 | return ssh_add_identity_constrained(auth, key, comment, 0, 0); | ||
552 | } | ||
553 | |||
554 | /* | 567 | /* |
555 | * Removes an identity from the authentication server. This call is not | 568 | * Removes an identity from the authentication server. This call is not |
556 | * meant to be used by normal applications. | 569 | * meant to be used by normal applications. |
@@ -571,7 +584,8 @@ ssh_remove_identity(AuthenticationConnection *auth, Key *key) | |||
571 | buffer_put_int(&msg, BN_num_bits(key->rsa->n)); | 584 | buffer_put_int(&msg, BN_num_bits(key->rsa->n)); |
572 | buffer_put_bignum(&msg, key->rsa->e); | 585 | buffer_put_bignum(&msg, key->rsa->e); |
573 | buffer_put_bignum(&msg, key->rsa->n); | 586 | buffer_put_bignum(&msg, key->rsa->n); |
574 | } else if (key->type == KEY_DSA || key->type == KEY_RSA) { | 587 | } else if (key_type_plain(key->type) == KEY_DSA || |
588 | key_type_plain(key->type) == KEY_RSA) { | ||
575 | key_to_blob(key, &blob, &blen); | 589 | key_to_blob(key, &blob, &blen); |
576 | buffer_put_char(&msg, SSH2_AGENTC_REMOVE_IDENTITY); | 590 | buffer_put_char(&msg, SSH2_AGENTC_REMOVE_IDENTITY); |
577 | buffer_put_string(&msg, blob, blen); | 591 | buffer_put_string(&msg, blob, blen); |