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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
--- lib/replace/system/network.h
+++ lib/replace/system/network.h
@@ -128,7 +128,7 @@
struct hostent *rep_gethostbyname(const char *name);
#endif
-#ifdef HAVE_IFADDRS_H
+#if defined(HAVE_IFADDRS_H) && (!defined(__ANDROID_API__) || __ANDROID_API__ >= 24)
#include <ifaddrs.h>
#endif
diff -ru lib/util/charset/iconv.c lib/util/charset/iconv.c
--- lib/util/charset/iconv.c 2013-01-29 09:49:31.000000000 +0100
+++ lib/util/charset/iconv.c 2015-03-28 08:30:53.191217266 +0100
@@ -24,6 +24,11 @@
#include "system/filesys.h"
#include "charset_proto.h"
+#if defined(ANDROID)
+#include <stdint.h>
+#include <byteswap.h>
+#endif
+
#ifdef strcasecmp
#undef strcasecmp
#endif
@@ -546,6 +551,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) = bswap_16(*((uint16_t*)from+i));
+}
+#endif
+
static size_t iconv_swab(void *cd, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
diff -ru lib/util/util_pw.c lib/util/util_pw.c
--- lib/util/util_pw.c 2013-01-29 09:49:31.000000000 +0100
+++ lib/util/util_pw.c 2015-03-28 08:30:53.843217274 +0100
@@ -40,7 +40,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);
diff -ru nsswitch/libwbclient/wbc_pwd.c nsswitch/libwbclient/wbc_pwd.c
--- nsswitch/libwbclient/wbc_pwd.c 2013-01-29 09:49:31.000000000 +0100
+++ nsswitch/libwbclient/wbc_pwd.c 2015-03-28 08:30:53.847217275 +0100
@@ -45,7 +45,9 @@
struct passwd *pw = (struct passwd *)ptr;
free(pw->pw_name);
free(pw->pw_passwd);
+#if !defined(ANDROID)
free(pw->pw_gecos);
+#endif
free(pw->pw_shell);
free(pw->pw_dir);
}
@@ -67,10 +69,12 @@
if (pw->pw_passwd == NULL) {
goto fail;
}
+#if !defined(ANDROID)
pw->pw_gecos = strdup(p->pw_gecos);
if (pw->pw_gecos == NULL) {
goto fail;
}
+#endif
pw->pw_shell = strdup(p->pw_shell);
if (pw->pw_shell == NULL) {
goto fail;
diff -ru nsswitch/libwbclient/wbc_sid.c nsswitch/libwbclient/wbc_sid.c
--- nsswitch/libwbclient/wbc_sid.c 2013-01-29 09:49:31.000000000 +0100
+++ nsswitch/libwbclient/wbc_sid.c 2015-03-28 08:30:53.847217275 +0100
@@ -957,9 +957,11 @@
wbcFreeMemory(name);
+#if !defined(ANDROID)
name = wbcStrDup(pwd->pw_gecos);
wbcFreeMemory(pwd);
BAIL_ON_PTR_ERROR(name, wbc_status);
+#endif
}
wbc_status = WBC_ERR_SUCCESS;
--- nsswitch/winbind_struct_protocol.h
+++ nsswitch/winbind_struct_protocol.h
@@ -186,6 +186,10 @@
WINBINDD_NUM_CMDS
};
+#if defined(ANDROID) && defined(pw_gecos)
+#undef pw_gecos
+#endif
+
typedef struct winbindd_pw {
fstring pw_name;
fstring pw_passwd;
diff -ru source3/configure source3/configure
--- source3/configure 2013-01-29 10:21:59.000000000 +0100
+++ source3/configure 2015-03-28 08:43:34.903227582 +0100
@@ -22424,7 +22424,7 @@
LIBSMBCLIENT_SOVER=0
LIBSMBCLIENT_FULLVER=$LIBSMBCLIENT_SOVER
-LIBSMBCLIENT_SHARED_TARGET_SOVER=$LIBSMBCLIENT_SHARED_TARGET.$LIBSMBCLIENT_SOVER
+LIBSMBCLIENT_SHARED_TARGET_SOVER=$LIBSMBCLIENT_SHARED_TARGET
LIBSMBCLIENT_SHARED_TARGET_FULLVER=$LIBSMBCLIENT_SHARED_TARGET.$LIBSMBCLIENT_FULLVER
@@ -37580,19 +37580,19 @@
if test "x$ac_cv_lib_pthread_pthread_attr_init" = xyes; then :
PTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
- PTHREAD_LDFLAGS="-lpthread"
+ PTHREAD_LDFLAGS=""
fi
fi
if test "x$PTHREAD_LDFLAGS" = xerror; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_init in -lpthreads" >&5
-$as_echo_n "checking for pthread_attr_init in -lpthreads... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_init in " >&5
+$as_echo_n "checking for pthread_attr_init in ... " >&6; }
if ${ac_cv_lib_pthreads_pthread_attr_init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthreads $LIBS"
+LIBS=" $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -37625,7 +37625,7 @@
if test "x$ac_cv_lib_pthreads_pthread_attr_init" = xyes; then :
PTHREAD_CFLAGS="-D_THREAD_SAFE"
- PTHREAD_LDFLAGS="-lpthreads"
+ PTHREAD_LDFLAGS=""
fi
fi
diff -ru source3/lib/dumpcore.c source3/lib/dumpcore.c
--- source3/lib/dumpcore.c
+++ source3/lib/dumpcore.c
@@ -320,7 +320,7 @@
umask(~(0700));
dbgflush();
-#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.
diff -ru lib/addns/dnsquery.c lib/addns/dnsquery.c
--- lib/addns/dnsquery.c
+++ lib/addns/dnsquery.c
@@ -41,6 +41,16 @@
#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_t_aaaa 28
+# 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
diff -ru source3/passdb/passdb.c source3/passdb/passdb.c
--- source3/Makefile.in
+++ source3/Makefile.in
@@ -2426,8 +2426,6 @@
@SONAMEFLAG@`basename $@`
$(LIBSMBCLIENT_SHARED_TARGET): $(LIBSMBCLIENT_SHARED_TARGET_SONAME)
- @rm -f $@
- @ln -s `basename $(LIBSMBCLIENT_SHARED_TARGET_SONAME)` $@
$(LIBSMBCLIENT_STATIC_TARGET): $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ1)
@echo Linking non-shared library $@
@@ -2444,11 +2442,6 @@
installlibsmbclient:: installdirs libsmbclient
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR)
-$(INSTALLLIBCMD_SH) $(LIBSMBCLIENT_SHARED_TARGET_SONAME) $(DESTDIR)$(LIBDIR)
- @rm -f $(DESTDIR)$(LIBDIR)/`basename $(LIBSMBCLIENT_SHARED_TARGET)`
- -if test -r $(LIBSMBCLIENT_SHARED_TARGET_SONAME) ; then \
- ln -f -s `basename $(LIBSMBCLIENT_SHARED_TARGET_SONAME)` \
- $(DESTDIR)$(LIBDIR)/`basename $(LIBSMBCLIENT_SHARED_TARGET)` ; \
- fi
-$(INSTALLLIBCMD_A) $(LIBSMBCLIENT_STATIC_TARGET) $(DESTDIR)$(LIBDIR)
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) ${prefix}/include
-$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(LIBSMBCLIENT_HEADERS) $(DESTDIR)${prefix}/include
--- source3/passdb/passdb.c 2013-01-29 09:49:31.000000000 +0100
+++ source3/passdb/passdb.c 2015-03-28 08:30:54.543217284 +0100
@@ -163,6 +163,7 @@
fullname = NULL;
+#if !defined(ANDROID)
if (count_commas(pwd->pw_gecos) == 3) {
/*
* Heuristic: This seems to be a gecos field that has been
@@ -173,11 +174,14 @@
talloc_tos(), pwd->pw_gecos,
strchr(pwd->pw_gecos, ',') - pwd->pw_gecos);
}
+#endif
if (fullname != NULL) {
pdb_set_fullname(user, fullname, PDB_SET);
+#if !defined(ANDROID)
} else {
pdb_set_fullname(user, pwd->pw_gecos, PDB_SET);
+#endif
}
TALLOC_FREE(fullname);
diff -ru source3/passdb/pdb_interface.c source3/passdb/pdb_interface.c
--- source3/passdb/pdb_interface.c 2013-01-29 09:49:31.000000000 +0100
+++ source3/passdb/pdb_interface.c 2015-03-28 08:30:54.547217284 +0100
@@ -1570,6 +1570,7 @@
}
/* Primary group members */
+#if !defined(ANDROID)
setpwent();
while ((pwd = getpwent()) != NULL) {
if (pwd->pw_gid == gid) {
@@ -1580,6 +1581,7 @@
}
}
endpwent();
+#endif
/* Secondary group members */
for (gr = grp->gr_mem; (*gr != NULL) && ((*gr)[0] != '\0'); gr += 1) {
|