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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
--- a/source/lib/fault.c
+++ b/source/lib/fault.c
@@ -136,7 +136,7 @@
#endif
#endif
-#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
+#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) && !defined(ANDROID)
/* On Linux we lose the ability to dump core when we change our user
* ID. We know how to dump core safely, so let's make sure we have our
* dumpable flag set.
--- a/source/lib/iconv.c
+++ b/source/lib/iconv.c
@@ -20,7 +20,10 @@
*/
#include "includes.h"
-
+#if defined(ANDROID)
+#include <stdint.h>
+#include <asm/byteorder.h>
+#endif
/*
* We have to use strcasecmp here as the character conversions
* haven't been initialised yet. JRA.
@@ -489,6 +492,19 @@
return 0;
}
+#if defined(ANDROID)
+void swab(const void *from, void*to, ssize_t n)
+{
+ ssize_t i;
+
+ if (n < 0)
+ return;
+
+ for (i = 0; i < (n/2)*2; i += 2)
+ *((uint16_t*)to+i) = __arch__swab16(*((uint16_t*)from+i));
+}
+#endif
+
static size_t iconv_swab(void *cd, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
--- a/source/lib/replace/system/passwd.h
+++ b/source/lib/replace/system/passwd.h
@@ -62,6 +62,8 @@
#ifdef REPLACE_GETPASS
#define getpass(prompt) getsmbpass((prompt))
+#else
+#define getpass(prompt) NULL
#endif
#ifndef NGROUPS_MAX
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -476,7 +476,10 @@
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_SEEKDIR64)
seekdir64(dirp, offset);
#else
+#if !defined(ANDROID)
seekdir(dirp, offset);
+#endif
+ return;
#endif
}
@@ -489,7 +492,11 @@
#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_TELLDIR64)
return (long)telldir64(dirp);
#else
+#if !defined(ANDROID)
return (long)telldir(dirp);
+#else
+ return(0);
+#endif
#endif
}
@@ -985,17 +992,25 @@
void sys_setpwent(void)
{
+#if !defined(ANDROID)
setpwent();
+#endif
}
struct passwd *sys_getpwent(void)
{
+#if !defined(ANDROID)
return getpwent();
+#else
+ return NULL;
+#endif
}
void sys_endpwent(void)
{
+#if !defined(ANDROID)
endpwent();
+#endif
}
/**************************************************************************
@@ -1065,7 +1080,9 @@
new_pwd.pw_passwd = SMB_STRDUP("x");
new_pwd.pw_uid = uid;
new_pwd.pw_gid = 100;
+#if !defined(ANDROID)
new_pwd.pw_gecos = SMB_STRDUP("faked user");
+#endif
new_pwd.pw_dir = SMB_STRDUP("/nodir");
new_pwd.pw_shell = SMB_STRDUP("/bin/false");
@@ -1241,7 +1258,9 @@
retval.pw_passwd = pwret->pw_passwd;
retval.pw_uid = pwret->pw_uid;
retval.pw_gid = pwret->pw_gid;
+#if !defined(ANDROID)
unix_to_unicode(retval.pw_gecos, pwret->pw_gecos, sizeof(retval.pw_gecos));
+#endif
unix_to_unicode(retval.pw_dir, pwret->pw_dir, sizeof(retval.pw_dir));
unix_to_unicode(retval.pw_shell, pwret->pw_shell, sizeof(retval.pw_shell));
@@ -1264,7 +1283,9 @@
retval.pw_passwd = pwret->pw_passwd;
retval.pw_uid = pwret->pw_uid;
retval.pw_gid = pwret->pw_gid;
+#if !defined(ANDROID)
unix_to_unicode(retval.pw_gecos, pwret->pw_gecos, sizeof(retval.pw_gecos));
+#endif
unix_to_unicode(retval.pw_dir, pwret->pw_dir, sizeof(retval.pw_dir));
unix_to_unicode(retval.pw_shell, pwret->pw_shell, sizeof(retval.pw_shell));
--- a/source/lib/util_pw.c
+++ b/source/lib/util_pw.c
@@ -32,7 +32,9 @@
ret->pw_passwd = talloc_strdup(ret, from->pw_passwd);
ret->pw_uid = from->pw_uid;
ret->pw_gid = from->pw_gid;
+#if !defined(ANDROID)
ret->pw_gecos = talloc_strdup(ret, from->pw_gecos);
+#endif
ret->pw_dir = talloc_strdup(ret, from->pw_dir);
ret->pw_shell = talloc_strdup(ret, from->pw_shell);
return ret;
--- a/source/libads/dns.c
+++ b/source/libads/dns.c
@@ -38,6 +38,15 @@
#define MAX_DNS_PACKET_SIZE 0xffff
+#if defined(ANDROID)
+# define NS_HFIXEDSZ 12
+# define C_IN 1
+# define T_A 1
+# define ns_t_srv 33
+# define NS_PACKETSZ 512
+# define T_NS 2
+#endif
+
#ifdef NS_HFIXEDSZ /* Bind 8/9 interface */
#if !defined(C_IN) /* AIX 5.3 already defines C_IN */
# define C_IN ns_c_in
--- a/source/passdb/passdb.c
+++ b/source/passdb/passdb.c
@@ -143,7 +143,9 @@
/* Basic properties based upon the Unix account information */
pdb_set_username(user, pwd->pw_name, PDB_SET);
+#if !defined(ANDROID)
pdb_set_fullname(user, pwd->pw_gecos, PDB_SET);
+#endif
pdb_set_domain (user, get_global_sam_name(), PDB_DEFAULT);
#if 0
/* This can lead to a primary group of S-1-22-2-XX which
--- a/source/passdb/pdb_interface.c
+++ b/source/passdb/pdb_interface.c
@@ -1380,8 +1380,8 @@
}
/* Primary group members */
- setpwent();
- while ((pwd = getpwent()) != NULL) {
+ sys_setpwent();
+ while ((pwd = sys_getpwent()) != NULL) {
if (pwd->pw_gid == gid) {
if (!add_uid_to_array_unique(mem_ctx, pwd->pw_uid,
pp_uids, p_num)) {
@@ -1389,7 +1389,7 @@
}
}
}
- endpwent();
+ sys_endpwent();
/* Secondary group members */
for (gr = grp->gr_mem; (*gr != NULL) && ((*gr)[0] != '\0'); gr += 1) {
|