OSDN Git Service

Fix the segmentation fault of ssh, and configure scp to make it work properly oreo-x86 android-x86-8.1-r1 android-x86-8.1-r2 android-x86-8.1-r3 android-x86-8.1-r4 android-x86-8.1-r5 android-x86-8.1-r6
authorelliott10 <xiaoluoyuan@163.com>
Fri, 10 Aug 2018 07:24:39 +0000 (07:24 +0000)
committerelliott10 <xiaoluoyuan@163.com>
Mon, 13 Aug 2018 02:41:32 +0000 (02:41 +0000)
config.h
misc.c

index aeb2663..afdf3ed 100644 (file)
--- a/config.h
+++ b/config.h
 
 #define _PATH_PRIVSEP_CHROOT_DIR SSHDIR "/empty"
 
-#define _PATH_SSH_PROGRAM "/system/bin/sftp"
+#define _PATH_SSH_PROGRAM "/system/bin/ssh"
diff --git a/misc.c b/misc.c
index cfd3272..f71bebb 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -208,7 +208,10 @@ pwcopy(struct passwd *pw)
        struct passwd *copy = xcalloc(1, sizeof(*copy));
 
        copy->pw_name = xstrdup(pw->pw_name);
-       copy->pw_passwd = xstrdup(pw->pw_passwd);
+       /* Android does not do passwords and passes NULL for them. This breaks strlen */
+       if (pw->pw_passwd) {
+               copy->pw_passwd = xstrdup(pw->pw_passwd);
+       }
 #ifdef HAVE_STRUCT_PASSWD_PW_GECOS
        copy->pw_gecos = xstrdup(pw->pw_gecos);
 #endif