summaryrefslogtreecommitdiff
path: root/monitor_wrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r--monitor_wrap.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 380175828..c5e3fb988 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"
28RCSID("$OpenBSD: monitor_wrap.c,v 1.6 2002/05/12 23:53:45 djm Exp $"); 28RCSID("$OpenBSD: monitor_wrap.c,v 1.7 2002/05/15 15:47:49 mouring Exp $");
29 29
30#include <openssl/bn.h> 30#include <openssl/bn.h>
31#include <openssl/dh.h> 31#include <openssl/dh.h>
@@ -56,7 +56,7 @@ extern int compat20;
56extern Newkeys *newkeys[]; 56extern Newkeys *newkeys[];
57extern z_stream incoming_stream; 57extern z_stream incoming_stream;
58extern z_stream outgoing_stream; 58extern z_stream outgoing_stream;
59extern struct monitor *monitor; 59extern struct monitor *pmonitor;
60extern Buffer input, output; 60extern Buffer input, output;
61 61
62void 62void
@@ -126,10 +126,10 @@ mm_choose_dh(int min, int nbits, int max)
126 buffer_put_int(&m, nbits); 126 buffer_put_int(&m, nbits);
127 buffer_put_int(&m, max); 127 buffer_put_int(&m, max);
128 128
129 mm_request_send(monitor->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", __FUNCTION__);
132 mm_request_receive_expect(monitor->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)
@@ -151,7 +151,7 @@ mm_choose_dh(int min, int nbits, int max)
151int 151int
152mm_key_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen) 152mm_key_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen)
153{ 153{
154 Kex *kex = *monitor->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", __FUNCTION__);
@@ -160,10 +160,10 @@ mm_key_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen)
160 buffer_put_int(&m, kex->host_key_index(key)); 160 buffer_put_int(&m, kex->host_key_index(key));
161 buffer_put_string(&m, data, datalen); 161 buffer_put_string(&m, data, datalen);
162 162
163 mm_request_send(monitor->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", __FUNCTION__);
166 mm_request_receive_expect(monitor->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);
169 169
@@ -182,10 +182,10 @@ mm_getpwnamallow(const char *login)
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(monitor->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", __FUNCTION__);
188 mm_request_receive_expect(monitor->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) {
191 buffer_free(&m); 191 buffer_free(&m);
@@ -215,10 +215,10 @@ char* mm_auth2_read_banner(void)
215 debug3("%s entering", __FUNCTION__); 215 debug3("%s entering", __FUNCTION__);
216 216
217 buffer_init(&m); 217 buffer_init(&m);
218 mm_request_send(monitor->m_recvfd, MONITOR_REQ_AUTH2_READ_BANNER, &m); 218 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTH2_READ_BANNER, &m);
219 buffer_clear(&m); 219 buffer_clear(&m);
220 220
221 mm_request_receive_expect(monitor->m_recvfd, MONITOR_ANS_AUTH2_READ_BANNER, &m); 221 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_AUTH2_READ_BANNER, &m);
222 banner = buffer_get_string(&m, NULL); 222 banner = buffer_get_string(&m, NULL);
223 buffer_free(&m); 223 buffer_free(&m);
224 224
@@ -238,7 +238,7 @@ mm_inform_authserv(char *service, char *style)
238 buffer_put_cstring(&m, service); 238 buffer_put_cstring(&m, service);
239 buffer_put_cstring(&m, style ? style : ""); 239 buffer_put_cstring(&m, style ? style : "");
240 240
241 mm_request_send(monitor->m_recvfd, MONITOR_REQ_AUTHSERV, &m); 241 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHSERV, &m);
242 242
243 buffer_free(&m); 243 buffer_free(&m);
244} 244}
@@ -254,10 +254,10 @@ mm_auth_password(Authctxt *authctxt, char *password)
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(monitor->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", __FUNCTION__);
260 mm_request_receive_expect(monitor->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);
263 263
@@ -327,10 +327,10 @@ mm_key_allowed(enum mm_keytype type, char *user, char *host, Key *key)
327 buffer_put_string(&m, blob, len); 327 buffer_put_string(&m, blob, len);
328 xfree(blob); 328 xfree(blob);
329 329
330 mm_request_send(monitor->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", __FUNCTION__);
333 mm_request_receive_expect(monitor->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);
336 336
@@ -368,10 +368,10 @@ mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
368 buffer_put_string(&m, data, datalen); 368 buffer_put_string(&m, data, datalen);
369 xfree(blob); 369 xfree(blob);
370 370
371 mm_request_send(monitor->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", __FUNCTION__);
374 mm_request_receive_expect(monitor->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);
377 377
@@ -510,7 +510,7 @@ mm_send_kex(Buffer *m, Kex *kex)
510} 510}
511 511
512void 512void
513mm_send_keystate(struct monitor *monitor) 513mm_send_keystate(struct monitor *pmonitor)
514{ 514{
515 Buffer m; 515 Buffer m;
516 u_char *blob, *p; 516 u_char *blob, *p;
@@ -536,7 +536,7 @@ mm_send_keystate(struct monitor *monitor)
536 goto skip; 536 goto skip;
537 } else { 537 } else {
538 /* Kex for rekeying */ 538 /* Kex for rekeying */
539 mm_send_kex(&m, *monitor->m_pkex); 539 mm_send_kex(&m, *pmonitor->m_pkex);
540 } 540 }
541 541
542 debug3("%s: Sending new keys: %p %p", 542 debug3("%s: Sending new keys: %p %p",
@@ -582,7 +582,7 @@ mm_send_keystate(struct monitor *monitor)
582 buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input)); 582 buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input));
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(monitor->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", __FUNCTION__);
587 587
588 buffer_free(&m); 588 buffer_free(&m);
@@ -596,10 +596,10 @@ mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
596 int success = 0; 596 int success = 0;
597 597
598 buffer_init(&m); 598 buffer_init(&m);
599 mm_request_send(monitor->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", __FUNCTION__);
602 mm_request_receive_expect(monitor->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) {
@@ -613,8 +613,8 @@ mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
613 strlcpy(namebuf, p, namebuflen); /* Possible truncation */ 613 strlcpy(namebuf, p, namebuflen); /* Possible truncation */
614 xfree(p); 614 xfree(p);
615 615
616 *ptyfd = mm_receive_fd(monitor->m_recvfd); 616 *ptyfd = mm_receive_fd(pmonitor->m_recvfd);
617 *ttyfd = mm_receive_fd(monitor->m_recvfd); 617 *ttyfd = mm_receive_fd(pmonitor->m_recvfd);
618 618
619 /* Success */ 619 /* Success */
620 return (1); 620 return (1);
@@ -630,7 +630,7 @@ mm_session_pty_cleanup2(void *session)
630 return; 630 return;
631 buffer_init(&m); 631 buffer_init(&m);
632 buffer_put_cstring(&m, s->tty); 632 buffer_put_cstring(&m, s->tty);
633 mm_request_send(monitor->m_recvfd, MONITOR_REQ_PTYCLEANUP, &m); 633 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTYCLEANUP, &m);
634 buffer_free(&m); 634 buffer_free(&m);
635 635
636 /* closed dup'ed master */ 636 /* closed dup'ed master */
@@ -652,7 +652,7 @@ mm_start_pam(char *user)
652 buffer_init(&m); 652 buffer_init(&m);
653 buffer_put_cstring(&m, user); 653 buffer_put_cstring(&m, user);
654 654
655 mm_request_send(monitor->m_recvfd, MONITOR_REQ_PAM_START, &m); 655 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_START, &m);
656 656
657 buffer_free(&m); 657 buffer_free(&m);
658} 658}
@@ -666,7 +666,7 @@ mm_terminate(void)
666 Buffer m; 666 Buffer m;
667 667
668 buffer_init(&m); 668 buffer_init(&m);
669 mm_request_send(monitor->m_recvfd, MONITOR_REQ_TERM, &m); 669 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_TERM, &m);
670 buffer_free(&m); 670 buffer_free(&m);
671} 671}
672 672
@@ -678,9 +678,9 @@ mm_ssh1_session_key(BIGNUM *num)
678 678
679 buffer_init(&m); 679 buffer_init(&m);
680 buffer_put_bignum2(&m, num); 680 buffer_put_bignum2(&m, num);
681 mm_request_send(monitor->m_recvfd, MONITOR_REQ_SESSKEY, &m); 681 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SESSKEY, &m);
682 682
683 mm_request_receive_expect(monitor->m_recvfd, MONITOR_ANS_SESSKEY, &m); 683 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SESSKEY, &m);
684 684
685 rsafail = buffer_get_int(&m); 685 rsafail = buffer_get_int(&m);
686 buffer_get_bignum2(&m, num); 686 buffer_get_bignum2(&m, num);
@@ -713,9 +713,9 @@ mm_bsdauth_query(void *ctx, char **name, char **infotxt,
713 debug3("%s: entering", __FUNCTION__); 713 debug3("%s: entering", __FUNCTION__);
714 714
715 buffer_init(&m); 715 buffer_init(&m);
716 mm_request_send(monitor->m_recvfd, MONITOR_REQ_BSDAUTHQUERY, &m); 716 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHQUERY, &m);
717 717
718 mm_request_receive_expect(monitor->m_recvfd, MONITOR_ANS_BSDAUTHQUERY, 718 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_BSDAUTHQUERY,
719 &m); 719 &m);
720 res = buffer_get_int(&m); 720 res = buffer_get_int(&m);
721 if (res == -1) { 721 if (res == -1) {
@@ -748,9 +748,9 @@ mm_bsdauth_respond(void *ctx, u_int numresponses, char **responses)
748 748
749 buffer_init(&m); 749 buffer_init(&m);
750 buffer_put_cstring(&m, responses[0]); 750 buffer_put_cstring(&m, responses[0]);
751 mm_request_send(monitor->m_recvfd, MONITOR_REQ_BSDAUTHRESPOND, &m); 751 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHRESPOND, &m);
752 752
753 mm_request_receive_expect(monitor->m_recvfd, 753 mm_request_receive_expect(pmonitor->m_recvfd,
754 MONITOR_ANS_BSDAUTHRESPOND, &m); 754 MONITOR_ANS_BSDAUTHRESPOND, &m);
755 755
756 authok = buffer_get_int(&m); 756 authok = buffer_get_int(&m);
@@ -770,9 +770,9 @@ mm_skey_query(void *ctx, char **name, char **infotxt,
770 debug3("%s: entering", __FUNCTION__); 770 debug3("%s: entering", __FUNCTION__);
771 771
772 buffer_init(&m); 772 buffer_init(&m);
773 mm_request_send(monitor->m_recvfd, MONITOR_REQ_SKEYQUERY, &m); 773 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SKEYQUERY, &m);
774 774
775 mm_request_receive_expect(monitor->m_recvfd, MONITOR_ANS_SKEYQUERY, 775 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SKEYQUERY,
776 &m); 776 &m);
777 res = buffer_get_int(&m); 777 res = buffer_get_int(&m);
778 if (res == -1) { 778 if (res == -1) {
@@ -811,9 +811,9 @@ mm_skey_respond(void *ctx, u_int numresponses, char **responses)
811 811
812 buffer_init(&m); 812 buffer_init(&m);
813 buffer_put_cstring(&m, responses[0]); 813 buffer_put_cstring(&m, responses[0]);
814 mm_request_send(monitor->m_recvfd, MONITOR_REQ_SKEYRESPOND, &m); 814 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SKEYRESPOND, &m);
815 815
816 mm_request_receive_expect(monitor->m_recvfd, 816 mm_request_receive_expect(pmonitor->m_recvfd,
817 MONITOR_ANS_SKEYRESPOND, &m); 817 MONITOR_ANS_SKEYRESPOND, &m);
818 818
819 authok = buffer_get_int(&m); 819 authok = buffer_get_int(&m);
@@ -834,7 +834,7 @@ mm_ssh1_session_id(u_char session_id[16])
834 for (i = 0; i < 16; i++) 834 for (i = 0; i < 16; i++)
835 buffer_put_char(&m, session_id[i]); 835 buffer_put_char(&m, session_id[i]);
836 836
837 mm_request_send(monitor->m_recvfd, MONITOR_REQ_SESSID, &m); 837 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SESSID, &m);
838 buffer_free(&m); 838 buffer_free(&m);
839} 839}
840 840
@@ -852,8 +852,8 @@ mm_auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
852 buffer_init(&m); 852 buffer_init(&m);
853 buffer_put_bignum2(&m, client_n); 853 buffer_put_bignum2(&m, client_n);
854 854
855 mm_request_send(monitor->m_recvfd, MONITOR_REQ_RSAKEYALLOWED, &m); 855 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_RSAKEYALLOWED, &m);
856 mm_request_receive_expect(monitor->m_recvfd, MONITOR_ANS_RSAKEYALLOWED, &m); 856 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_RSAKEYALLOWED, &m);
857 857
858 allowed = buffer_get_int(&m); 858 allowed = buffer_get_int(&m);
859 859
@@ -892,8 +892,8 @@ mm_auth_rsa_generate_challenge(Key *key)
892 buffer_put_string(&m, blob, blen); 892 buffer_put_string(&m, blob, blen);
893 xfree(blob); 893 xfree(blob);
894 894
895 mm_request_send(monitor->m_recvfd, MONITOR_REQ_RSACHALLENGE, &m); 895 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_RSACHALLENGE, &m);
896 mm_request_receive_expect(monitor->m_recvfd, MONITOR_ANS_RSACHALLENGE, &m); 896 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_RSACHALLENGE, &m);
897 897
898 buffer_get_bignum2(&m, challenge); 898 buffer_get_bignum2(&m, challenge);
899 buffer_free(&m); 899 buffer_free(&m);
@@ -921,8 +921,8 @@ mm_auth_rsa_verify_response(Key *key, BIGNUM *p, u_char response[16])
921 buffer_put_string(&m, response, 16); 921 buffer_put_string(&m, response, 16);
922 xfree(blob); 922 xfree(blob);
923 923
924 mm_request_send(monitor->m_recvfd, MONITOR_REQ_RSARESPONSE, &m); 924 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_RSARESPONSE, &m);
925 mm_request_receive_expect(monitor->m_recvfd, MONITOR_ANS_RSARESPONSE, &m); 925 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_RSARESPONSE, &m);
926 926
927 success = buffer_get_int(&m); 927 success = buffer_get_int(&m);
928 buffer_free(&m); 928 buffer_free(&m);