blob: 96bafd855087c10f4032c3ec9211c9c921846989 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
--- src/connect.c 2011-05-31 10:29:52.000000000 -0400
+++ src/connect.c 2013-01-03 00:38:13.572737322 -0500
@@ -159,7 +159,11 @@
int timeout_ms;
ssh_pollfd_t fds;
int rc = 0;
+#ifdef ANDROID
+ socklen_t len = sizeof(rc);
+#else
unsigned int len = sizeof(rc);
+#endif
enter_function();
--- src/misc.c 2011-05-31 10:29:52.000000000 -0400
+++ src/misc.c 2013-01-03 00:37:37.652737345 -0500
@@ -208,6 +208,9 @@
char *ssh_get_user_home_dir(void) {
char *szPath = NULL;
+#ifdef ANDROID
+ return strdup(getenv("HOME"));
+#else
struct passwd pwd;
struct passwd *pwdbuf;
char buf[NSS_BUFLEN_PASSWD];
@@ -219,7 +222,7 @@
}
szPath = strdup(pwd.pw_dir);
-
+#endif
return szPath;
}
@@ -233,6 +236,19 @@
}
char *ssh_get_local_username(ssh_session session) {
+#ifdef ANDROID
+ char *name = NULL;
+ struct passwd *pwd = NULL;
+ pwd = getpwuid(getuid());
+ if ( pwd == NULL) {
+ ssh_set_error(session, SSH_FATAL,
+ "Couldn't retrieve information for current user!");
+ return NULL;
+ }
+
+ name = strdup(pwd->pw_name);
+
+#else
struct passwd pwd;
struct passwd *pwdbuf;
char buf[NSS_BUFLEN_PASSWD];
@@ -248,6 +264,7 @@
name = strdup(pwd.pw_name);
+#endif
if (name == NULL) {
ssh_set_error_oom(session);
return NULL;
|