From a4c404ea9ce75a01c35446383db11f2dbab6da58 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Tue, 17 May 2022 21:05:51 +0430 Subject: Ports: Update dropbear's patches to use git patches --- .../0001-Disable-some-default-options.patch | 37 ++++++++ Ports/dropbear/patches/0002-Disable-SSP.patch | 100 +++++++++++++++++++++ .../patches/0003-Include-sys-select.h.patch | 25 ++++++ .../dropbear/patches/0004-Install-in-bindir.patch | 28 ++++++ ...Remove-some-unsupported-socket-operations.patch | 57 ++++++++++++ Ports/dropbear/patches/ReadMe.md | 34 +++++++ Ports/dropbear/patches/default-options.patch | 24 ----- Ports/dropbear/patches/disable-ssp.patch | 88 ------------------ Ports/dropbear/patches/fix-includes.patch | 13 --- Ports/dropbear/patches/install-in-bin.patch | 14 --- Ports/dropbear/patches/netio.patch | 44 --------- 11 files changed, 281 insertions(+), 183 deletions(-) create mode 100644 Ports/dropbear/patches/0001-Disable-some-default-options.patch create mode 100644 Ports/dropbear/patches/0002-Disable-SSP.patch create mode 100644 Ports/dropbear/patches/0003-Include-sys-select.h.patch create mode 100644 Ports/dropbear/patches/0004-Install-in-bindir.patch create mode 100644 Ports/dropbear/patches/0005-Remove-some-unsupported-socket-operations.patch create mode 100644 Ports/dropbear/patches/ReadMe.md delete mode 100644 Ports/dropbear/patches/default-options.patch delete mode 100644 Ports/dropbear/patches/disable-ssp.patch delete mode 100644 Ports/dropbear/patches/fix-includes.patch delete mode 100644 Ports/dropbear/patches/install-in-bin.patch delete mode 100644 Ports/dropbear/patches/netio.patch diff --git a/Ports/dropbear/patches/0001-Disable-some-default-options.patch b/Ports/dropbear/patches/0001-Disable-some-default-options.patch new file mode 100644 index 0000000000..077bc61388 --- /dev/null +++ b/Ports/dropbear/patches/0001-Disable-some-default-options.patch @@ -0,0 +1,37 @@ +From 828399ef58c44dfe248c46bd3e7cadfcb904c5cd Mon Sep 17 00:00:00 2001 +From: Patrick Meyer +Date: Thu, 28 Apr 2022 01:50:11 +0000 +Subject: [PATCH 1/5] Disable some default options + +Co-Authored-By: Yonatan Goldschmidt +--- + default_options.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/default_options.h b/default_options.h +index 536f4e7..5073b7c 100644 +--- a/default_options.h ++++ b/default_options.h +@@ -72,8 +72,8 @@ IMPORTANT: Some options will require "make clean" after changes */ + #define DROPBEAR_SVR_REMOTETCPFWD 1 + + /* Enable Authentication Agent Forwarding */ +-#define DROPBEAR_SVR_AGENTFWD 1 +-#define DROPBEAR_CLI_AGENTFWD 1 ++#define DROPBEAR_SVR_AGENTFWD 0 ++#define DROPBEAR_CLI_AGENTFWD 0 + + /* Note: Both DROPBEAR_CLI_PROXYCMD and DROPBEAR_CLI_NETCAT must be set to + * allow multihop dbclient connections */ +@@ -210,7 +210,7 @@ group1 in Dropbear server too */ + + /* Authentication Types - at least one required. + RFC Draft requires pubkey auth, and recommends password */ +-#define DROPBEAR_SVR_PASSWORD_AUTH 1 ++#define DROPBEAR_SVR_PASSWORD_AUTH 0 + + /* Note: PAM auth is quite simple and only works for PAM modules which just do + * a simple "Login: " "Password: " (you can edit the strings in svr-authpam.c). +-- +2.36.1 + diff --git a/Ports/dropbear/patches/0002-Disable-SSP.patch b/Ports/dropbear/patches/0002-Disable-SSP.patch new file mode 100644 index 0000000000..b2a29a0f09 --- /dev/null +++ b/Ports/dropbear/patches/0002-Disable-SSP.patch @@ -0,0 +1,100 @@ +From 634f30f41971933508832954c142cc6c384d19ed Mon Sep 17 00:00:00 2001 +From: Patrick Meyer +Date: Thu, 28 Apr 2022 01:50:11 +0000 +Subject: [PATCH 2/5] Disable SSP + +Co-Authored-By: Yonatan Goldschmidt +--- + configure | 46 ---------------------------------------------- + configure.ac | 17 +---------------- + 2 files changed, 1 insertion(+), 62 deletions(-) + +diff --git a/configure b/configure +index 8374714..8c9eb9a 100755 +--- a/configure ++++ b/configure +@@ -3381,53 +3381,7 @@ fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi # non-static +- # stack protector. -strong is good but only in gcc 4.9 or later +- OLDCFLAGS="$CFLAGS" +- TESTFLAGS="-fstack-protector-strong" +- CFLAGS="$CFLAGS $TESTFLAGS" +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-int +-main () +-{ + +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_compile "$LINENO"; then : +- { $as_echo "$as_me:${as_lineno-$LINENO}: Setting $TESTFLAGS" >&5 +-$as_echo "$as_me: Setting $TESTFLAGS" >&6;} +-else +- +- CFLAGS="$OLDCFLAGS" +- TESTFLAGS="-fstack-protector --param=ssp-buffer-size=4" +- CFLAGS="$CFLAGS $TESTFLAGS" +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-int +-main () +-{ +- +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_compile "$LINENO"; then : +- { $as_echo "$as_me:${as_lineno-$LINENO}: Setting $TESTFLAGS" >&5 +-$as_echo "$as_me: Setting $TESTFLAGS" >&6;} +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: Not setting $TESTFLAGS" >&5 +-$as_echo "$as_me: Not setting $TESTFLAGS" >&6;}; CFLAGS="$OLDCFLAGS" +- +-fi +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +- +- +-fi +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # FORTIFY_SOURCE + { + OLDFLAGS="$CFLAGS" +diff --git a/configure.ac b/configure.ac +index 6a19479..28cd987 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -103,22 +103,7 @@ if test "$hardenbuild" -eq 1; then + [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ] + ) + fi # non-static +- # stack protector. -strong is good but only in gcc 4.9 or later +- OLDCFLAGS="$CFLAGS" +- TESTFLAGS="-fstack-protector-strong" +- CFLAGS="$CFLAGS $TESTFLAGS" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], +- [AC_MSG_NOTICE([Setting $TESTFLAGS])], +- [ +- CFLAGS="$OLDCFLAGS" +- TESTFLAGS="-fstack-protector --param=ssp-buffer-size=4" +- CFLAGS="$CFLAGS $TESTFLAGS" +- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], +- [AC_MSG_NOTICE([Setting $TESTFLAGS])], +- [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ] +- ) +- ] +- ) ++ + # FORTIFY_SOURCE + DB_TRYADDCFLAGS([-D_FORTIFY_SOURCE=2]) + +-- +2.36.1 + diff --git a/Ports/dropbear/patches/0003-Include-sys-select.h.patch b/Ports/dropbear/patches/0003-Include-sys-select.h.patch new file mode 100644 index 0000000000..2a5ba50eba --- /dev/null +++ b/Ports/dropbear/patches/0003-Include-sys-select.h.patch @@ -0,0 +1,25 @@ +From 6515921fcacaa71f666963a8ef8a8b3c0ad64eb2 Mon Sep 17 00:00:00 2001 +From: Patrick Meyer +Date: Thu, 28 Apr 2022 01:50:11 +0000 +Subject: [PATCH 3/5] Include + +Co-Authored-By: Yonatan Goldschmidt +--- + includes.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/includes.h b/includes.h +index 1e00002..2208f94 100644 +--- a/includes.h ++++ b/includes.h +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + #include + #include +-- +2.36.1 + diff --git a/Ports/dropbear/patches/0004-Install-in-bindir.patch b/Ports/dropbear/patches/0004-Install-in-bindir.patch new file mode 100644 index 0000000000..8ab1c8ca31 --- /dev/null +++ b/Ports/dropbear/patches/0004-Install-in-bindir.patch @@ -0,0 +1,28 @@ +From 06371c6e143c43c31070a80d8d717e3213316296 Mon Sep 17 00:00:00 2001 +From: Patrick Meyer +Date: Thu, 28 Apr 2022 01:50:11 +0000 +Subject: [PATCH 4/5] Install in bindir + +FIXME: Not sure what this is exactly doing. + +Co-Authored-By: Yonatan Goldschmidt +--- + Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.in b/Makefile.in +index e824491..f30f508 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -97,7 +97,7 @@ prefix=@prefix@ + exec_prefix=@exec_prefix@ + datarootdir = @datarootdir@ + bindir=@bindir@ +-sbindir=@sbindir@ ++sbindir=$(bindir) + mandir=@mandir@ + + .DELETE_ON_ERROR: +-- +2.36.1 + diff --git a/Ports/dropbear/patches/0005-Remove-some-unsupported-socket-operations.patch b/Ports/dropbear/patches/0005-Remove-some-unsupported-socket-operations.patch new file mode 100644 index 0000000000..55949408bb --- /dev/null +++ b/Ports/dropbear/patches/0005-Remove-some-unsupported-socket-operations.patch @@ -0,0 +1,57 @@ +From bc87404dcffad4d0e1577bf407a0bfbacb2d79f2 Mon Sep 17 00:00:00 2001 +From: Patrick Meyer +Date: Thu, 28 Apr 2022 01:50:11 +0000 +Subject: [PATCH 5/5] Remove some unsupported socket operations + +Co-Authored-By: Yonatan Goldschmidt +--- + netio.c | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +diff --git a/netio.c b/netio.c +index 2ed9bb1..e0e9962 100644 +--- a/netio.c ++++ b/netio.c +@@ -304,7 +304,7 @@ void packet_queue_to_iovec(const struct Queue *queue, struct iovec *iov, unsigne + buffer *writebuf; + + #ifndef IOV_MAX +- #if defined(__CYGWIN__) && !defined(UIO_MAXIOV) ++ #if !defined(UIO_MAXIOV) + #define IOV_MAX 1024 + #elif defined(__sgi) + #define IOV_MAX 512 +@@ -346,11 +346,7 @@ void packet_queue_consume(struct Queue *queue, ssize_t written) { + } + + void set_sock_nodelay(int sock) { +- int val; +- +- /* disable nagle */ +- val = 1; +- setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val)); ++ (void)sock; + } + + #if DROPBEAR_SERVER_TCP_FAST_OPEN +@@ -469,7 +465,6 @@ int dropbear_listen(const char* address, const char* port, + struct addrinfo hints, *res = NULL, *res0 = NULL; + int err; + unsigned int nsock; +- struct linger linger; + int val; + int sock; + uint16_t *allocated_lport_p = NULL; +@@ -548,9 +543,6 @@ int dropbear_listen(const char* address, const char* port, + val = 1; + /* set to reuse, quick timeout */ + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &val, sizeof(val)); +- linger.l_onoff = 1; +- linger.l_linger = 5; +- setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger)); + + #if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY) + if (res->ai_family == AF_INET6) { +-- +2.36.1 + diff --git a/Ports/dropbear/patches/ReadMe.md b/Ports/dropbear/patches/ReadMe.md new file mode 100644 index 0000000000..76d60d08f5 --- /dev/null +++ b/Ports/dropbear/patches/ReadMe.md @@ -0,0 +1,34 @@ +# Patches for dropbear on SerenityOS + +## `0001-Disable-some-default-options.patch` + +Disable some default options + + + +## `0002-Disable-SSP.patch` + +Disable SSP + + + +## `0003-Include-sys-select.h.patch` + +Include + + + +## `0004-Install-in-bindir.patch` + +Install in bindir + +FIXME: Not sure what this is exactly doing. + + + +## `0005-Remove-some-unsupported-socket-operations.patch` + +Remove some unsupported socket operations + + + diff --git a/Ports/dropbear/patches/default-options.patch b/Ports/dropbear/patches/default-options.patch deleted file mode 100644 index bc5a30f5fe..0000000000 --- a/Ports/dropbear/patches/default-options.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/default_options.h b/default_options.h -index 536f4e7..5073b7c 100644 ---- a/default_options.h -+++ b/default_options.h -@@ -72,8 +72,8 @@ IMPORTANT: Some options will require "make clean" after changes */ - #define DROPBEAR_SVR_REMOTETCPFWD 1 - - /* Enable Authentication Agent Forwarding */ --#define DROPBEAR_SVR_AGENTFWD 1 --#define DROPBEAR_CLI_AGENTFWD 1 -+#define DROPBEAR_SVR_AGENTFWD 0 -+#define DROPBEAR_CLI_AGENTFWD 0 - - /* Note: Both DROPBEAR_CLI_PROXYCMD and DROPBEAR_CLI_NETCAT must be set to - * allow multihop dbclient connections */ -@@ -210,7 +210,7 @@ group1 in Dropbear server too */ - - /* Authentication Types - at least one required. - RFC Draft requires pubkey auth, and recommends password */ --#define DROPBEAR_SVR_PASSWORD_AUTH 1 -+#define DROPBEAR_SVR_PASSWORD_AUTH 0 - - /* Note: PAM auth is quite simple and only works for PAM modules which just do - * a simple "Login: " "Password: " (you can edit the strings in svr-authpam.c). diff --git a/Ports/dropbear/patches/disable-ssp.patch b/Ports/dropbear/patches/disable-ssp.patch deleted file mode 100644 index ebc9c63352..0000000000 --- a/Ports/dropbear/patches/disable-ssp.patch +++ /dev/null @@ -1,88 +0,0 @@ -I patch both configure.ac and configure itself (though only configure is required for the build) -Serenity's GCC doesn't support SSP, so this is disabled. -diff --git a/configure b/configure -index 8374714..8c9eb9a 100755 ---- a/configure -+++ b/configure -@@ -3381,53 +3381,7 @@ fi - rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi # non-static -- # stack protector. -strong is good but only in gcc 4.9 or later -- OLDCFLAGS="$CFLAGS" -- TESTFLAGS="-fstack-protector-strong" -- CFLAGS="$CFLAGS $TESTFLAGS" -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ -- --int --main () --{ - -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_compile "$LINENO"; then : -- { $as_echo "$as_me:${as_lineno-$LINENO}: Setting $TESTFLAGS" >&5 --$as_echo "$as_me: Setting $TESTFLAGS" >&6;} --else -- -- CFLAGS="$OLDCFLAGS" -- TESTFLAGS="-fstack-protector --param=ssp-buffer-size=4" -- CFLAGS="$CFLAGS $TESTFLAGS" -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ -- --int --main () --{ -- -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_compile "$LINENO"; then : -- { $as_echo "$as_me:${as_lineno-$LINENO}: Setting $TESTFLAGS" >&5 --$as_echo "$as_me: Setting $TESTFLAGS" >&6;} --else -- { $as_echo "$as_me:${as_lineno-$LINENO}: Not setting $TESTFLAGS" >&5 --$as_echo "$as_me: Not setting $TESTFLAGS" >&6;}; CFLAGS="$OLDCFLAGS" -- --fi --rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -- -- --fi --rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # FORTIFY_SOURCE - { - OLDFLAGS="$CFLAGS" -diff --git a/configure.ac b/configure.ac -index 6a19479..28cd987 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -103,22 +103,7 @@ if test "$hardenbuild" -eq 1; then - [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ] - ) - fi # non-static -- # stack protector. -strong is good but only in gcc 4.9 or later -- OLDCFLAGS="$CFLAGS" -- TESTFLAGS="-fstack-protector-strong" -- CFLAGS="$CFLAGS $TESTFLAGS" -- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], -- [AC_MSG_NOTICE([Setting $TESTFLAGS])], -- [ -- CFLAGS="$OLDCFLAGS" -- TESTFLAGS="-fstack-protector --param=ssp-buffer-size=4" -- CFLAGS="$CFLAGS $TESTFLAGS" -- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], -- [AC_MSG_NOTICE([Setting $TESTFLAGS])], -- [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ] -- ) -- ] -- ) -+ - # FORTIFY_SOURCE - DB_TRYADDCFLAGS([-D_FORTIFY_SOURCE=2]) - diff --git a/Ports/dropbear/patches/fix-includes.patch b/Ports/dropbear/patches/fix-includes.patch deleted file mode 100644 index 09e83e68bf..0000000000 --- a/Ports/dropbear/patches/fix-includes.patch +++ /dev/null @@ -1,13 +0,0 @@ -Not sure why this is missing, but okay. -diff --git a/includes.h b/includes.h -index 1e00002..2208f94 100644 ---- a/includes.h -+++ b/includes.h -@@ -37,6 +37,7 @@ - #include - #include - #include -+#include - - #include - #include diff --git a/Ports/dropbear/patches/install-in-bin.patch b/Ports/dropbear/patches/install-in-bin.patch deleted file mode 100644 index 1a441e48f4..0000000000 --- a/Ports/dropbear/patches/install-in-bin.patch +++ /dev/null @@ -1,14 +0,0 @@ -Serenity doesn't use /sbin. -diff --git a/Makefile.in b/Makefile.in -index e824491..f30f508 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -97,7 +97,7 @@ prefix=@prefix@ - exec_prefix=@exec_prefix@ - datarootdir = @datarootdir@ - bindir=@bindir@ --sbindir=@sbindir@ -+sbindir=$(bindir) - mandir=@mandir@ - - .DELETE_ON_ERROR: diff --git a/Ports/dropbear/patches/netio.patch b/Ports/dropbear/patches/netio.patch deleted file mode 100644 index 73d5730f07..0000000000 --- a/Ports/dropbear/patches/netio.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/netio.c b/netio.c -index 2ed9bb1..e0e9962 100644 ---- a/netio.c -+++ b/netio.c -@@ -304,7 +304,7 @@ void packet_queue_to_iovec(const struct Queue *queue, struct iovec *iov, unsigne - buffer *writebuf; - - #ifndef IOV_MAX -- #if defined(__CYGWIN__) && !defined(UIO_MAXIOV) -+ #if !defined(UIO_MAXIOV) - #define IOV_MAX 1024 - #elif defined(__sgi) - #define IOV_MAX 512 -@@ -346,11 +346,7 @@ void packet_queue_consume(struct Queue *queue, ssize_t written) { - } - - void set_sock_nodelay(int sock) { -- int val; -- -- /* disable nagle */ -- val = 1; -- setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val)); -+ (void)sock; - } - - #if DROPBEAR_SERVER_TCP_FAST_OPEN -@@ -469,7 +465,6 @@ int dropbear_listen(const char* address, const char* port, - struct addrinfo hints, *res = NULL, *res0 = NULL; - int err; - unsigned int nsock; -- struct linger linger; - int val; - int sock; - uint16_t *allocated_lport_p = NULL; -@@ -548,9 +543,6 @@ int dropbear_listen(const char* address, const char* port, - val = 1; - /* set to reuse, quick timeout */ - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &val, sizeof(val)); -- linger.l_onoff = 1; -- linger.l_linger = 5; -- setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger)); - - #if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY) - if (res->ai_family == AF_INET6) { -- cgit v1.2.3