mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-28 18:01:21 +02:00
85 lines
2.3 KiB
Diff
85 lines
2.3 KiB
Diff
diff --git a/tinyssh-tests/packet_uinmplementedtest.c b/tinyssh-tests/packet_uinmplementedtest.c
|
|
new file mode 120000
|
|
index 0000000..c1c5f9b
|
|
--- /dev/null
|
|
+++ b/tinyssh-tests/packet_uinmplementedtest.c
|
|
@@ -0,0 +1 @@
|
|
+emptytest.c
|
|
\ No newline at end of file
|
|
diff --git a/tinyssh/LIBS b/tinyssh/LIBS
|
|
index 7f1bcf5..9c1f27a 100644
|
|
--- a/tinyssh/LIBS
|
|
+++ b/tinyssh/LIBS
|
|
@@ -36,6 +36,7 @@ packetparser.o
|
|
packet_put.o
|
|
packet_recv.o
|
|
packet_send.o
|
|
+packet_uinmplemented.o
|
|
porttostr.o
|
|
randommod.o
|
|
readall.o
|
|
diff --git a/tinyssh/SOURCES b/tinyssh/SOURCES
|
|
index be77a5f..613535d 100644
|
|
--- a/tinyssh/SOURCES
|
|
+++ b/tinyssh/SOURCES
|
|
@@ -36,6 +36,7 @@ packetparser
|
|
packet_put
|
|
packet_recv
|
|
packet_send
|
|
+packet_uinmplemented
|
|
porttostr
|
|
randommod
|
|
readall
|
|
diff --git a/tinyssh/packet.h b/tinyssh/packet.h
|
|
index 891ede8..b2cba92 100644
|
|
--- a/tinyssh/packet.h
|
|
+++ b/tinyssh/packet.h
|
|
@@ -127,4 +127,7 @@ extern int packet_channel_send_windowadjust(struct buf *);
|
|
extern void packet_channel_send_eof(struct buf *);
|
|
extern int packet_channel_send_close(struct buf *, int, int);
|
|
|
|
+/* packet_uinmplemented.c */
|
|
+extern int packet_uinmplemented(struct buf *);
|
|
+
|
|
#endif
|
|
diff --git a/tinyssh/packet_uinmplemented.c b/tinyssh/packet_uinmplemented.c
|
|
new file mode 100644
|
|
index 0000000..1ca82d6
|
|
--- /dev/null
|
|
+++ b/tinyssh/packet_uinmplemented.c
|
|
@@ -0,0 +1,18 @@
|
|
+/*
|
|
+20150719
|
|
+Jan Mojzis
|
|
+Public domain.
|
|
+*/
|
|
+
|
|
+#include "buf.h"
|
|
+#include "ssh.h"
|
|
+#include "packet.h"
|
|
+
|
|
+int packet_uinmplemented(struct buf *b) {
|
|
+
|
|
+ buf_purge(b);
|
|
+ buf_putnum8(b, SSH_MSG_UNIMPLEMENTED); /* SSH_MSG_UNIMPLEMENTED */
|
|
+ buf_putnum32(b, packet.receivepacketid); /* packeid */
|
|
+ packet_put(b);
|
|
+ return packet_sendall();
|
|
+}
|
|
diff --git a/tinyssh/tinysshd.c b/tinyssh/tinysshd.c
|
|
index ba44584..78677f5 100644
|
|
--- a/tinyssh/tinysshd.c
|
|
+++ b/tinyssh/tinysshd.c
|
|
@@ -300,8 +300,8 @@ int main(int argc, char **argv) {
|
|
case SSH_MSG_KEXINIT:
|
|
goto rekeying;
|
|
default:
|
|
- die_fatal("unknown message type", 0, 0);
|
|
- /* XXX TODO - send SSH_MSG_UNIMPLEMENTED */
|
|
+ log_d1("unknown packet - sending SSH_MSG_UNIMPLEMENTED message");
|
|
+ if (!packet_uinmplemented(&b1)) die_fatal("unable to send SSH_MSG_UNIMPLEMENTED message", 0, 0);
|
|
}
|
|
}
|
|
}
|
|
|