Changeset 988 for vendor/current/lib/replace
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/lib/replace
- Files:
-
- 7 added
- 26 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/replace/README
r740 r988 50 50 chown 51 51 lchown 52 getpass53 52 readline (the library) 54 53 inet_ntoa … … 73 72 symlink 74 73 realpath 74 poll 75 setproctitle 75 76 76 77 Types: … … 81 82 intptr_t 82 83 sig_atomic_t 84 blksize_t 85 blkcnt_t 83 86 84 87 Constants: -
vendor/current/lib/replace/getaddrinfo.c
r414 r988 322 322 for (;res; res = next) { 323 323 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); 330 326 free(res); 331 327 } -
vendor/current/lib/replace/getifaddrs.c
r860 r988 23 23 License along with this library; if not, see <http://www.gnu.org/licenses/>. 24 24 */ 25 26 #define SOCKET_WRAPPER_NOT_REPLACE27 25 28 26 #include "replace.h" … … 114 112 if (ioctl(fd, SIOCGIFFLAGS, &ifr[i]) == -1) { 115 113 freeifaddrs(*ifap); 114 close(fd); 116 115 return -1; 117 116 } 118 117 119 118 curif = calloc(1, sizeof(struct ifaddrs)); 119 if (curif == NULL) { 120 freeifaddrs(*ifap); 121 close(fd); 122 return -1; 123 } 120 124 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 } 121 131 curif->ifa_flags = ifr[i].ifr_flags; 122 132 curif->ifa_dstaddr = NULL; … … 127 137 if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != -1) { 128 138 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 } 129 146 } 130 147 … … 132 149 if (ioctl(fd, SIOCGIFNETMASK, &ifr[i]) != -1) { 133 150 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 } 134 161 } 135 162 -
vendor/current/lib/replace/replace-test.h
r740 r988 2 2 #define __LIB_REPLACE_REPLACE_TEST_H__ 3 3 4 bool torture_local_replace(struct torture_context *ctx);5 4 int libreplace_test_strptime(void); 6 5 int test_readdir_os2_delete(void); -
vendor/current/lib/replace/replace.c
r860 r988 28 28 #include "system/filesys.h" 29 29 #include "system/time.h" 30 #include "system/network.h" 30 31 #include "system/passwd.h" 31 32 #include "system/syslog.h" … … 64 65 65 66 #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 */ 68 72 size_t rep_strlcpy(char *d, const char *s, size_t bufsize) 69 73 { 70 74 size_t len = strlen(s); 71 75 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 } 74 83 memcpy(d, s, len); 75 84 d[len] = 0; … … 84 93 size_t rep_strlcat(char *d, const char *s, size_t bufsize) 85 94 { 86 size_t len1 = str len(d);95 size_t len1 = strnlen(d, bufsize); 87 96 size_t len2 = strlen(s); 88 97 size_t ret = len1 + len2; … … 212 221 } 213 222 #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 want218 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 #endif224 223 225 224 … … 412 411 /* have a reasonable go at emulating it. Hope that 413 412 the system mktemp() isn't completely hopeless */ 414 char *p =mktemp(template);415 if ( !p)413 mktemp(template); 414 if (template[0] == 0) 416 415 return -1; 417 return open( p, O_CREAT|O_EXCL|O_RDWR, 0600);416 return open(template, O_CREAT|O_EXCL|O_RDWR, 0600); 418 417 } 419 418 #endif … … 477 476 #endif 478 477 478 #ifndef HAVE_STRSEP 479 char *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 479 498 #ifndef HAVE_STRTOK_R 480 499 /* based on GLIBC version, copyright Free Software Foundation */ … … 520 539 #else 521 540 #ifdef HAVE_BSD_STRTOLL 522 # ifdef HAVE_STRTOQ541 #undef strtoll 523 542 long long int rep_strtoll(const char *str, char **endptr, int base) 524 543 { 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 */ 527 547 if (errno == EINVAL) { 528 548 if (base == 0 || (base >1 && base <37)) { … … 531 551 * Let's reset errno. 532 552 */ 533 errno = 0;553 errno = saved_errno; 534 554 } 535 555 } 536 556 return nb; 537 557 } 538 #else539 #error "You need the strtoq function"540 #endif /* HAVE_STRTOQ */541 558 #endif /* HAVE_BSD_STRTOLL */ 542 559 #endif /* HAVE_STRTOLL */ … … 558 575 #else 559 576 #ifdef HAVE_BSD_STRTOLL 560 # ifdef HAVE_STRTOUQ577 #undef strtoull 561 578 unsigned long long int rep_strtoull(const char *str, char **endptr, int base) 562 579 { 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 */ 565 583 if (errno == EINVAL) { 566 584 if (base == 0 || (base >1 && base <37)) { … … 569 587 * Let's reset errno. 570 588 */ 571 errno = 0;589 errno = saved_errno; 572 590 } 573 591 } 574 592 return nb; 575 593 } 576 #else577 #error "You need the strtouq function"578 #endif /* HAVE_STRTOUQ */579 594 #endif /* HAVE_BSD_STRTOLL */ 580 595 #endif /* HAVE_STRTOULL */ … … 795 810 #endif 796 811 797 #if !defined(HAVE_STRERROR_R) || !defined(STRERROR_R_PROTO_COMPATIBLE)812 #ifndef HAVE_STRERROR_R 798 813 int rep_strerror_r(int errnum, char *buf, size_t buflen) 799 814 { … … 814 829 switch (clk_id) { 815 830 case 0: /* CLOCK_REALTIME :*/ 816 #if def HAVE_GETTIMEOFDAY_TZ831 #if defined(HAVE_GETTIMEOFDAY_TZ) || defined(HAVE_GETTIMEOFDAY_TZ_VOID) 817 832 gettimeofday(&tval,NULL); 818 833 #else … … 829 844 } 830 845 #endif 846 847 #ifndef HAVE_MEMALIGN 848 void *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 880 int 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 909 int 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 923 void rep_setproctitle(const char *fmt, ...) 924 { 925 } 926 #endif -
vendor/current/lib/replace/replace.h
r860 r988 42 42 #include <errno.h> 43 43 44 #ifndef HAVE_DECL_EWOULDBLOCK 45 #define EWOULDBLOCK EAGAIN 46 #endif 47 44 48 #if defined(_MSC_VER) || defined(__MINGW32__) 45 49 #include "win32_replace.h" … … 47 51 48 52 49 #ifdef HAVE_STDINT_H 53 #ifdef HAVE_INTTYPES_H 54 #define __STDC_FORMAT_MACROS 55 #include <inttypes.h> 56 #elif HAVE_STDINT_H 50 57 #include <stdint.h> 51 58 /* force off HAVE_INTTYPES_H so that roken doesn't try to include both, 52 59 which causes a warning storm on irix */ 53 60 #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> 57 65 #endif 58 66 59 67 #ifndef __PRI64_PREFIX 60 # if __WORDSIZE == 64 68 # if __WORDSIZE == 64 && ! defined __APPLE__ 61 69 # define __PRI64_PREFIX "l" 62 70 # else … … 105 113 #endif 106 114 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 107 162 #ifdef HAVE_STRING_H 108 163 #include <string.h> … … 115 170 #ifdef HAVE_SYS_TYPES_H 116 171 #include <sys/types.h> 172 #endif 173 174 #ifdef HAVE_SETPROCTITLE_H 175 #include <setproctitle.h> 117 176 #endif 118 177 … … 154 213 #endif 155 214 215 #ifndef HAVE_MEMALIGN 216 #define memalign rep_memalign 217 void *rep_memalign(size_t boundary, size_t size); 218 #endif 219 156 220 #ifndef HAVE_MKTIME 157 221 #define mktime rep_mktime … … 284 348 #define strcasestr rep_strcasestr 285 349 char *rep_strcasestr(const char *haystack, const char *needle); 350 #endif 351 352 #ifndef HAVE_STRSEP 353 #define strsep rep_strsep 354 char *rep_strsep(char **pps, const char *delim); 286 355 #endif 287 356 … … 453 522 #endif 454 523 455 #if def REPLACE_STRPTIME524 #ifndef HAVE_WORKING_STRPTIME 456 525 #define strptime rep_strptime 457 526 struct tm; … … 550 619 #endif 551 620 552 #if !defined(HAVE_STRERROR_R) || !defined(STRERROR_R_PROTO_COMPATIBLE) 553 #undef strerror_r 621 #ifndef HAVE_STRERROR_R 554 622 #define strerror_r rep_strerror_r 555 623 int rep_strerror_r(int errnum, char *buf, size_t buflen); … … 586 654 #ifndef UINT64_MAX 587 655 #define UINT64_MAX ((uint64_t)-1) 656 #endif 657 658 #ifndef INT64_MAX 659 #define INT64_MAX 9223372036854775807LL 588 660 #endif 589 661 … … 821 893 #endif 822 894 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 897 int rep_getpeereid(int s, uid_t *uid, gid_t *gid); 898 #endif 899 900 #ifndef HAVE_USLEEP 901 #define usleep rep_usleep 902 typedef long useconds_t; 903 int usleep(useconds_t); 904 #endif 905 906 #ifndef HAVE_SETPROCTITLE 907 #define setproctitle rep_setproctitle 908 void rep_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2); 909 #endif 910 911 bool nss_wrapper_enabled(void); 912 bool nss_wrapper_hosts_enabled(void); 913 bool socket_wrapper_enabled(void); 914 bool 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> 832 919 #endif 833 920 -
vendor/current/lib/replace/snprintf.c
r860 r988 446 446 } 447 447 break; 448 case 'j': 449 cnk->cflags = DP_C_LLONG; 450 ch = *format++; 451 break; 448 452 case 'L': 449 453 cnk->cflags = DP_C_LDOUBLE; -
vendor/current/lib/replace/strptime.c
r414 r988 252 252 int era_cnt; 253 253 { 254 const char *rp_backup;255 254 int cnt; 256 255 size_t val; … … 262 261 int have_mon, have_mday; 263 262 #ifdef _NL_CURRENT 263 const char *rp_backup; 264 264 size_t num_eras; 265 #endif266 265 struct era_entry *era; 266 267 era = NULL; 268 #endif 267 269 268 270 have_I = is_pm = 0; … … 270 272 want_century = 0; 271 273 want_era = 0; 272 era = NULL;273 274 274 275 have_wday = want_xday = have_yday = have_mon = have_mday = 0; … … 300 301 #endif 301 302 303 #ifdef _NL_CURRENT 302 304 /* Make back up of current processing pointer. */ 303 305 rp_backup = rp; 306 #endif 304 307 305 308 switch (*fmt++) -
vendor/current/lib/replace/system/filesys.h
r618 r988 27 27 */ 28 28 29 #ifdef HAVE_UNISTD_H 29 30 #include <unistd.h> 31 #endif 32 30 33 #include <sys/stat.h> 31 34 … … 99 102 #ifdef HAVE_SYS_IOCTL_H 100 103 #include <sys/ioctl.h> 104 #endif 105 106 #ifdef HAVE_SYS_UIO_H 107 #include <sys/uio.h> 101 108 #endif 102 109 … … 111 118 #if HAVE_SYS_ATTRIBUTES_H 112 119 #include <sys/attributes.h> 120 #elif HAVE_ATTR_ATTRIBUTES_H 121 #include <attr/attributes.h> 113 122 #endif 114 123 … … 120 129 #endif 121 130 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 122 138 123 139 #ifdef HAVE_SYS_RESOURCE_H … … 125 141 #endif 126 142 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 127 151 /* Some POSIX definitions for those without */ 128 152 … … 186 210 #endif 187 211 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) 222 ssize_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) 228 ssize_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) 234 ssize_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) 240 ssize_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) 246 int 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) 252 int 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) 258 int 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) 264 int 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 8 8 9 9 Copyright (C) Andrew Tridgell 2004 10 10 11 11 ** NOTE! The following LGPL license applies to the replace 12 12 ** library. This does NOT imply that all of Samba is released 13 13 ** under the LGPL 14 14 15 15 This library is free software; you can redistribute it and/or 16 16 modify it under the terms of the GNU Lesser General Public … … 29 29 30 30 #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 135 /* Define to 1 if you have the `gsskrb5_extract_authz_data_from_sec_context' */36 #define HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT 137 /* Define to 1 if you have the `gsskrb5_get_initiator_subkey' function. */38 #define HAVE_GSSKRB5_GET_INITIATOR_SUBKEY 139 /* Define to 1 if you have the `gsskrb5_register_acceptor_identity' function. */40 #define HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY 141 /* Define to 1 if you have the `gss_krb5_ccache_name' function. */42 #define HAVE_GSS_KRB5_CCACHE_NAME 143 /* Define to 1 if you have the `krb5_addlog_func' function. */44 #define HAVE_KRB5_ADDLOG_FUNC 145 /* Define to 1 if you have the `krb5_auth_con_setkey' function. */46 #define HAVE_KRB5_AUTH_CON_SETKEY 147 /* 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 151 /* Define to 1 if you have the `krb5_c_verify_checksum' function. */52 #define HAVE_KRB5_C_VERIFY_CHECKSUM 153 /* 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 159 /* Define to 1 if you have the `krb5_free_data_contents' function. */60 #define HAVE_KRB5_FREE_DATA_CONTENTS 161 /* 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 165 /* 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 173 /* Define to 1 if you have the `krb5_get_error_string' function. */74 #define HAVE_KRB5_GET_ERROR_STRING 175 /* Define to 1 if you have the `krb5_get_error_message' function. */76 #define HAVE_KRB5_GET_ERROR_MESSAGE 177 /* 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 181 /* Define to 1 if you have the <krb5.h> header file. */82 #define HAVE_KRB5_H 183 /* Define to 1 if you have the `krb5_initlog' function. */84 #define HAVE_KRB5_INITLOG 185 /* Define to 1 if you have the `krb5_kdc_default_config' function. */86 #define HAVE_KRB5_KDC_DEFAULT_CONFIG 187 /* 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 191 /* 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 195 /* Define to 1 if you have the `krb5_krbhst_get_addrinfo' function. */96 #define HAVE_KRB5_KRBHST_GET_ADDRINFO 197 /* Define to 1 if you have the `krb5_kt_compare' function. */98 #define HAVE_KRB5_KT_COMPARE 199 /* Define to 1 if you have the `krb5_kt_free_entry' function. */100 #define HAVE_KRB5_KT_FREE_ENTRY 1101 /* Whether the type krb5_log_facility exists */102 #define HAVE_KRB5_LOG_FACILITY 1103 /* Define to 1 if you have the `krb5_mk_req_extended' function. */104 #define HAVE_KRB5_MK_REQ_EXTENDED 1105 /* 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 1109 /* 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 1113 /* Define to 1 if you have the `krb5_set_default_in_tkt_etypes' function. */114 #define HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES 1115 /* 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 1119 /* Define to 1 if you have the `krb5_set_warn_dest' function. */120 #define HAVE_KRB5_SET_WARN_DEST 1121 /* Define to 1 if you have the `krb5_string_to_key' function. */122 #define HAVE_KRB5_STRING_TO_KEY 1123 /* Define to 1 if you have the `krb5_string_to_key_salt' function. */124 #define HAVE_KRB5_STRING_TO_KEY_SALT 1125 /* Define to 1 if you have the `krb5_ticket_get_authorization_data_type' */126 #define HAVE_KRB5_TICKET_GET_AUTHORIZATION_DATA_TYPE 1127 /* 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 1133 /* Whether krb5_princ_realm returns krb5_realm or krb5_data */134 #define KRB5_PRINC_REALM_RETURNS_REALM 1135 31 32 #if HAVE_KRB5_H 136 33 #include <krb5.h> 34 #endif 35 36 #if HAVE_COM_ERR_H 137 37 #include <com_err.h> 138 139 38 #endif 140 39 141 40 #endif 41 #endif -
vendor/current/lib/replace/system/network.h
r740 r988 32 32 #endif 33 33 34 #ifdef HAVE_UNISTD_H 35 #include <unistd.h> 36 #endif 37 34 38 #ifdef HAVE_SYS_SOCKET_H 35 39 #include <sys/socket.h> … … 74 78 #ifdef HAVE_NET_IF_H 75 79 #include <net/if.h> 76 #endif77 78 #ifdef HAVE_UNISTD_H79 #include <unistd.h>80 80 #endif 81 81 … … 366 366 #endif /* HAVE_IPV6 */ 367 367 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 28 28 */ 29 29 30 /* this needs to be included before nss_wrapper.h on some systems */ 30 #ifdef HAVE_UNISTD_H 31 31 #include <unistd.h> 32 #endif 32 33 33 34 #ifdef HAVE_PWD_H … … 68 69 #endif 69 70 70 #if !defined(getpass)71 #ifdef REPLACE_GETPASS72 #if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)73 #define getpass(prompt) getpassphrase(prompt)74 #else75 #define getpass(prompt) rep_getpass(prompt)76 char *rep_getpass(const char *prompt);77 #endif78 #endif79 #endif80 81 71 #ifndef NGROUPS_MAX 82 72 #define NGROUPS_MAX 32 /* Guess... */ … … 89 79 #endif 90 80 91 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)92 #define OSF1_ENH_SEC 193 #endif94 81 95 82 #ifndef ALLOW_CHANGE_PASSWORD … … 103 90 #endif 104 91 105 #ifdef NSS_WRAPPER106 #ifndef NSS_WRAPPER_DISABLE107 #ifndef NSS_WRAPPER_NOT_REPLACE108 #define NSS_WRAPPER_REPLACE109 #endif /* NSS_WRAPPER_NOT_REPLACE */110 #include "../nss_wrapper/nss_wrapper.h"111 #endif /* NSS_WRAPPER_DISABLE */112 #endif /* NSS_WRAPPER */113 114 92 #endif -
vendor/current/lib/replace/system/select.h
r740 r988 33 33 #ifdef HAVE_SYS_EPOLL_H 34 34 #include <sys/epoll.h> 35 #endif 36 37 #ifdef HAVE_SOLARIS_PORTS 38 #include <port.h> 35 39 #endif 36 40 -
vendor/current/lib/replace/test/getifaddrs.c
r860 r988 27 27 #include "replace.h" 28 28 #include "system/network.h" 29 #include "replace-test.h" 29 30 #endif 30 31 -
vendor/current/lib/replace/test/main.c
r414 r988 25 25 26 26 #include "replace.h" 27 28 struct torture_context; 29 bool torture_local_replace(struct torture_context *ctx); 27 #include "replace-testsuite.h" 30 28 31 29 int main(void) -
vendor/current/lib/replace/test/os2_delete.c
r740 r988 13 13 #include <string.h> 14 14 #include <fcntl.h> 15 #include "replace-test.h" 15 16 16 17 #define NUM_FILES 700 … … 22 23 static int test_readdir_os2_delete_ret; 23 24 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) 25 26 26 27 #ifndef MIN … … 70 71 de=readdir(d), i++) { 71 72 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); 73 75 } 74 76 -
vendor/current/lib/replace/test/strptime.c
r414 r988 20 20 #include "replace.h" 21 21 #include "system/time.h" 22 #include "replace-test.h" 22 23 23 24 #endif /* LIBREPLACE_CONFIGURE_TEST_STRPTIME */ -
vendor/current/lib/replace/test/testsuite.c
r740 r988 25 25 26 26 #include "replace.h" 27 #include "replace-test.h" 28 #include "replace-testsuite.h" 27 29 28 30 /* … … 49 51 #define TESTFILE "testfile.dat" 50 52 53 51 54 /* 52 55 test ftruncate() function … … 67 70 if (ftruncate(fd, size) != 0) { 68 71 printf("failure: ftruncate [\n%s\n]\n", strerror(errno)); 72 close(fd); 69 73 return false; 70 74 } 71 75 if (fstat(fd, &st) != 0) { 72 76 printf("failure: ftruncate [\nfstat failed - %s\n]\n", strerror(errno)); 77 close(fd); 73 78 return false; 74 79 } … … 76 81 printf("failure: ftruncate [\ngave wrong size %d - expected %d\n]\n", 77 82 (int)st.st_size, size); 83 close(fd); 78 84 return false; 79 85 } 80 86 unlink(TESTFILE); 81 87 printf("success: ftruncate\n"); 88 close(fd); 82 89 return true; 83 90 } … … 270 277 if (strcmp(x, "bla") != 0) { 271 278 printf("failure: strndup [\ninvalid\n]\n"); 279 free(x); 272 280 return false; 273 281 } … … 377 385 } 378 386 379 extern int test_readdir_os2_delete(void);380 381 387 static int test_readdir(void) 382 388 { … … 458 464 459 465 static int test_pwrite(void) 460 {461 /* FIXME */462 return true;463 }464 465 static int test_getpass(void)466 466 { 467 467 /* FIXME */ … … 893 893 "fstat (1) failed - %s\n]\n", 894 894 strerror(errno)); 895 close(fd); 895 896 return false; 896 897 } … … 902 903 "utime(&u) failed - %s\n]\n", 903 904 strerror(errno)); 905 close(fd); 904 906 return false; 905 907 } … … 909 911 "fstat (2) failed - %s\n]\n", 910 912 strerror(errno)); 913 close(fd); 911 914 return false; 912 915 } … … 916 919 "utime(NULL) failed - %s\n]\n", 917 920 strerror(errno)); 921 close(fd); 918 922 return false; 919 923 } … … 923 927 "fstat (3) failed - %s\n]\n", 924 928 strerror(errno)); 929 close(fd); 925 930 return false; 926 931 } … … 932 937 __location__, \ 933 938 #a, (int)a, #c, #b, (int)b); \ 939 close(fd); \ 934 940 return false; \ 935 941 } \ … … 951 957 unlink(TESTFILE); 952 958 printf("success: utime\n"); 959 close(fd); 953 960 return true; 954 961 } … … 975 982 "fstat (1) failed - %s\n]\n", 976 983 strerror(errno)); 984 close(fd); 977 985 return false; 978 986 } … … 985 993 "utimes(tv) failed - %s\n]\n", 986 994 strerror(errno)); 995 close(fd); 987 996 return false; 988 997 } … … 992 1001 "fstat (2) failed - %s\n]\n", 993 1002 strerror(errno)); 1003 close(fd); 994 1004 return false; 995 1005 } … … 1001 1011 __location__, \ 1002 1012 #a, (int)a, #b, (int)b); \ 1013 close(fd); \ 1003 1014 return false; \ 1004 1015 } \ … … 1012 1023 unlink(TESTFILE); 1013 1024 printf("success: utimes\n"); 1025 close(fd); 1014 1026 return true; 1015 1027 } … … 1053 1065 1054 1066 1055 struct torture_context;1056 1067 bool torture_local_replace(struct torture_context *ctx) 1057 1068 { … … 1090 1101 ret &= test_pread(); 1091 1102 ret &= test_pwrite(); 1092 ret &= test_getpass();1093 1103 ret &= test_inet_ntoa(); 1094 1104 ret &= test_strtoll(); -
vendor/current/lib/replace/wscript
r740 r988 6 6 blddir = 'bin' 7 7 8 import sys, os , Utils8 import sys, os 9 9 10 10 # find the buildtools directory 11 11 srcdir = '.' 12 12 while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5: 13 srcdir = '../' + srcdir13 srcdir = srcdir + '/..' 14 14 sys.path.insert(0, srcdir + '/buildtools/wafsamba') 15 15 16 16 import wafsamba, samba_dist 17 import Options, os, preproc18 19 samba_dist.DIST_DIRS('lib/replace buildtools:buildtools ')17 import Options, Utils 18 19 samba_dist.DIST_DIRS('lib/replace buildtools:buildtools third_party/waf:third_party/waf') 20 20 21 21 def set_options(opt): … … 24 24 opt.RECURSE('buildtools/wafsamba') 25 25 26 @ wafsamba.runonce26 @Utils.run_once 27 27 def configure(conf): 28 28 conf.RECURSE('buildtools/wafsamba') … … 30 30 conf.env.standalone_replace = conf.IN_LAUNCH_DIR() 31 31 32 conf.DEFINE('HAVE_LIBREPLACE', 1) 32 33 conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1) 33 34 # on Tru64 certain features are only available with _OSF_SOURCE set to 135 # and _XOPEN_SOURCE set to 60036 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)39 34 40 35 conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h') … … 43 38 conf.CHECK_HEADERS('libaio.h locale.h ndir.h pwd.h') 44 39 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') 46 42 conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h sys/fs/vx/quota.h') 47 43 conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h') 48 44 conf.CHECK_HEADERS('sys/resource.h sys/security.h sys/shm.h sys/statfs.h sys/statvfs.h sys/termio.h') 49 45 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') 51 52 conf.CHECK_HEADERS('sys/select.h setjmp.h utime.h sys/syslog.h syslog.h') 52 53 conf.CHECK_HEADERS('stdarg.h vararg.h sys/mount.h mntent.h') … … 57 58 conf.CHECK_HEADERS('sys/uio.h ifaddrs.h direct.h dirent.h') 58 59 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') 63 68 conf.CHECK_HEADERS('aio.h sys/unistd.h rpc/rpc.h rpc/nettype.h alloca.h float.h') 64 69 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') 66 71 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 68 76 conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h valgrind/memcheck.h') 69 77 conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h') … … 71 79 conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h') 72 80 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)') 73 106 74 107 conf.CHECK_TYPES('"long long" intptr_t uintptr_t ptrdiff_t comparison_fn_t') … … 91 124 conf.CHECK_TYPE('volatile int', define='HAVE_VOLATILE') 92 125 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') 93 128 94 129 conf.CHECK_SIZEOF('bool char int "long long" long short size_t ssize_t') … … 107 142 108 143 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') 109 145 110 146 conf.CHECK_FUNCS_IN('''inet_ntoa inet_aton inet_ntop inet_pton connect gethostbyname … … 156 192 headers='sys/socket.h netdb.h netinet/in.h') 157 193 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 158 227 # these may be builtins, so we need the link=False strategy 159 228 conf.CHECK_FUNCS('strdup memmem printf memset memcpy memmove strcpy strncpy bzero', link=False) 160 229 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 161 243 conf.CHECK_FUNCS('shl_load shl_unload shl_findsym') 162 244 conf.CHECK_FUNCS('pipe strftime srandom random srand rand usleep setbuffer') 163 conf.CHECK_FUNCS('lstat getpgrp utime utimes set euid setresuid setegid')164 conf.CHECK_FUNCS('setre sgid 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') 167 249 conf.CHECK_FUNCS('strtok_r mkdtemp dup2 dprintf vdprintf isatty chown lchown') 168 250 conf.CHECK_FUNCS('link readlink symlink realpath snprintf vsnprintf') 169 251 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 171 276 #Some OS (ie. freebsd) return EINVAL if the convertion could not be done, it's not what we expect 172 277 #Let's detect those cases … … 183 288 headers = 'errno.h', 184 289 execute = True, 185 define_ret = True,186 290 define = 'HAVE_BSD_STRTOLL', 187 291 ) … … 189 293 conf.CHECK_FUNCS('getdirentries getdents syslog') 190 294 conf.CHECK_FUNCS('gai_strerror get_current_dir_name') 191 conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs mmap setgroups s etsid')295 conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs mmap setgroups syscall setsid') 192 296 conf.CHECK_FUNCS('getgrent_r getgrgid_r getgrnam_r getgrouplist getpagesize') 193 297 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(''' 305 fgetxattr flistea flistxattr 306 fremovexattr fsetxattr getxattr 307 listxattr 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(''' 314 attr_get attr_getf attr_list attr_listf attropen attr_remove 315 attr_removef attr_set attr_setf extattr_delete_fd extattr_delete_file 316 extattr_get_fd extattr_get_file extattr_list_fd extattr_list_file 317 extattr_set_fd extattr_set_file fgetea 318 fremoveea fsetea getea listea 319 removeea 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") 194 333 195 334 conf.CHECK_FUNCS_IN('dlopen dlsym dlerror dlclose', 'dl', … … 206 345 for c in ['CLOCK_MONOTONIC', 'CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_REALTIME']: 207 346 conf.CHECK_CODE(''' 208 209 210 211 212 213 214 215 216 217 218 219 220 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) 221 360 222 361 conf.CHECK_TYPE('struct timespec', headers='sys/time.h time.h') … … 229 368 230 369 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') 238 391 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 242 412 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) 243 472 244 473 conf.CHECK_FUNCS_IN('crypt', 'crypt', checklibc=True) … … 250 479 251 480 conf.CHECK_DECLS('errno', headers='errno.h', reverse=True) 481 conf.CHECK_DECLS('EWOULDBLOCK', headers='errno.h') 252 482 conf.CHECK_DECLS('environ getgrent_r getpwent_r', reverse=True, headers='pwd.h grp.h') 253 483 conf.CHECK_DECLS('pread pwrite setenv setresgid setresuid', reverse=True) … … 256 486 conf.DEFINE('HAVE_EPOLL', 1) 257 487 488 if conf.CONFIG_SET('HAVE_PORT_CREATE') and conf.CONFIG_SET('HAVE_PORT_H'): 489 conf.DEFINE('HAVE_SOLARIS_PORTS', 1) 490 258 491 conf.CHECK_HEADERS('poll.h') 259 492 conf.CHECK_FUNCS('poll') 260 493 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') 288 511 289 512 conf.CHECK_CODE('#include "test/snprintf.c"', 290 513 define="HAVE_C99_VSNPRINTF", 291 execute= 1,514 execute=True, 292 515 addmain=False, 293 516 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") 294 534 295 535 conf.SAMBA_BUILD_ENV() … … 342 582 struct stat st; 343 583 char tpl[20]="/tmp/test.XXXXXX"; 584 char tpl2[20]="/tmp/test.XXXXXX"; 344 585 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); 346 594 unlink(tpl); 595 unlink(tpl2); 347 596 if (fstat(fd, &st) != 0) exit(1); 348 597 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 } 349 604 exit(0); 350 605 ''', … … 352 607 execute=True, 353 608 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')361 609 362 610 # look for a method of finding the list of network interfaces … … 366 614 #define NO_CONFIG_H 1 367 615 #define AUTOCONF_TEST 1 368 #define SOCKET_WRAPPER_NOT_REPLACE369 616 #include "replace.c" 370 617 #include "inet_ntop.c" … … 380 627 break 381 628 382 if conf.CHECK_FUNCS('getpass getpassphrase'):383 # if we have both, then we prefer getpassphrase384 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 393 629 conf.RECURSE('system') 394 630 conf.SAMBA_CONFIG_H() 395 631 396 632 633 REPLACEMENT_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 397 653 def build(bld): 398 654 bld.RECURSE('buildtools/wafsamba') 399 655 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' 404 666 405 667 bld.SAMBA_SUBSYSTEM('LIBREPLACE_HOSTCC', … … 407 669 use_hostcc=True, 408 670 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 411 674 ) 412 675 413 676 REPLACE_SOURCE = REPLACE_HOSTCC_SOURCE 414 415 if bld.CONFIG_SET('REPLACE_GETPASS'): REPLACE_SOURCE += ' getpass.c' 677 REPLACE_SOURCE += ' cwrap.c' 678 416 679 if not bld.CONFIG_SET('HAVE_CRYPT'): REPLACE_SOURCE += ' crypt.c' 417 680 if not bld.CONFIG_SET('HAVE_DLOPEN'): REPLACE_SOURCE += ' dlfcn.c' … … 426 689 if not bld.CONFIG_SET('HAVE_INET_NTOP'): REPLACE_SOURCE += ' inet_ntop.c' 427 690 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' 428 693 429 694 bld.SAMBA_LIBRARY('replace', … … 436 701 # hide_symbols=bld.BUILTIN_LIBRARY('replace'), 437 702 private_library=True, 438 deps='crypt dl nsl socket rt ')703 deps='crypt dl nsl socket rt attr' + extra_libs) 439 704 440 705 bld.SAMBA_SUBSYSTEM('replace-test', … … 461 726 enabled = not bld.CONFIG_SET('HAVE_STDBOOL_H')) 462 727 728 bld.SAMBA_SUBSYSTEM('samba_intl', source='', use_global_deps=False,deps=bld.env.intl_libs) 729 463 730 def dist(): 464 731 '''makes a tarball for distribution'''
Note:
See TracChangeset
for help on using the changeset viewer.