summaryrefslogtreecommitdiff
path: root/Ports/openssh/patches/0001-ifdef-out-missing-functionality.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Ports/openssh/patches/0001-ifdef-out-missing-functionality.patch')
-rw-r--r--Ports/openssh/patches/0001-ifdef-out-missing-functionality.patch630
1 files changed, 630 insertions, 0 deletions
diff --git a/Ports/openssh/patches/0001-ifdef-out-missing-functionality.patch b/Ports/openssh/patches/0001-ifdef-out-missing-functionality.patch
new file mode 100644
index 0000000000..b692b690e1
--- /dev/null
+++ b/Ports/openssh/patches/0001-ifdef-out-missing-functionality.patch
@@ -0,0 +1,630 @@
+From 0eca70393610857e0a87f157698b295bd727dcae Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Sat, 30 Apr 2022 10:58:10 +0000
+Subject: [PATCH 1/7] ifdef out missing functionality
+
+Co-Authored-By: Luke <luke.wilde@live.co.uk>
+Co-Authored-By: Patrick Meyer <git@the-space.agency>
+Co-Authored-By: Tim Schumacher <timschumi@gmx.de>
+---
+ atomicio.c | 2 +-
+ defines.h | 5 +++++
+ dns.c | 4 ++++
+ dns.h | 4 ++++
+ hostfile.c | 2 ++
+ includes.h | 2 ++
+ loginrec.c | 8 ++++----
+ misc.c | 2 ++
+ openbsd-compat/getrrsetbyname-ldns.c | 4 ++++
+ openbsd-compat/getrrsetbyname.c | 4 ++++
+ openbsd-compat/getrrsetbyname.h | 4 ++++
+ openbsd-compat/mktemp.c | 2 +-
+ readconf.c | 5 ++++-
+ regress/netcat.c | 2 ++
+ sandbox-pledge.c | 2 ++
+ servconf.c | 2 ++
+ ssh-add.c | 4 ++++
+ ssh-agent.c | 2 ++
+ ssh-keygen.c | 11 +++++++++++
+ ssh-keyscan.c | 2 ++
+ ssh-pkcs11-client.c | 8 +++++++-
+ ssh-sk-client.c | 4 ++++
+ sshbuf-misc.c | 2 ++
+ sshconnect.c | 10 ++++++++--
+ sshkey.c | 4 ++++
+ 25 files changed, 91 insertions(+), 10 deletions(-)
+
+diff --git a/atomicio.c b/atomicio.c
+index 7650733..7a195f5 100644
+--- a/atomicio.c
++++ b/atomicio.c
+@@ -119,7 +119,7 @@ atomiciov6(ssize_t (*f) (int, const struct iovec *, int), int fd,
+ memcpy(iov, _iov, (size_t)iovcnt * sizeof(*_iov));
+
+ pfd.fd = fd;
+-#ifndef BROKEN_READV_COMPARISON
++#if !defined(BROKEN_READV_COMPARISON) && !defined(__serenity__)
+ pfd.events = f == readv ? POLLIN : POLLOUT;
+ #else
+ pfd.events = POLLIN|POLLOUT;
+diff --git a/defines.h b/defines.h
+index 279e509..5fb970a 100644
+--- a/defines.h
++++ b/defines.h
+@@ -55,8 +55,13 @@ enum
+ /*
+ * Definitions for IP type of service (ip_tos)
+ */
++#ifndef __serenity__
+ #include <netinet/in_systm.h>
++#endif
+ #include <netinet/ip.h>
++#ifdef __serenity__
++#include <arpa/inet.h>
++#endif
+ #ifndef IPTOS_LOWDELAY
+ # define IPTOS_LOWDELAY 0x10
+ # define IPTOS_THROUGHPUT 0x08
+diff --git a/dns.c b/dns.c
+index f2310be..f39db58 100644
+--- a/dns.c
++++ b/dns.c
+@@ -25,6 +25,8 @@
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
++#ifndef __serenity__
++
+ #include "includes.h"
+
+ #include <sys/types.h>
+@@ -338,3 +340,5 @@ export_dns_rr(const char *hostname, struct sshkey *key, FILE *f, int generic)
+
+ return success;
+ }
++
++#endif
+diff --git a/dns.h b/dns.h
+index c9b61c4..2b9f153 100644
+--- a/dns.h
++++ b/dns.h
+@@ -25,6 +25,8 @@
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
++#ifndef __serenity__
++
+ #ifndef DNS_H
+ #define DNS_H
+
+@@ -57,3 +59,5 @@ int verify_host_key_dns(const char *, struct sockaddr *,
+ int export_dns_rr(const char *, struct sshkey *, FILE *, int);
+
+ #endif /* DNS_H */
++
++#endif
+diff --git a/hostfile.c b/hostfile.c
+index bd49e3a..34030f1 100644
+--- a/hostfile.c
++++ b/hostfile.c
+@@ -44,7 +44,9 @@
+ #include <netinet/in.h>
+
+ #include <errno.h>
++#ifndef __serenity__
+ #include <resolv.h>
++#endif
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/includes.h b/includes.h
+index 6d17ef6..eef913a 100644
+--- a/includes.h
++++ b/includes.h
+@@ -109,7 +109,9 @@
+ #endif
+
+ #include <netinet/in.h>
++#ifndef __serenity__
+ #include <netinet/in_systm.h> /* For typedefs */
++#endif
+ #ifdef HAVE_RPC_TYPES_H
+ # include <rpc/types.h> /* For INADDR_LOOPBACK */
+ #endif
+diff --git a/loginrec.c b/loginrec.c
+index 4f21499..574e3a1 100644
+--- a/loginrec.c
++++ b/loginrec.c
+@@ -461,7 +461,7 @@ login_write(struct logininfo *li)
+ #ifdef USE_WTMP
+ wtmp_write_entry(li);
+ #endif
+-#ifdef USE_UTMPX
++#ifndef __serenity__
+ utmpx_write_entry(li);
+ #endif
+ #ifdef USE_WTMPX
+@@ -494,7 +494,7 @@ login_utmp_only(struct logininfo *li)
+ # ifdef USE_WTMP
+ wtmp_write_entry(li);
+ # endif
+-# ifdef USE_UTMPX
++# ifndef __serenity__
+ utmpx_write_entry(li);
+ # endif
+ # ifdef USE_WTMPX
+@@ -725,7 +725,7 @@ construct_utmp(struct logininfo *li,
+ ** variations.
+ **/
+
+-#if defined(USE_UTMPX) || defined (USE_WTMPX)
++#if !defined(__serenity__)
+ /* build the utmpx structure */
+ void
+ set_utmpx_time(struct logininfo *li, struct utmpx *utx)
+@@ -987,7 +987,7 @@ utmp_write_entry(struct logininfo *li)
+ **/
+
+ /* not much point if we don't want utmpx entries */
+-#ifdef USE_UTMPX
++#ifndef __serenity__
+
+ /* if we have the wherewithall, use pututxline etc. */
+ # if !defined(DISABLE_PUTUTXLINE) && defined(HAVE_SETUTXENT) && \
+diff --git a/misc.c b/misc.c
+index 85d2236..bc06094 100644
+--- a/misc.c
++++ b/misc.c
+@@ -44,7 +44,9 @@
+ #include <unistd.h>
+
+ #include <netinet/in.h>
++#ifndef __serenity__
+ #include <netinet/in_systm.h>
++#endif
+ #include <netinet/ip.h>
+ #include <netinet/tcp.h>
+ #include <arpa/inet.h>
+diff --git a/openbsd-compat/getrrsetbyname-ldns.c b/openbsd-compat/getrrsetbyname-ldns.c
+index 4647b62..d684f6f 100644
+--- a/openbsd-compat/getrrsetbyname-ldns.c
++++ b/openbsd-compat/getrrsetbyname-ldns.c
+@@ -43,6 +43,8 @@
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#ifndef __serenity__
++
+ #include "includes.h"
+
+ #if !defined (HAVE_GETRRSETBYNAME) && defined (HAVE_LDNS)
+@@ -282,3 +284,5 @@ freerrset(struct rrsetinfo *rrset)
+
+
+ #endif /* !defined (HAVE_GETRRSETBYNAME) && defined (HAVE_LDNS) */
++
++#endif
+diff --git a/openbsd-compat/getrrsetbyname.c b/openbsd-compat/getrrsetbyname.c
+index cc1f8ae..57999ed 100644
+--- a/openbsd-compat/getrrsetbyname.c
++++ b/openbsd-compat/getrrsetbyname.c
+@@ -45,6 +45,8 @@
+
+ /* OPENBSD ORIGINAL: lib/libc/net/getrrsetbyname.c */
+
++#ifndef __serenity__
++
+ #include "includes.h"
+
+ #if !defined (HAVE_GETRRSETBYNAME) && !defined (HAVE_LDNS)
+@@ -607,3 +609,5 @@ count_dns_rr(struct dns_rr *p, u_int16_t class, u_int16_t type)
+ }
+
+ #endif /* !defined (HAVE_GETRRSETBYNAME) && !defined (HAVE_LDNS) */
++
++#endif
+diff --git a/openbsd-compat/getrrsetbyname.h b/openbsd-compat/getrrsetbyname.h
+index 1283f55..0b33705 100644
+--- a/openbsd-compat/getrrsetbyname.h
++++ b/openbsd-compat/getrrsetbyname.h
+@@ -45,6 +45,8 @@
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#ifndef __serenity__
++
+ #ifndef _GETRRSETBYNAME_H
+ #define _GETRRSETBYNAME_H
+
+@@ -108,3 +110,5 @@ void freerrset(struct rrsetinfo *);
+ #endif /* !defined(HAVE_GETRRSETBYNAME) */
+
+ #endif /* _GETRRSETBYNAME_H */
++
++#endif
+diff --git a/openbsd-compat/mktemp.c b/openbsd-compat/mktemp.c
+index ac922c1..1ebb975 100644
+--- a/openbsd-compat/mktemp.c
++++ b/openbsd-compat/mktemp.c
+@@ -34,7 +34,7 @@
+ #include <ctype.h>
+ #include <unistd.h>
+
+-#if !defined(HAVE_MKDTEMP)
++#if !defined(HAVE_MKDTEMP) || !defined(__serenity__)
+
+ #define MKTEMP_NAME 0
+ #define MKTEMP_FILE 1
+diff --git a/readconf.c b/readconf.c
+index f26faba..56122d8 100644
+--- a/readconf.c
++++ b/readconf.c
+@@ -21,7 +21,9 @@
+ #include <sys/un.h>
+
+ #include <netinet/in.h>
++#ifndef __serenity__
+ #include <netinet/in_systm.h>
++#endif
+ #include <netinet/ip.h>
+ #include <arpa/inet.h>
+
+@@ -1134,11 +1136,12 @@ parse_time:
+ case oCheckHostIP:
+ intptr = &options->check_host_ip;
+ goto parse_flag;
+-
++#ifndef __serenity__
+ case oVerifyHostKeyDNS:
+ intptr = &options->verify_host_key_dns;
+ multistate_ptr = multistate_yesnoask;
+ goto parse_multistate;
++ #endif
+
+ case oStrictHostKeyChecking:
+ intptr = &options->strict_host_key_checking;
+diff --git a/regress/netcat.c b/regress/netcat.c
+index 20ec3f5..55e087e 100644
+--- a/regress/netcat.c
++++ b/regress/netcat.c
+@@ -1384,7 +1384,9 @@ usage(int ret)
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
++#ifndef __serenity__
+ #include <resolv.h>
++#endif
+
+ #define SOCKS_PORT "1080"
+ #define HTTP_PROXY_PORT "3128"
+diff --git a/sandbox-pledge.c b/sandbox-pledge.c
+index 302f1cf..693a443 100644
+--- a/sandbox-pledge.c
++++ b/sandbox-pledge.c
+@@ -21,7 +21,9 @@
+
+ #include <sys/types.h>
+ #include <sys/ioctl.h>
++#ifndef __serenity__
+ #include <sys/syscall.h>
++#endif
+ #include <sys/socket.h>
+ #include <sys/wait.h>
+
+diff --git a/servconf.c b/servconf.c
+index 9d9681f..c418509 100644
+--- a/servconf.c
++++ b/servconf.c
+@@ -21,7 +21,9 @@
+ #endif
+
+ #include <netinet/in.h>
++#ifndef __serenity__
+ #include <netinet/in_systm.h>
++#endif
+ #include <netinet/ip.h>
+ #ifdef HAVE_NET_ROUTE_H
+ #include <net/route.h>
+diff --git a/ssh-add.c b/ssh-add.c
+index 7555477..ea8e27c 100644
+--- a/ssh-add.c
++++ b/ssh-add.c
+@@ -577,6 +577,7 @@ lock_agent(int agent_fd, int lock)
+ return (ret);
+ }
+
++#ifndef __serenity__
+ static int
+ load_resident_keys(int agent_fd, const char *skprovider, int qflag,
+ struct dest_constraint **dest_constraints, size_t ndest_constraints)
+@@ -628,6 +629,7 @@ load_resident_keys(int agent_fd, const char *skprovider, int qflag,
+ return SSH_ERR_KEY_NOT_FOUND;
+ return ok == 1 ? 0 : ok;
+ }
++#endif
+
+ static int
+ do_file(int agent_fd, int deleting, int key_only, char *file, int qflag,
+@@ -964,6 +966,7 @@ main(int argc, char **argv)
+ ret = 1;
+ goto done;
+ }
++ #ifndef __serenity__
+ if (do_download) {
+ if (skprovider == NULL)
+ fatal("Cannot download keys without provider");
+@@ -972,6 +975,7 @@ main(int argc, char **argv)
+ ret = 1;
+ goto done;
+ }
++ #endif
+ if (argc == 0) {
+ char buf[PATH_MAX];
+ struct passwd *pw;
+diff --git a/ssh-agent.c b/ssh-agent.c
+index 03ae2b0..c1b6350 100644
+--- a/ssh-agent.c
++++ b/ssh-agent.c
+@@ -2146,10 +2146,12 @@ main(int ac, char **av)
+ * a few spare for libc / stack protectors / sanitisers, etc.
+ */
+ #define SSH_AGENT_MIN_FDS (3+1+1+1+4)
++#ifndef __serenity__
+ if (rlim.rlim_cur < SSH_AGENT_MIN_FDS)
+ fatal("%s: file descriptor rlimit %lld too low (minimum %u)",
+ __progname, (long long)rlim.rlim_cur, SSH_AGENT_MIN_FDS);
+ maxfds = rlim.rlim_cur - SSH_AGENT_MIN_FDS;
++#endif
+
+ parent_pid = getpid();
+
+diff --git a/ssh-keygen.c b/ssh-keygen.c
+index d62fab3..1443c9c 100644
+--- a/ssh-keygen.c
++++ b/ssh-keygen.c
+@@ -1471,6 +1471,7 @@ do_change_passphrase(struct passwd *pw)
+ exit(0);
+ }
+
++#ifndef __serenity__
+ /*
+ * Print the SSHFP RR.
+ */
+@@ -1497,6 +1498,7 @@ do_print_resource_record(struct passwd *pw, char *fname, char *hname,
+ free(comment);
+ return 1;
+ }
++#endif
+
+ /*
+ * Change the comment of a private key file.
+@@ -3075,6 +3077,7 @@ sk_suffix(const char *application, const uint8_t *user, size_t userlen)
+ return ret;
+ }
+
++#ifndef __serenity__
+ static int
+ do_download_sk(const char *skprovider, const char *device)
+ {
+@@ -3185,6 +3188,7 @@ save_attestation(struct sshbuf *attest, const char *path)
+ printf("Your FIDO attestation certificate has been saved in "
+ "%s\n", path);
+ }
++#endif
+
+ static void
+ usage(void)
+@@ -3627,6 +3631,7 @@ main(int argc, char **argv)
+ }
+ if (pkcs11provider != NULL)
+ do_download(pw);
++#ifndef __serenity__
+ if (download_sk) {
+ for (i = 0; i < nopts; i++) {
+ if (strncasecmp(opts[i], "device=", 7) == 0) {
+@@ -3638,6 +3643,7 @@ main(int argc, char **argv)
+ }
+ return do_download_sk(sk_provider, sk_device);
+ }
++#endif
+ if (print_fingerprint || print_bubblebabble)
+ do_fingerprint(pw);
+ if (change_passphrase)
+@@ -3655,6 +3661,8 @@ main(int argc, char **argv)
+ #endif /* WITH_OPENSSL */
+ if (print_public)
+ do_print_public(pw);
++
++#ifndef __serenity__
+ if (rr_hostname != NULL) {
+ unsigned int n = 0;
+
+@@ -3686,6 +3694,7 @@ main(int argc, char **argv)
+ exit(0);
+ }
+ }
++#endif
+
+ if (do_gen_candidates || do_screen_candidates) {
+ if (argc <= 0)
+@@ -3717,6 +3726,7 @@ main(int argc, char **argv)
+ printf("Generating public/private %s key pair.\n",
+ key_type_name);
+ switch (type) {
++#ifndef __serenity__
+ case KEY_ECDSA_SK:
+ case KEY_ED25519_SK:
+ for (i = 0; i < nopts; i++) {
+@@ -3795,6 +3805,7 @@ main(int argc, char **argv)
+ passphrase = NULL;
+ }
+ break;
++#endif
+ default:
+ if ((r = sshkey_generate(type, bits, &private)) != 0)
+ fatal("sshkey_generate failed");
+diff --git a/ssh-keyscan.c b/ssh-keyscan.c
+index d29a03b..e6aac3d 100644
+--- a/ssh-keyscan.c
++++ b/ssh-keyscan.c
+@@ -313,7 +313,9 @@ keyprint_one(const char *host, struct sshkey *key)
+ found_one = 1;
+
+ if (print_sshfp) {
++#ifndef __serenity__
+ export_dns_rr(host, key, stdout, 0);
++#endif
+ return;
+ }
+
+diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c
+index cfd833d..de8fb90 100644
+--- a/ssh-pkcs11-client.c
++++ b/ssh-pkcs11-client.c
+@@ -241,6 +241,7 @@ wrap_key(struct sshkey *k)
+ fatal_f("unknown key type");
+ }
+
++#ifndef __serenity__
+ static int
+ pkcs11_start_helper_methods(void)
+ {
+@@ -310,6 +311,7 @@ pkcs11_start_helper(void)
+ fd = pair[0];
+ return (0);
+ }
++#endif
+
+ int
+ pkcs11_add_provider(char *name, char *pin, struct sshkey ***keysp,
+@@ -323,7 +325,11 @@ pkcs11_add_provider(char *name, char *pin, struct sshkey ***keysp,
+ u_int nkeys, i;
+ struct sshbuf *msg;
+
+- if (fd < 0 && pkcs11_start_helper() < 0)
++ if (fd < 0
++#ifndef __serenity__
++ && pkcs11_start_helper() < 0
++#endif
++ )
+ return (-1);
+
+ if ((msg = sshbuf_new()) == NULL)
+diff --git a/ssh-sk-client.c b/ssh-sk-client.c
+index 321fe53..984aa6a 100644
+--- a/ssh-sk-client.c
++++ b/ssh-sk-client.c
+@@ -15,6 +15,8 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#ifndef __serenity__
++
+ #include "includes.h"
+
+ #include <sys/types.h>
+@@ -478,3 +480,5 @@ sshsk_load_resident(const char *provider_path, const char *device,
+ errno = oerrno;
+ return r;
+ }
++
++#endif
+diff --git a/sshbuf-misc.c b/sshbuf-misc.c
+index 9c5c42b..1759ed2 100644
+--- a/sshbuf-misc.c
++++ b/sshbuf-misc.c
+@@ -28,7 +28,9 @@
+ #include <stdio.h>
+ #include <limits.h>
+ #include <string.h>
++#ifndef __serenity__
+ #include <resolv.h>
++#endif
+ #include <ctype.h>
+ #include <unistd.h>
+
+diff --git a/sshconnect.c b/sshconnect.c
+index ebecc83..81df612 100644
+--- a/sshconnect.c
++++ b/sshconnect.c
+@@ -106,6 +106,7 @@ expand_proxy_command(const char *proxy_command, const char *user,
+ return ret;
+ }
+
++#ifndef __serenity__
+ /*
+ * Connect to the given ssh server using a proxy command that passes a
+ * a connected fd back to us.
+@@ -188,6 +189,7 @@ ssh_proxy_fdpass_connect(struct ssh *ssh, const char *host,
+
+ return 0;
+ }
++#endif
+
+ /*
+ * Connect to the given ssh server using a proxy command.
+@@ -555,10 +557,13 @@ ssh_connect(struct ssh *ssh, const char *host, const char *host_arg,
+ if ((ssh_packet_set_connection(ssh, in, out)) == NULL)
+ return -1; /* ssh_packet_set_connection logs error */
+ return 0;
+- } else if (options.proxy_use_fdpass) {
++ }
++ #ifndef __serenity__
++ else if (options.proxy_use_fdpass) {
+ return ssh_proxy_fdpass_connect(ssh, host, host_arg, port,
+ options.proxy_command);
+ }
++ #endif
+ return ssh_proxy_connect(ssh, host, host_arg, port,
+ options.proxy_command);
+ }
+@@ -1483,7 +1488,7 @@ verify_host_key(char *host, struct sockaddr *hostaddr, struct sshkey *host_key,
+ goto out;
+ }
+ }
+-
++#ifndef __serenity__
+ if (options.verify_host_key_dns) {
+ /*
+ * XXX certs are not yet supported for DNS, so downgrade
+@@ -1512,6 +1517,7 @@ verify_host_key(char *host, struct sockaddr *hostaddr, struct sshkey *host_key,
+ }
+ }
+ }
++#endif
+ r = check_host_key(host, cinfo, hostaddr, options.port, host_key,
+ RDRW, 0, options.user_hostfiles, options.num_user_hostfiles,
+ options.system_hostfiles, options.num_system_hostfiles,
+diff --git a/sshkey.c b/sshkey.c
+index f1e9200..564ff40 100644
+--- a/sshkey.c
++++ b/sshkey.c
+@@ -42,7 +42,9 @@
+ #include <limits.h>
+ #include <stdio.h>
+ #include <string.h>
++#ifndef __serenity__
+ #include <resolv.h>
++#endif
+ #include <time.h>
+ #ifdef HAVE_UTIL_H
+ #include <util.h>
+@@ -2790,6 +2792,7 @@ sshkey_sign(struct sshkey *key,
+ case KEY_ED25519_CERT:
+ r = ssh_ed25519_sign(key, sigp, lenp, data, datalen, compat);
+ break;
++#ifndef __serenity__
+ case KEY_ED25519_SK:
+ case KEY_ED25519_SK_CERT:
+ case KEY_ECDSA_SK_CERT:
+@@ -2797,6 +2800,7 @@ sshkey_sign(struct sshkey *key,
+ r = sshsk_sign(sk_provider, key, sigp, lenp, data,
+ datalen, compat, sk_pin);
+ break;
++#endif
+ #ifdef WITH_XMSS
+ case KEY_XMSS:
+ case KEY_XMSS_CERT:
+--
+2.36.1
+