Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LSH
lsh
Commits
51bb172c
Commit
51bb172c
authored
Sep 15, 1998
by
Niels Möller
Browse files
New function connection_init_io().
Rev: src/connection.c:1.7
parent
8d65a829
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/connection.c
View file @
51bb172c
...
...
@@ -4,10 +4,11 @@
#include
"connection.h"
#include
"encrypt.h"
#include
"format.h"
#include
"
packet_
disconnect.h"
#include
"disconnect.h"
#include
"packet_ignore.h"
#include
"pad.h"
#include
"ssh.h"
#include
"werror.h"
#include
"xalloc.h"
...
...
@@ -32,6 +33,12 @@ static int handle_connection(struct abstract_write **w,
lsh_string_free
(
packet
);
return
WRITE_OK
;
}
/* If we are expecting a NEWKEYS message, don't accept anything else. */
if
(
closure
->
dispatch
[
SSH_MSG_NEWKEYS
]
&&
(
msg
!=
SSH_MSG_NEWKEYS
))
return
WRITE_CLOSED
;
return
HANDLE_PACKET
(
closure
->
dispatch
[
msg
],
closure
,
packet
);
}
...
...
@@ -64,7 +71,7 @@ static int do_unimplemented(struct packet_handler *closure,
return
res
;
}
struct
packet_handler
*
make_unimplemented_handler
()
struct
packet_handler
*
make_unimplemented_handler
()
{
struct
packet_handler
*
res
=
xalloc
(
sizeof
(
struct
packet_handler
));
...
...
@@ -77,10 +84,10 @@ struct ssh_connection *make_ssh_connection(struct packet_handler *kex_handler)
{
struct
ssh_connection
*
connection
=
xalloc
(
sizeof
(
struct
ssh_connection
));
int
i
;
connection
->
super
.
write
=
handle_connection
;
connection
->
max_packet
=
0x8000
;
connection
->
super
.
write
=
handle_connection
;
/* Initialize dispatch */
connection
->
ignore
=
make_ignore_handler
();
connection
->
unimplemented
=
make_unimplemented_handler
();
connection
->
fail
=
make_fail_handler
();
...
...
@@ -128,3 +135,20 @@ struct ssh_connection *make_ssh_connection(struct packet_handler *kex_handler)
return
connection
;
}
void
connection_init_io
(
struct
ssh_connection
*
connection
,
struct
abstract_write
*
raw
,
struct
randomness
*
r
)
{
/* Initialize i/o hooks */
connection
->
raw
=
raw
;
connection
->
write
=
make_packet_pad
(
make_packet_encrypt
(
raw
,
connection
),
connection
,
r
);
connection
->
send_crypto
=
connection
->
rec_crypto
=
NULL
;
connection
->
send_mac
=
connection
->
rec_mac
=
NULL
;
connection
->
rec_max_packet
=
0x8000
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment