r/o

hosts/seraphim: oh boy. b1d86eb8 parent 1bf6007a

authored by ~talya

1
From 0d7198c9b62c4d13739f81bc782f3f52d686d774 Mon Sep 17 00:00:00 2001
2
From: Asherah Connor <ashe@kivikakk.ee>
3
Date: Sun, 24 Aug 2025 11:19:43 +1000
4
Subject: [PATCH 1/2] ssh-agent: add __APPLE_LAUNCHD__ parts.
5
6
Source: https://github.com/apple-oss-distributions/OpenSSH/blob/9b6202341ee10b42e7391229ad5c0f2eb8aea8af/openssh/ssh-agent.c#L2482.
7
---
8
ssh-agent.c | 30 +++++++++++++++++++++++++++++-
9
1 file changed, 29 insertions(+), 1 deletion(-)
10
11
diff --git a/ssh-agent.c b/ssh-agent.c
12
index c27c5a9..64e41f4 100644
13
--- a/ssh-agent.c
14
+++ b/ssh-agent.c
15
@@ -70,6 +70,7 @@
16
#include <time.h>
17
#include <string.h>
18
#include <unistd.h>
19
+#include <launch.h>
20
#ifdef HAVE_UTIL_H
21
# include <util.h>
22
#endif
23
@@ -2220,6 +2221,7 @@ int
24
main(int ac, char **av)
25
{
26
int c_flag = 0, d_flag = 0, D_flag = 0, k_flag = 0, s_flag = 0;
27
+ int l_flag = 0;
28
int sock = -1, ch, result, saved_errno;
29
char *shell, *format, *fdstr, *pidstr, *agentsocket = NULL;
30
const char *errstr = NULL;
31
@@ -2256,7 +2258,7 @@ main(int ac, char **av)
32
__progname = ssh_get_progname(av[0]);
33
seed_rng();
34
35
- while ((ch = getopt(ac, av, "cDdksE:a:O:P:t:")) != -1) {
36
+ while ((ch = getopt(ac, av, "cDdksE:a:O:P:t:l")) != -1) {
37
switch (ch) {
38
case 'E':
39
fingerprint_hash = ssh_digest_alg_by_name(optarg);
40
@@ -2289,6 +2291,9 @@ main(int ac, char **av)
41
fatal("-P option already specified");
42
allowed_providers = xstrdup(optarg);
43
break;
44
+ case 'l':
45
+ l_flag++;
46
+ break;
47
case 's':
48
if (c_flag)
49
usage();
50
@@ -2415,6 +2420,27 @@ main(int ac, char **av)
51
* Create socket early so it will exist before command gets run from
52
* the parent.
53
*/
54
+ if (l_flag) {
55
+ int *fds = NULL;
56
+ size_t count = 0;
57
+ result = launch_activate_socket("Listeners", &fds, &count);
58
+
59
+ if (result != 0 || fds == NULL || count < 1) {
60
+ errno = result;
61
+ perror("launch_activate_socket()");
62
+ exit(1);
63
+ }
64
+
65
+ size_t i;
66
+ for (i = 0; i < count; i++) {
67
+ new_socket(AUTH_SOCKET, fds[i]);
68
+ }
69
+
70
+ if (fds)
71
+ free(fds);
72
+
73
+ goto skip2;
74
+ } else {
75
if (sock == -1) {
76
prev_mask = umask(0177);
77
sock = unix_listener(socket_name, SSH_LISTEN_BACKLOG, 0);
78
@@ -2425,6 +2451,7 @@ main(int ac, char **av)
79
}
80
umask(prev_mask);
81
}
82
+ }
83
84
/*
85
* Fork, and have the parent execute the command, if any, or present
86
@@ -2499,6 +2526,7 @@ skip:
87
pkcs11_init(0);
88
#endif
89
new_socket(AUTH_SOCKET, sock);
90
+skip2:
91
if (ac > 0)
92
parent_alive_interval = 10;
93
idtab_init();
94
--
95
2.49.0
96
97