Mercurial > dropbear
annotate cli-service.c @ 64:efb5e0b335cf
TCP forwarding works.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 12 Aug 2004 13:48:42 +0000 |
parents | 9ee8996a375f |
children | e3adf4cf5465 |
rev | line source |
---|---|
33 | 1 #include "includes.h" |
2 #include "service.h" | |
3 #include "dbutil.h" | |
4 #include "packet.h" | |
5 #include "buffer.h" | |
6 #include "session.h" | |
7 #include "ssh.h" | |
8 | |
9 void send_msg_service_request(char* servicename) { | |
10 | |
11 TRACE(("enter send_msg_service_request: servicename='%s'", servicename)); | |
12 | |
13 CHECKCLEARTOWRITE(); | |
14 | |
34
e2a1eaa19f22
Client mostly works up to password auth
Matt Johnston <matt@ucc.asn.au>
parents:
33
diff
changeset
|
15 buf_putbyte(ses.writepayload, SSH_MSG_SERVICE_REQUEST); |
e2a1eaa19f22
Client mostly works up to password auth
Matt Johnston <matt@ucc.asn.au>
parents:
33
diff
changeset
|
16 buf_putstring(ses.writepayload, servicename, strlen(servicename)); |
33 | 17 |
18 encrypt_packet(); | |
19 TRACE(("leave send_msg_service_request")); | |
20 } | |
21 | |
22 /* This just sets up the state variables right for the main client session loop | |
23 * to deal with */ | |
24 void recv_msg_service_accept() { | |
25 | |
26 unsigned char* servicename; | |
27 unsigned int len; | |
28 | |
29 TRACE(("enter recv_msg_service_accept")); | |
30 | |
31 servicename = buf_getstring(ses.payload, &len); | |
32 | |
33 /* ssh-userauth */ | |
45
9ee8996a375f
Pubkey auth is mostly there for the client. Something strange with
Matt Johnston <matt@ucc.asn.au>
parents:
34
diff
changeset
|
34 if (cli_ses.state == SERVICE_AUTH_REQ_SENT |
33 | 35 && len == SSH_SERVICE_USERAUTH_LEN |
36 && strncmp(SSH_SERVICE_USERAUTH, servicename, len) == 0) { | |
37 | |
38 cli_ses.state = SERVICE_AUTH_ACCEPT_RCVD; | |
39 m_free(servicename); | |
40 TRACE(("leave recv_msg_service_accept: done ssh-userauth")); | |
41 return; | |
42 } | |
43 | |
44 /* ssh-connection */ | |
45
9ee8996a375f
Pubkey auth is mostly there for the client. Something strange with
Matt Johnston <matt@ucc.asn.au>
parents:
34
diff
changeset
|
45 if (cli_ses.state == SERVICE_CONN_REQ_SENT |
33 | 46 && len == SSH_SERVICE_CONNECTION_LEN |
47 && strncmp(SSH_SERVICE_CONNECTION, servicename, len) == 0) { | |
48 | |
49 if (ses.authstate.authdone != 1) { | |
50 dropbear_exit("request for connection before auth"); | |
51 } | |
52 | |
53 cli_ses.state = SERVICE_CONN_ACCEPT_RCVD; | |
54 m_free(servicename); | |
55 TRACE(("leave recv_msg_service_accept: done ssh-connection")); | |
56 return; | |
57 } | |
58 | |
59 dropbear_exit("unrecognised service accept"); | |
60 /* m_free(servicename); not reached */ | |
61 | |
62 } |