--- 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 #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 +#include +#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) {