0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-06-09 03:00:02 +00:00
Files
termux-packages/packages/openssh/sshd-auth.c.patch
liu lei fcab72adf9 Refactor: Replace sshd.0.patch with sshd.8.patch and add newline to sshd-auth.c.patch
The obsolete `sshd.0.patch` file has been removed as it is no longer needed. Its functionality is now covered by the updated `sshd.8.patch`.

Additionally, a newline character has been added to the end of the `sshd-auth.c.patch` file to resolve the "patch unexpectedly ends in middle of line" warning.
2025-05-13 06:44:32 -05:00

22 lines
634 B
Diff

--- a/sshd-auth.c
+++ b/sshd-auth.c
@@ -680,7 +680,18 @@
/* Store privilege separation user for later use if required. */
privsep_chroot = (getuid() == 0 || geteuid() == 0);
+#ifdef __ANDROID__
+ /* Let the privilege separation user be Termux on Android */
+ do {
+ struct stat st;
+ if (stat("@TERMUX_PREFIX@", &st) != -1) {
+ privsep_pw = getpwuid(st.st_uid);
+ }
+ } while (0);
+ if (privsep_pw == NULL) {
+#else
if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) {
+#endif
if (privsep_chroot || options.kerberos_authentication)
fatal("Privilege separation user %s does not exist",
SSH_PRIVSEP_USER);