diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | cipher.c | 26 | ||||
-rw-r--r-- | monitor.c | 144 | ||||
-rw-r--r-- | monitor_fdpass.c | 18 | ||||
-rw-r--r-- | monitor_mm.c | 12 | ||||
-rw-r--r-- | monitor_wrap.c | 126 |
6 files changed, 167 insertions, 164 deletions
@@ -95,6 +95,9 @@ | |||
95 | - markus@cvs.openbsd.org 2002/06/04 23:02:06 | 95 | - markus@cvs.openbsd.org 2002/06/04 23:02:06 |
96 | [packet.c] | 96 | [packet.c] |
97 | remove __FUNCTION__ | 97 | remove __FUNCTION__ |
98 | - markus@cvs.openbsd.org 2002/06/04 23:05:49 | ||
99 | [cipher.c monitor.c monitor_fdpass.c monitor_mm.c monitor_wrap.c] | ||
100 | __FUNCTION__ -> __func__ | ||
98 | 101 | ||
99 | 20020604 | 102 | 20020604 |
100 | - (stevesk) [channels.c] bug #164 patch from YOSHIFUJI Hideaki (changed | 103 | - (stevesk) [channels.c] bug #164 patch from YOSHIFUJI Hideaki (changed |
@@ -779,4 +782,4 @@ | |||
779 | - (stevesk) entropy.c: typo in debug message | 782 | - (stevesk) entropy.c: typo in debug message |
780 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ | 783 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ |
781 | 784 | ||
782 | $Id: ChangeLog,v 1.2169 2002/06/06 20:59:25 mouring Exp $ | 785 | $Id: ChangeLog,v 1.2170 2002/06/06 21:40:51 mouring Exp $ |
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: cipher.c,v 1.57 2002/05/30 08:07:31 markus Exp $"); | 38 | RCSID("$OpenBSD: cipher.c,v 1.58 2002/06/04 23:05:49 markus Exp $"); |
39 | 39 | ||
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
41 | #include "log.h" | 41 | #include "log.h" |
@@ -595,7 +595,7 @@ cipher_get_keyiv(CipherContext *cc, u_char *iv, u_int len) | |||
595 | if (evplen == 0) | 595 | if (evplen == 0) |
596 | return; | 596 | return; |
597 | if (evplen != len) | 597 | if (evplen != len) |
598 | fatal("%s: wrong iv length %d != %d", __FUNCTION__, | 598 | fatal("%s: wrong iv length %d != %d", __func__, |
599 | evplen, len); | 599 | evplen, len); |
600 | 600 | ||
601 | #if OPENSSL_VERSION_NUMBER < 0x00907000L | 601 | #if OPENSSL_VERSION_NUMBER < 0x00907000L |
@@ -604,7 +604,7 @@ cipher_get_keyiv(CipherContext *cc, u_char *iv, u_int len) | |||
604 | 604 | ||
605 | aesc = EVP_CIPHER_CTX_get_app_data(&cc->evp); | 605 | aesc = EVP_CIPHER_CTX_get_app_data(&cc->evp); |
606 | if (aesc == NULL) | 606 | if (aesc == NULL) |
607 | fatal("%s: no rijndael context", __FUNCTION__); | 607 | fatal("%s: no rijndael context", __func__); |
608 | civ = aesc->r_iv; | 608 | civ = aesc->r_iv; |
609 | } else | 609 | } else |
610 | #endif | 610 | #endif |
@@ -615,18 +615,18 @@ cipher_get_keyiv(CipherContext *cc, u_char *iv, u_int len) | |||
615 | case SSH_CIPHER_3DES: { | 615 | case SSH_CIPHER_3DES: { |
616 | struct ssh1_3des_ctx *desc; | 616 | struct ssh1_3des_ctx *desc; |
617 | if (len != 24) | 617 | if (len != 24) |
618 | fatal("%s: bad 3des iv length: %d", __FUNCTION__, len); | 618 | fatal("%s: bad 3des iv length: %d", __func__, len); |
619 | desc = EVP_CIPHER_CTX_get_app_data(&cc->evp); | 619 | desc = EVP_CIPHER_CTX_get_app_data(&cc->evp); |
620 | if (desc == NULL) | 620 | if (desc == NULL) |
621 | fatal("%s: no 3des context", __FUNCTION__); | 621 | fatal("%s: no 3des context", __func__); |
622 | debug3("%s: Copying 3DES IV", __FUNCTION__); | 622 | debug3("%s: Copying 3DES IV", __func__); |
623 | memcpy(iv, desc->k1.iv, 8); | 623 | memcpy(iv, desc->k1.iv, 8); |
624 | memcpy(iv + 8, desc->k2.iv, 8); | 624 | memcpy(iv + 8, desc->k2.iv, 8); |
625 | memcpy(iv + 16, desc->k3.iv, 8); | 625 | memcpy(iv + 16, desc->k3.iv, 8); |
626 | return; | 626 | return; |
627 | } | 627 | } |
628 | default: | 628 | default: |
629 | fatal("%s: bad cipher %d", __FUNCTION__, c->number); | 629 | fatal("%s: bad cipher %d", __func__, c->number); |
630 | } | 630 | } |
631 | memcpy(iv, civ, len); | 631 | memcpy(iv, civ, len); |
632 | } | 632 | } |
@@ -652,7 +652,7 @@ cipher_set_keyiv(CipherContext *cc, u_char *iv) | |||
652 | 652 | ||
653 | aesc = EVP_CIPHER_CTX_get_app_data(&cc->evp); | 653 | aesc = EVP_CIPHER_CTX_get_app_data(&cc->evp); |
654 | if (aesc == NULL) | 654 | if (aesc == NULL) |
655 | fatal("%s: no rijndael context", __FUNCTION__); | 655 | fatal("%s: no rijndael context", __func__); |
656 | div = aesc->r_iv; | 656 | div = aesc->r_iv; |
657 | } else | 657 | } else |
658 | #endif | 658 | #endif |
@@ -664,15 +664,15 @@ cipher_set_keyiv(CipherContext *cc, u_char *iv) | |||
664 | struct ssh1_3des_ctx *desc; | 664 | struct ssh1_3des_ctx *desc; |
665 | desc = EVP_CIPHER_CTX_get_app_data(&cc->evp); | 665 | desc = EVP_CIPHER_CTX_get_app_data(&cc->evp); |
666 | if (desc == NULL) | 666 | if (desc == NULL) |
667 | fatal("%s: no 3des context", __FUNCTION__); | 667 | fatal("%s: no 3des context", __func__); |
668 | debug3("%s: Installed 3DES IV", __FUNCTION__); | 668 | debug3("%s: Installed 3DES IV", __func__); |
669 | memcpy(desc->k1.iv, iv, 8); | 669 | memcpy(desc->k1.iv, iv, 8); |
670 | memcpy(desc->k2.iv, iv + 8, 8); | 670 | memcpy(desc->k2.iv, iv + 8, 8); |
671 | memcpy(desc->k3.iv, iv + 16, 8); | 671 | memcpy(desc->k3.iv, iv + 16, 8); |
672 | return; | 672 | return; |
673 | } | 673 | } |
674 | default: | 674 | default: |
675 | fatal("%s: bad cipher %d", __FUNCTION__, c->number); | 675 | fatal("%s: bad cipher %d", __func__, c->number); |
676 | } | 676 | } |
677 | memcpy(div, iv, evplen); | 677 | memcpy(div, iv, evplen); |
678 | } | 678 | } |
@@ -695,7 +695,7 @@ cipher_get_keycontext(CipherContext *cc, u_char *dat) | |||
695 | struct ssh1_3des_ctx *desc; | 695 | struct ssh1_3des_ctx *desc; |
696 | desc = EVP_CIPHER_CTX_get_app_data(&cc->evp); | 696 | desc = EVP_CIPHER_CTX_get_app_data(&cc->evp); |
697 | if (desc == NULL) | 697 | if (desc == NULL) |
698 | fatal("%s: no 3des context", __FUNCTION__); | 698 | fatal("%s: no 3des context", __func__); |
699 | plen = EVP_X_STATE_LEN(desc->k1); | 699 | plen = EVP_X_STATE_LEN(desc->k1); |
700 | if (dat == NULL) | 700 | if (dat == NULL) |
701 | return (3*plen); | 701 | return (3*plen); |
@@ -724,7 +724,7 @@ cipher_set_keycontext(CipherContext *cc, u_char *dat) | |||
724 | struct ssh1_3des_ctx *desc; | 724 | struct ssh1_3des_ctx *desc; |
725 | desc = EVP_CIPHER_CTX_get_app_data(&cc->evp); | 725 | desc = EVP_CIPHER_CTX_get_app_data(&cc->evp); |
726 | if (desc == NULL) | 726 | if (desc == NULL) |
727 | fatal("%s: no 3des context", __FUNCTION__); | 727 | fatal("%s: no 3des context", __func__); |
728 | plen = EVP_X_STATE_LEN(desc->k1); | 728 | plen = EVP_X_STATE_LEN(desc->k1); |
729 | memcpy(EVP_X_STATE(desc->k1), dat, plen); | 729 | memcpy(EVP_X_STATE(desc->k1), dat, plen); |
730 | memcpy(EVP_X_STATE(desc->k2), dat + plen, plen); | 730 | memcpy(EVP_X_STATE(desc->k2), dat + plen, plen); |
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | RCSID("$OpenBSD: monitor.c,v 1.13 2002/06/04 19:53:40 markus Exp $"); | 28 | RCSID("$OpenBSD: monitor.c,v 1.14 2002/06/04 23:05:49 markus Exp $"); |
29 | 29 | ||
30 | #include <openssl/dh.h> | 30 | #include <openssl/dh.h> |
31 | 31 | ||
@@ -269,7 +269,7 @@ monitor_child_preauth(struct monitor *pmonitor) | |||
269 | if (authenticated) { | 269 | if (authenticated) { |
270 | if (!(ent->flags & MON_AUTHDECIDE)) | 270 | if (!(ent->flags & MON_AUTHDECIDE)) |
271 | fatal("%s: unexpected authentication from %d", | 271 | fatal("%s: unexpected authentication from %d", |
272 | __FUNCTION__, ent->type); | 272 | __func__, ent->type); |
273 | if (authctxt->pw->pw_uid == 0 && | 273 | if (authctxt->pw->pw_uid == 0 && |
274 | !auth_root_allowed(auth_method)) | 274 | !auth_root_allowed(auth_method)) |
275 | authenticated = 0; | 275 | authenticated = 0; |
@@ -288,10 +288,10 @@ monitor_child_preauth(struct monitor *pmonitor) | |||
288 | } | 288 | } |
289 | 289 | ||
290 | if (!authctxt->valid) | 290 | if (!authctxt->valid) |
291 | fatal("%s: authenticated invalid user", __FUNCTION__); | 291 | fatal("%s: authenticated invalid user", __func__); |
292 | 292 | ||
293 | debug("%s: %s has been authenticated by privileged process", | 293 | debug("%s: %s has been authenticated by privileged process", |
294 | __FUNCTION__, authctxt->user); | 294 | __func__, authctxt->user); |
295 | 295 | ||
296 | mm_get_keystate(pmonitor); | 296 | mm_get_keystate(pmonitor); |
297 | 297 | ||
@@ -342,7 +342,7 @@ monitor_read(struct monitor *pmonitor, struct mon_table *ent, | |||
342 | mm_request_receive(pmonitor->m_sendfd, &m); | 342 | mm_request_receive(pmonitor->m_sendfd, &m); |
343 | type = buffer_get_char(&m); | 343 | type = buffer_get_char(&m); |
344 | 344 | ||
345 | debug3("%s: checking request %d", __FUNCTION__, type); | 345 | debug3("%s: checking request %d", __func__, type); |
346 | 346 | ||
347 | while (ent->f != NULL) { | 347 | while (ent->f != NULL) { |
348 | if (ent->type == type) | 348 | if (ent->type == type) |
@@ -352,14 +352,14 @@ monitor_read(struct monitor *pmonitor, struct mon_table *ent, | |||
352 | 352 | ||
353 | if (ent->f != NULL) { | 353 | if (ent->f != NULL) { |
354 | if (!(ent->flags & MON_PERMIT)) | 354 | if (!(ent->flags & MON_PERMIT)) |
355 | fatal("%s: unpermitted request %d", __FUNCTION__, | 355 | fatal("%s: unpermitted request %d", __func__, |
356 | type); | 356 | type); |
357 | ret = (*ent->f)(pmonitor->m_sendfd, &m); | 357 | ret = (*ent->f)(pmonitor->m_sendfd, &m); |
358 | buffer_free(&m); | 358 | buffer_free(&m); |
359 | 359 | ||
360 | /* The child may use this request only once, disable it */ | 360 | /* The child may use this request only once, disable it */ |
361 | if (ent->flags & MON_ONCE) { | 361 | if (ent->flags & MON_ONCE) { |
362 | debug2("%s: %d used once, disabling now", __FUNCTION__, | 362 | debug2("%s: %d used once, disabling now", __func__, |
363 | type); | 363 | type); |
364 | ent->flags &= ~MON_PERMIT; | 364 | ent->flags &= ~MON_PERMIT; |
365 | } | 365 | } |
@@ -370,7 +370,7 @@ monitor_read(struct monitor *pmonitor, struct mon_table *ent, | |||
370 | return ret; | 370 | return ret; |
371 | } | 371 | } |
372 | 372 | ||
373 | fatal("%s: unsupported request: %d", __FUNCTION__, type); | 373 | fatal("%s: unsupported request: %d", __func__, type); |
374 | 374 | ||
375 | /* NOTREACHED */ | 375 | /* NOTREACHED */ |
376 | return (-1); | 376 | return (-1); |
@@ -415,11 +415,11 @@ mm_answer_moduli(int socket, Buffer *m) | |||
415 | max = buffer_get_int(m); | 415 | max = buffer_get_int(m); |
416 | 416 | ||
417 | debug3("%s: got parameters: %d %d %d", | 417 | debug3("%s: got parameters: %d %d %d", |
418 | __FUNCTION__, min, want, max); | 418 | __func__, min, want, max); |
419 | /* We need to check here, too, in case the child got corrupted */ | 419 | /* We need to check here, too, in case the child got corrupted */ |
420 | if (max < min || want < min || max < want) | 420 | if (max < min || want < min || max < want) |
421 | fatal("%s: bad parameters: %d %d %d", | 421 | fatal("%s: bad parameters: %d %d %d", |
422 | __FUNCTION__, min, want, max); | 422 | __func__, min, want, max); |
423 | 423 | ||
424 | buffer_clear(m); | 424 | buffer_clear(m); |
425 | 425 | ||
@@ -448,13 +448,13 @@ mm_answer_sign(int socket, Buffer *m) | |||
448 | u_int siglen, datlen; | 448 | u_int siglen, datlen; |
449 | int keyid; | 449 | int keyid; |
450 | 450 | ||
451 | debug3("%s", __FUNCTION__); | 451 | debug3("%s", __func__); |
452 | 452 | ||
453 | keyid = buffer_get_int(m); | 453 | keyid = buffer_get_int(m); |
454 | p = buffer_get_string(m, &datlen); | 454 | p = buffer_get_string(m, &datlen); |
455 | 455 | ||
456 | if (datlen != 20) | 456 | if (datlen != 20) |
457 | fatal("%s: data length incorrect: %d", __FUNCTION__, datlen); | 457 | fatal("%s: data length incorrect: %d", __func__, datlen); |
458 | 458 | ||
459 | /* save session id, it will be passed on the first call */ | 459 | /* save session id, it will be passed on the first call */ |
460 | if (session_id2_len == 0) { | 460 | if (session_id2_len == 0) { |
@@ -464,11 +464,11 @@ mm_answer_sign(int socket, Buffer *m) | |||
464 | } | 464 | } |
465 | 465 | ||
466 | if ((key = get_hostkey_by_index(keyid)) == NULL) | 466 | if ((key = get_hostkey_by_index(keyid)) == NULL) |
467 | fatal("%s: no hostkey from index %d", __FUNCTION__, keyid); | 467 | fatal("%s: no hostkey from index %d", __func__, keyid); |
468 | if (key_sign(key, &signature, &siglen, p, datlen) < 0) | 468 | if (key_sign(key, &signature, &siglen, p, datlen) < 0) |
469 | fatal("%s: key_sign failed", __FUNCTION__); | 469 | fatal("%s: key_sign failed", __func__); |
470 | 470 | ||
471 | debug3("%s: signature %p(%d)", __FUNCTION__, signature, siglen); | 471 | debug3("%s: signature %p(%d)", __func__, signature, siglen); |
472 | 472 | ||
473 | buffer_clear(m); | 473 | buffer_clear(m); |
474 | buffer_put_string(m, signature, siglen); | 474 | buffer_put_string(m, signature, siglen); |
@@ -493,10 +493,10 @@ mm_answer_pwnamallow(int socket, Buffer *m) | |||
493 | struct passwd *pwent; | 493 | struct passwd *pwent; |
494 | int allowed = 0; | 494 | int allowed = 0; |
495 | 495 | ||
496 | debug3("%s", __FUNCTION__); | 496 | debug3("%s", __func__); |
497 | 497 | ||
498 | if (authctxt->attempt++ != 0) | 498 | if (authctxt->attempt++ != 0) |
499 | fatal("%s: multiple attempts for getpwnam", __FUNCTION__); | 499 | fatal("%s: multiple attempts for getpwnam", __func__); |
500 | 500 | ||
501 | login = buffer_get_string(m, NULL); | 501 | login = buffer_get_string(m, NULL); |
502 | 502 | ||
@@ -529,7 +529,7 @@ mm_answer_pwnamallow(int socket, Buffer *m) | |||
529 | buffer_put_cstring(m, pwent->pw_shell); | 529 | buffer_put_cstring(m, pwent->pw_shell); |
530 | 530 | ||
531 | out: | 531 | out: |
532 | debug3("%s: sending MONITOR_ANS_PWNAM: %d", __FUNCTION__, allowed); | 532 | debug3("%s: sending MONITOR_ANS_PWNAM: %d", __func__, allowed); |
533 | mm_request_send(socket, MONITOR_ANS_PWNAM, m); | 533 | mm_request_send(socket, MONITOR_ANS_PWNAM, m); |
534 | 534 | ||
535 | /* For SSHv1 allow authentication now */ | 535 | /* For SSHv1 allow authentication now */ |
@@ -571,7 +571,7 @@ mm_answer_authserv(int socket, Buffer *m) | |||
571 | authctxt->service = buffer_get_string(m, NULL); | 571 | authctxt->service = buffer_get_string(m, NULL); |
572 | authctxt->style = buffer_get_string(m, NULL); | 572 | authctxt->style = buffer_get_string(m, NULL); |
573 | debug3("%s: service=%s, style=%s", | 573 | debug3("%s: service=%s, style=%s", |
574 | __FUNCTION__, authctxt->service, authctxt->style); | 574 | __func__, authctxt->service, authctxt->style); |
575 | 575 | ||
576 | if (strlen(authctxt->style) == 0) { | 576 | if (strlen(authctxt->style) == 0) { |
577 | xfree(authctxt->style); | 577 | xfree(authctxt->style); |
@@ -598,7 +598,7 @@ mm_answer_authpassword(int socket, Buffer *m) | |||
598 | buffer_clear(m); | 598 | buffer_clear(m); |
599 | buffer_put_int(m, authenticated); | 599 | buffer_put_int(m, authenticated); |
600 | 600 | ||
601 | debug3("%s: sending result %d", __FUNCTION__, authenticated); | 601 | debug3("%s: sending result %d", __func__, authenticated); |
602 | mm_request_send(socket, MONITOR_ANS_AUTHPASSWORD, m); | 602 | mm_request_send(socket, MONITOR_ANS_AUTHPASSWORD, m); |
603 | 603 | ||
604 | call_count++; | 604 | call_count++; |
@@ -629,7 +629,7 @@ mm_answer_bsdauthquery(int socket, Buffer *m) | |||
629 | if (res != -1) | 629 | if (res != -1) |
630 | buffer_put_cstring(m, prompts[0]); | 630 | buffer_put_cstring(m, prompts[0]); |
631 | 631 | ||
632 | debug3("%s: sending challenge res: %d", __FUNCTION__, res); | 632 | debug3("%s: sending challenge res: %d", __func__, res); |
633 | mm_request_send(socket, MONITOR_ANS_BSDAUTHQUERY, m); | 633 | mm_request_send(socket, MONITOR_ANS_BSDAUTHQUERY, m); |
634 | 634 | ||
635 | if (res != -1) { | 635 | if (res != -1) { |
@@ -649,19 +649,19 @@ mm_answer_bsdauthrespond(int socket, Buffer *m) | |||
649 | int authok; | 649 | int authok; |
650 | 650 | ||
651 | if (authctxt->as == 0) | 651 | if (authctxt->as == 0) |
652 | fatal("%s: no bsd auth session", __FUNCTION__); | 652 | fatal("%s: no bsd auth session", __func__); |
653 | 653 | ||
654 | response = buffer_get_string(m, NULL); | 654 | response = buffer_get_string(m, NULL); |
655 | authok = options.challenge_response_authentication && | 655 | authok = options.challenge_response_authentication && |
656 | auth_userresponse(authctxt->as, response, 0); | 656 | auth_userresponse(authctxt->as, response, 0); |
657 | authctxt->as = NULL; | 657 | authctxt->as = NULL; |
658 | debug3("%s: <%s> = <%d>", __FUNCTION__, response, authok); | 658 | debug3("%s: <%s> = <%d>", __func__, response, authok); |
659 | xfree(response); | 659 | xfree(response); |
660 | 660 | ||
661 | buffer_clear(m); | 661 | buffer_clear(m); |
662 | buffer_put_int(m, authok); | 662 | buffer_put_int(m, authok); |
663 | 663 | ||
664 | debug3("%s: sending authenticated: %d", __FUNCTION__, authok); | 664 | debug3("%s: sending authenticated: %d", __func__, authok); |
665 | mm_request_send(socket, MONITOR_ANS_BSDAUTHRESPOND, m); | 665 | mm_request_send(socket, MONITOR_ANS_BSDAUTHRESPOND, m); |
666 | 666 | ||
667 | auth_method = "bsdauth"; | 667 | auth_method = "bsdauth"; |
@@ -685,7 +685,7 @@ mm_answer_skeyquery(int socket, Buffer *m) | |||
685 | if (res != -1) | 685 | if (res != -1) |
686 | buffer_put_cstring(m, challenge); | 686 | buffer_put_cstring(m, challenge); |
687 | 687 | ||
688 | debug3("%s: sending challenge res: %d", __FUNCTION__, res); | 688 | debug3("%s: sending challenge res: %d", __func__, res); |
689 | mm_request_send(socket, MONITOR_ANS_SKEYQUERY, m); | 689 | mm_request_send(socket, MONITOR_ANS_SKEYQUERY, m); |
690 | 690 | ||
691 | return (0); | 691 | return (0); |
@@ -709,7 +709,7 @@ mm_answer_skeyrespond(int socket, Buffer *m) | |||
709 | buffer_clear(m); | 709 | buffer_clear(m); |
710 | buffer_put_int(m, authok); | 710 | buffer_put_int(m, authok); |
711 | 711 | ||
712 | debug3("%s: sending authenticated: %d", __FUNCTION__, authok); | 712 | debug3("%s: sending authenticated: %d", __func__, authok); |
713 | mm_request_send(socket, MONITOR_ANS_SKEYRESPOND, m); | 713 | mm_request_send(socket, MONITOR_ANS_SKEYRESPOND, m); |
714 | 714 | ||
715 | auth_method = "skey"; | 715 | auth_method = "skey"; |
@@ -738,7 +738,7 @@ static void | |||
738 | mm_append_debug(Buffer *m) | 738 | mm_append_debug(Buffer *m) |
739 | { | 739 | { |
740 | if (auth_debug_init && buffer_len(&auth_debug)) { | 740 | if (auth_debug_init && buffer_len(&auth_debug)) { |
741 | debug3("%s: Appending debug messages for child", __FUNCTION__); | 741 | debug3("%s: Appending debug messages for child", __func__); |
742 | buffer_append(m, buffer_ptr(&auth_debug), | 742 | buffer_append(m, buffer_ptr(&auth_debug), |
743 | buffer_len(&auth_debug)); | 743 | buffer_len(&auth_debug)); |
744 | buffer_clear(&auth_debug); | 744 | buffer_clear(&auth_debug); |
@@ -754,7 +754,7 @@ mm_answer_keyallowed(int socket, Buffer *m) | |||
754 | enum mm_keytype type = 0; | 754 | enum mm_keytype type = 0; |
755 | int allowed = 0; | 755 | int allowed = 0; |
756 | 756 | ||
757 | debug3("%s entering", __FUNCTION__); | 757 | debug3("%s entering", __func__); |
758 | 758 | ||
759 | type = buffer_get_int(m); | 759 | type = buffer_get_int(m); |
760 | cuser = buffer_get_string(m, NULL); | 760 | cuser = buffer_get_string(m, NULL); |
@@ -765,9 +765,9 @@ mm_answer_keyallowed(int socket, Buffer *m) | |||
765 | 765 | ||
766 | if ((compat20 && type == MM_RSAHOSTKEY) || | 766 | if ((compat20 && type == MM_RSAHOSTKEY) || |
767 | (!compat20 && type != MM_RSAHOSTKEY)) | 767 | (!compat20 && type != MM_RSAHOSTKEY)) |
768 | fatal("%s: key type and protocol mismatch", __FUNCTION__); | 768 | fatal("%s: key type and protocol mismatch", __func__); |
769 | 769 | ||
770 | debug3("%s: key_from_blob: %p", __FUNCTION__, key); | 770 | debug3("%s: key_from_blob: %p", __func__, key); |
771 | 771 | ||
772 | if (key != NULL && authctxt->pw != NULL) { | 772 | if (key != NULL && authctxt->pw != NULL) { |
773 | switch(type) { | 773 | switch(type) { |
@@ -787,7 +787,7 @@ mm_answer_keyallowed(int socket, Buffer *m) | |||
787 | cuser, chost, key); | 787 | cuser, chost, key); |
788 | break; | 788 | break; |
789 | default: | 789 | default: |
790 | fatal("%s: unknown key type %d", __FUNCTION__, type); | 790 | fatal("%s: unknown key type %d", __func__, type); |
791 | break; | 791 | break; |
792 | } | 792 | } |
793 | key_free(key); | 793 | key_free(key); |
@@ -806,7 +806,7 @@ mm_answer_keyallowed(int socket, Buffer *m) | |||
806 | } | 806 | } |
807 | 807 | ||
808 | debug3("%s: key %p is %s", | 808 | debug3("%s: key %p is %s", |
809 | __FUNCTION__, key, allowed ? "allowed" : "disallowed"); | 809 | __func__, key, allowed ? "allowed" : "disallowed"); |
810 | 810 | ||
811 | buffer_clear(m); | 811 | buffer_clear(m); |
812 | buffer_put_int(m, allowed); | 812 | buffer_put_int(m, allowed); |
@@ -948,11 +948,11 @@ mm_answer_keyverify(int socket, Buffer *m) | |||
948 | 948 | ||
949 | if (hostbased_cuser == NULL || hostbased_chost == NULL || | 949 | if (hostbased_cuser == NULL || hostbased_chost == NULL || |
950 | !monitor_allowed_key(blob, bloblen)) | 950 | !monitor_allowed_key(blob, bloblen)) |
951 | fatal("%s: bad key, not previously allowed", __FUNCTION__); | 951 | fatal("%s: bad key, not previously allowed", __func__); |
952 | 952 | ||
953 | key = key_from_blob(blob, bloblen); | 953 | key = key_from_blob(blob, bloblen); |
954 | if (key == NULL) | 954 | if (key == NULL) |
955 | fatal("%s: bad public key blob", __FUNCTION__); | 955 | fatal("%s: bad public key blob", __func__); |
956 | 956 | ||
957 | switch (key_blobtype) { | 957 | switch (key_blobtype) { |
958 | case MM_USERKEY: | 958 | case MM_USERKEY: |
@@ -967,11 +967,11 @@ mm_answer_keyverify(int socket, Buffer *m) | |||
967 | break; | 967 | break; |
968 | } | 968 | } |
969 | if (!valid_data) | 969 | if (!valid_data) |
970 | fatal("%s: bad signature data blob", __FUNCTION__); | 970 | fatal("%s: bad signature data blob", __func__); |
971 | 971 | ||
972 | verified = key_verify(key, signature, signaturelen, data, datalen); | 972 | verified = key_verify(key, signature, signaturelen, data, datalen); |
973 | debug3("%s: key %p signature %s", | 973 | debug3("%s: key %p signature %s", |
974 | __FUNCTION__, key, verified ? "verified" : "unverified"); | 974 | __func__, key, verified ? "verified" : "unverified"); |
975 | 975 | ||
976 | key_free(key); | 976 | key_free(key); |
977 | xfree(blob); | 977 | xfree(blob); |
@@ -1017,9 +1017,9 @@ mm_record_login(Session *s, struct passwd *pw) | |||
1017 | static void | 1017 | static void |
1018 | mm_session_close(Session *s) | 1018 | mm_session_close(Session *s) |
1019 | { | 1019 | { |
1020 | debug3("%s: session %d pid %d", __FUNCTION__, s->self, s->pid); | 1020 | debug3("%s: session %d pid %d", __func__, s->self, s->pid); |
1021 | if (s->ttyfd != -1) { | 1021 | if (s->ttyfd != -1) { |
1022 | debug3("%s: tty %s ptyfd %d", __FUNCTION__, s->tty, s->ptyfd); | 1022 | debug3("%s: tty %s ptyfd %d", __func__, s->tty, s->ptyfd); |
1023 | fatal_remove_cleanup(session_pty_cleanup2, (void *)s); | 1023 | fatal_remove_cleanup(session_pty_cleanup2, (void *)s); |
1024 | session_pty_cleanup2(s); | 1024 | session_pty_cleanup2(s); |
1025 | } | 1025 | } |
@@ -1033,7 +1033,7 @@ mm_answer_pty(int socket, Buffer *m) | |||
1033 | Session *s; | 1033 | Session *s; |
1034 | int res, fd0; | 1034 | int res, fd0; |
1035 | 1035 | ||
1036 | debug3("%s entering", __FUNCTION__); | 1036 | debug3("%s entering", __func__); |
1037 | 1037 | ||
1038 | buffer_clear(m); | 1038 | buffer_clear(m); |
1039 | s = session_new(); | 1039 | s = session_new(); |
@@ -1057,7 +1057,7 @@ mm_answer_pty(int socket, Buffer *m) | |||
1057 | 1057 | ||
1058 | /* We need to trick ttyslot */ | 1058 | /* We need to trick ttyslot */ |
1059 | if (dup2(s->ttyfd, 0) == -1) | 1059 | if (dup2(s->ttyfd, 0) == -1) |
1060 | fatal("%s: dup2", __FUNCTION__); | 1060 | fatal("%s: dup2", __func__); |
1061 | 1061 | ||
1062 | mm_record_login(s, authctxt->pw); | 1062 | mm_record_login(s, authctxt->pw); |
1063 | 1063 | ||
@@ -1066,9 +1066,9 @@ mm_answer_pty(int socket, Buffer *m) | |||
1066 | 1066 | ||
1067 | /* make sure nothing uses fd 0 */ | 1067 | /* make sure nothing uses fd 0 */ |
1068 | if ((fd0 = open(_PATH_DEVNULL, O_RDONLY)) < 0) | 1068 | if ((fd0 = open(_PATH_DEVNULL, O_RDONLY)) < 0) |
1069 | fatal("%s: open(/dev/null): %s", __FUNCTION__, strerror(errno)); | 1069 | fatal("%s: open(/dev/null): %s", __func__, strerror(errno)); |
1070 | if (fd0 != 0) | 1070 | if (fd0 != 0) |
1071 | error("%s: fd0 %d != 0", __FUNCTION__, fd0); | 1071 | error("%s: fd0 %d != 0", __func__, fd0); |
1072 | 1072 | ||
1073 | /* slave is not needed */ | 1073 | /* slave is not needed */ |
1074 | close(s->ttyfd); | 1074 | close(s->ttyfd); |
@@ -1076,7 +1076,7 @@ mm_answer_pty(int socket, Buffer *m) | |||
1076 | /* no need to dup() because nobody closes ptyfd */ | 1076 | /* no need to dup() because nobody closes ptyfd */ |
1077 | s->ptymaster = s->ptyfd; | 1077 | s->ptymaster = s->ptyfd; |
1078 | 1078 | ||
1079 | debug3("%s: tty %s ptyfd %d", __FUNCTION__, s->tty, s->ttyfd); | 1079 | debug3("%s: tty %s ptyfd %d", __func__, s->tty, s->ttyfd); |
1080 | 1080 | ||
1081 | return (0); | 1081 | return (0); |
1082 | 1082 | ||
@@ -1094,7 +1094,7 @@ mm_answer_pty_cleanup(int socket, Buffer *m) | |||
1094 | Session *s; | 1094 | Session *s; |
1095 | char *tty; | 1095 | char *tty; |
1096 | 1096 | ||
1097 | debug3("%s entering", __FUNCTION__); | 1097 | debug3("%s entering", __func__); |
1098 | 1098 | ||
1099 | tty = buffer_get_string(m, NULL); | 1099 | tty = buffer_get_string(m, NULL); |
1100 | if ((s = session_by_tty(tty)) != NULL) | 1100 | if ((s = session_by_tty(tty)) != NULL) |
@@ -1114,7 +1114,7 @@ mm_answer_sesskey(int socket, Buffer *m) | |||
1114 | monitor_permit(mon_dispatch, MONITOR_REQ_SESSKEY, 1); | 1114 | monitor_permit(mon_dispatch, MONITOR_REQ_SESSKEY, 1); |
1115 | 1115 | ||
1116 | if ((p = BN_new()) == NULL) | 1116 | if ((p = BN_new()) == NULL) |
1117 | fatal("%s: BN_new", __FUNCTION__); | 1117 | fatal("%s: BN_new", __func__); |
1118 | 1118 | ||
1119 | buffer_get_bignum2(m, p); | 1119 | buffer_get_bignum2(m, p); |
1120 | 1120 | ||
@@ -1139,10 +1139,10 @@ mm_answer_sessid(int socket, Buffer *m) | |||
1139 | { | 1139 | { |
1140 | int i; | 1140 | int i; |
1141 | 1141 | ||
1142 | debug3("%s entering", __FUNCTION__); | 1142 | debug3("%s entering", __func__); |
1143 | 1143 | ||
1144 | if (buffer_len(m) != 16) | 1144 | if (buffer_len(m) != 16) |
1145 | fatal("%s: bad ssh1 session id", __FUNCTION__); | 1145 | fatal("%s: bad ssh1 session id", __func__); |
1146 | for (i = 0; i < 16; i++) | 1146 | for (i = 0; i < 16; i++) |
1147 | session_id[i] = buffer_get_char(m); | 1147 | session_id[i] = buffer_get_char(m); |
1148 | 1148 | ||
@@ -1161,11 +1161,11 @@ mm_answer_rsa_keyallowed(int socket, Buffer *m) | |||
1161 | u_int blen = 0; | 1161 | u_int blen = 0; |
1162 | int allowed = 0; | 1162 | int allowed = 0; |
1163 | 1163 | ||
1164 | debug3("%s entering", __FUNCTION__); | 1164 | debug3("%s entering", __func__); |
1165 | 1165 | ||
1166 | if (options.rsa_authentication && authctxt->valid) { | 1166 | if (options.rsa_authentication && authctxt->valid) { |
1167 | if ((client_n = BN_new()) == NULL) | 1167 | if ((client_n = BN_new()) == NULL) |
1168 | fatal("%s: BN_new", __FUNCTION__); | 1168 | fatal("%s: BN_new", __func__); |
1169 | buffer_get_bignum2(m, client_n); | 1169 | buffer_get_bignum2(m, client_n); |
1170 | allowed = auth_rsa_key_allowed(authctxt->pw, client_n, &key); | 1170 | allowed = auth_rsa_key_allowed(authctxt->pw, client_n, &key); |
1171 | BN_clear_free(client_n); | 1171 | BN_clear_free(client_n); |
@@ -1179,7 +1179,7 @@ mm_answer_rsa_keyallowed(int socket, Buffer *m) | |||
1179 | if (allowed && key != NULL) { | 1179 | if (allowed && key != NULL) { |
1180 | key->type = KEY_RSA; /* cheat for key_to_blob */ | 1180 | key->type = KEY_RSA; /* cheat for key_to_blob */ |
1181 | if (key_to_blob(key, &blob, &blen) == 0) | 1181 | if (key_to_blob(key, &blob, &blen) == 0) |
1182 | fatal("%s: key_to_blob failed", __FUNCTION__); | 1182 | fatal("%s: key_to_blob failed", __func__); |
1183 | buffer_put_string(m, blob, blen); | 1183 | buffer_put_string(m, blob, blen); |
1184 | 1184 | ||
1185 | /* Save temporarily for comparison in verify */ | 1185 | /* Save temporarily for comparison in verify */ |
@@ -1205,17 +1205,17 @@ mm_answer_rsa_challenge(int socket, Buffer *m) | |||
1205 | u_char *blob; | 1205 | u_char *blob; |
1206 | u_int blen; | 1206 | u_int blen; |
1207 | 1207 | ||
1208 | debug3("%s entering", __FUNCTION__); | 1208 | debug3("%s entering", __func__); |
1209 | 1209 | ||
1210 | if (!authctxt->valid) | 1210 | if (!authctxt->valid) |
1211 | fatal("%s: authctxt not valid", __FUNCTION__); | 1211 | fatal("%s: authctxt not valid", __func__); |
1212 | blob = buffer_get_string(m, &blen); | 1212 | blob = buffer_get_string(m, &blen); |
1213 | if (!monitor_allowed_key(blob, blen)) | 1213 | if (!monitor_allowed_key(blob, blen)) |
1214 | fatal("%s: bad key, not previously allowed", __FUNCTION__); | 1214 | fatal("%s: bad key, not previously allowed", __func__); |
1215 | if (key_blobtype != MM_RSAUSERKEY && key_blobtype != MM_RSAHOSTKEY) | 1215 | if (key_blobtype != MM_RSAUSERKEY && key_blobtype != MM_RSAHOSTKEY) |
1216 | fatal("%s: key type mismatch", __FUNCTION__); | 1216 | fatal("%s: key type mismatch", __func__); |
1217 | if ((key = key_from_blob(blob, blen)) == NULL) | 1217 | if ((key = key_from_blob(blob, blen)) == NULL) |
1218 | fatal("%s: received bad key", __FUNCTION__); | 1218 | fatal("%s: received bad key", __func__); |
1219 | 1219 | ||
1220 | if (ssh1_challenge) | 1220 | if (ssh1_challenge) |
1221 | BN_clear_free(ssh1_challenge); | 1221 | BN_clear_free(ssh1_challenge); |
@@ -1224,7 +1224,7 @@ mm_answer_rsa_challenge(int socket, Buffer *m) | |||
1224 | buffer_clear(m); | 1224 | buffer_clear(m); |
1225 | buffer_put_bignum2(m, ssh1_challenge); | 1225 | buffer_put_bignum2(m, ssh1_challenge); |
1226 | 1226 | ||
1227 | debug3("%s sending reply", __FUNCTION__); | 1227 | debug3("%s sending reply", __func__); |
1228 | mm_request_send(socket, MONITOR_ANS_RSACHALLENGE, m); | 1228 | mm_request_send(socket, MONITOR_ANS_RSACHALLENGE, m); |
1229 | 1229 | ||
1230 | monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1); | 1230 | monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1); |
@@ -1239,23 +1239,23 @@ mm_answer_rsa_response(int socket, Buffer *m) | |||
1239 | u_int blen, len; | 1239 | u_int blen, len; |
1240 | int success; | 1240 | int success; |
1241 | 1241 | ||
1242 | debug3("%s entering", __FUNCTION__); | 1242 | debug3("%s entering", __func__); |
1243 | 1243 | ||
1244 | if (!authctxt->valid) | 1244 | if (!authctxt->valid) |
1245 | fatal("%s: authctxt not valid", __FUNCTION__); | 1245 | fatal("%s: authctxt not valid", __func__); |
1246 | if (ssh1_challenge == NULL) | 1246 | if (ssh1_challenge == NULL) |
1247 | fatal("%s: no ssh1_challenge", __FUNCTION__); | 1247 | fatal("%s: no ssh1_challenge", __func__); |
1248 | 1248 | ||
1249 | blob = buffer_get_string(m, &blen); | 1249 | blob = buffer_get_string(m, &blen); |
1250 | if (!monitor_allowed_key(blob, blen)) | 1250 | if (!monitor_allowed_key(blob, blen)) |
1251 | fatal("%s: bad key, not previously allowed", __FUNCTION__); | 1251 | fatal("%s: bad key, not previously allowed", __func__); |
1252 | if (key_blobtype != MM_RSAUSERKEY && key_blobtype != MM_RSAHOSTKEY) | 1252 | if (key_blobtype != MM_RSAUSERKEY && key_blobtype != MM_RSAHOSTKEY) |
1253 | fatal("%s: key type mismatch: %d", __FUNCTION__, key_blobtype); | 1253 | fatal("%s: key type mismatch: %d", __func__, key_blobtype); |
1254 | if ((key = key_from_blob(blob, blen)) == NULL) | 1254 | if ((key = key_from_blob(blob, blen)) == NULL) |
1255 | fatal("%s: received bad key", __FUNCTION__); | 1255 | fatal("%s: received bad key", __func__); |
1256 | response = buffer_get_string(m, &len); | 1256 | response = buffer_get_string(m, &len); |
1257 | if (len != 16) | 1257 | if (len != 16) |
1258 | fatal("%s: received bad response to challenge", __FUNCTION__); | 1258 | fatal("%s: received bad response to challenge", __func__); |
1259 | success = auth_rsa_verify_response(key, ssh1_challenge, response); | 1259 | success = auth_rsa_verify_response(key, ssh1_challenge, response); |
1260 | 1260 | ||
1261 | key_free(key); | 1261 | key_free(key); |
@@ -1281,7 +1281,7 @@ mm_answer_term(int socket, Buffer *req) | |||
1281 | extern struct monitor *pmonitor; | 1281 | extern struct monitor *pmonitor; |
1282 | int res, status; | 1282 | int res, status; |
1283 | 1283 | ||
1284 | debug3("%s: tearing down sessions", __FUNCTION__); | 1284 | debug3("%s: tearing down sessions", __func__); |
1285 | 1285 | ||
1286 | /* The child is terminating */ | 1286 | /* The child is terminating */ |
1287 | session_destroy_all(&mm_session_close); | 1287 | session_destroy_all(&mm_session_close); |
@@ -1389,7 +1389,7 @@ mm_get_keystate(struct monitor *pmonitor) | |||
1389 | u_char *blob, *p; | 1389 | u_char *blob, *p; |
1390 | u_int bloblen, plen; | 1390 | u_int bloblen, plen; |
1391 | 1391 | ||
1392 | debug3("%s: Waiting for new keys", __FUNCTION__); | 1392 | debug3("%s: Waiting for new keys", __func__); |
1393 | 1393 | ||
1394 | buffer_init(&m); | 1394 | buffer_init(&m); |
1395 | mm_request_receive_expect(pmonitor->m_sendfd, MONITOR_REQ_KEYEXPORT, &m); | 1395 | mm_request_receive_expect(pmonitor->m_sendfd, MONITOR_REQ_KEYEXPORT, &m); |
@@ -1409,7 +1409,7 @@ mm_get_keystate(struct monitor *pmonitor) | |||
1409 | current_keys[MODE_OUT] = mm_newkeys_from_blob(blob, bloblen); | 1409 | current_keys[MODE_OUT] = mm_newkeys_from_blob(blob, bloblen); |
1410 | xfree(blob); | 1410 | xfree(blob); |
1411 | 1411 | ||
1412 | debug3("%s: Waiting for second key", __FUNCTION__); | 1412 | debug3("%s: Waiting for second key", __func__); |
1413 | blob = buffer_get_string(&m, &bloblen); | 1413 | blob = buffer_get_string(&m, &bloblen); |
1414 | current_keys[MODE_IN] = mm_newkeys_from_blob(blob, bloblen); | 1414 | current_keys[MODE_IN] = mm_newkeys_from_blob(blob, bloblen); |
1415 | xfree(blob); | 1415 | xfree(blob); |
@@ -1423,22 +1423,22 @@ mm_get_keystate(struct monitor *pmonitor) | |||
1423 | child_state.keyout = buffer_get_string(&m, &child_state.keyoutlen); | 1423 | child_state.keyout = buffer_get_string(&m, &child_state.keyoutlen); |
1424 | child_state.keyin = buffer_get_string(&m, &child_state.keyinlen); | 1424 | child_state.keyin = buffer_get_string(&m, &child_state.keyinlen); |
1425 | 1425 | ||
1426 | debug3("%s: Getting compression state", __FUNCTION__); | 1426 | debug3("%s: Getting compression state", __func__); |
1427 | /* Get compression state */ | 1427 | /* Get compression state */ |
1428 | p = buffer_get_string(&m, &plen); | 1428 | p = buffer_get_string(&m, &plen); |
1429 | if (plen != sizeof(child_state.outgoing)) | 1429 | if (plen != sizeof(child_state.outgoing)) |
1430 | fatal("%s: bad request size", __FUNCTION__); | 1430 | fatal("%s: bad request size", __func__); |
1431 | memcpy(&child_state.outgoing, p, sizeof(child_state.outgoing)); | 1431 | memcpy(&child_state.outgoing, p, sizeof(child_state.outgoing)); |
1432 | xfree(p); | 1432 | xfree(p); |
1433 | 1433 | ||
1434 | p = buffer_get_string(&m, &plen); | 1434 | p = buffer_get_string(&m, &plen); |
1435 | if (plen != sizeof(child_state.incoming)) | 1435 | if (plen != sizeof(child_state.incoming)) |
1436 | fatal("%s: bad request size", __FUNCTION__); | 1436 | fatal("%s: bad request size", __func__); |
1437 | memcpy(&child_state.incoming, p, sizeof(child_state.incoming)); | 1437 | memcpy(&child_state.incoming, p, sizeof(child_state.incoming)); |
1438 | xfree(p); | 1438 | xfree(p); |
1439 | 1439 | ||
1440 | /* Network I/O buffers */ | 1440 | /* Network I/O buffers */ |
1441 | debug3("%s: Getting Network I/O buffers", __FUNCTION__); | 1441 | debug3("%s: Getting Network I/O buffers", __func__); |
1442 | child_state.input = buffer_get_string(&m, &child_state.ilen); | 1442 | child_state.input = buffer_get_string(&m, &child_state.ilen); |
1443 | child_state.output = buffer_get_string(&m, &child_state.olen); | 1443 | child_state.output = buffer_get_string(&m, &child_state.olen); |
1444 | 1444 | ||
@@ -1487,10 +1487,10 @@ monitor_socketpair(int *pair) | |||
1487 | { | 1487 | { |
1488 | #ifdef HAVE_SOCKETPAIR | 1488 | #ifdef HAVE_SOCKETPAIR |
1489 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) | 1489 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) |
1490 | fatal("%s: socketpair", __FUNCTION__); | 1490 | fatal("%s: socketpair", __func__); |
1491 | #else | 1491 | #else |
1492 | fatal("%s: UsePrivilegeSeparation=yes not supported", | 1492 | fatal("%s: UsePrivilegeSeparation=yes not supported", |
1493 | __FUNCTION__); | 1493 | __func__); |
1494 | #endif | 1494 | #endif |
1495 | FD_CLOSEONEXEC(pair[0]); | 1495 | FD_CLOSEONEXEC(pair[0]); |
1496 | FD_CLOSEONEXEC(pair[1]); | 1496 | FD_CLOSEONEXEC(pair[1]); |
diff --git a/monitor_fdpass.c b/monitor_fdpass.c index 5401ea466..0d7628fa2 100644 --- a/monitor_fdpass.c +++ b/monitor_fdpass.c | |||
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "includes.h" | 26 | #include "includes.h" |
27 | RCSID("$OpenBSD: monitor_fdpass.c,v 1.2 2002/03/24 17:53:16 stevesk Exp $"); | 27 | RCSID("$OpenBSD: monitor_fdpass.c,v 1.3 2002/06/04 23:05:49 markus Exp $"); |
28 | 28 | ||
29 | #include <sys/uio.h> | 29 | #include <sys/uio.h> |
30 | 30 | ||
@@ -64,14 +64,14 @@ mm_send_fd(int socket, int fd) | |||
64 | msg.msg_iovlen = 1; | 64 | msg.msg_iovlen = 1; |
65 | 65 | ||
66 | if ((n = sendmsg(socket, &msg, 0)) == -1) | 66 | if ((n = sendmsg(socket, &msg, 0)) == -1) |
67 | fatal("%s: sendmsg(%d): %s", __FUNCTION__, fd, | 67 | fatal("%s: sendmsg(%d): %s", __func__, fd, |
68 | strerror(errno)); | 68 | strerror(errno)); |
69 | if (n != 1) | 69 | if (n != 1) |
70 | fatal("%s: sendmsg: expected sent 1 got %d", | 70 | fatal("%s: sendmsg: expected sent 1 got %d", |
71 | __FUNCTION__, n); | 71 | __func__, n); |
72 | #else | 72 | #else |
73 | fatal("%s: UsePrivilegeSeparation=yes not supported", | 73 | fatal("%s: UsePrivilegeSeparation=yes not supported", |
74 | __FUNCTION__); | 74 | __func__); |
75 | #endif | 75 | #endif |
76 | } | 76 | } |
77 | 77 | ||
@@ -102,24 +102,24 @@ mm_receive_fd(int socket) | |||
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | if ((n = recvmsg(socket, &msg, 0)) == -1) | 104 | if ((n = recvmsg(socket, &msg, 0)) == -1) |
105 | fatal("%s: recvmsg: %s", __FUNCTION__, strerror(errno)); | 105 | fatal("%s: recvmsg: %s", __func__, strerror(errno)); |
106 | if (n != 1) | 106 | if (n != 1) |
107 | fatal("%s: recvmsg: expected received 1 got %d", | 107 | fatal("%s: recvmsg: expected received 1 got %d", |
108 | __FUNCTION__, n); | 108 | __func__, n); |
109 | 109 | ||
110 | #ifdef HAVE_ACCRIGHTS_IN_MSGHDR | 110 | #ifdef HAVE_ACCRIGHTS_IN_MSGHDR |
111 | if (msg.msg_accrightslen != sizeof(fd)) | 111 | if (msg.msg_accrightslen != sizeof(fd)) |
112 | fatal("%s: no fd", __FUNCTION__); | 112 | fatal("%s: no fd", __func__); |
113 | #else | 113 | #else |
114 | cmsg = CMSG_FIRSTHDR(&msg); | 114 | cmsg = CMSG_FIRSTHDR(&msg); |
115 | if (cmsg->cmsg_type != SCM_RIGHTS) | 115 | if (cmsg->cmsg_type != SCM_RIGHTS) |
116 | fatal("%s: expected type %d got %d", __FUNCTION__, | 116 | fatal("%s: expected type %d got %d", __func__, |
117 | SCM_RIGHTS, cmsg->cmsg_type); | 117 | SCM_RIGHTS, cmsg->cmsg_type); |
118 | fd = (*(int *)CMSG_DATA(cmsg)); | 118 | fd = (*(int *)CMSG_DATA(cmsg)); |
119 | #endif | 119 | #endif |
120 | return fd; | 120 | return fd; |
121 | #else | 121 | #else |
122 | fatal("%s: UsePrivilegeSeparation=yes not supported", | 122 | fatal("%s: UsePrivilegeSeparation=yes not supported", |
123 | __FUNCTION__); | 123 | __func__); |
124 | #endif | 124 | #endif |
125 | } | 125 | } |
diff --git a/monitor_mm.c b/monitor_mm.c index 17b319cce..30c9825e3 100644 --- a/monitor_mm.c +++ b/monitor_mm.c | |||
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "includes.h" | 26 | #include "includes.h" |
27 | RCSID("$OpenBSD: monitor_mm.c,v 1.5 2002/05/28 16:45:27 stevesk Exp $"); | 27 | RCSID("$OpenBSD: monitor_mm.c,v 1.6 2002/06/04 23:05:49 markus Exp $"); |
28 | 28 | ||
29 | #ifdef HAVE_SYS_MMAN_H | 29 | #ifdef HAVE_SYS_MMAN_H |
30 | #include <sys/mman.h> | 30 | #include <sys/mman.h> |
@@ -91,7 +91,7 @@ mm_create(struct mm_master *mmalloc, size_t size) | |||
91 | fatal("mmap(%lu): %s", (u_long)size, strerror(errnor)); | 91 | fatal("mmap(%lu): %s", (u_long)size, strerror(errnor)); |
92 | #else | 92 | #else |
93 | fatal("%s: UsePrivilegeSeparation=yes not supported", | 93 | fatal("%s: UsePrivilegeSeparation=yes not supported", |
94 | __FUNCTION__); | 94 | __func__); |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | mm->address = address; | 97 | mm->address = address; |
@@ -136,7 +136,7 @@ mm_destroy(struct mm_master *mm) | |||
136 | strerror(errno)); | 136 | strerror(errno)); |
137 | #else | 137 | #else |
138 | fatal("%s: UsePrivilegeSeparation=yes not supported", | 138 | fatal("%s: UsePrivilegeSeparation=yes not supported", |
139 | __FUNCTION__); | 139 | __func__); |
140 | #endif | 140 | #endif |
141 | if (mm->mmalloc == NULL) | 141 | if (mm->mmalloc == NULL) |
142 | xfree(mm); | 142 | xfree(mm); |
@@ -151,7 +151,7 @@ mm_xmalloc(struct mm_master *mm, size_t size) | |||
151 | 151 | ||
152 | address = mm_malloc(mm, size); | 152 | address = mm_malloc(mm, size); |
153 | if (address == NULL) | 153 | if (address == NULL) |
154 | fatal("%s: mm_malloc(%lu)", __FUNCTION__, (u_long)size); | 154 | fatal("%s: mm_malloc(%lu)", __func__, (u_long)size); |
155 | return (address); | 155 | return (address); |
156 | } | 156 | } |
157 | 157 | ||
@@ -300,7 +300,7 @@ mm_share_sync(struct mm_master **pmm, struct mm_master **pmmalloc) | |||
300 | struct mm_master *mmold; | 300 | struct mm_master *mmold; |
301 | struct mmtree rb_free, rb_allocated; | 301 | struct mmtree rb_free, rb_allocated; |
302 | 302 | ||
303 | debug3("%s: Share sync", __FUNCTION__); | 303 | debug3("%s: Share sync", __func__); |
304 | 304 | ||
305 | mm = *pmm; | 305 | mm = *pmm; |
306 | mmold = mm->mmalloc; | 306 | mmold = mm->mmalloc; |
@@ -325,7 +325,7 @@ mm_share_sync(struct mm_master **pmm, struct mm_master **pmmalloc) | |||
325 | *pmm = mm; | 325 | *pmm = mm; |
326 | *pmmalloc = mmalloc; | 326 | *pmmalloc = mmalloc; |
327 | 327 | ||
328 | debug3("%s: Share sync end", __FUNCTION__); | 328 | debug3("%s: Share sync end", __func__); |
329 | } | 329 | } |
330 | 330 | ||
331 | void | 331 | void |
diff --git a/monitor_wrap.c b/monitor_wrap.c index c5e3fb988..fca5ffe50 100644 --- a/monitor_wrap.c +++ b/monitor_wrap.c | |||
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | RCSID("$OpenBSD: monitor_wrap.c,v 1.7 2002/05/15 15:47:49 mouring Exp $"); | 28 | RCSID("$OpenBSD: monitor_wrap.c,v 1.8 2002/06/04 23:05:49 markus Exp $"); |
29 | 29 | ||
30 | #include <openssl/bn.h> | 30 | #include <openssl/bn.h> |
31 | #include <openssl/dh.h> | 31 | #include <openssl/dh.h> |
@@ -65,14 +65,14 @@ mm_request_send(int socket, enum monitor_reqtype type, Buffer *m) | |||
65 | u_char buf[5]; | 65 | u_char buf[5]; |
66 | u_int mlen = buffer_len(m); | 66 | u_int mlen = buffer_len(m); |
67 | 67 | ||
68 | debug3("%s entering: type %d", __FUNCTION__, type); | 68 | debug3("%s entering: type %d", __func__, type); |
69 | 69 | ||
70 | PUT_32BIT(buf, mlen + 1); | 70 | PUT_32BIT(buf, mlen + 1); |
71 | buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ | 71 | buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ |
72 | if (atomicio(write, socket, buf, sizeof(buf)) != sizeof(buf)) | 72 | if (atomicio(write, socket, buf, sizeof(buf)) != sizeof(buf)) |
73 | fatal("%s: write", __FUNCTION__); | 73 | fatal("%s: write", __func__); |
74 | if (atomicio(write, socket, buffer_ptr(m), mlen) != mlen) | 74 | if (atomicio(write, socket, buffer_ptr(m), mlen) != mlen) |
75 | fatal("%s: write", __FUNCTION__); | 75 | fatal("%s: write", __func__); |
76 | } | 76 | } |
77 | 77 | ||
78 | void | 78 | void |
@@ -82,22 +82,22 @@ mm_request_receive(int socket, Buffer *m) | |||
82 | ssize_t res; | 82 | ssize_t res; |
83 | u_int msg_len; | 83 | u_int msg_len; |
84 | 84 | ||
85 | debug3("%s entering", __FUNCTION__); | 85 | debug3("%s entering", __func__); |
86 | 86 | ||
87 | res = atomicio(read, socket, buf, sizeof(buf)); | 87 | res = atomicio(read, socket, buf, sizeof(buf)); |
88 | if (res != sizeof(buf)) { | 88 | if (res != sizeof(buf)) { |
89 | if (res == 0) | 89 | if (res == 0) |
90 | fatal_cleanup(); | 90 | fatal_cleanup(); |
91 | fatal("%s: read: %ld", __FUNCTION__, (long)res); | 91 | fatal("%s: read: %ld", __func__, (long)res); |
92 | } | 92 | } |
93 | msg_len = GET_32BIT(buf); | 93 | msg_len = GET_32BIT(buf); |
94 | if (msg_len > 256 * 1024) | 94 | if (msg_len > 256 * 1024) |
95 | fatal("%s: read: bad msg_len %d", __FUNCTION__, msg_len); | 95 | fatal("%s: read: bad msg_len %d", __func__, msg_len); |
96 | buffer_clear(m); | 96 | buffer_clear(m); |
97 | buffer_append_space(m, msg_len); | 97 | buffer_append_space(m, msg_len); |
98 | res = atomicio(read, socket, buffer_ptr(m), msg_len); | 98 | res = atomicio(read, socket, buffer_ptr(m), msg_len); |
99 | if (res != msg_len) | 99 | if (res != msg_len) |
100 | fatal("%s: read: %ld != msg_len", __FUNCTION__, (long)res); | 100 | fatal("%s: read: %ld != msg_len", __func__, (long)res); |
101 | } | 101 | } |
102 | 102 | ||
103 | void | 103 | void |
@@ -105,12 +105,12 @@ mm_request_receive_expect(int socket, enum monitor_reqtype type, Buffer *m) | |||
105 | { | 105 | { |
106 | u_char rtype; | 106 | u_char rtype; |
107 | 107 | ||
108 | debug3("%s entering: type %d", __FUNCTION__, type); | 108 | debug3("%s entering: type %d", __func__, type); |
109 | 109 | ||
110 | mm_request_receive(socket, m); | 110 | mm_request_receive(socket, m); |
111 | rtype = buffer_get_char(m); | 111 | rtype = buffer_get_char(m); |
112 | if (rtype != type) | 112 | if (rtype != type) |
113 | fatal("%s: read: rtype %d != type %d", __FUNCTION__, | 113 | fatal("%s: read: rtype %d != type %d", __func__, |
114 | rtype, type); | 114 | rtype, type); |
115 | } | 115 | } |
116 | 116 | ||
@@ -128,21 +128,21 @@ mm_choose_dh(int min, int nbits, int max) | |||
128 | 128 | ||
129 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_MODULI, &m); | 129 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_MODULI, &m); |
130 | 130 | ||
131 | debug3("%s: waiting for MONITOR_ANS_MODULI", __FUNCTION__); | 131 | debug3("%s: waiting for MONITOR_ANS_MODULI", __func__); |
132 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_MODULI, &m); | 132 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_MODULI, &m); |
133 | 133 | ||
134 | success = buffer_get_char(&m); | 134 | success = buffer_get_char(&m); |
135 | if (success == 0) | 135 | if (success == 0) |
136 | fatal("%s: MONITOR_ANS_MODULI failed", __FUNCTION__); | 136 | fatal("%s: MONITOR_ANS_MODULI failed", __func__); |
137 | 137 | ||
138 | if ((p = BN_new()) == NULL) | 138 | if ((p = BN_new()) == NULL) |
139 | fatal("%s: BN_new failed", __FUNCTION__); | 139 | fatal("%s: BN_new failed", __func__); |
140 | if ((g = BN_new()) == NULL) | 140 | if ((g = BN_new()) == NULL) |
141 | fatal("%s: BN_new failed", __FUNCTION__); | 141 | fatal("%s: BN_new failed", __func__); |
142 | buffer_get_bignum2(&m, p); | 142 | buffer_get_bignum2(&m, p); |
143 | buffer_get_bignum2(&m, g); | 143 | buffer_get_bignum2(&m, g); |
144 | 144 | ||
145 | debug3("%s: remaining %d", __FUNCTION__, buffer_len(&m)); | 145 | debug3("%s: remaining %d", __func__, buffer_len(&m)); |
146 | buffer_free(&m); | 146 | buffer_free(&m); |
147 | 147 | ||
148 | return (dh_new_group(g, p)); | 148 | return (dh_new_group(g, p)); |
@@ -154,7 +154,7 @@ mm_key_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen) | |||
154 | Kex *kex = *pmonitor->m_pkex; | 154 | Kex *kex = *pmonitor->m_pkex; |
155 | Buffer m; | 155 | Buffer m; |
156 | 156 | ||
157 | debug3("%s entering", __FUNCTION__); | 157 | debug3("%s entering", __func__); |
158 | 158 | ||
159 | buffer_init(&m); | 159 | buffer_init(&m); |
160 | buffer_put_int(&m, kex->host_key_index(key)); | 160 | buffer_put_int(&m, kex->host_key_index(key)); |
@@ -162,7 +162,7 @@ mm_key_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen) | |||
162 | 162 | ||
163 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, &m); | 163 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, &m); |
164 | 164 | ||
165 | debug3("%s: waiting for MONITOR_ANS_SIGN", __FUNCTION__); | 165 | debug3("%s: waiting for MONITOR_ANS_SIGN", __func__); |
166 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SIGN, &m); | 166 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SIGN, &m); |
167 | *sigp = buffer_get_string(&m, lenp); | 167 | *sigp = buffer_get_string(&m, lenp); |
168 | buffer_free(&m); | 168 | buffer_free(&m); |
@@ -177,14 +177,14 @@ mm_getpwnamallow(const char *login) | |||
177 | struct passwd *pw; | 177 | struct passwd *pw; |
178 | u_int pwlen; | 178 | u_int pwlen; |
179 | 179 | ||
180 | debug3("%s entering", __FUNCTION__); | 180 | debug3("%s entering", __func__); |
181 | 181 | ||
182 | buffer_init(&m); | 182 | buffer_init(&m); |
183 | buffer_put_cstring(&m, login); | 183 | buffer_put_cstring(&m, login); |
184 | 184 | ||
185 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PWNAM, &m); | 185 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PWNAM, &m); |
186 | 186 | ||
187 | debug3("%s: waiting for MONITOR_ANS_PWNAM", __FUNCTION__); | 187 | debug3("%s: waiting for MONITOR_ANS_PWNAM", __func__); |
188 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PWNAM, &m); | 188 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PWNAM, &m); |
189 | 189 | ||
190 | if (buffer_get_char(&m) == 0) { | 190 | if (buffer_get_char(&m) == 0) { |
@@ -193,7 +193,7 @@ mm_getpwnamallow(const char *login) | |||
193 | } | 193 | } |
194 | pw = buffer_get_string(&m, &pwlen); | 194 | pw = buffer_get_string(&m, &pwlen); |
195 | if (pwlen != sizeof(struct passwd)) | 195 | if (pwlen != sizeof(struct passwd)) |
196 | fatal("%s: struct passwd size mismatch", __FUNCTION__); | 196 | fatal("%s: struct passwd size mismatch", __func__); |
197 | pw->pw_name = buffer_get_string(&m, NULL); | 197 | pw->pw_name = buffer_get_string(&m, NULL); |
198 | pw->pw_passwd = buffer_get_string(&m, NULL); | 198 | pw->pw_passwd = buffer_get_string(&m, NULL); |
199 | pw->pw_gecos = buffer_get_string(&m, NULL); | 199 | pw->pw_gecos = buffer_get_string(&m, NULL); |
@@ -212,7 +212,7 @@ char* mm_auth2_read_banner(void) | |||
212 | Buffer m; | 212 | Buffer m; |
213 | char *banner; | 213 | char *banner; |
214 | 214 | ||
215 | debug3("%s entering", __FUNCTION__); | 215 | debug3("%s entering", __func__); |
216 | 216 | ||
217 | buffer_init(&m); | 217 | buffer_init(&m); |
218 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTH2_READ_BANNER, &m); | 218 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTH2_READ_BANNER, &m); |
@@ -232,7 +232,7 @@ mm_inform_authserv(char *service, char *style) | |||
232 | { | 232 | { |
233 | Buffer m; | 233 | Buffer m; |
234 | 234 | ||
235 | debug3("%s entering", __FUNCTION__); | 235 | debug3("%s entering", __func__); |
236 | 236 | ||
237 | buffer_init(&m); | 237 | buffer_init(&m); |
238 | buffer_put_cstring(&m, service); | 238 | buffer_put_cstring(&m, service); |
@@ -250,13 +250,13 @@ mm_auth_password(Authctxt *authctxt, char *password) | |||
250 | Buffer m; | 250 | Buffer m; |
251 | int authenticated = 0; | 251 | int authenticated = 0; |
252 | 252 | ||
253 | debug3("%s entering", __FUNCTION__); | 253 | debug3("%s entering", __func__); |
254 | 254 | ||
255 | buffer_init(&m); | 255 | buffer_init(&m); |
256 | buffer_put_cstring(&m, password); | 256 | buffer_put_cstring(&m, password); |
257 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHPASSWORD, &m); | 257 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHPASSWORD, &m); |
258 | 258 | ||
259 | debug3("%s: waiting for MONITOR_ANS_AUTHPASSWORD", __FUNCTION__); | 259 | debug3("%s: waiting for MONITOR_ANS_AUTHPASSWORD", __func__); |
260 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_AUTHPASSWORD, &m); | 260 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_AUTHPASSWORD, &m); |
261 | 261 | ||
262 | authenticated = buffer_get_int(&m); | 262 | authenticated = buffer_get_int(&m); |
@@ -264,7 +264,7 @@ mm_auth_password(Authctxt *authctxt, char *password) | |||
264 | buffer_free(&m); | 264 | buffer_free(&m); |
265 | 265 | ||
266 | debug3("%s: user %sauthenticated", | 266 | debug3("%s: user %sauthenticated", |
267 | __FUNCTION__, authenticated ? "" : "not "); | 267 | __func__, authenticated ? "" : "not "); |
268 | return (authenticated); | 268 | return (authenticated); |
269 | } | 269 | } |
270 | 270 | ||
@@ -300,7 +300,7 @@ mm_send_debug(Buffer *m) | |||
300 | 300 | ||
301 | while (buffer_len(m)) { | 301 | while (buffer_len(m)) { |
302 | msg = buffer_get_string(m, NULL); | 302 | msg = buffer_get_string(m, NULL); |
303 | debug3("%s: Sending debug: %s", __FUNCTION__, msg); | 303 | debug3("%s: Sending debug: %s", __func__, msg); |
304 | packet_send_debug("%s", msg); | 304 | packet_send_debug("%s", msg); |
305 | xfree(msg); | 305 | xfree(msg); |
306 | } | 306 | } |
@@ -314,7 +314,7 @@ mm_key_allowed(enum mm_keytype type, char *user, char *host, Key *key) | |||
314 | u_int len; | 314 | u_int len; |
315 | int allowed = 0; | 315 | int allowed = 0; |
316 | 316 | ||
317 | debug3("%s entering", __FUNCTION__); | 317 | debug3("%s entering", __func__); |
318 | 318 | ||
319 | /* Convert the key to a blob and the pass it over */ | 319 | /* Convert the key to a blob and the pass it over */ |
320 | if (!key_to_blob(key, &blob, &len)) | 320 | if (!key_to_blob(key, &blob, &len)) |
@@ -329,7 +329,7 @@ mm_key_allowed(enum mm_keytype type, char *user, char *host, Key *key) | |||
329 | 329 | ||
330 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYALLOWED, &m); | 330 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYALLOWED, &m); |
331 | 331 | ||
332 | debug3("%s: waiting for MONITOR_ANS_KEYALLOWED", __FUNCTION__); | 332 | debug3("%s: waiting for MONITOR_ANS_KEYALLOWED", __func__); |
333 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYALLOWED, &m); | 333 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYALLOWED, &m); |
334 | 334 | ||
335 | allowed = buffer_get_int(&m); | 335 | allowed = buffer_get_int(&m); |
@@ -356,7 +356,7 @@ mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen) | |||
356 | u_int len; | 356 | u_int len; |
357 | int verified = 0; | 357 | int verified = 0; |
358 | 358 | ||
359 | debug3("%s entering", __FUNCTION__); | 359 | debug3("%s entering", __func__); |
360 | 360 | ||
361 | /* Convert the key to a blob and the pass it over */ | 361 | /* Convert the key to a blob and the pass it over */ |
362 | if (!key_to_blob(key, &blob, &len)) | 362 | if (!key_to_blob(key, &blob, &len)) |
@@ -370,7 +370,7 @@ mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen) | |||
370 | 370 | ||
371 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYVERIFY, &m); | 371 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYVERIFY, &m); |
372 | 372 | ||
373 | debug3("%s: waiting for MONITOR_ANS_KEYVERIFY", __FUNCTION__); | 373 | debug3("%s: waiting for MONITOR_ANS_KEYVERIFY", __func__); |
374 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYVERIFY, &m); | 374 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYVERIFY, &m); |
375 | 375 | ||
376 | verified = buffer_get_int(&m); | 376 | verified = buffer_get_int(&m); |
@@ -391,7 +391,7 @@ mm_newkeys_from_blob(u_char *blob, int blen) | |||
391 | Mac *mac; | 391 | Mac *mac; |
392 | Comp *comp; | 392 | Comp *comp; |
393 | 393 | ||
394 | debug3("%s: %p(%d)", __FUNCTION__, blob, blen); | 394 | debug3("%s: %p(%d)", __func__, blob, blen); |
395 | #ifdef DEBUG_PK | 395 | #ifdef DEBUG_PK |
396 | dump_base64(stderr, blob, blen); | 396 | dump_base64(stderr, blob, blen); |
397 | #endif | 397 | #endif |
@@ -411,21 +411,21 @@ mm_newkeys_from_blob(u_char *blob, int blen) | |||
411 | enc->key = buffer_get_string(&b, &enc->key_len); | 411 | enc->key = buffer_get_string(&b, &enc->key_len); |
412 | enc->iv = buffer_get_string(&b, &len); | 412 | enc->iv = buffer_get_string(&b, &len); |
413 | if (len != enc->block_size) | 413 | if (len != enc->block_size) |
414 | fatal("%s: bad ivlen: expected %d != %d", __FUNCTION__, | 414 | fatal("%s: bad ivlen: expected %d != %d", __func__, |
415 | enc->block_size, len); | 415 | enc->block_size, len); |
416 | 416 | ||
417 | if (enc->name == NULL || cipher_by_name(enc->name) != enc->cipher) | 417 | if (enc->name == NULL || cipher_by_name(enc->name) != enc->cipher) |
418 | fatal("%s: bad cipher name %s or pointer %p", __FUNCTION__, | 418 | fatal("%s: bad cipher name %s or pointer %p", __func__, |
419 | enc->name, enc->cipher); | 419 | enc->name, enc->cipher); |
420 | 420 | ||
421 | /* Mac structure */ | 421 | /* Mac structure */ |
422 | mac->name = buffer_get_string(&b, NULL); | 422 | mac->name = buffer_get_string(&b, NULL); |
423 | if (mac->name == NULL || mac_init(mac, mac->name) == -1) | 423 | if (mac->name == NULL || mac_init(mac, mac->name) == -1) |
424 | fatal("%s: can not init mac %s", __FUNCTION__, mac->name); | 424 | fatal("%s: can not init mac %s", __func__, mac->name); |
425 | mac->enabled = buffer_get_int(&b); | 425 | mac->enabled = buffer_get_int(&b); |
426 | mac->key = buffer_get_string(&b, &len); | 426 | mac->key = buffer_get_string(&b, &len); |
427 | if (len > mac->key_len) | 427 | if (len > mac->key_len) |
428 | fatal("%s: bad mac key lenght: %d > %d", __FUNCTION__, len, | 428 | fatal("%s: bad mac key lenght: %d > %d", __func__, len, |
429 | mac->key_len); | 429 | mac->key_len); |
430 | mac->key_len = len; | 430 | mac->key_len = len; |
431 | 431 | ||
@@ -452,10 +452,10 @@ mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp) | |||
452 | Comp *comp; | 452 | Comp *comp; |
453 | Newkeys *newkey = newkeys[mode]; | 453 | Newkeys *newkey = newkeys[mode]; |
454 | 454 | ||
455 | debug3("%s: converting %p", __FUNCTION__, newkey); | 455 | debug3("%s: converting %p", __func__, newkey); |
456 | 456 | ||
457 | if (newkey == NULL) { | 457 | if (newkey == NULL) { |
458 | error("%s: newkey == NULL", __FUNCTION__); | 458 | error("%s: newkey == NULL", __func__); |
459 | return 0; | 459 | return 0; |
460 | } | 460 | } |
461 | enc = &newkey->enc; | 461 | enc = &newkey->enc; |
@@ -526,7 +526,7 @@ mm_send_keystate(struct monitor *pmonitor) | |||
526 | 526 | ||
527 | buffer_put_int(&m, packet_get_ssh1_cipher()); | 527 | buffer_put_int(&m, packet_get_ssh1_cipher()); |
528 | 528 | ||
529 | debug3("%s: Sending ssh1 IV", __FUNCTION__); | 529 | debug3("%s: Sending ssh1 IV", __func__); |
530 | ivlen = packet_get_keyiv_len(MODE_OUT); | 530 | ivlen = packet_get_keyiv_len(MODE_OUT); |
531 | packet_get_keyiv(MODE_OUT, iv, ivlen); | 531 | packet_get_keyiv(MODE_OUT, iv, ivlen); |
532 | buffer_put_string(&m, iv, ivlen); | 532 | buffer_put_string(&m, iv, ivlen); |
@@ -540,17 +540,17 @@ mm_send_keystate(struct monitor *pmonitor) | |||
540 | } | 540 | } |
541 | 541 | ||
542 | debug3("%s: Sending new keys: %p %p", | 542 | debug3("%s: Sending new keys: %p %p", |
543 | __FUNCTION__, newkeys[MODE_OUT], newkeys[MODE_IN]); | 543 | __func__, newkeys[MODE_OUT], newkeys[MODE_IN]); |
544 | 544 | ||
545 | /* Keys from Kex */ | 545 | /* Keys from Kex */ |
546 | if (!mm_newkeys_to_blob(MODE_OUT, &blob, &bloblen)) | 546 | if (!mm_newkeys_to_blob(MODE_OUT, &blob, &bloblen)) |
547 | fatal("%s: conversion of newkeys failed", __FUNCTION__); | 547 | fatal("%s: conversion of newkeys failed", __func__); |
548 | 548 | ||
549 | buffer_put_string(&m, blob, bloblen); | 549 | buffer_put_string(&m, blob, bloblen); |
550 | xfree(blob); | 550 | xfree(blob); |
551 | 551 | ||
552 | if (!mm_newkeys_to_blob(MODE_IN, &blob, &bloblen)) | 552 | if (!mm_newkeys_to_blob(MODE_IN, &blob, &bloblen)) |
553 | fatal("%s: conversion of newkeys failed", __FUNCTION__); | 553 | fatal("%s: conversion of newkeys failed", __func__); |
554 | 554 | ||
555 | buffer_put_string(&m, blob, bloblen); | 555 | buffer_put_string(&m, blob, bloblen); |
556 | xfree(blob); | 556 | xfree(blob); |
@@ -558,7 +558,7 @@ mm_send_keystate(struct monitor *pmonitor) | |||
558 | buffer_put_int(&m, packet_get_seqnr(MODE_OUT)); | 558 | buffer_put_int(&m, packet_get_seqnr(MODE_OUT)); |
559 | buffer_put_int(&m, packet_get_seqnr(MODE_IN)); | 559 | buffer_put_int(&m, packet_get_seqnr(MODE_IN)); |
560 | 560 | ||
561 | debug3("%s: New keys have been sent", __FUNCTION__); | 561 | debug3("%s: New keys have been sent", __func__); |
562 | skip: | 562 | skip: |
563 | /* More key context */ | 563 | /* More key context */ |
564 | plen = packet_get_keycontext(MODE_OUT, NULL); | 564 | plen = packet_get_keycontext(MODE_OUT, NULL); |
@@ -574,7 +574,7 @@ mm_send_keystate(struct monitor *pmonitor) | |||
574 | xfree(p); | 574 | xfree(p); |
575 | 575 | ||
576 | /* Compression state */ | 576 | /* Compression state */ |
577 | debug3("%s: Sending compression state", __FUNCTION__); | 577 | debug3("%s: Sending compression state", __func__); |
578 | buffer_put_string(&m, &outgoing_stream, sizeof(outgoing_stream)); | 578 | buffer_put_string(&m, &outgoing_stream, sizeof(outgoing_stream)); |
579 | buffer_put_string(&m, &incoming_stream, sizeof(incoming_stream)); | 579 | buffer_put_string(&m, &incoming_stream, sizeof(incoming_stream)); |
580 | 580 | ||
@@ -583,7 +583,7 @@ mm_send_keystate(struct monitor *pmonitor) | |||
583 | buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output)); | 583 | buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output)); |
584 | 584 | ||
585 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m); | 585 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m); |
586 | debug3("%s: Finished sending state", __FUNCTION__); | 586 | debug3("%s: Finished sending state", __func__); |
587 | 587 | ||
588 | buffer_free(&m); | 588 | buffer_free(&m); |
589 | } | 589 | } |
@@ -598,12 +598,12 @@ mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) | |||
598 | buffer_init(&m); | 598 | buffer_init(&m); |
599 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTY, &m); | 599 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTY, &m); |
600 | 600 | ||
601 | debug3("%s: waiting for MONITOR_ANS_PTY", __FUNCTION__); | 601 | debug3("%s: waiting for MONITOR_ANS_PTY", __func__); |
602 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PTY, &m); | 602 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PTY, &m); |
603 | 603 | ||
604 | success = buffer_get_int(&m); | 604 | success = buffer_get_int(&m); |
605 | if (success == 0) { | 605 | if (success == 0) { |
606 | debug3("%s: pty alloc failed", __FUNCTION__); | 606 | debug3("%s: pty alloc failed", __func__); |
607 | buffer_free(&m); | 607 | buffer_free(&m); |
608 | return (0); | 608 | return (0); |
609 | } | 609 | } |
@@ -647,7 +647,7 @@ mm_start_pam(char *user) | |||
647 | { | 647 | { |
648 | Buffer m; | 648 | Buffer m; |
649 | 649 | ||
650 | debug3("%s entering", __FUNCTION__); | 650 | debug3("%s entering", __func__); |
651 | 651 | ||
652 | buffer_init(&m); | 652 | buffer_init(&m); |
653 | buffer_put_cstring(&m, user); | 653 | buffer_put_cstring(&m, user); |
@@ -710,7 +710,7 @@ mm_bsdauth_query(void *ctx, char **name, char **infotxt, | |||
710 | int res; | 710 | int res; |
711 | char *challenge; | 711 | char *challenge; |
712 | 712 | ||
713 | debug3("%s: entering", __FUNCTION__); | 713 | debug3("%s: entering", __func__); |
714 | 714 | ||
715 | buffer_init(&m); | 715 | buffer_init(&m); |
716 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHQUERY, &m); | 716 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHQUERY, &m); |
@@ -719,7 +719,7 @@ mm_bsdauth_query(void *ctx, char **name, char **infotxt, | |||
719 | &m); | 719 | &m); |
720 | res = buffer_get_int(&m); | 720 | res = buffer_get_int(&m); |
721 | if (res == -1) { | 721 | if (res == -1) { |
722 | debug3("%s: no challenge", __FUNCTION__); | 722 | debug3("%s: no challenge", __func__); |
723 | buffer_free(&m); | 723 | buffer_free(&m); |
724 | return (-1); | 724 | return (-1); |
725 | } | 725 | } |
@@ -731,7 +731,7 @@ mm_bsdauth_query(void *ctx, char **name, char **infotxt, | |||
731 | mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); | 731 | mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); |
732 | (*prompts)[0] = challenge; | 732 | (*prompts)[0] = challenge; |
733 | 733 | ||
734 | debug3("%s: received challenge: %s", __FUNCTION__, challenge); | 734 | debug3("%s: received challenge: %s", __func__, challenge); |
735 | 735 | ||
736 | return (0); | 736 | return (0); |
737 | } | 737 | } |
@@ -742,7 +742,7 @@ mm_bsdauth_respond(void *ctx, u_int numresponses, char **responses) | |||
742 | Buffer m; | 742 | Buffer m; |
743 | int authok; | 743 | int authok; |
744 | 744 | ||
745 | debug3("%s: entering", __FUNCTION__); | 745 | debug3("%s: entering", __func__); |
746 | if (numresponses != 1) | 746 | if (numresponses != 1) |
747 | return (-1); | 747 | return (-1); |
748 | 748 | ||
@@ -767,7 +767,7 @@ mm_skey_query(void *ctx, char **name, char **infotxt, | |||
767 | int len, res; | 767 | int len, res; |
768 | char *p, *challenge; | 768 | char *p, *challenge; |
769 | 769 | ||
770 | debug3("%s: entering", __FUNCTION__); | 770 | debug3("%s: entering", __func__); |
771 | 771 | ||
772 | buffer_init(&m); | 772 | buffer_init(&m); |
773 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SKEYQUERY, &m); | 773 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SKEYQUERY, &m); |
@@ -776,7 +776,7 @@ mm_skey_query(void *ctx, char **name, char **infotxt, | |||
776 | &m); | 776 | &m); |
777 | res = buffer_get_int(&m); | 777 | res = buffer_get_int(&m); |
778 | if (res == -1) { | 778 | if (res == -1) { |
779 | debug3("%s: no challenge", __FUNCTION__); | 779 | debug3("%s: no challenge", __func__); |
780 | buffer_free(&m); | 780 | buffer_free(&m); |
781 | return (-1); | 781 | return (-1); |
782 | } | 782 | } |
@@ -785,7 +785,7 @@ mm_skey_query(void *ctx, char **name, char **infotxt, | |||
785 | challenge = buffer_get_string(&m, NULL); | 785 | challenge = buffer_get_string(&m, NULL); |
786 | buffer_free(&m); | 786 | buffer_free(&m); |
787 | 787 | ||
788 | debug3("%s: received challenge: %s", __FUNCTION__, challenge); | 788 | debug3("%s: received challenge: %s", __func__, challenge); |
789 | 789 | ||
790 | mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); | 790 | mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); |
791 | 791 | ||
@@ -805,7 +805,7 @@ mm_skey_respond(void *ctx, u_int numresponses, char **responses) | |||
805 | Buffer m; | 805 | Buffer m; |
806 | int authok; | 806 | int authok; |
807 | 807 | ||
808 | debug3("%s: entering", __FUNCTION__); | 808 | debug3("%s: entering", __func__); |
809 | if (numresponses != 1) | 809 | if (numresponses != 1) |
810 | return (-1); | 810 | return (-1); |
811 | 811 | ||
@@ -828,7 +828,7 @@ mm_ssh1_session_id(u_char session_id[16]) | |||
828 | Buffer m; | 828 | Buffer m; |
829 | int i; | 829 | int i; |
830 | 830 | ||
831 | debug3("%s entering", __FUNCTION__); | 831 | debug3("%s entering", __func__); |
832 | 832 | ||
833 | buffer_init(&m); | 833 | buffer_init(&m); |
834 | for (i = 0; i < 16; i++) | 834 | for (i = 0; i < 16; i++) |
@@ -847,7 +847,7 @@ mm_auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey) | |||
847 | u_int blen; | 847 | u_int blen; |
848 | int allowed = 0; | 848 | int allowed = 0; |
849 | 849 | ||
850 | debug3("%s entering", __FUNCTION__); | 850 | debug3("%s entering", __func__); |
851 | 851 | ||
852 | buffer_init(&m); | 852 | buffer_init(&m); |
853 | buffer_put_bignum2(&m, client_n); | 853 | buffer_put_bignum2(&m, client_n); |
@@ -860,7 +860,7 @@ mm_auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey) | |||
860 | if (allowed && rkey != NULL) { | 860 | if (allowed && rkey != NULL) { |
861 | blob = buffer_get_string(&m, &blen); | 861 | blob = buffer_get_string(&m, &blen); |
862 | if ((key = key_from_blob(blob, blen)) == NULL) | 862 | if ((key = key_from_blob(blob, blen)) == NULL) |
863 | fatal("%s: key_from_blob failed", __FUNCTION__); | 863 | fatal("%s: key_from_blob failed", __func__); |
864 | *rkey = key; | 864 | *rkey = key; |
865 | xfree(blob); | 865 | xfree(blob); |
866 | } | 866 | } |
@@ -878,14 +878,14 @@ mm_auth_rsa_generate_challenge(Key *key) | |||
878 | u_char *blob; | 878 | u_char *blob; |
879 | u_int blen; | 879 | u_int blen; |
880 | 880 | ||
881 | debug3("%s entering", __FUNCTION__); | 881 | debug3("%s entering", __func__); |
882 | 882 | ||
883 | if ((challenge = BN_new()) == NULL) | 883 | if ((challenge = BN_new()) == NULL) |
884 | fatal("%s: BN_new failed", __FUNCTION__); | 884 | fatal("%s: BN_new failed", __func__); |
885 | 885 | ||
886 | key->type = KEY_RSA; /* XXX cheat for key_to_blob */ | 886 | key->type = KEY_RSA; /* XXX cheat for key_to_blob */ |
887 | if (key_to_blob(key, &blob, &blen) == 0) | 887 | if (key_to_blob(key, &blob, &blen) == 0) |
888 | fatal("%s: key_to_blob failed", __FUNCTION__); | 888 | fatal("%s: key_to_blob failed", __func__); |
889 | key->type = KEY_RSA1; | 889 | key->type = KEY_RSA1; |
890 | 890 | ||
891 | buffer_init(&m); | 891 | buffer_init(&m); |
@@ -909,11 +909,11 @@ mm_auth_rsa_verify_response(Key *key, BIGNUM *p, u_char response[16]) | |||
909 | u_int blen; | 909 | u_int blen; |
910 | int success = 0; | 910 | int success = 0; |
911 | 911 | ||
912 | debug3("%s entering", __FUNCTION__); | 912 | debug3("%s entering", __func__); |
913 | 913 | ||
914 | key->type = KEY_RSA; /* XXX cheat for key_to_blob */ | 914 | key->type = KEY_RSA; /* XXX cheat for key_to_blob */ |
915 | if (key_to_blob(key, &blob, &blen) == 0) | 915 | if (key_to_blob(key, &blob, &blen) == 0) |
916 | fatal("%s: key_to_blob failed", __FUNCTION__); | 916 | fatal("%s: key_to_blob failed", __func__); |
917 | key->type = KEY_RSA1; | 917 | key->type = KEY_RSA1; |
918 | 918 | ||
919 | buffer_init(&m); | 919 | buffer_init(&m); |