You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
67 lines
1.8 KiB
diff -u -r ../openssh-8.0p1/sshd.c ./sshd.c
|
|
--- ../openssh-8.0p1/sshd.c 2019-04-17 22:52:57.000000000 +0000
|
|
+++ ./sshd.c 2019-04-18 06:50:06.774278599 +0000
|
|
@@ -468,8 +468,10 @@
|
|
debug3("privsep user:group %u:%u", (u_int)privsep_pw->pw_uid,
|
|
(u_int)privsep_pw->pw_gid);
|
|
gidset[0] = privsep_pw->pw_gid;
|
|
+#ifndef __ANDROID__
|
|
if (setgroups(1, gidset) < 0)
|
|
fatal("setgroups: %.100s", strerror(errno));
|
|
+#endif
|
|
permanently_set_uid(privsep_pw);
|
|
}
|
|
}
|
|
@@ -1444,7 +1446,8 @@
|
|
saved_argc = ac;
|
|
rexec_argc = ac;
|
|
saved_argv = xcalloc(ac + 1, sizeof(*saved_argv));
|
|
- for (i = 0; (int)i < ac; i++)
|
|
+ saved_argv[0] = "@TERMUX_PREFIX@/bin/sshd";
|
|
+ for (i = 1; (int)i < ac; i++)
|
|
saved_argv[i] = xstrdup(av[i]);
|
|
saved_argv[i] = NULL;
|
|
|
|
@@ -1454,8 +1457,10 @@
|
|
av = saved_argv;
|
|
#endif
|
|
|
|
+#ifndef __ANDROID__
|
|
if (geteuid() == 0 && setgroups(0, NULL) == -1)
|
|
debug("setgroups(): %.200s", strerror(errno));
|
|
+#endif
|
|
|
|
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
|
|
sanitise_stdfd();
|
|
@@ -1576,8 +1581,10 @@
|
|
}
|
|
if (rexeced_flag || inetd_flag)
|
|
rexec_flag = 0;
|
|
+#ifndef __ANDROID__
|
|
if (!test_flag && rexec_flag && !path_absolute(av[0]))
|
|
fatal("sshd re-exec requires execution with an absolute path");
|
|
+#endif
|
|
if (rexeced_flag)
|
|
closefrom(REEXEC_MIN_FREE_FD);
|
|
else
|
|
@@ -1696,7 +1703,9 @@
|
|
freezero(privsep_pw->pw_passwd, strlen(privsep_pw->pw_passwd));
|
|
privsep_pw->pw_passwd = xstrdup("*");
|
|
}
|
|
+#ifndef __ANDROID__
|
|
endpwent();
|
|
+#endif
|
|
|
|
/* load host keys */
|
|
sensitive_data.host_keys = xcalloc(options.num_host_key_files,
|
|
@@ -1858,8 +1867,10 @@
|
|
* to create a file, and we can't control the code in every
|
|
* module which might be used).
|
|
*/
|
|
+#ifndef __ANDROID__
|
|
if (setgroups(0, NULL) < 0)
|
|
debug("setgroups() failed: %.200s", strerror(errno));
|
|
+#endif
|
|
|
|
if (rexec_flag) {
|
|
if (rexec_argc < 0)
|
|
|