Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

Location:
vendor/current/lib/replace
Files:
7 added
26 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/replace/README

    r740 r988  
    5050chown
    5151lchown
    52 getpass
    5352readline (the library)
    5453inet_ntoa
     
    7372symlink
    7473realpath
     74poll
     75setproctitle
    7576
    7677Types:
     
    8182intptr_t
    8283sig_atomic_t
     84blksize_t
     85blkcnt_t
    8386
    8487Constants:
  • vendor/current/lib/replace/getaddrinfo.c

    r414 r988  
    322322        for (;res; res = next) {
    323323                next = res->ai_next;
    324                 if (res->ai_canonname) {
    325                         free(res->ai_canonname);
    326                 }
    327                 if (res->ai_addr) {
    328                         free(res->ai_addr);
    329                 }
     324                free(res->ai_canonname);
     325                free(res->ai_addr);
    330326                free(res);
    331327        }
  • vendor/current/lib/replace/getifaddrs.c

    r860 r988  
    2323   License along with this library; if not, see <http://www.gnu.org/licenses/>.
    2424*/
    25 
    26 #define SOCKET_WRAPPER_NOT_REPLACE
    2725
    2826#include "replace.h"
     
    114112                if (ioctl(fd, SIOCGIFFLAGS, &ifr[i]) == -1) {
    115113                        freeifaddrs(*ifap);
     114                        close(fd);
    116115                        return -1;
    117116                }
    118117
    119118                curif = calloc(1, sizeof(struct ifaddrs));
     119                if (curif == NULL) {
     120                        freeifaddrs(*ifap);
     121                        close(fd);
     122                        return -1;
     123                }
    120124                curif->ifa_name = strdup(ifr[i].ifr_name);
     125                if (curif->ifa_name == NULL) {
     126                        free(curif);
     127                        freeifaddrs(*ifap);
     128                        close(fd);
     129                        return -1;
     130                }
    121131                curif->ifa_flags = ifr[i].ifr_flags;
    122132                curif->ifa_dstaddr = NULL;
     
    127137                if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != -1) {
    128138                        curif->ifa_addr = sockaddr_dup(&ifr[i].ifr_addr);
     139                        if (curif->ifa_addr == NULL) {
     140                                free(curif->ifa_name);
     141                                free(curif);
     142                                freeifaddrs(*ifap);
     143                                close(fd);
     144                                return -1;
     145                        }
    129146                }
    130147
     
    132149                if (ioctl(fd, SIOCGIFNETMASK, &ifr[i]) != -1) {
    133150                        curif->ifa_netmask = sockaddr_dup(&ifr[i].ifr_addr);
     151                        if (curif->ifa_netmask == NULL) {
     152                                if (curif->ifa_addr != NULL) {
     153                                        free(curif->ifa_addr);
     154                                }
     155                                free(curif->ifa_name);
     156                                free(curif);
     157                                freeifaddrs(*ifap);
     158                                close(fd);
     159                                return -1;
     160                        }
    134161                }
    135162
  • vendor/current/lib/replace/replace-test.h

    r740 r988  
    22#define __LIB_REPLACE_REPLACE_TEST_H__
    33
    4 bool torture_local_replace(struct torture_context *ctx);
    54int libreplace_test_strptime(void);
    65int test_readdir_os2_delete(void);
  • vendor/current/lib/replace/replace.c

    r860 r988  
    2828#include "system/filesys.h"
    2929#include "system/time.h"
     30#include "system/network.h"
    3031#include "system/passwd.h"
    3132#include "system/syslog.h"
     
    6465
    6566#ifndef HAVE_STRLCPY
    66 /* like strncpy but does not 0 fill the buffer and always null
    67    terminates. bufsize is the size of the destination buffer */
     67/*
     68 * Like strncpy but does not 0 fill the buffer and always null
     69 * terminates. bufsize is the size of the destination buffer.
     70 * Returns the length of s.
     71 */
    6872size_t rep_strlcpy(char *d, const char *s, size_t bufsize)
    6973{
    7074        size_t len = strlen(s);
    7175        size_t ret = len;
    72         if (bufsize <= 0) return 0;
    73         if (len >= bufsize) len = bufsize-1;
     76
     77        if (bufsize <= 0) {
     78                return 0;
     79        }
     80        if (len >= bufsize) {
     81                len = bufsize - 1;
     82        }
    7483        memcpy(d, s, len);
    7584        d[len] = 0;
     
    8493size_t rep_strlcat(char *d, const char *s, size_t bufsize)
    8594{
    86         size_t len1 = strlen(d);
     95        size_t len1 = strnlen(d, bufsize);
    8796        size_t len2 = strlen(s);
    8897        size_t ret = len1 + len2;
     
    212221}
    213222#endif /* HAVE_INITGROUPS */
    214 
    215 
    216 #if (defined(SecureWare) && defined(SCO))
    217 /* This is needed due to needing the nap() function but we don't want
    218    to include the Xenix libraries since that will break other things...
    219    BTW: system call # 0x0c28 is the same as calling nap() */
    220 long nap(long milliseconds) {
    221          return syscall(0x0c28, milliseconds);
    222  }
    223 #endif
    224223
    225224
     
    412411        /* have a reasonable go at emulating it. Hope that
    413412           the system mktemp() isn't completely hopeless */
    414         char *p = mktemp(template);
    415         if (!p)
     413        mktemp(template);
     414        if (template[0] == 0)
    416415                return -1;
    417         return open(p, O_CREAT|O_EXCL|O_RDWR, 0600);
     416        return open(template, O_CREAT|O_EXCL|O_RDWR, 0600);
    418417}
    419418#endif
     
    477476#endif
    478477
     478#ifndef HAVE_STRSEP
     479char *rep_strsep(char **pps, const char *delim)
     480{
     481        char *ret = *pps;
     482        char *p = *pps;
     483
     484        if (p == NULL) {
     485                return NULL;
     486        }
     487        p += strcspn(p, delim);
     488        if (*p == '\0') {
     489                *pps = NULL;
     490        } else {
     491                *p = '\0';
     492                *pps = p + 1;
     493        }
     494        return ret;
     495}
     496#endif
     497
    479498#ifndef HAVE_STRTOK_R
    480499/* based on GLIBC version, copyright Free Software Foundation */
     
    520539#else
    521540#ifdef HAVE_BSD_STRTOLL
    522 #ifdef HAVE_STRTOQ
     541#undef strtoll
    523542long long int rep_strtoll(const char *str, char **endptr, int base)
    524543{
    525         long long int nb = strtoq(str, endptr, base);
    526         /* In linux EINVAL is only returned if base is not ok */
     544        int saved_errno = errno;
     545        long long int nb = strtoll(str, endptr, base);
     546        /* With glibc EINVAL is only returned if base is not ok */
    527547        if (errno == EINVAL) {
    528548                if (base == 0 || (base >1 && base <37)) {
     
    531551                         * Let's reset errno.
    532552                         */
    533                         errno = 0;
     553                        errno = saved_errno;
    534554                }
    535555        }
    536556        return nb;
    537557}
    538 #else
    539 #error "You need the strtoq function"
    540 #endif /* HAVE_STRTOQ */
    541558#endif /* HAVE_BSD_STRTOLL */
    542559#endif /* HAVE_STRTOLL */
     
    558575#else
    559576#ifdef HAVE_BSD_STRTOLL
    560 #ifdef HAVE_STRTOUQ
     577#undef strtoull
    561578unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
    562579{
    563         unsigned long long int nb = strtouq(str, endptr, base);
    564         /* In linux EINVAL is only returned if base is not ok */
     580        int saved_errno = errno;
     581        unsigned long long int nb = strtoull(str, endptr, base);
     582        /* With glibc EINVAL is only returned if base is not ok */
    565583        if (errno == EINVAL) {
    566584                if (base == 0 || (base >1 && base <37)) {
     
    569587                         * Let's reset errno.
    570588                         */
    571                         errno = 0;
     589                        errno = saved_errno;
    572590                }
    573591        }
    574592        return nb;
    575593}
    576 #else
    577 #error "You need the strtouq function"
    578 #endif /* HAVE_STRTOUQ */
    579594#endif /* HAVE_BSD_STRTOLL */
    580595#endif /* HAVE_STRTOULL */
     
    795810#endif
    796811
    797 #if !defined(HAVE_STRERROR_R) || !defined(STRERROR_R_PROTO_COMPATIBLE)
     812#ifndef HAVE_STRERROR_R
    798813int rep_strerror_r(int errnum, char *buf, size_t buflen)
    799814{
     
    814829        switch (clk_id) {
    815830                case 0: /* CLOCK_REALTIME :*/
    816 #ifdef HAVE_GETTIMEOFDAY_TZ
     831#if defined(HAVE_GETTIMEOFDAY_TZ) || defined(HAVE_GETTIMEOFDAY_TZ_VOID)
    817832                        gettimeofday(&tval,NULL);
    818833#else
     
    829844}
    830845#endif
     846
     847#ifndef HAVE_MEMALIGN
     848void *rep_memalign( size_t align, size_t size )
     849{
     850#if defined(HAVE_POSIX_MEMALIGN)
     851        void *p = NULL;
     852        int ret = posix_memalign( &p, align, size );
     853        if ( ret == 0 )
     854                return p;
     855
     856        return NULL;
     857#else
     858        /* On *BSD systems memaligns doesn't exist, but memory will
     859         * be aligned on allocations of > pagesize. */
     860#if defined(SYSCONF_SC_PAGESIZE)
     861        size_t pagesize = (size_t)sysconf(_SC_PAGESIZE);
     862#elif defined(HAVE_GETPAGESIZE)
     863        size_t pagesize = (size_t)getpagesize();
     864#else
     865        size_t pagesize = (size_t)-1;
     866#endif
     867        if (pagesize == (size_t)-1) {
     868                errno = ENOSYS;
     869                return NULL;
     870        }
     871        if (size < pagesize) {
     872                size = pagesize;
     873        }
     874        return malloc(size);
     875#endif
     876}
     877#endif
     878
     879#ifndef HAVE_GETPEEREID
     880int rep_getpeereid(int s, uid_t *uid, gid_t *gid)
     881{
     882#if defined(HAVE_PEERCRED)
     883        struct ucred cred;
     884        socklen_t cred_len = sizeof(struct ucred);
     885        int ret;
     886
     887#undef getsockopt
     888        ret = getsockopt(s, SOL_SOCKET, SO_PEERCRED, (void *)&cred, &cred_len);
     889        if (ret != 0) {
     890                return -1;
     891        }
     892
     893        if (cred_len != sizeof(struct ucred)) {
     894                errno = EINVAL;
     895                return -1;
     896        }
     897
     898        *uid = cred.uid;
     899        *gid = cred.gid;
     900        return 0;
     901#else
     902        errno = ENOSYS;
     903        return -1;
     904#endif
     905}
     906#endif
     907
     908#ifndef HAVE_USLEEP
     909int rep_usleep(useconds_t sec)
     910{
     911        struct timeval tval;
     912        /*
     913         * Fake it with select...
     914         */
     915        tval.tv_sec = 0;
     916        tval.tv_usec = usecs/1000;
     917        select(0,NULL,NULL,NULL,&tval);
     918        return 0;
     919}
     920#endif /* HAVE_USLEEP */
     921
     922#ifndef HAVE_SETPROCTITLE
     923void rep_setproctitle(const char *fmt, ...)
     924{
     925}
     926#endif
  • vendor/current/lib/replace/replace.h

    r860 r988  
    4242#include <errno.h>
    4343
     44#ifndef HAVE_DECL_EWOULDBLOCK
     45#define EWOULDBLOCK EAGAIN
     46#endif
     47
    4448#if defined(_MSC_VER) || defined(__MINGW32__)
    4549#include "win32_replace.h"
     
    4751
    4852
    49 #ifdef HAVE_STDINT_H
     53#ifdef HAVE_INTTYPES_H
     54#define __STDC_FORMAT_MACROS
     55#include <inttypes.h>
     56#elif HAVE_STDINT_H
    5057#include <stdint.h>
    5158/* force off HAVE_INTTYPES_H so that roken doesn't try to include both,
    5259   which causes a warning storm on irix */
    5360#undef HAVE_INTTYPES_H
    54 #elif HAVE_INTTYPES_H
    55 #define __STDC_FORMAT_MACROS
    56 #include <inttypes.h>
     61#endif
     62
     63#ifdef HAVE_MALLOC_H
     64#include <malloc.h>
    5765#endif
    5866
    5967#ifndef __PRI64_PREFIX
    60 # if __WORDSIZE == 64
     68# if __WORDSIZE == 64 && ! defined __APPLE__
    6169#  define __PRI64_PREFIX        "l"
    6270# else
     
    105113#endif
    106114
     115#ifndef SCNd8
     116# define SCNd8          "hhd"
     117#endif
     118#ifndef SCNd16
     119# define SCNd16         "hd"
     120#endif
     121#ifndef SCNd32
     122# define SCNd32         "d"
     123#endif
     124#ifndef SCNd64
     125# define SCNd64         __PRI64_PREFIX "d"
     126#endif
     127
     128#ifndef SCNi8
     129# define SCNi8          "hhi"
     130#endif
     131#ifndef SCNi16
     132# define SCNi16         "hi"
     133#endif
     134#ifndef SCNi32
     135# define SCNi32         "i"
     136#endif
     137#ifndef SCNi64
     138# define SCNi64         __PRI64_PREFIX "i"
     139#endif
     140
     141#ifndef SCNu8
     142# define SCNu8          "hhu"
     143#endif
     144#ifndef SCNu16
     145# define SCNu16         "hu"
     146#endif
     147#ifndef SCNu32
     148# define SCNu32         "u"
     149#endif
     150#ifndef SCNu64
     151# define SCNu64         __PRI64_PREFIX "u"
     152#endif
     153
     154#ifdef HAVE_BSD_STRING_H
     155#include <bsd/string.h>
     156#endif
     157
     158#ifdef HAVE_BSD_UNISTD_H
     159#include <bsd/unistd.h>
     160#endif
     161
    107162#ifdef HAVE_STRING_H
    108163#include <string.h>
     
    115170#ifdef HAVE_SYS_TYPES_H
    116171#include <sys/types.h>
     172#endif
     173
     174#ifdef HAVE_SETPROCTITLE_H
     175#include <setproctitle.h>
    117176#endif
    118177
     
    154213#endif
    155214
     215#ifndef HAVE_MEMALIGN
     216#define memalign rep_memalign
     217void *rep_memalign(size_t boundary, size_t size);
     218#endif
     219
    156220#ifndef HAVE_MKTIME
    157221#define mktime rep_mktime
     
    284348#define strcasestr rep_strcasestr
    285349char *rep_strcasestr(const char *haystack, const char *needle);
     350#endif
     351
     352#ifndef HAVE_STRSEP
     353#define strsep rep_strsep
     354char *rep_strsep(char **pps, const char *delim);
    286355#endif
    287356
     
    453522#endif
    454523
    455 #ifdef REPLACE_STRPTIME
     524#ifndef HAVE_WORKING_STRPTIME
    456525#define strptime rep_strptime
    457526struct tm;
     
    550619#endif
    551620
    552 #if !defined(HAVE_STRERROR_R) || !defined(STRERROR_R_PROTO_COMPATIBLE)
    553 #undef strerror_r
     621#ifndef HAVE_STRERROR_R
    554622#define strerror_r rep_strerror_r
    555623int rep_strerror_r(int errnum, char *buf, size_t buflen);
     
    586654#ifndef UINT64_MAX
    587655#define UINT64_MAX ((uint64_t)-1)
     656#endif
     657
     658#ifndef INT64_MAX
     659#define INT64_MAX 9223372036854775807LL
    588660#endif
    589661
     
    821893#endif
    822894
    823 #if !defined(getpass)
    824 #ifdef REPLACE_GETPASS
    825 #if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
    826 #define getpass(prompt) getpassphrase(prompt)
    827 #else
    828 #define getpass(prompt) rep_getpass(prompt)
    829 char *rep_getpass(const char *prompt);
    830 #endif
    831 #endif
     895#ifndef HAVE_GETPEEREID
     896#define getpeereid rep_getpeereid
     897int rep_getpeereid(int s, uid_t *uid, gid_t *gid);
     898#endif
     899
     900#ifndef HAVE_USLEEP
     901#define usleep rep_usleep
     902typedef long useconds_t;
     903int usleep(useconds_t);
     904#endif
     905
     906#ifndef HAVE_SETPROCTITLE
     907#define setproctitle rep_setproctitle
     908void rep_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
     909#endif
     910
     911bool nss_wrapper_enabled(void);
     912bool nss_wrapper_hosts_enabled(void);
     913bool socket_wrapper_enabled(void);
     914bool uid_wrapper_enabled(void);
     915
     916/* Needed for Solaris atomic_add_XX functions. */
     917#if defined(HAVE_SYS_ATOMIC_H)
     918#include <sys/atomic.h>
    832919#endif
    833920
  • vendor/current/lib/replace/snprintf.c

    r860 r988  
    446446                                }
    447447                                break;
     448                        case 'j':
     449                                cnk->cflags = DP_C_LLONG;
     450                                ch = *format++;
     451                                break;
    448452                        case 'L':
    449453                                cnk->cflags = DP_C_LDOUBLE;
  • vendor/current/lib/replace/strptime.c

    r414 r988  
    252252     int era_cnt;
    253253{
    254   const char *rp_backup;
    255254  int cnt;
    256255  size_t val;
     
    262261  int have_mon, have_mday;
    263262#ifdef _NL_CURRENT
     263  const char *rp_backup;
    264264  size_t num_eras;
    265 #endif
    266265  struct era_entry *era;
     266
     267  era = NULL;
     268#endif
    267269
    268270  have_I = is_pm = 0;
     
    270272  want_century = 0;
    271273  want_era = 0;
    272   era = NULL;
    273274
    274275  have_wday = want_xday = have_yday = have_mon = have_mday = 0;
     
    300301#endif
    301302
     303#ifdef _NL_CURRENT
    302304      /* Make back up of current processing pointer.  */
    303305      rp_backup = rp;
     306#endif
    304307
    305308      switch (*fmt++)
  • vendor/current/lib/replace/system/filesys.h

    r618 r988  
    2727*/
    2828
     29#ifdef HAVE_UNISTD_H
    2930#include <unistd.h>
     31#endif
     32
    3033#include <sys/stat.h>
    3134
     
    99102#ifdef HAVE_SYS_IOCTL_H
    100103#include <sys/ioctl.h>
     104#endif
     105
     106#ifdef HAVE_SYS_UIO_H
     107#include <sys/uio.h>
    101108#endif
    102109
     
    111118#if HAVE_SYS_ATTRIBUTES_H
    112119#include <sys/attributes.h>
     120#elif HAVE_ATTR_ATTRIBUTES_H
     121#include <attr/attributes.h>
    113122#endif
    114123
     
    120129#endif
    121130
     131#ifdef HAVE_SYS_EA_H
     132#include <sys/ea.h>
     133#endif
     134
     135#ifdef HAVE_SYS_EXTATTR_H
     136#include <sys/extattr.h>
     137#endif
    122138
    123139#ifdef HAVE_SYS_RESOURCE_H
     
    125141#endif
    126142
     143#ifndef XATTR_CREATE
     144#define XATTR_CREATE  0x1       /* set value, fail if attr already exists */
     145#endif
     146
     147#ifndef XATTR_REPLACE
     148#define XATTR_REPLACE 0x2       /* set value, fail if attr does not exist */
     149#endif
     150
    127151/* Some POSIX definitions for those without */
    128152
     
    186210#endif
    187211
    188 #endif
     212/*
     213   this allows us to use a uniform error handling for our xattr
     214   wrappers
     215*/
     216#ifndef ENOATTR
     217#define ENOATTR ENODATA
     218#endif
     219
     220
     221#if !defined(HAVE_GETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
     222ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size);
     223#define getxattr(path, name, value, size) rep_getxattr(path, name, value, size)
     224/* define is in "replace.h" */
     225#endif
     226
     227#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
     228ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size);
     229#define fgetxattr(filedes, name, value, size) rep_fgetxattr(filedes, name, value, size)
     230/* define is in "replace.h" */
     231#endif
     232
     233#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
     234ssize_t rep_listxattr (const char *path, char *list, size_t size);
     235#define listxattr(path, list, size) rep_listxattr(path, list, size)
     236/* define is in "replace.h" */
     237#endif
     238
     239#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
     240ssize_t rep_flistxattr (int filedes, char *list, size_t size);
     241#define flistxattr(filedes, value, size) rep_flistxattr(filedes, value, size)
     242/* define is in "replace.h" */
     243#endif
     244
     245#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
     246int rep_removexattr (const char *path, const char *name);
     247#define removexattr(path, name) rep_removexattr(path, name)
     248/* define is in "replace.h" */
     249#endif
     250
     251#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
     252int rep_fremovexattr (int filedes, const char *name);
     253#define fremovexattr(filedes, name) rep_fremovexattr(filedes, name)
     254/* define is in "replace.h" */
     255#endif
     256
     257#if !defined(HAVE_SETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
     258int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
     259#define setxattr(path, name, value, size, flags) rep_setxattr(path, name, value, size, flags)
     260/* define is in "replace.h" */
     261#endif
     262
     263#if !defined(HAVE_FSETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
     264int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
     265#define fsetxattr(filedes, name, value, size, flags) rep_fsetxattr(filedes, name, value, size, flags)
     266/* define is in "replace.h" */
     267#endif
     268
     269#endif
  • vendor/current/lib/replace/system/kerberos.h

    r414 r988  
    88
    99   Copyright (C) Andrew Tridgell 2004
    10    
     10
    1111     ** NOTE! The following LGPL license applies to the replace
    1212     ** library. This does NOT imply that all of Samba is released
    1313     ** under the LGPL
    14    
     14
    1515   This library is free software; you can redistribute it and/or
    1616   modify it under the terms of the GNU Lesser General Public
     
    2929
    3030#ifdef HAVE_KRB5
    31 /* Whether the krb5_address struct has a addrtype property */
    32 /* #undef HAVE_ADDRTYPE_IN_KRB5_ADDRESS */
    33 /* Whether the krb5_address struct has a addr_type property */
    34 #define HAVE_ADDR_TYPE_IN_KRB5_ADDRESS 1
    35 /* Define to 1 if you have the `gsskrb5_extract_authz_data_from_sec_context' */
    36 #define HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT 1
    37 /* Define to 1 if you have the `gsskrb5_get_initiator_subkey' function. */
    38 #define HAVE_GSSKRB5_GET_INITIATOR_SUBKEY 1
    39 /* Define to 1 if you have the `gsskrb5_register_acceptor_identity' function. */
    40 #define HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY 1
    41 /* Define to 1 if you have the `gss_krb5_ccache_name' function. */
    42 #define HAVE_GSS_KRB5_CCACHE_NAME 1
    43 /* Define to 1 if you have the `krb5_addlog_func' function. */
    44 #define HAVE_KRB5_ADDLOG_FUNC 1
    45 /* Define to 1 if you have the `krb5_auth_con_setkey' function. */
    46 #define HAVE_KRB5_AUTH_CON_SETKEY 1
    47 /* Define to 1 if you have the `krb5_auth_con_setuseruserkey' function. */
    48 /* #undef HAVE_KRB5_AUTH_CON_SETUSERUSERKEY */
    49 /* Define to 1 if you have the `krb5_c_enctype_compare' function. */
    50 #define HAVE_KRB5_C_ENCTYPE_COMPARE 1
    51 /* Define to 1 if you have the `krb5_c_verify_checksum' function. */
    52 #define HAVE_KRB5_C_VERIFY_CHECKSUM 1
    53 /* Whether the type krb5_encrypt_block exists */
    54 /* #undef HAVE_KRB5_ENCRYPT_BLOCK */
    55 /* Define to 1 if you have the `krb5_encrypt_data' function. */
    56 /* #undef HAVE_KRB5_ENCRYPT_DATA */
    57 /* Define to 1 if you have the `krb5_enctypes_compatible_keys' function. */
    58 #define HAVE_KRB5_ENCTYPES_COMPATIBLE_KEYS 1
    59 /* Define to 1 if you have the `krb5_free_data_contents' function. */
    60 #define HAVE_KRB5_FREE_DATA_CONTENTS 1
    61 /* Define to 1 if you have the `krb5_free_error_string' function. */
    62 /* #undef HAVE_KRB5_FREE_ERROR_STRING */
    63 /* Define to 1 if you have the `krb5_free_error_message' function. */
    64 #define HAVE_KRB5_FREE_ERROR_MESSAGE 1
    65 /* Define to 1 if you have the `krb5_free_keytab_entry_contents' function. */
    66 /* #undef HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS */
    67 /* Define to 1 if you have the `krb5_free_ktypes' function. */
    68 /* #undef HAVE_KRB5_FREE_KTYPES */
    69 /* Define to 1 if you have the `krb5_free_unparsed_name' function. */
    70 /* #undef HAVE_KRB5_FREE_UNPARSED_NAME */
    71 /* Define to 1 if you have the `krb5_get_default_in_tkt_etypes' function. */
    72 #define HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES 1
    73 /* Define to 1 if you have the `krb5_get_error_string' function. */
    74 #define HAVE_KRB5_GET_ERROR_STRING 1
    75 /* Define to 1 if you have the `krb5_get_error_message' function. */
    76 #define HAVE_KRB5_GET_ERROR_MESSAGE 1
    77 /* Define to 1 if you have the `krb5_get_permitted_enctypes' function. */
    78 /* #undef HAVE_KRB5_GET_PERMITTED_ENCTYPES */
    79 /* Define to 1 if you have the `krb5_get_pw_salt' function. */
    80 #define HAVE_KRB5_GET_PW_SALT 1
    81 /* Define to 1 if you have the <krb5.h> header file. */
    82 #define HAVE_KRB5_H 1
    83 /* Define to 1 if you have the `krb5_initlog' function. */
    84 #define HAVE_KRB5_INITLOG 1
    85 /* Define to 1 if you have the `krb5_kdc_default_config' function. */
    86 #define HAVE_KRB5_KDC_DEFAULT_CONFIG 1
    87 /* Whether the krb5_creds struct has a keyblock property */
    88 /* #undef HAVE_KRB5_KEYBLOCK_IN_CREDS */
    89 /* Whether the krb5_keyblock struct has a keyvalue property */
    90 #define HAVE_KRB5_KEYBLOCK_KEYVALUE 1
    91 /* Whether krb5_keytab_entry has key member */
    92 /* #undef HAVE_KRB5_KEYTAB_ENTRY_KEY */
    93 /* Whether krb5_keytab_entry has keyblock member */
    94 #define HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK 1
    95 /* Define to 1 if you have the `krb5_krbhst_get_addrinfo' function. */
    96 #define HAVE_KRB5_KRBHST_GET_ADDRINFO 1
    97 /* Define to 1 if you have the `krb5_kt_compare' function. */
    98 #define HAVE_KRB5_KT_COMPARE 1
    99 /* Define to 1 if you have the `krb5_kt_free_entry' function. */
    100 #define HAVE_KRB5_KT_FREE_ENTRY 1
    101 /* Whether the type krb5_log_facility exists */
    102 #define HAVE_KRB5_LOG_FACILITY 1
    103 /* Define to 1 if you have the `krb5_mk_req_extended' function. */
    104 #define HAVE_KRB5_MK_REQ_EXTENDED 1
    105 /* Define to 1 if you have the `krb5_principal2salt' function. */
    106 /* #undef HAVE_KRB5_PRINCIPAL2SALT */
    107 /* Define to 1 if you have the `krb5_principal_get_comp_string' function. */
    108 #define HAVE_KRB5_PRINCIPAL_GET_COMP_STRING 1
    109 /* Whether krb5_princ_component is available */
    110 /* #undef HAVE_KRB5_PRINC_COMPONENT */
    111 /* Whether the krb5_creds struct has a session property */
    112 #define HAVE_KRB5_SESSION_IN_CREDS 1
    113 /* Define to 1 if you have the `krb5_set_default_in_tkt_etypes' function. */
    114 #define HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES 1
    115 /* Define to 1 if you have the `krb5_set_default_tgs_ktypes' function. */
    116 /* #undef HAVE_KRB5_SET_DEFAULT_TGS_KTYPES */
    117 /* Define to 1 if you have the `krb5_set_real_time' function. */
    118 #define HAVE_KRB5_SET_REAL_TIME 1
    119 /* Define to 1 if you have the `krb5_set_warn_dest' function. */
    120 #define HAVE_KRB5_SET_WARN_DEST 1
    121 /* Define to 1 if you have the `krb5_string_to_key' function. */
    122 #define HAVE_KRB5_STRING_TO_KEY 1
    123 /* Define to 1 if you have the `krb5_string_to_key_salt' function. */
    124 #define HAVE_KRB5_STRING_TO_KEY_SALT 1
    125 /* Define to 1 if you have the `krb5_ticket_get_authorization_data_type' */
    126 #define HAVE_KRB5_TICKET_GET_AUTHORIZATION_DATA_TYPE 1
    127 /* Whether the krb5_ticket struct has a enc_part2 property */
    128 /* #undef HAVE_KRB5_TKT_ENC_PART2 */
    129 /* Define to 1 if you have the `krb5_use_enctype' function. */
    130 /* #undef HAVE_KRB5_USE_ENCTYPE */
    131 /* Define to 1 if you have the `krb5_verify_checksum' function. */
    132 #define HAVE_KRB5_VERIFY_CHECKSUM 1
    133 /* Whether krb5_princ_realm returns krb5_realm or krb5_data */
    134 #define KRB5_PRINC_REALM_RETURNS_REALM 1
    13531
     32#if HAVE_KRB5_H
    13633#include <krb5.h>
     34#endif
     35
     36#if HAVE_COM_ERR_H
    13737#include <com_err.h>
    138 
    13938#endif
    14039
    14140#endif
     41#endif
  • vendor/current/lib/replace/system/network.h

    r740 r988  
    3232#endif
    3333
     34#ifdef HAVE_UNISTD_H
     35#include <unistd.h>
     36#endif
     37
    3438#ifdef HAVE_SYS_SOCKET_H
    3539#include <sys/socket.h>
     
    7478#ifdef HAVE_NET_IF_H
    7579#include <net/if.h>
    76 #endif
    77 
    78 #ifdef HAVE_UNISTD_H
    79 #include <unistd.h>
    8080#endif
    8181
     
    366366#endif /* HAVE_IPV6 */
    367367
    368 #ifdef SOCKET_WRAPPER
    369 #ifndef SOCKET_WRAPPER_DISABLE
    370 #ifndef SOCKET_WRAPPER_NOT_REPLACE
    371 #define SOCKET_WRAPPER_REPLACE
    372 #endif /* SOCKET_WRAPPER_NOT_REPLACE */
    373 #include "../socket_wrapper/socket_wrapper.h"
    374 #endif /* SOCKET_WRAPPER_DISABLE */
    375 #endif /* SOCKET_WRAPPER */
    376 
    377 #endif
     368#endif
  • vendor/current/lib/replace/system/passwd.h

    r746 r988  
    2828*/
    2929
    30 /* this needs to be included before nss_wrapper.h on some systems */
     30#ifdef HAVE_UNISTD_H
    3131#include <unistd.h>
     32#endif
    3233
    3334#ifdef HAVE_PWD_H
     
    6869#endif
    6970
    70 #if !defined(getpass)
    71 #ifdef REPLACE_GETPASS
    72 #if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
    73 #define getpass(prompt) getpassphrase(prompt)
    74 #else
    75 #define getpass(prompt) rep_getpass(prompt)
    76 char *rep_getpass(const char *prompt);
    77 #endif
    78 #endif
    79 #endif
    80 
    8171#ifndef NGROUPS_MAX
    8272#define NGROUPS_MAX 32 /* Guess... */
     
    8979#endif
    9080
    91 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
    92 #define OSF1_ENH_SEC 1
    93 #endif
    9481
    9582#ifndef ALLOW_CHANGE_PASSWORD
     
    10390#endif
    10491
    105 #ifdef NSS_WRAPPER
    106 #ifndef NSS_WRAPPER_DISABLE
    107 #ifndef NSS_WRAPPER_NOT_REPLACE
    108 #define NSS_WRAPPER_REPLACE
    109 #endif /* NSS_WRAPPER_NOT_REPLACE */
    110 #include "../nss_wrapper/nss_wrapper.h"
    111 #endif /* NSS_WRAPPER_DISABLE */
    112 #endif /* NSS_WRAPPER */
    113 
    11492#endif
  • vendor/current/lib/replace/system/select.h

    r740 r988  
    3333#ifdef HAVE_SYS_EPOLL_H
    3434#include <sys/epoll.h>
     35#endif
     36
     37#ifdef HAVE_SOLARIS_PORTS
     38#include <port.h>
    3539#endif
    3640
  • vendor/current/lib/replace/test/getifaddrs.c

    r860 r988  
    2727#include "replace.h"
    2828#include "system/network.h"
     29#include "replace-test.h"
    2930#endif
    3031
  • vendor/current/lib/replace/test/main.c

    r414 r988  
    2525
    2626#include "replace.h"
    27 
    28 struct torture_context;
    29 bool torture_local_replace(struct torture_context *ctx);
     27#include "replace-testsuite.h"
    3028
    3129int main(void)
  • vendor/current/lib/replace/test/os2_delete.c

    r740 r988  
    1313#include <string.h>
    1414#include <fcntl.h>
     15#include "replace-test.h"
    1516
    1617#define NUM_FILES 700
     
    2223static int test_readdir_os2_delete_ret;
    2324
    24 #define FAILED(d) (printf("failure: readdir [\nFailed for %s - %d = %s\n]\n", d, errno, strerror(errno)), test_readdir_os2_delete_ret = 1, 1)
     25#define FAILED(d) (printf("failure: readdir [\nFailed for %s - %d = %s\n]\n", d, errno, strerror(errno)), test_readdir_os2_delete_ret = 1)
    2526
    2627#ifndef MIN
     
    7071             de=readdir(d), i++) {
    7172                offsets[i] = telldir(d);
    72                 strcpy(names[i], de->d_name);
     73                /* strlcpy not available here */
     74                snprintf(names[i], sizeof(names[i]), "%s", de->d_name);
    7375        }
    7476
  • vendor/current/lib/replace/test/strptime.c

    r414 r988  
    2020#include "replace.h"
    2121#include "system/time.h"
     22#include "replace-test.h"
    2223
    2324#endif /* LIBREPLACE_CONFIGURE_TEST_STRPTIME */
  • vendor/current/lib/replace/test/testsuite.c

    r740 r988  
    2525
    2626#include "replace.h"
     27#include "replace-test.h"
     28#include "replace-testsuite.h"
    2729
    2830/*
     
    4951#define TESTFILE "testfile.dat"
    5052
     53
    5154/*
    5255  test ftruncate() function
     
    6770        if (ftruncate(fd, size) != 0) {
    6871                printf("failure: ftruncate [\n%s\n]\n", strerror(errno));
     72                close(fd);
    6973                return false;
    7074        }
    7175        if (fstat(fd, &st) != 0) {
    7276                printf("failure: ftruncate [\nfstat failed - %s\n]\n", strerror(errno));
     77                close(fd);
    7378                return false;
    7479        }
     
    7681                printf("failure: ftruncate [\ngave wrong size %d - expected %d\n]\n",
    7782                       (int)st.st_size, size);
     83                close(fd);
    7884                return false;
    7985        }
    8086        unlink(TESTFILE);
    8187        printf("success: ftruncate\n");
     88        close(fd);
    8289        return true;
    8390}
     
    270277        if (strcmp(x, "bla") != 0) {
    271278                printf("failure: strndup [\ninvalid\n]\n");
     279                free(x);
    272280                return false;
    273281        }
     
    377385}
    378386
    379 extern int test_readdir_os2_delete(void);
    380 
    381387static int test_readdir(void)
    382388{
     
    458464
    459465static int test_pwrite(void)
    460 {
    461         /* FIXME */
    462         return true;
    463 }
    464 
    465 static int test_getpass(void)
    466466{
    467467        /* FIXME */
     
    893893                       "fstat (1) failed - %s\n]\n",
    894894                       strerror(errno));
     895                close(fd);
    895896                return false;
    896897        }
     
    902903                       "utime(&u) failed - %s\n]\n",
    903904                       strerror(errno));
     905                close(fd);
    904906                return false;
    905907        }
     
    909911                       "fstat (2) failed - %s\n]\n",
    910912                       strerror(errno));
     913                close(fd);
    911914                return false;
    912915        }
     
    916919                       "utime(NULL) failed - %s\n]\n",
    917920                       strerror(errno));
     921                close(fd);
    918922                return false;
    919923        }
     
    923927                       "fstat (3) failed - %s\n]\n",
    924928                       strerror(errno));
     929                close(fd);
    925930                return false;
    926931        }
     
    932937                       __location__, \
    933938                       #a, (int)a, #c, #b, (int)b); \
     939                close(fd); \
    934940                return false; \
    935941        } \
     
    951957        unlink(TESTFILE);
    952958        printf("success: utime\n");
     959        close(fd);
    953960        return true;
    954961}
     
    975982                       "fstat (1) failed - %s\n]\n",
    976983                       strerror(errno));
     984                close(fd);
    977985                return false;
    978986        }
     
    985993                       "utimes(tv) failed - %s\n]\n",
    986994                       strerror(errno));
     995                close(fd);
    987996                return false;
    988997        }
     
    9921001                       "fstat (2) failed - %s\n]\n",
    9931002                       strerror(errno));
     1003                close(fd);
    9941004                return false;
    9951005        }
     
    10011011                       __location__, \
    10021012                       #a, (int)a, #b, (int)b); \
     1013                close(fd); \
    10031014                return false; \
    10041015        } \
     
    10121023        unlink(TESTFILE);
    10131024        printf("success: utimes\n");
     1025        close(fd);
    10141026        return true;
    10151027}
     
    10531065
    10541066
    1055 struct torture_context;
    10561067bool torture_local_replace(struct torture_context *ctx)
    10571068{
     
    10901101        ret &= test_pread();
    10911102        ret &= test_pwrite();
    1092         ret &= test_getpass();
    10931103        ret &= test_inet_ntoa();
    10941104        ret &= test_strtoll();
  • vendor/current/lib/replace/wscript

    r740 r988  
    66blddir = 'bin'
    77
    8 import sys, os, Utils
     8import sys, os
    99
    1010# find the buildtools directory
    1111srcdir = '.'
    1212while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
    13     srcdir = '../' + srcdir
     13    srcdir = srcdir + '/..'
    1414sys.path.insert(0, srcdir + '/buildtools/wafsamba')
    1515
    1616import wafsamba, samba_dist
    17 import Options, os, preproc
    18 
    19 samba_dist.DIST_DIRS('lib/replace buildtools:buildtools')
     17import Options, Utils
     18
     19samba_dist.DIST_DIRS('lib/replace buildtools:buildtools third_party/waf:third_party/waf')
    2020
    2121def set_options(opt):
     
    2424    opt.RECURSE('buildtools/wafsamba')
    2525
    26 @wafsamba.runonce
     26@Utils.run_once
    2727def configure(conf):
    2828    conf.RECURSE('buildtools/wafsamba')
     
    3030    conf.env.standalone_replace = conf.IN_LAUNCH_DIR()
    3131
     32    conf.DEFINE('HAVE_LIBREPLACE', 1)
    3233    conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1)
    33 
    34     # on Tru64 certain features are only available with _OSF_SOURCE set to 1
    35     # and _XOPEN_SOURCE set to 600
    36     if conf.env['SYSTEM_UNAME_SYSNAME'] == 'OSF1':
    37         conf.DEFINE('_OSF_SOURCE', 1, add_to_cflags=True)
    38         conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True)
    3934
    4035    conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h')
     
    4338    conf.CHECK_HEADERS('libaio.h locale.h ndir.h pwd.h')
    4439    conf.CHECK_HEADERS('shadow.h sys/acl.h')
    45     conf.CHECK_HEADERS('sys/attributes.h sys/capability.h sys/dir.h sys/epoll.h')
     40    conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h')
     41    conf.CHECK_HEADERS('port.h')
    4642    conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h sys/fs/vx/quota.h')
    4743    conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h')
    4844    conf.CHECK_HEADERS('sys/resource.h sys/security.h sys/shm.h sys/statfs.h sys/statvfs.h sys/termio.h')
    4945    conf.CHECK_HEADERS('sys/vfs.h sys/xattr.h termio.h termios.h sys/file.h')
    50     conf.CHECK_HEADERS('sys/wait.h sys/stat.h malloc.h grp.h')
     46    conf.CHECK_HEADERS('sys/ucontext.h sys/wait.h sys/stat.h')
     47
     48    if not conf.CHECK_DECLS('malloc', headers='stdlib.h'):
     49        conf.CHECK_HEADERS('malloc.h')
     50
     51    conf.CHECK_HEADERS('grp.h')
    5152    conf.CHECK_HEADERS('sys/select.h setjmp.h utime.h sys/syslog.h syslog.h')
    5253    conf.CHECK_HEADERS('stdarg.h vararg.h sys/mount.h mntent.h')
     
    5758    conf.CHECK_HEADERS('sys/uio.h ifaddrs.h direct.h dirent.h')
    5859    conf.CHECK_HEADERS('windows.h winsock2.h ws2tcpip.h')
    59     conf.CHECK_HEADERS('libintl.h errno.h')
    60     conf.CHECK_HEADERS('gcrypt.h getopt.h iconv.h')
    61     conf.CHECK_HEADERS('sys/inotify.h memory.h nss.h sasl/sasl.h')
    62     conf.CHECK_HEADERS('security/pam_appl.h sys/inotify.h zlib.h asm/unistd.h')
     60    conf.CHECK_HEADERS('errno.h')
     61    conf.CHECK_HEADERS('getopt.h iconv.h')
     62    conf.CHECK_HEADERS('memory.h nss.h sasl/sasl.h')
     63
     64    conf.CHECK_FUNCS_IN('inotify_init', 'inotify', checklibc=True,
     65                        headers='sys/inotify.h')
     66
     67    conf.CHECK_HEADERS('security/pam_appl.h zlib.h asm/unistd.h')
    6368    conf.CHECK_HEADERS('aio.h sys/unistd.h rpc/rpc.h rpc/nettype.h alloca.h float.h')
    6469
    65     conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h sys/prctl.h sys/sysctl.h')
     70    conf.CHECK_HEADERS('rpcsvc/nis.h rpcsvc/ypclnt.h sys/sysctl.h')
    6671    conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h')
    67     conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h rpcsvc/yp_prot.h')
     72    conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h')
     73
     74    conf.CHECK_CODE('', headers='rpc/rpc.h rpcsvc/yp_prot.h', define='HAVE_RPCSVC_YP_PROT_H')
     75
    6876    conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h')
    6977    conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h')
     
    7179    conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h')
    7280    conf.CHECK_HEADERS('syscall.h sys/syscall.h inttypes.h')
     81    conf.CHECK_HEADERS('sys/atomic.h')
     82    conf.CHECK_HEADERS('libgen.h')
     83
     84    # Check for process set name support
     85    conf.CHECK_CODE('''
     86                    #include <sys/prctl.h>
     87                    int main(void) {
     88                        prctl(0);
     89                        return 0;
     90                    }
     91                    ''',
     92                    'HAVE_PRCTL',
     93                    headers='sys/prctl.h',
     94                    msg='Checking for prctl syscall')
     95
     96    conf.CHECK_CODE('''
     97                    #include <unistd.h>
     98                    #ifdef HAVE_FCNTL_H
     99                    #include <fcntl.h>
     100                    #endif
     101                    int main(void) { int fd = open("/dev/null", O_DIRECT); }
     102                    ''',
     103                    define='HAVE_OPEN_O_DIRECT',
     104                    addmain=False,
     105                    msg='Checking for O_DIRECT flag to open(2)')
    73106
    74107    conf.CHECK_TYPES('"long long" intptr_t uintptr_t ptrdiff_t comparison_fn_t')
     
    91124    conf.CHECK_TYPE('volatile int', define='HAVE_VOLATILE')
    92125    conf.CHECK_TYPE('uint_t', 'unsigned int')
     126    conf.CHECK_TYPE('blksize_t', 'long', headers='sys/types.h sys/stat.h unistd.h')
     127    conf.CHECK_TYPE('blkcnt_t', 'long', headers='sys/types.h sys/stat.h unistd.h')
    93128
    94129    conf.CHECK_SIZEOF('bool char int "long long" long short size_t ssize_t')
     
    107142
    108143    conf.CHECK_TYPE_IN('sig_atomic_t', 'signal.h', define='HAVE_SIG_ATOMIC_T_TYPE')
     144    conf.CHECK_FUNCS('sigsetmask siggetmask sigprocmask sigblock sigaction sigset')
    109145
    110146    conf.CHECK_FUNCS_IN('''inet_ntoa inet_aton inet_ntop inet_pton connect gethostbyname
     
    156192                    headers='sys/socket.h netdb.h netinet/in.h')
    157193
     194    if conf.CONFIG_SET('HAVE_SYS_UCONTEXT_H') and conf.CONFIG_SET('HAVE_SIGNAL_H'):
     195        conf.CHECK_CODE('''
     196                       ucontext_t uc;
     197                       sigaddset(&uc.uc_sigmask, SIGUSR1);
     198                       ''',
     199                       'HAVE_UCONTEXT_T',
     200                       msg="Checking whether we have ucontext_t",
     201                       headers='signal.h sys/ucontext.h')
     202
     203    # Check for atomic builtins. */
     204    conf.CHECK_CODE('''
     205                    int main(void) {
     206                        int i;
     207                        (void)__sync_fetch_and_add(&i, 1);
     208                        return 0;
     209                    }
     210                    ''',
     211                    'HAVE___SYNC_FETCH_AND_ADD',
     212                    msg='Checking for __sync_fetch_and_add compiler builtin')
     213
     214    conf.CHECK_CODE('''
     215                    #include <stdint.h>
     216                    #include <sys/atomic.h>
     217                    int main(void) {
     218                        int32_t i;
     219                        atomic_add_32(&i, 1);
     220                        return 0;
     221                    }
     222                    ''',
     223                    'HAVE_ATOMIC_ADD_32',
     224                    headers='stdint.h sys/atomic.h',
     225                    msg='Checking for atomic_add_32 compiler builtin')
     226
    158227    # these may be builtins, so we need the link=False strategy
    159228    conf.CHECK_FUNCS('strdup memmem printf memset memcpy memmove strcpy strncpy bzero', link=False)
    160229
     230    # See https://bugzilla.samba.org/show_bug.cgi?id=1097
     231    #
     232    # Ported in from autoconf where it was added with this commit:
     233    # commit 804cfb20a067b4b687089dc72a8271b3abf20f31
     234    # Author: Simo Sorce <idra@samba.org>
     235    # Date:   Wed Aug 25 14:24:16 2004 +0000
     236    #     r2070: Let's try to overload srnlen and strndup for AIX where they are natly broken.
     237
     238    host_os = sys.platform
     239    if host_os.rfind('aix') > -1:
     240        conf.DEFINE('BROKEN_STRNLEN', 1)
     241        conf.DEFINE('BROKEN_STRNDUP', 1)
     242
    161243    conf.CHECK_FUNCS('shl_load shl_unload shl_findsym')
    162244    conf.CHECK_FUNCS('pipe strftime srandom random srand rand usleep setbuffer')
    163     conf.CHECK_FUNCS('lstat getpgrp utime utimes seteuid setresuid setegid')
    164     conf.CHECK_FUNCS('setresgid chroot strerror vsyslog setlinebuf mktime')
    165     conf.CHECK_FUNCS('ftruncate chsize rename waitpid wait4 strlcpy strlcat')
    166     conf.CHECK_FUNCS('initgroups pread pwrite strndup strcasestr')
     245    conf.CHECK_FUNCS('lstat getpgrp utime utimes setuid seteuid setreuid setresuid setgid setegid')
     246    conf.CHECK_FUNCS('setregid setresgid chroot strerror vsyslog setlinebuf mktime')
     247    conf.CHECK_FUNCS('ftruncate chsize rename waitpid wait4')
     248    conf.CHECK_FUNCS('initgroups pread pwrite strndup strcasestr strsep')
    167249    conf.CHECK_FUNCS('strtok_r mkdtemp dup2 dprintf vdprintf isatty chown lchown')
    168250    conf.CHECK_FUNCS('link readlink symlink realpath snprintf vsnprintf')
    169251    conf.CHECK_FUNCS('asprintf vasprintf setenv unsetenv strnlen strtoull __strtoull')
    170     conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq')
     252    conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq memalign posix_memalign')
     253
     254    if conf.CONFIG_SET('HAVE_MEMALIGN'):
     255        conf.CHECK_DECLS('memalign', headers='malloc.h')
     256
     257    conf.CHECK_FUNCS('prctl dirname basename')
     258
     259    # libbsd on some platforms provides strlcpy and strlcat
     260    if not conf.CHECK_FUNCS('strlcpy strlcat'):
     261        conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h',
     262                checklibc=True)
     263    if not conf.CHECK_FUNCS('getpeereid'):
     264        conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
     265    if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
     266        conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
     267
     268    conf.CHECK_CODE('''
     269                struct ucred cred;
     270                socklen_t cred_len;
     271                int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
     272                'HAVE_PEERCRED',
     273                msg="Checking whether we can use SO_PEERCRED to get socket credentials",
     274                headers='sys/types.h sys/socket.h')
     275
    171276    #Some OS (ie. freebsd) return EINVAL if the convertion could not be done, it's not what we expect
    172277    #Let's detect those cases
     
    183288                        headers = 'errno.h',
    184289                        execute = True,
    185                         define_ret = True,
    186290                        define = 'HAVE_BSD_STRTOLL',
    187291                        )
     
    189293    conf.CHECK_FUNCS('getdirentries getdents syslog')
    190294    conf.CHECK_FUNCS('gai_strerror get_current_dir_name')
    191     conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs mmap setgroups setsid')
     295    conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs mmap setgroups syscall setsid')
    192296    conf.CHECK_FUNCS('getgrent_r getgrgid_r getgrnam_r getgrouplist getpagesize')
    193297    conf.CHECK_FUNCS('getpwent_r getpwnam_r getpwuid_r epoll_create')
     298    conf.CHECK_FUNCS('port_create')
     299
     300    conf.SET_TARGET_TYPE('attr', 'EMPTY')
     301
     302    xattr_headers='sys/attributes.h attr/xattr.h sys/xattr.h'
     303
     304    conf.CHECK_FUNCS_IN('''
     305fgetxattr flistea flistxattr
     306fremovexattr fsetxattr getxattr
     307listxattr removexattr setxattr
     308''', 'attr', checklibc=True, headers=xattr_headers)
     309
     310    # We need to check for linux xattrs first, as we do not wish to link to -lattr
     311    # (the XFS compat API) on Linux systems with the native xattr API
     312    if not conf.CONFIG_SET('HAVE_GETXATTR'):
     313        conf.CHECK_FUNCS_IN('''
     314attr_get attr_getf attr_list attr_listf attropen attr_remove
     315attr_removef attr_set attr_setf extattr_delete_fd extattr_delete_file
     316extattr_get_fd extattr_get_file extattr_list_fd extattr_list_file
     317extattr_set_fd extattr_set_file fgetea
     318fremoveea fsetea getea listea
     319removeea setea
     320''', 'attr', checklibc=True, headers=xattr_headers)
     321
     322    if (conf.CONFIG_SET('HAVE_ATTR_LISTF') or
     323        conf.CONFIG_SET('HAVE_EXTATTR_LIST_FD') or
     324        conf.CONFIG_SET('HAVE_FLISTEA') or
     325        conf.CONFIG_SET('HAVE_FLISTXATTR')):
     326            conf.DEFINE('HAVE_XATTR_SUPPORT', 1)
     327
     328    # Darwin has extra options to xattr-family functions
     329    conf.CHECK_CODE('getxattr(NULL, NULL, NULL, 0, 0, 0)',
     330                    headers=xattr_headers, local_include=False,
     331                    define='XATTR_ADDITIONAL_OPTIONS',
     332                    msg="Checking whether xattr interface takes additional options")
    194333
    195334    conf.CHECK_FUNCS_IN('dlopen dlsym dlerror dlclose', 'dl',
     
    206345        for c in ['CLOCK_MONOTONIC', 'CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_REALTIME']:
    207346            conf.CHECK_CODE('''
    208                             #if TIME_WITH_SYS_TIME
    209                             # include <sys/time.h>
    210                             # include <time.h>
    211                             #else
    212                             # if HAVE_SYS_TIME_H
    213                             #  include <sys/time.h>
    214                             # else
    215                             #  include <time.h>
    216                             # endif
    217                             #endif
    218                             clockid_t clk = %s''' % c,
    219                             'HAVE_%s' % c,
    220                             msg='Checking whether the clock_gettime clock ID %s is available' % c)
     347                #if TIME_WITH_SYS_TIME
     348                # include <sys/time.h>
     349                # include <time.h>
     350                #else
     351                # if HAVE_SYS_TIME_H
     352                #  include <sys/time.h>
     353                # else
     354                #  include <time.h>
     355                # endif
     356                #endif
     357                clockid_t clk = %s''' % c,
     358                'HAVE_%s' % c,
     359                msg='Checking whether the clock_gettime clock ID %s is available' % c)
    221360
    222361    conf.CHECK_TYPE('struct timespec', headers='sys/time.h time.h')
     
    229368
    230369
    231     if not conf.CHECK_FUNCS_IN('gettext', 'intl', checklibc=True, headers='libintl.h'):
    232     # Some hosts need lib iconv for linking with lib intl
    233     # So we try with flags just in case it helps.
    234         oldflags = conf.env['LDFLAGS_INTL']
    235         conf.env['LDFLAGS_INTL'] = "-liconv"
    236         if not conf.CHECK_LIB('intl'):
    237             conf.env['LDFLAGS_INTL'] = oldflags
     370    # try to find libintl (if --without-gettext is not given)
     371    conf.env.intl_libs=''
     372    if not Options.options.disable_gettext:
     373        conf.CHECK_HEADERS('libintl.h')
     374        conf.CHECK_LIB('intl')
     375        conf.CHECK_DECLS('dgettext gettext bindtextdomain textdomain bind_textdomain_codeset', headers="libintl.h")
     376        # *textdomain functions are not strictly necessary
     377        conf.CHECK_FUNCS_IN('bindtextdomain textdomain bind_textdomain_codeset',
     378                            '', checklibc=True, headers='libintl.h')
     379        # gettext and dgettext must exist
     380        # on some systems (the ones with glibc, those are in libc)
     381        if conf.CHECK_FUNCS_IN('dgettext gettext', '', checklibc=True, headers='libintl.h'):
     382            # save for dependency definitions
     383            conf.env.intl_libs=''
     384        # others (e.g. FreeBSD) have seperate libintl
     385        elif conf.CHECK_FUNCS_IN('dgettext gettext', 'intl', checklibc=False, headers='libintl.h'):
     386            # save for dependency definitions
     387            conf.env.intl_libs='intl'
     388            # recheck with libintl
     389            conf.CHECK_FUNCS_IN('bindtextdomain textdomain bind_textdomain_codeset',
     390                            'intl', checklibc=False, headers='libintl.h')
    238391        else:
    239             conf.CHECK_FUNCS_IN('gettext', 'intl', checklibc=True, headers='libintl.h')
    240 
    241     conf.CHECK_FUNCS_IN('dgettext gettext', 'intl', headers='libintl.h')
     392            # Some hosts need lib iconv for linking with lib intl
     393            # So we try with flags just in case it helps.
     394            oldflags = list(conf.env['EXTRA_LDFLAGS']);
     395            conf.env['EXTRA_LDFLAGS'].extend(["-liconv"])
     396            conf.CHECK_FUNCS_IN('dgettext gettext bindtextdomain textdomain bind_textdomain_codeset',
     397                                'intl', checklibc=False, headers='libintl.h')
     398            conf.env['EXTRA_LDFLAGS'] = oldflags
     399            if conf.env['HAVE_GETTEXT'] and conf.env['HAVE_DGETTEXT']:
     400                # save for dependency definitions
     401                conf.env.intl_libs='iconv intl'
     402
     403    # did we find both prototypes and a library to link against?
     404    # if not, unset the detected values (see Bug #9911)
     405    if not (conf.env['HAVE_GETTEXT'] and conf.env['HAVE_DECL_GETTEXT']):
     406       conf.undefine('HAVE_GETTEXT')
     407       conf.undefine('HAVE_DECL_GETTEXT')
     408    if not (conf.env['HAVE_DGETTEXT'] and conf.env['HAVE_DECL_DGETTEXT']):
     409       conf.undefine('HAVE_DGETTEXT')
     410       conf.undefine('HAVE_DECL_DGETTEXT')
     411
    242412    conf.CHECK_FUNCS_IN('pthread_create', 'pthread', checklibc=True, headers='pthread.h')
     413
     414    PTHREAD_CFLAGS='error'
     415    PTHREAD_LDFLAGS='error'
     416
     417    if PTHREAD_LDFLAGS == 'error':
     418        if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthread'):
     419            PTHREAD_CFLAGS='-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS'
     420            PTHREAD_LDFLAGS='-lpthread'
     421    if PTHREAD_LDFLAGS == 'error':
     422        if conf.CHECK_FUNCS_IN('pthread_attr_init', 'pthreads'):
     423            PTHREAD_CFLAGS='-D_THREAD_SAFE'
     424            PTHREAD_LDFLAGS='-lpthreads'
     425    if PTHREAD_LDFLAGS == 'error':
     426        if conf.CHECK_FUNCS_IN('pthread_attr_init', 'c_r'):
     427            PTHREAD_CFLAGS='-D_THREAD_SAFE -pthread'
     428            PTHREAD_LDFLAGS='-pthread'
     429    if PTHREAD_LDFLAGS == 'error':
     430        if conf.CHECK_FUNCS('pthread_attr_init'):
     431            PTHREAD_CFLAGS='-D_REENTRANT'
     432            PTHREAD_LDFLAGS='-lpthread'
     433    # especially for HP-UX, where the CHECK_FUNC macro fails to test for
     434    # pthread_attr_init. On pthread_mutex_lock it works there...
     435    if PTHREAD_LDFLAGS == 'error':
     436        if conf.CHECK_FUNCS_IN('pthread_mutex_lock', 'pthread'):
     437            PTHREAD_CFLAGS='-D_REENTRANT'
     438            PTHREAD_LDFLAGS='-lpthread'
     439
     440    if PTHREAD_CFLAGS != 'error' and PTHREAD_LDFLAGS != 'error':
     441        if conf.CONFIG_SET('replace_add_global_pthread'):
     442            conf.ADD_CFLAGS(PTHREAD_CFLAGS)
     443            conf.ADD_LDFLAGS(PTHREAD_LDFLAGS)
     444        conf.CHECK_HEADERS('pthread.h')
     445        conf.DEFINE('HAVE_PTHREAD', '1')
     446
     447    if conf.CONFIG_SET('HAVE_PTHREAD'):
     448
     449        conf.CHECK_FUNCS_IN('pthread_mutexattr_setrobust', 'pthread',
     450                            checklibc=True, headers='pthread.h')
     451        if not conf.CONFIG_SET('HAVE_PTHREAD_MUTEXATTR_SETROBUST'):
     452            conf.CHECK_FUNCS_IN('pthread_mutexattr_setrobust_np', 'pthread',
     453                                checklibc=True, headers='pthread.h')
     454
     455        conf.CHECK_DECLS('PTHREAD_MUTEX_ROBUST', headers='pthread.h')
     456        if not conf.CONFIG_SET('HAVE_DECL_PTHREAD_MUTEX_ROBUST'):
     457            conf.CHECK_DECLS('PTHREAD_MUTEX_ROBUST_NP', headers='pthread.h')
     458
     459        conf.CHECK_FUNCS_IN('pthread_mutex_consistent', 'pthread',
     460                            checklibc=True, headers='pthread.h')
     461        if not conf.CONFIG_SET('HAVE_PTHREAD_MUTEX_CONSISTENT'):
     462            conf.CHECK_FUNCS_IN('pthread_mutex_consistent_np', 'pthread',
     463                                checklibc=True, headers='pthread.h')
     464
     465        if ((conf.CONFIG_SET('HAVE_PTHREAD_MUTEXATTR_SETROBUST') or
     466             conf.CONFIG_SET('HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP')) and
     467            (conf.CONFIG_SET('HAVE_DECL_PTHREAD_MUTEX_ROBUST') or
     468             conf.CONFIG_SET('HAVE_DECL_PTHREAD_MUTEX_ROBUST_NP')) and
     469            (conf.CONFIG_SET('HAVE_PTHREAD_MUTEX_CONSISTENT') or
     470             conf.CONFIG_SET('HAVE_PTHREAD_MUTEX_CONSISTENT_NP'))):
     471            conf.DEFINE('HAVE_ROBUST_MUTEXES', 1)
    243472
    244473    conf.CHECK_FUNCS_IN('crypt', 'crypt', checklibc=True)
     
    250479
    251480    conf.CHECK_DECLS('errno', headers='errno.h', reverse=True)
     481    conf.CHECK_DECLS('EWOULDBLOCK', headers='errno.h')
    252482    conf.CHECK_DECLS('environ getgrent_r getpwent_r', reverse=True, headers='pwd.h grp.h')
    253483    conf.CHECK_DECLS('pread pwrite setenv setresgid setresuid', reverse=True)
     
    256486        conf.DEFINE('HAVE_EPOLL', 1)
    257487
     488    if conf.CONFIG_SET('HAVE_PORT_CREATE') and conf.CONFIG_SET('HAVE_PORT_H'):
     489        conf.DEFINE('HAVE_SOLARIS_PORTS', 1)
     490
    258491    conf.CHECK_HEADERS('poll.h')
    259492    conf.CHECK_FUNCS('poll')
    260493
    261     if not conf.CHECK_CODE('''#define LIBREPLACE_CONFIGURE_TEST_STRPTIME
    262                            #include "test/strptime.c"''',
    263                            define='HAVE_STRPTIME',
    264                            addmain=False,
    265                            msg='Checking for working strptime'):
    266         conf.DEFINE('REPLACE_STRPTIME', 1)
    267     else:
    268        conf.CHECK_CODE('''
    269                         const char *s = "20070414101546Z";
    270                         char *ret;
    271                         struct tm t;
    272                         memset(&t, 0, sizeof(t));
    273                         ret = strptime(s, "%Y%m%d%H%M%S", &t);
    274                         if (ret == NULL || t.tm_wday != 6) {
    275                             return 0;
    276                         } else {
    277                             return 1;
    278                         }
    279                         ''',
    280                         msg="Checking correct behavior of strptime",
    281                         headers = 'time.h',
    282                         execute = True,
    283                         define_ret = True,
    284                         define = 'REPLACE_STRPTIME',
    285                         )
    286 
    287     conf.CHECK_CODE('gettimeofday(NULL, NULL)', 'HAVE_GETTIMEOFDAY_TZ', execute=False)
     494    conf.CHECK_FUNCS('strptime')
     495    conf.CHECK_DECLS('strptime', headers='time.h')
     496    conf.CHECK_CODE('''#define LIBREPLACE_CONFIGURE_TEST_STRPTIME
     497                       #include "test/strptime.c"''',
     498                       define='HAVE_WORKING_STRPTIME',
     499                       execute=True,
     500                       addmain=False,
     501                       msg='Checking for working strptime')
     502
     503    conf.CHECK_C_PROTOTYPE('gettimeofday',
     504                           'int gettimeofday(struct timeval *tv, struct timezone *tz)',
     505                           define='HAVE_GETTIMEOFDAY_TZ', headers='sys/time.h')
     506
     507    conf.CHECK_C_PROTOTYPE('gettimeofday',
     508                           'int gettimeofday(struct timeval *tv, void *tz)',
     509                           define='HAVE_GETTIMEOFDAY_TZ_VOID',
     510                           headers='sys/time.h')
    288511
    289512    conf.CHECK_CODE('#include "test/snprintf.c"',
    290513                    define="HAVE_C99_VSNPRINTF",
    291                     execute=1,
     514                    execute=True,
    292515                    addmain=False,
    293516                    msg="Checking for C99 vsnprintf")
     517
     518    conf.CHECK_CODE('#include "test/shared_mmap.c"',
     519                    addmain=False, add_headers=False, execute=True,
     520                    define='HAVE_SHARED_MMAP',
     521                    msg="Checking for HAVE_SHARED_MMAP")
     522
     523    conf.CHECK_CODE('#include "test/shared_mremap.c"',
     524                    addmain=False, add_headers=False, execute=True,
     525                    define='HAVE_MREMAP',
     526                    msg="Checking for HAVE_MREMAP")
     527
     528    # OpenBSD (and I've heard HPUX) doesn't sync between mmap and write.
     529    # FIXME: Anything other than a 0 or 1 exit code should abort configure!
     530    conf.CHECK_CODE('#include "test/incoherent_mmap.c"',
     531                    addmain=False, add_headers=False, execute=True,
     532                    define='HAVE_INCOHERENT_MMAP',
     533                    msg="Checking for HAVE_INCOHERENT_MMAP")
    294534
    295535    conf.SAMBA_BUILD_ENV()
     
    342582                    struct stat st;
    343583                    char tpl[20]="/tmp/test.XXXXXX";
     584                    char tpl2[20]="/tmp/test.XXXXXX";
    344585                    int fd = mkstemp(tpl);
    345                     if (fd == -1) exit(1);
     586                    int fd2 = mkstemp(tpl2);
     587                    if (fd == -1) {
     588                          if (fd2 != -1) {
     589                                  unlink(tpl2);
     590                          }
     591                          exit(1);
     592                    }
     593                    if (fd2 == -1) exit(1);
    346594                    unlink(tpl);
     595                    unlink(tpl2);
    347596                    if (fstat(fd, &st) != 0) exit(1);
    348597                    if ((st.st_mode & 0777) != 0600) exit(1);
     598                    if (strcmp(tpl, "/tmp/test.XXXXXX") == 0) {
     599                          exit(1);
     600                    }
     601                    if (strcmp(tpl, tpl2) == 0) {
     602                          exit(1);
     603                    }
    349604                    exit(0);
    350605                    ''',
     
    352607                    execute=True,
    353608                    mandatory=True) # lets see if we get a mandatory failure for this one
    354 
    355     if conf.CHECK_CFLAGS('-fvisibility=hidden'):
    356         conf.env.VISIBILITY_CFLAGS = '-fvisibility=hidden'
    357         conf.CHECK_CODE('''void vis_foo1(void) {}
    358                            __attribute__((visibility("default"))) void vis_foo2(void) {}''',
    359                         cflags=conf.env.VISIBILITY_CFLAGS,
    360                         define='HAVE_VISIBILITY_ATTR')
    361609
    362610    # look for a method of finding the list of network interfaces
     
    366614                           #define NO_CONFIG_H 1
    367615                           #define AUTOCONF_TEST 1
    368                            #define SOCKET_WRAPPER_NOT_REPLACE
    369616                           #include "replace.c"
    370617                           #include "inet_ntop.c"
     
    380627            break
    381628
    382     if conf.CHECK_FUNCS('getpass getpassphrase'):
    383         # if we have both, then we prefer getpassphrase
    384         conf.DEFINE('REPLACE_GETPASS_BY_GETPASSPHRASE', 1)
    385         conf.DEFINE('REPLACE_GETPASS', 1)
    386     else:
    387         conf.CHECK_CODE('''#include "getpass.c"
    388                        int main(void) { return 0; }''',
    389                     addmain=False,
    390                     define='REPLACE_GETPASS',
    391                     cflags='-DNO_CONFIG_H')
    392 
    393629    conf.RECURSE('system')
    394630    conf.SAMBA_CONFIG_H()
    395631
    396632
     633REPLACEMENT_FUNCTIONS = {
     634    'replace.c': ['ftruncate', 'strlcpy', 'strlcat', 'mktime', 'initgroups',
     635                  'memmove', 'strdup', 'setlinebuf', 'vsyslog', 'strnlen',
     636                  'strndup', 'waitpid', 'seteuid', 'setegid', 'chroot',
     637                  'mkstemp', 'mkdtemp', 'pread', 'pwrite', 'strcasestr',
     638                  'strsep', 'strtok_r', 'strtoll', 'strtoull', 'setenv', 'unsetenv',
     639                  'utime', 'utimes', 'dup2', 'chown', 'link', 'readlink',
     640                  'symlink', 'lchown', 'realpath', 'memmem', 'vdprintf',
     641                  'dprintf', 'get_current_dir_name',
     642                  'strerror_r', 'clock_gettime'],
     643    'timegm.c': ['timegm'],
     644    # Note: C99_VSNPRINTF is not a function, but a special condition
     645    # for replacement
     646    'snprintf.c': ['C99_VSNPRINTF', 'snprintf', 'vsnprintf', 'asprintf', 'vasprintf'],
     647    # Note: WORKING_STRPTIME is not a function, but a special condition
     648    # for replacement
     649    'strptime.c': ['WORKING_STRPTIME', 'strptime'],
     650    }
     651
     652
    397653def build(bld):
    398654    bld.RECURSE('buildtools/wafsamba')
    399655
    400     REPLACE_HOSTCC_SOURCE = 'replace.c snprintf.c'
    401 
    402     if bld.CONFIG_SET('REPLACE_STRPTIME'):       REPLACE_HOSTCC_SOURCE += ' strptime.c'
    403     if not bld.CONFIG_SET('HAVE_TIMEGM'):        REPLACE_HOSTCC_SOURCE += ' timegm.c'
     656    REPLACE_HOSTCC_SOURCE = ''
     657
     658    for filename, functions in REPLACEMENT_FUNCTIONS.iteritems():
     659        for function in functions:
     660            if not bld.CONFIG_SET('HAVE_%s' % function.upper()):
     661                REPLACE_HOSTCC_SOURCE += ' %s' % filename
     662                break
     663
     664    extra_libs = ''
     665    if bld.CONFIG_SET('HAVE_LIBBSD'): extra_libs += ' bsd'
    404666
    405667    bld.SAMBA_SUBSYSTEM('LIBREPLACE_HOSTCC',
     
    407669        use_hostcc=True,
    408670        use_global_deps=False,
    409         cflags='-DSOCKET_WRAPPER_DISABLE=1 -DNSS_WRAPPER_DISABLE=1 -D_SAMBA_HOSTCC_',
    410         group='compiler_libraries'
     671        cflags='-D_SAMBA_HOSTCC_',
     672        group='compiler_libraries',
     673        deps = extra_libs
    411674    )
    412675
    413676    REPLACE_SOURCE = REPLACE_HOSTCC_SOURCE
    414 
    415     if bld.CONFIG_SET('REPLACE_GETPASS'):        REPLACE_SOURCE += ' getpass.c'
     677    REPLACE_SOURCE += ' cwrap.c'
     678
    416679    if not bld.CONFIG_SET('HAVE_CRYPT'):         REPLACE_SOURCE += ' crypt.c'
    417680    if not bld.CONFIG_SET('HAVE_DLOPEN'):        REPLACE_SOURCE += ' dlfcn.c'
     
    426689    if not bld.CONFIG_SET('HAVE_INET_NTOP'):     REPLACE_SOURCE += ' inet_ntop.c'
    427690    if not bld.CONFIG_SET('HAVE_INET_PTON'):     REPLACE_SOURCE += ' inet_pton.c'
     691    if not bld.CONFIG_SET('HAVE_GETXATTR') or bld.CONFIG_SET('XATTR_ADDITIONAL_OPTIONS'):
     692                                                 REPLACE_SOURCE += ' xattr.c'
    428693
    429694    bld.SAMBA_LIBRARY('replace',
     
    436701                      # hide_symbols=bld.BUILTIN_LIBRARY('replace'),
    437702                      private_library=True,
    438                       deps='crypt dl nsl socket rt')
     703                      deps='crypt dl nsl socket rt attr' + extra_libs)
    439704
    440705    bld.SAMBA_SUBSYSTEM('replace-test',
     
    461726                        enabled = not bld.CONFIG_SET('HAVE_STDBOOL_H'))
    462727
     728    bld.SAMBA_SUBSYSTEM('samba_intl', source='', use_global_deps=False,deps=bld.env.intl_libs)
     729
    463730def dist():
    464731    '''makes a tarball for distribution'''
Note: See TracChangeset for help on using the changeset viewer.