Changeset 745 for trunk/server/source4/heimdal/lib/roken
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 60 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/heimdal/lib/roken/base64.c
r414 r745 36 36 #include <stdlib.h> 37 37 #include <string.h> 38 #include <limits.h> 38 39 #include "base64.h" 39 40 … … 51 52 } 52 53 53 int ROKEN_LIB_FUNCTION 54 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 54 55 base64_encode(const void *data, int size, char **str) 55 56 { … … 93 94 *p = 0; 94 95 *str = s; 95 return strlen(s);96 return (int) strlen(s); 96 97 } 97 98 … … 120 121 } 121 122 122 int ROKEN_LIB_FUNCTION 123 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 123 124 base64_decode(const char *str, void *data) 124 125 { -
trunk/server/source4/heimdal/lib/roken/base64.h
r414 r745 39 39 #ifndef ROKEN_LIB_FUNCTION 40 40 #ifdef _WIN32 41 #define ROKEN_LIB_FUNCTION _stdcall 41 #define ROKEN_LIB_FUNCTION 42 #define ROKEN_LIB_CALL __cdecl 42 43 #else 43 44 #define ROKEN_LIB_FUNCTION 45 #define ROKEN_LIB_CALL 44 46 #endif 45 47 #endif 46 48 47 int ROKEN_LIB_FUNCTION 49 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 48 50 base64_encode(const void *, int, char **); 49 51 50 int ROKEN_LIB_FUNCTION 52 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 51 53 base64_decode(const char *, void *); 52 54 -
trunk/server/source4/heimdal/lib/roken/bswap.c
r414 r745 37 37 #ifndef HAVE_BSWAP32 38 38 39 unsigned int ROKEN_LIB_FUNCTION 39 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL 40 40 bswap32 (unsigned int val) 41 41 { … … 49 49 #ifndef HAVE_BSWAP16 50 50 51 unsigned short ROKEN_LIB_FUNCTION 51 ROKEN_LIB_FUNCTION unsigned short ROKEN_LIB_CALL 52 52 bswap16 (unsigned short val) 53 53 { -
trunk/server/source4/heimdal/lib/roken/cloexec.c
r414 r745 34 34 #include <config.h> 35 35 36 #include <unistd.h>37 #include <fcntl.h>38 39 36 #include "roken.h" 40 37 … … 42 39 rk_cloexec(int fd) 43 40 { 41 #ifdef HAVE_FCNTL 44 42 int ret; 45 43 … … 49 47 if (fcntl(fd, F_SETFD, ret | FD_CLOEXEC) == -1) 50 48 return; 49 #endif 51 50 } 52 51 … … 54 53 rk_cloexec_file(FILE *f) 55 54 { 55 #ifdef HAVE_FCNTL 56 56 rk_cloexec(fileno(f)); 57 #endif 57 58 } 59 60 void ROKEN_LIB_FUNCTION 61 rk_cloexec_dir(DIR * d) 62 { 63 #ifndef _WIN32 64 rk_cloexec(dirfd(d)); 65 #endif 66 } -
trunk/server/source4/heimdal/lib/roken/closefrom.c
r414 r745 43 43 #include "roken.h" 44 44 45 int ROKEN_LIB_FUNCTION 45 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 46 46 closefrom(int fd) 47 47 { -
trunk/server/source4/heimdal/lib/roken/copyhostent.c
r414 r745 40 40 */ 41 41 42 struct hostent * ROKEN_LIB_FUNCTION 42 ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL 43 43 copyhostent (const struct hostent *h) 44 44 { -
trunk/server/source4/heimdal/lib/roken/dumpdata.c
r414 r745 34 34 #include <config.h> 35 35 36 #include <unistd.h>37 38 36 #include "roken.h" 39 37 … … 42 40 */ 43 41 44 void ROKEN_LIB_FUNCTION 42 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 45 43 rk_dumpdata (const char *filename, const void *buf, size_t size) 46 44 { … … 58 56 */ 59 57 60 int ROKEN_LIB_FUNCTION 58 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 61 59 rk_undumpdata(const char *filename, void **buf, size_t *size) 62 60 { -
trunk/server/source4/heimdal/lib/roken/ecalloc.c
r414 r745 43 43 */ 44 44 45 void * ROKEN_LIB_FUNCTION 45 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL 46 46 ecalloc (size_t number, size_t size) 47 47 { -
trunk/server/source4/heimdal/lib/roken/emalloc.c
r414 r745 43 43 */ 44 44 45 void * ROKEN_LIB_FUNCTION 45 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL 46 46 emalloc (size_t sz) 47 47 { -
trunk/server/source4/heimdal/lib/roken/erealloc.c
r414 r745 43 43 */ 44 44 45 void * ROKEN_LIB_FUNCTION 45 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL 46 46 erealloc (void *ptr, size_t sz) 47 47 { -
trunk/server/source4/heimdal/lib/roken/err.hin
r414 r745 49 49 #ifndef ROKEN_LIB_FUNCTION 50 50 #ifdef _WIN32 51 #define ROKEN_LIB_FUNCTION _stdcall 51 #define ROKEN_LIB_FUNCTION 52 #define ROKEN_LIB_CALL __cdecl 52 53 #else 53 54 #define ROKEN_LIB_FUNCTION 55 #define ROKEN_LIB_CALL 54 56 #endif 55 57 #endif 56 58 57 void ROKEN_LIB_FUNCTION 59 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 58 60 verr(int eval, const char *fmt, va_list ap) 59 61 __attribute__ ((noreturn, format (printf, 2, 0))); 60 62 61 void ROKEN_LIB_FUNCTION 63 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 62 64 err(int eval, const char *fmt, ...) 63 65 __attribute__ ((noreturn, format (printf, 2, 3))); 64 66 65 void ROKEN_LIB_FUNCTION 67 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 66 68 verrx(int eval, const char *fmt, va_list ap) 67 69 __attribute__ ((noreturn, format (printf, 2, 0))); 68 70 69 void ROKEN_LIB_FUNCTION 71 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 70 72 errx(int eval, const char *fmt, ...) 71 73 __attribute__ ((noreturn, format (printf, 2, 3))); 72 void ROKEN_LIB_FUNCTION 74 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 73 75 vwarn(const char *fmt, va_list ap) 74 76 __attribute__ ((format (printf, 1, 0))); 75 77 76 void ROKEN_LIB_FUNCTION 78 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 77 79 warn(const char *fmt, ...) 78 80 __attribute__ ((format (printf, 1, 2))); 79 81 80 void ROKEN_LIB_FUNCTION 82 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 81 83 vwarnx(const char *fmt, va_list ap) 82 84 __attribute__ ((format (printf, 1, 0))); 83 85 84 void ROKEN_LIB_FUNCTION 86 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 85 87 warnx(const char *fmt, ...) 86 88 __attribute__ ((format (printf, 1, 2))); -
trunk/server/source4/heimdal/lib/roken/estrdup.c
r414 r745 43 43 */ 44 44 45 char * ROKEN_LIB_FUNCTION 45 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 46 46 estrdup (const char *str) 47 47 { -
trunk/server/source4/heimdal/lib/roken/freeaddrinfo.c
r414 r745 40 40 */ 41 41 42 void ROKEN_LIB_FUNCTION 42 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 43 43 freeaddrinfo(struct addrinfo *ai) 44 44 { -
trunk/server/source4/heimdal/lib/roken/freehostent.c
r414 r745 40 40 */ 41 41 42 void ROKEN_LIB_FUNCTION 42 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 43 43 freehostent (struct hostent *h) 44 44 { -
trunk/server/source4/heimdal/lib/roken/gai_strerror.c
r414 r745 63 63 */ 64 64 65 const char * ROKEN_LIB_FUNCTION 65 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL 66 66 gai_strerror(int ecode) 67 67 { -
trunk/server/source4/heimdal/lib/roken/get_window_size.c
r414 r745 58 58 #include "roken.h" 59 59 60 int ROKEN_LIB_FUNCTION 60 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 61 61 get_window_size(int fd, struct winsize *wp) 62 62 { … … 86 86 ret = 0; 87 87 } 88 #elif defined(_WIN32) 89 { 90 intptr_t fh = 0; 91 CONSOLE_SCREEN_BUFFER_INFO sb_info; 92 93 fh = _get_osfhandle(fd); 94 if (fh != (intptr_t) INVALID_HANDLE_VALUE && 95 GetConsoleScreenBufferInfo((HANDLE) fh, &sb_info)) { 96 wp->ws_row = 1 + sb_info.srWindow.Bottom - sb_info.srWindow.Top; 97 wp->ws_col = 1 + sb_info.srWindow.Right - sb_info.srWindow.Left; 98 99 ret = 0; 100 } 101 } 88 102 #endif 89 103 if (ret != 0) { -
trunk/server/source4/heimdal/lib/roken/getaddrinfo.c
r414 r745 366 366 */ 367 367 368 int ROKEN_LIB_FUNCTION 368 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 369 369 getaddrinfo(const char *nodename, 370 370 const char *servname, -
trunk/server/source4/heimdal/lib/roken/getarg.c
r414 r745 92 92 char *(i18n)(const char *)) 93 93 { 94 int i;94 size_t i; 95 95 char timestr[64], cmd[64]; 96 96 char buf[128]; … … 208 208 } 209 209 210 void ROKEN_LIB_FUNCTION 210 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 211 211 arg_printusage (struct getargs *args, 212 212 size_t num_args, … … 218 218 } 219 219 220 void ROKEN_LIB_FUNCTION 220 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 221 221 arg_printusage_i18n (struct getargs *args, 222 222 size_t num_args, … … 224 224 const char *progname, 225 225 const char *extra_string, 226 char *(i18n)(const char *)) 227 { 228 int i; 229 size_t max_len = 0; 226 char *(*i18n)(const char *)) 227 { 228 size_t i, max_len = 0; 230 229 char buf[128]; 231 230 int col = 0, columns; … … 437 436 return 0; 438 437 } else if (*goptarg && strcmp(goptarg + 1, "maybe") == 0) { 439 #ifdef HAVE_RANDOM 440 *flag = random() & 1; 441 #else 442 *flag = rand() & 1; 443 #endif 438 *flag = rk_random() & 1; 444 439 } else { 445 440 *flag = negate; … … 475 470 default: 476 471 abort (); 477 } 478 479 /* not reached */ 480 return ARG_ERR_NO_MATCH; 472 UNREACHABLE(return 0); 473 } 481 474 } 482 475 … … 551 544 } 552 545 553 int ROKEN_LIB_FUNCTION 546 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 554 547 getarg(struct getargs *args, size_t num_args, 555 548 int argc, char **argv, int *goptind) … … 558 551 int ret = 0; 559 552 560 #if defined(HAVE_SRANDOMDEV) 561 srandomdev(); 562 #elif defined(HAVE_RANDOM) 563 srandom(time(NULL)); 564 #else 565 srand (time(NULL)); 566 #endif 553 rk_random_init(); 567 554 (*goptind)++; 568 555 for(i = *goptind; i < argc; i++) { … … 587 574 } 588 575 589 void ROKEN_LIB_FUNCTION 576 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 590 577 free_getarg_strings (getarg_strings *s) 591 578 { -
trunk/server/source4/heimdal/lib/roken/getarg.h
r414 r745 41 41 #ifndef ROKEN_LIB_FUNCTION 42 42 #ifdef _WIN32 43 #define ROKEN_LIB_FUNCTION _stdcall 43 #define ROKEN_LIB_FUNCTION 44 #define ROKEN_LIB_CALL __cdecl 44 45 #else 45 46 #define ROKEN_LIB_FUNCTION 47 #define ROKEN_LIB_CALL 46 48 #endif 47 49 #endif … … 87 89 } getarg_collect_info; 88 90 89 int ROKEN_LIB_FUNCTION 91 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 90 92 getarg(struct getargs *args, size_t num_args, 91 93 int argc, char **argv, int *goptind); 92 94 93 void ROKEN_LIB_FUNCTION 95 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 94 96 arg_printusage (struct getargs *args, 95 97 size_t num_args, … … 97 99 const char *extra_string); 98 100 99 void ROKEN_LIB_FUNCTION 101 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 100 102 arg_printusage_i18n (struct getargs *args, 101 103 size_t num_args, … … 103 105 const char *progname, 104 106 const char *extra_string, 105 char *( i18n)(const char *));107 char *(*i18n)(const char *)); 106 108 107 void ROKEN_LIB_FUNCTION 109 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 108 110 free_getarg_strings (getarg_strings *); 109 111 -
trunk/server/source4/heimdal/lib/roken/getdtablesize.c
r414 r745 62 62 #endif 63 63 64 int ROKEN_LIB_FUNCTION 64 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 65 65 getdtablesize(void) 66 66 { -
trunk/server/source4/heimdal/lib/roken/getipnodebyaddr.c
r414 r745 41 41 */ 42 42 43 struct hostent * ROKEN_LIB_FUNCTION 43 ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL 44 44 getipnodebyaddr (const void *src, size_t len, int af, int *error_num) 45 45 { -
trunk/server/source4/heimdal/lib/roken/getipnodebyname.c
r414 r745 45 45 */ 46 46 47 struct hostent * ROKEN_LIB_FUNCTION 47 ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL 48 48 getipnodebyname (const char *name, int af, int flags, int *error_num) 49 49 { -
trunk/server/source4/heimdal/lib/roken/getnameinfo.c
r414 r745 92 92 */ 93 93 94 int ROKEN_LIB_FUNCTION 94 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 95 95 getnameinfo(const struct sockaddr *sa, socklen_t salen, 96 96 char *host, size_t hostlen, -
trunk/server/source4/heimdal/lib/roken/getprogname.c
r414 r745 41 41 42 42 #ifndef HAVE_GETPROGNAME 43 const char * ROKEN_LIB_FUNCTION 43 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL 44 44 getprogname(void) 45 45 { -
trunk/server/source4/heimdal/lib/roken/hex.c
r414 r745 51 51 } 52 52 53 ssize_t ROKEN_LIB_FUNCTION 53 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 54 54 hex_encode(const void *data, size_t size, char **str) 55 55 { … … 81 81 } 82 82 83 ssize_t ROKEN_LIB_FUNCTION 83 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 84 84 hex_decode(const char *str, void *data, size_t len) 85 85 { -
trunk/server/source4/heimdal/lib/roken/hex.h
r414 r745 39 39 #ifndef ROKEN_LIB_FUNCTION 40 40 #ifdef _WIN32 41 #define ROKEN_LIB_FUNCTION _stdcall 41 #define ROKEN_LIB_FUNCTION 42 #define ROKEN_LIB_CALL __cdecl 42 43 #else 43 44 #define ROKEN_LIB_FUNCTION 45 #define ROKEN_LIB_CALL 44 46 #endif 45 47 #endif … … 48 50 #define hex_decode rk_hex_decode 49 51 50 ssize_t ROKEN_LIB_FUNCTION 52 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 51 53 hex_encode(const void *, size_t, char **); 52 ssize_t ROKEN_LIB_FUNCTION 54 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 53 55 hex_decode(const char *, void *, size_t); 54 56 -
trunk/server/source4/heimdal/lib/roken/hostent_find_fqdn.c
r414 r745 40 40 */ 41 41 42 const char * ROKEN_LIB_FUNCTION 42 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL 43 43 hostent_find_fqdn (const struct hostent *he) 44 44 { -
trunk/server/source4/heimdal/lib/roken/inet_aton.c
r414 r745 39 39 * Cannot distinguish between failure and a local broadcast address. */ 40 40 41 int ROKEN_LIB_FUNCTION 41 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 42 42 inet_aton(const char *cp, struct in_addr *addr) 43 43 { -
trunk/server/source4/heimdal/lib/roken/inet_ntop.c
r414 r745 84 84 const u_char *ptr = addr->s6_addr; 85 85 const char *orig_dst = dst; 86 int compressed = 0; 86 87 87 88 if (size < INET6_ADDRSTRLEN) { … … 91 92 for (i = 0; i < 8; ++i) { 92 93 int non_zerop = 0; 94 95 if (compressed == 0 && 96 ptr[0] == 0 && ptr[1] == 0 && 97 i <= 5 && 98 ptr[2] == 0 && ptr[3] == 0 && 99 ptr[4] == 0 && ptr[5] == 0) { 100 101 compressed = 1; 102 103 if (i == 0) 104 *dst++ = ':'; 105 *dst++ = ':'; 106 107 for (ptr += 6, i += 3; 108 i < 8 && ptr[0] == 0 && ptr[1] == 0; 109 ++i, ptr += 2); 110 111 if (i >= 8) 112 break; 113 } 93 114 94 115 if (non_zerop || (ptr[0] >> 4)) { … … 114 135 #endif /* HAVE_IPV6 */ 115 136 116 const char * ROKEN_LIB_FUNCTION 137 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL 117 138 inet_ntop(int af, const void *src, char *dst, size_t size) 118 139 { -
trunk/server/source4/heimdal/lib/roken/inet_pton.c
r414 r745 36 36 #include "roken.h" 37 37 38 int ROKEN_LIB_FUNCTION 38 #ifdef HAVE_WINSOCK 39 40 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 41 inet_pton(int af, const char *csrc, void *dst) 42 { 43 char * src; 44 45 if (csrc == NULL || (src = strdup(csrc)) == NULL) { 46 _set_errno( ENOMEM ); 47 return 0; 48 } 49 50 switch (af) { 51 case AF_INET: 52 { 53 struct sockaddr_in si4; 54 INT r; 55 INT s = sizeof(si4); 56 57 si4.sin_family = AF_INET; 58 r = WSAStringToAddress(src, AF_INET, NULL, (LPSOCKADDR) &si4, &s); 59 free(src); 60 src = NULL; 61 62 if (r == 0) { 63 memcpy(dst, &si4.sin_addr, sizeof(si4.sin_addr)); 64 return 1; 65 } 66 } 67 break; 68 69 case AF_INET6: 70 { 71 struct sockaddr_in6 si6; 72 INT r; 73 INT s = sizeof(si6); 74 75 si6.sin6_family = AF_INET6; 76 r = WSAStringToAddress(src, AF_INET6, NULL, (LPSOCKADDR) &si6, &s); 77 free(src); 78 src = NULL; 79 80 if (r == 0) { 81 memcpy(dst, &si6.sin6_addr, sizeof(si6.sin6_addr)); 82 return 1; 83 } 84 } 85 break; 86 87 default: 88 _set_errno( EAFNOSUPPORT ); 89 return -1; 90 } 91 92 /* the call failed */ 93 { 94 int le = WSAGetLastError(); 95 96 if (le == WSAEINVAL) 97 return 0; 98 99 _set_errno(le); 100 return -1; 101 } 102 } 103 104 #else /* !HAVE_WINSOCK */ 105 106 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 39 107 inet_pton(int af, const char *src, void *dst) 40 108 { … … 45 113 return inet_aton (src, dst); 46 114 } 115 116 #endif -
trunk/server/source4/heimdal/lib/roken/issuid.c
r414 r745 36 36 #include "roken.h" 37 37 38 int ROKEN_LIB_FUNCTION 38 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 39 39 issuid(void) 40 40 { -
trunk/server/source4/heimdal/lib/roken/net_read.c
r414 r745 34 34 #include <config.h> 35 35 36 #include <sys/types.h>37 #include <unistd.h>38 #include <errno.h>39 40 36 #include "roken.h" 41 37 … … 44 40 */ 45 41 46 ssize_t ROKEN_LIB_FUNCTION 47 net_read (int fd, void *buf, size_t nbytes) 42 #ifndef _WIN32 43 44 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 45 net_read (rk_socket_t fd, void *buf, size_t nbytes) 48 46 { 49 47 char *cbuf = (char *)buf; … … 52 50 53 51 while (rem > 0) { 54 #ifdef WIN3255 count = recv (fd, cbuf, rem, 0);56 #else57 52 count = read (fd, cbuf, rem); 58 #endif59 53 if (count < 0) { 60 54 if (errno == EINTR) … … 70 64 return nbytes; 71 65 } 66 67 #else 68 69 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 70 net_read(rk_socket_t sock, void *buf, size_t nbytes) 71 { 72 char *cbuf = (char *)buf; 73 ssize_t count; 74 size_t rem = nbytes; 75 76 #ifdef SOCKET_IS_NOT_AN_FD 77 int use_read = 0; 78 #endif 79 80 while (rem > 0) { 81 #ifdef SOCKET_IS_NOT_AN_FD 82 if (use_read) 83 count = _read (sock, cbuf, rem); 84 else 85 count = recv (sock, cbuf, rem, 0); 86 87 if (use_read == 0 && 88 rk_IS_SOCKET_ERROR(count) && 89 (rk_SOCK_ERRNO == WSANOTINITIALISED || 90 rk_SOCK_ERRNO == WSAENOTSOCK)) { 91 use_read = 1; 92 93 count = _read (sock, cbuf, rem); 94 } 95 #else 96 count = recv (sock, cbuf, rem, 0); 97 #endif 98 if (count < 0) { 99 100 /* With WinSock, the error EINTR (WSAEINTR), is used to 101 indicate that a blocking call was cancelled using 102 WSACancelBlockingCall(). */ 103 104 #ifndef HAVE_WINSOCK 105 if (rk_SOCK_ERRNO == EINTR) 106 continue; 107 #endif 108 return count; 109 } else if (count == 0) { 110 return count; 111 } 112 cbuf += count; 113 rem -= count; 114 } 115 return nbytes; 116 } 117 118 #endif -
trunk/server/source4/heimdal/lib/roken/net_write.c
r414 r745 34 34 #include <config.h> 35 35 36 #include <sys/types.h>37 #include <unistd.h>38 #include <errno.h>39 40 36 #include "roken.h" 41 37 … … 44 40 */ 45 41 46 ssize_t ROKEN_LIB_FUNCTION 47 net_write (int fd, const void *buf, size_t nbytes) 42 #ifndef _WIN32 43 44 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 45 net_write (rk_socket_t fd, const void *buf, size_t nbytes) 48 46 { 49 47 const char *cbuf = (const char *)buf; … … 52 50 53 51 while (rem > 0) { 54 #ifdef WIN32 55 count = send (fd, cbuf, rem, 0); 52 count = write (fd, cbuf, rem); 53 if (count < 0) { 54 if (errno == EINTR) 55 continue; 56 else 57 return count; 58 } 59 cbuf += count; 60 rem -= count; 61 } 62 return nbytes; 63 } 64 56 65 #else 57 count = write (fd, cbuf, rem); 66 67 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 68 net_write(rk_socket_t sock, const void *buf, size_t nbytes) 69 { 70 const char *cbuf = (const char *)buf; 71 ssize_t count; 72 size_t rem = nbytes; 73 #ifdef SOCKET_IS_NOT_AN_FD 74 int use_write = 0; 75 #endif 76 77 while (rem > 0) { 78 #ifdef SOCKET_IS_NOT_AN_FD 79 if (use_write) 80 count = _write (sock, cbuf, rem); 81 else 82 count = send (sock, cbuf, rem, 0); 83 84 if (use_write == 0 && 85 rk_IS_SOCKET_ERROR(count) && 86 (rk_SOCK_ERRNO == WSANOTINITIALISED || 87 rk_SOCK_ERRNO == WSAENOTSOCK)) { 88 use_write = 1; 89 90 count = _write (sock, cbuf, rem); 91 } 92 #else 93 count = send (sock, cbuf, rem, 0); 58 94 #endif 59 95 if (count < 0) { … … 68 104 return nbytes; 69 105 } 106 107 #endif -
trunk/server/source4/heimdal/lib/roken/parse_bytes.h
r414 r745 39 39 #ifndef ROKEN_LIB_FUNCTION 40 40 #ifdef _WIN32 41 #define ROKEN_LIB_FUNCTION _stdcall 41 #define ROKEN_LIB_FUNCTION 42 #define ROKEN_LIB_CALL __cdecl 42 43 #else 43 44 #define ROKEN_LIB_FUNCTION 45 #define ROKEN_LIB_CALL 44 46 #endif 45 47 #endif 46 48 47 int ROKEN_LIB_FUNCTION 49 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 48 50 parse_bytes (const char *s, const char *def_unit); 49 51 50 int ROKEN_LIB_FUNCTION 52 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 51 53 unparse_bytes (int t, char *s, size_t len); 52 54 53 int ROKEN_LIB_FUNCTION 55 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 54 56 unparse_bytes_short (int t, char *s, size_t len); 55 57 -
trunk/server/source4/heimdal/lib/roken/parse_time.c
r414 r745 51 51 }; 52 52 53 int ROKEN_LIB_FUNCTION 53 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 54 54 parse_time (const char *s, const char *def_unit) 55 55 { … … 57 57 } 58 58 59 size_t ROKEN_LIB_FUNCTION 59 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 60 60 unparse_time (int t, char *s, size_t len) 61 61 { … … 63 63 } 64 64 65 size_t ROKEN_LIB_FUNCTION 65 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 66 66 unparse_time_approx (int t, char *s, size_t len) 67 67 { … … 69 69 } 70 70 71 void ROKEN_LIB_FUNCTION 71 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 72 72 print_time_table (FILE *f) 73 73 { -
trunk/server/source4/heimdal/lib/roken/parse_time.h
r414 r745 39 39 #ifndef ROKEN_LIB_FUNCTION 40 40 #ifdef _WIN32 41 #define ROKEN_LIB_FUNCTION _stdcall 41 #define ROKEN_LIB_FUNCTION 42 #define ROKEN_LIB_CALL __cdecl 42 43 #else 43 44 #define ROKEN_LIB_FUNCTION 45 #define ROKEN_LIB_CALL 44 46 #endif 45 47 #endif 46 48 47 int 49 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 48 50 parse_time (const char *s, const char *def_unit); 49 51 50 size_t 52 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 51 53 unparse_time (int t, char *s, size_t len); 52 54 53 size_t 55 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 54 56 unparse_time_approx (int t, char *s, size_t len); 55 57 56 void 58 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 57 59 print_time_table (FILE *f); 58 60 -
trunk/server/source4/heimdal/lib/roken/parse_units.c
r414 r745 71 71 p = s; 72 72 while (*p) { 73 doubleval;73 int val; 74 74 char *next; 75 75 const struct units *u, *partial_unit; … … 81 81 ++p; 82 82 83 val = strto d (p, &next); /* strtol(p, &next, 0); */83 val = strtol(p, &next, 0); 84 84 if (p == next) { 85 85 val = 0; … … 150 150 } 151 151 152 int ROKEN_LIB_FUNCTION 152 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 153 153 parse_units (const char *s, const struct units *units, 154 154 const char *def_unit) … … 176 176 } 177 177 178 int ROKEN_LIB_FUNCTION 178 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 179 179 parse_flags (const char *s, const struct units *units, 180 180 int orig) … … 209 209 if (tmp < 0) 210 210 return tmp; 211 if (tmp > len) {211 if (tmp > (int) len) { 212 212 len = 0; 213 213 s = NULL; … … 246 246 } 247 247 248 int ROKEN_LIB_FUNCTION 248 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 249 249 unparse_units (int num, const struct units *units, char *s, size_t len) 250 250 { … … 255 255 } 256 256 257 int ROKEN_LIB_FUNCTION 257 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 258 258 unparse_units_approx (int num, const struct units *units, char *s, size_t len) 259 259 { … … 264 264 } 265 265 266 void ROKEN_LIB_FUNCTION 266 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 267 267 print_units_table (const struct units *units, FILE *f) 268 268 { … … 309 309 } 310 310 311 int ROKEN_LIB_FUNCTION 311 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 312 312 unparse_flags (int num, const struct units *units, char *s, size_t len) 313 313 { … … 318 318 } 319 319 320 void ROKEN_LIB_FUNCTION 320 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 321 321 print_flags_table (const struct units *units, FILE *f) 322 322 { -
trunk/server/source4/heimdal/lib/roken/parse_units.h
r414 r745 42 42 #ifndef ROKEN_LIB_FUNCTION 43 43 #ifdef _WIN32 44 #define ROKEN_LIB_FUNCTION _stdcall 44 #define ROKEN_LIB_FUNCTION 45 #define ROKEN_LIB_CALL __cdecl 45 46 #else 46 47 #define ROKEN_LIB_FUNCTION 48 #define ROKEN_LIB_CALL 47 49 #endif 48 50 #endif … … 53 55 }; 54 56 55 int ROKEN_LIB_FUNCTION 57 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 56 58 parse_units (const char *s, const struct units *units, 57 59 const char *def_unit); 58 60 59 void ROKEN_LIB_FUNCTION 61 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 60 62 print_units_table (const struct units *units, FILE *f); 61 63 62 int ROKEN_LIB_FUNCTION 64 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 63 65 parse_flags (const char *s, const struct units *units, 64 66 int orig); 65 67 66 int ROKEN_LIB_FUNCTION 68 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 67 69 unparse_units (int num, const struct units *units, char *s, size_t len); 68 70 69 int ROKEN_LIB_FUNCTION 71 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 70 72 unparse_units_approx (int num, const struct units *units, char *s, 71 73 size_t len); 72 74 73 int ROKEN_LIB_FUNCTION 75 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 74 76 unparse_flags (int num, const struct units *units, char *s, size_t len); 75 77 76 void ROKEN_LIB_FUNCTION 78 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 77 79 print_flags_table (const struct units *units, FILE *f); 78 80 -
trunk/server/source4/heimdal/lib/roken/resolve.c
r414 r745 49 49 #include <assert.h> 50 50 51 RCSID("$Id$");52 53 51 #ifdef _AIX /* AIX have broken res_nsearch() in 5.1 (5.0 also ?) */ 54 52 #undef HAVE_RES_NSEARCH … … 81 79 int _resolve_debug = 0; 82 80 83 int ROKEN_LIB_FUNCTION 81 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 84 82 rk_dns_string_to_type(const char *name) 85 83 { … … 91 89 } 92 90 93 const char * ROKEN_LIB_FUNCTION 91 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL 94 92 rk_dns_type_to_string(int type) 95 93 { … … 101 99 } 102 100 103 #if ( defined(HAVE_RES_SEARCH) || defined(HAVE_RES_NSEARCH)) && defined(HAVE_DN_EXPAND)101 #if ((defined(HAVE_RES_SEARCH) || defined(HAVE_RES_NSEARCH)) && defined(HAVE_DN_EXPAND)) || defined(HAVE_WINDNS) 104 102 105 103 static void … … 113 111 } 114 112 115 void ROKEN_LIB_FUNCTION 113 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 116 114 rk_dns_free_data(struct rk_dns_reply *r) 117 115 { … … 126 124 free (r); 127 125 } 126 127 #ifndef HAVE_WINDNS 128 128 129 129 static int … … 524 524 struct rk_dns_reply *r; 525 525 void *reply = NULL; 526 int size; 527 int len; 526 int size, len; 528 527 #if defined(HAVE_DNS_SEARCH) 529 528 struct sockaddr_storage from; … … 543 542 #endif 544 543 545 size = 0; 546 len = 1000; 547 do { 544 len = 1500; 545 while(1) { 548 546 if (reply) { 549 547 free(reply); 550 548 reply = NULL; 551 549 } 552 if (size <= len)553 size = len;554 550 if (_resolve_debug) { 555 551 #if defined(HAVE_DNS_SEARCH) … … 559 555 #endif 560 556 fprintf(stderr, "dns_lookup(%s, %d, %s), buffer size %d\n", domain, 561 rr_class, rk_dns_type_to_string(rr_type), size);562 } 563 reply = malloc( size);557 rr_class, rk_dns_type_to_string(rr_type), len); 558 } 559 reply = malloc(len); 564 560 if (reply == NULL) { 565 561 resolve_free_handle(handle); … … 567 563 } 568 564 569 len = resolve_search(handle, domain, rr_class, rr_type, reply, size);565 size = resolve_search(handle, domain, rr_class, rr_type, reply, len); 570 566 571 567 if (_resolve_debug) { 572 568 fprintf(stderr, "dns_lookup(%s, %d, %s) --> %d\n", 573 domain, rr_class, rk_dns_type_to_string(rr_type), len); 574 } 575 if (len <= 0) { 569 domain, rr_class, rk_dns_type_to_string(rr_type), size); 570 } 571 if (size > len) { 572 /* resolver thinks it know better, go for it */ 573 len = size; 574 } else if (size > 0) { 575 /* got a good reply */ 576 break; 577 } else if (size <= 0 && len < rk_DNS_MAX_PACKET_SIZE) { 578 len *= 2; 579 if (len > rk_DNS_MAX_PACKET_SIZE) 580 len = rk_DNS_MAX_PACKET_SIZE; 581 } else { 582 /* the end, leave */ 576 583 resolve_free_handle(handle); 577 584 free(reply); 578 585 return NULL; 579 586 } 580 } while (size < len && len < rk_DNS_MAX_PACKET_SIZE); 581 resolve_free_handle(handle); 587 } 582 588 583 589 len = min(len, size); … … 587 593 } 588 594 589 struct rk_dns_reply * ROKEN_LIB_FUNCTION 595 ROKEN_LIB_FUNCTION struct rk_dns_reply * ROKEN_LIB_CALL 590 596 rk_dns_lookup(const char *domain, const char *type_name) 591 597 { … … 602 608 } 603 609 610 #endif /* !HAVE_WINDNS */ 611 604 612 static int 605 613 compare_srv(const void *a, const void *b) … … 612 620 } 613 621 614 #ifndef HAVE_RANDOM615 #define random() rand()616 #endif617 618 622 /* try to rearrange the srv-records by the algorithm in RFC2782 */ 619 void ROKEN_LIB_FUNCTION 623 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 620 624 rk_dns_srv_order(struct rk_dns_reply *r) 621 625 { … … 628 632 char *oldstate; 629 633 #endif 634 635 rk_random_init(); 630 636 631 637 for(rr = r->head; rr; rr = rr->next) … … 675 681 first of the next */ 676 682 while(ss < ee) { 677 rnd = r andom() % (sum + 1);683 rnd = rk_random() % (sum + 1); 678 684 for(count = 0, tt = ss; ; tt++) { 679 685 if(*tt == NULL) … … 705 711 } 706 712 713 #ifdef HAVE_WINDNS 714 715 #include <WinDNS.h> 716 717 static struct rk_resource_record * 718 parse_dns_record(PDNS_RECORD pRec) 719 { 720 struct rk_resource_record * rr; 721 722 if (pRec == NULL) 723 return NULL; 724 725 rr = calloc(1, sizeof(*rr)); 726 727 rr->domain = strdup(pRec->pName); 728 rr->type = pRec->wType; 729 rr->class = 0; 730 rr->ttl = pRec->dwTtl; 731 rr->size = 0; 732 733 switch (rr->type) { 734 case rk_ns_t_ns: 735 case rk_ns_t_cname: 736 case rk_ns_t_ptr: 737 rr->u.txt = strdup(pRec->Data.NS.pNameHost); 738 if(rr->u.txt == NULL) { 739 dns_free_rr(rr); 740 return NULL; 741 } 742 break; 743 744 case rk_ns_t_mx: 745 case rk_ns_t_afsdb:{ 746 size_t hostlen = strnlen(pRec->Data.MX.pNameExchange, DNS_MAX_NAME_LENGTH); 747 748 rr->u.mx = (struct mx_record *)malloc(sizeof(struct mx_record) + 749 hostlen); 750 if (rr->u.mx == NULL) { 751 dns_free_rr(rr); 752 return NULL; 753 } 754 755 strcpy_s(rr->u.mx->domain, hostlen + 1, pRec->Data.MX.pNameExchange); 756 rr->u.mx->preference = pRec->Data.MX.wPreference; 757 break; 758 } 759 760 case rk_ns_t_srv:{ 761 size_t hostlen = strnlen(pRec->Data.SRV.pNameTarget, DNS_MAX_NAME_LENGTH); 762 763 rr->u.srv = 764 (struct srv_record*)malloc(sizeof(struct srv_record) + 765 hostlen); 766 if(rr->u.srv == NULL) { 767 dns_free_rr(rr); 768 return NULL; 769 } 770 771 rr->u.srv->priority = pRec->Data.SRV.wPriority; 772 rr->u.srv->weight = pRec->Data.SRV.wWeight; 773 rr->u.srv->port = pRec->Data.SRV.wPort; 774 strcpy_s(rr->u.srv->target, hostlen + 1, pRec->Data.SRV.pNameTarget); 775 776 break; 777 } 778 779 case rk_ns_t_txt:{ 780 size_t len; 781 782 if (pRec->Data.TXT.dwStringCount == 0) { 783 rr->u.txt = strdup(""); 784 break; 785 } 786 787 len = strnlen(pRec->Data.TXT.pStringArray[0], DNS_MAX_TEXT_STRING_LENGTH); 788 789 rr->u.txt = (char *)malloc(len + 1); 790 strcpy_s(rr->u.txt, len + 1, pRec->Data.TXT.pStringArray[0]); 791 792 break; 793 } 794 795 case rk_ns_t_key : { 796 size_t key_len; 797 798 if (pRec->wDataLength < 4) { 799 dns_free_rr(rr); 800 return NULL; 801 } 802 803 key_len = pRec->wDataLength - 4; 804 rr->u.key = malloc (sizeof(*rr->u.key) + key_len - 1); 805 if (rr->u.key == NULL) { 806 dns_free_rr(rr); 807 return NULL; 808 } 809 810 rr->u.key->flags = pRec->Data.KEY.wFlags; 811 rr->u.key->protocol = pRec->Data.KEY.chProtocol; 812 rr->u.key->algorithm = pRec->Data.KEY.chAlgorithm; 813 rr->u.key->key_len = key_len; 814 memcpy_s (rr->u.key->key_data, key_len, 815 pRec->Data.KEY.Key, key_len); 816 break; 817 } 818 819 case rk_ns_t_sig : { 820 size_t sig_len, hostlen; 821 822 if(pRec->wDataLength <= 18) { 823 dns_free_rr(rr); 824 return NULL; 825 } 826 827 sig_len = pRec->wDataLength; 828 829 hostlen = strnlen(pRec->Data.SIG.pNameSigner, DNS_MAX_NAME_LENGTH); 830 831 rr->u.sig = malloc(sizeof(*rr->u.sig) 832 + hostlen + sig_len); 833 if (rr->u.sig == NULL) { 834 dns_free_rr(rr); 835 return NULL; 836 } 837 rr->u.sig->type = pRec->Data.SIG.wTypeCovered; 838 rr->u.sig->algorithm = pRec->Data.SIG.chAlgorithm; 839 rr->u.sig->labels = pRec->Data.SIG.chLabelCount; 840 rr->u.sig->orig_ttl = pRec->Data.SIG.dwOriginalTtl; 841 rr->u.sig->sig_expiration = pRec->Data.SIG.dwExpiration; 842 rr->u.sig->sig_inception = pRec->Data.SIG.dwTimeSigned; 843 rr->u.sig->key_tag = pRec->Data.SIG.wKeyTag; 844 rr->u.sig->sig_len = sig_len; 845 memcpy_s (rr->u.sig->sig_data, sig_len, 846 pRec->Data.SIG.Signature, sig_len); 847 rr->u.sig->signer = &rr->u.sig->sig_data[sig_len]; 848 strcpy_s(rr->u.sig->signer, hostlen + 1, pRec->Data.SIG.pNameSigner); 849 break; 850 } 851 852 #ifdef DNS_TYPE_DS 853 case rk_ns_t_ds: { 854 rr->u.ds = malloc (sizeof(*rr->u.ds) + pRec->Data.DS.wDigestLength - 1); 855 if (rr->u.ds == NULL) { 856 dns_free_rr(rr); 857 return NULL; 858 } 859 860 rr->u.ds->key_tag = pRec->Data.DS.wKeyTag; 861 rr->u.ds->algorithm = pRec->Data.DS.chAlgorithm; 862 rr->u.ds->digest_type = pRec->Data.DS.chDigestType; 863 rr->u.ds->digest_len = pRec->Data.DS.wDigestLength; 864 memcpy_s (rr->u.ds->digest_data, pRec->Data.DS.wDigestLength, 865 pRec->Data.DS.Digest, pRec->Data.DS.wDigestLength); 866 break; 867 } 868 #endif 869 870 default: 871 dns_free_rr(rr); 872 return NULL; 873 } 874 875 rr->next = parse_dns_record(pRec->pNext); 876 return rr; 877 } 878 879 ROKEN_LIB_FUNCTION struct rk_dns_reply * ROKEN_LIB_CALL 880 rk_dns_lookup(const char *domain, const char *type_name) 881 { 882 DNS_STATUS status; 883 int type; 884 PDNS_RECORD pRec = NULL; 885 struct rk_dns_reply * r = NULL; 886 887 __try { 888 889 type = rk_dns_string_to_type(type_name); 890 if(type == -1) { 891 if(_resolve_debug) 892 fprintf(stderr, "dns_lookup: unknown resource type: `%s'\n", 893 type_name); 894 return NULL; 895 } 896 897 status = DnsQuery_UTF8(domain, type, DNS_QUERY_STANDARD, NULL, 898 &pRec, NULL); 899 if (status != ERROR_SUCCESS) 900 return NULL; 901 902 r = calloc(1, sizeof(*r)); 903 r->q.domain = strdup(domain); 904 r->q.type = type; 905 r->q.class = 0; 906 907 r->head = parse_dns_record(pRec); 908 909 if (r->head == NULL) { 910 rk_dns_free_data(r); 911 return NULL; 912 } else { 913 return r; 914 } 915 916 } __finally { 917 918 if (pRec) 919 DnsRecordListFree(pRec, DnsFreeRecordList); 920 921 } 922 } 923 #endif /* HAVE_WINDNS */ 924 707 925 #else /* NOT defined(HAVE_RES_SEARCH) && defined(HAVE_DN_EXPAND) */ 708 926 709 struct rk_dns_reply * ROKEN_LIB_FUNCTION 927 ROKEN_LIB_FUNCTION struct rk_dns_reply * ROKEN_LIB_CALL 710 928 rk_dns_lookup(const char *domain, const char *type_name) 711 929 { … … 713 931 } 714 932 715 void ROKEN_LIB_FUNCTION 933 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 716 934 rk_dns_free_data(struct rk_dns_reply *r) 717 935 { 718 936 } 719 937 720 void ROKEN_LIB_FUNCTION 938 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 721 939 rk_dns_srv_order(struct rk_dns_reply *r) 722 940 { -
trunk/server/source4/heimdal/lib/roken/resolve.h
r414 r745 39 39 #ifndef ROKEN_LIB_FUNCTION 40 40 #ifdef _WIN32 41 #define ROKEN_LIB_FUNCTION _stdcall 41 #define ROKEN_LIB_FUNCTION 42 #define ROKEN_LIB_CALL __cdecl 42 43 #else 43 44 #define ROKEN_LIB_FUNCTION 45 #define ROKEN_LIB_CALL 44 46 #endif 45 47 #endif … … 152 154 unsigned key_tag; 153 155 char *signer; 154 unsignedsig_len;156 size_t sig_len; 155 157 char sig_data[1]; /* also includes signer */ 156 158 }; … … 175 177 unsigned algorithm; 176 178 unsigned digest_type; 177 unsigneddigest_len;179 size_t digest_len; 178 180 u_char digest_data[1]; 179 181 }; … … 232 234 #endif 233 235 234 struct rk_dns_reply* ROKEN_LIB_FUNCTION 236 ROKEN_LIB_FUNCTION struct rk_dns_reply* ROKEN_LIB_CALL 235 237 rk_dns_lookup(const char *, const char *); 236 void ROKEN_LIB_FUNCTION 238 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 237 239 rk_dns_free_data(struct rk_dns_reply *); 238 int ROKEN_LIB_FUNCTION 240 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 239 241 rk_dns_string_to_type(const char *name); 240 const char *ROKEN_LIB_FUNCTION 242 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL 241 243 rk_dns_type_to_string(int type); 242 void ROKEN_LIB_FUNCTION 244 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 243 245 rk_dns_srv_order(struct rk_dns_reply*); 244 246 -
trunk/server/source4/heimdal/lib/roken/rkpty.c
r414 r745 42 42 #include <stdio.h> 43 43 #include <stdlib.h> 44 #ifdef HAVE_UNISTD_H 44 45 #include <unistd.h> 46 #endif 45 47 #ifdef HAVE_PTY_H 46 48 #include <pty.h> … … 94 96 open_pty(void) 95 97 { 98 #ifdef _AIX 99 printf("implement open_pty\n"); 100 exit(77); 101 #endif 96 102 #if defined(HAVE_OPENPTY) || defined(__linux) || defined(__osf__) /* XXX */ 97 103 if(openpty(&master, &slave, line, 0, 0) == 0) … … 121 127 slave = open(line, O_RDWR); 122 128 if (slave < 0) 123 errx(1, "failed to open slave when using %s", q);129 errx(1, "failed to open slave when using %s", *q); 124 130 ioctl(slave, I_PUSH, "ptem"); 125 131 ioctl(slave, I_PUSH, "ldterm"); -
trunk/server/source4/heimdal/lib/roken/roken-common.h
r414 r745 39 39 #ifndef ROKEN_LIB_FUNCTION 40 40 #ifdef _WIN32 41 #define ROKEN_LIB_FUNCTION _stdcall 41 #define ROKEN_LIB_FUNCTION 42 #define ROKEN_LIB_CALL __cdecl 42 43 #else 43 44 #define ROKEN_LIB_FUNCTION 45 #define ROKEN_LIB_CALL 44 46 #endif 45 47 #endif … … 121 123 #endif 122 124 125 #ifndef _WIN32 126 123 127 #ifndef _PATH_DEV 124 128 #define _PATH_DEV "/dev/" … … 143 147 #ifndef MAXPATHLEN 144 148 #define MAXPATHLEN (1024+4) 149 #endif 150 151 #endif /* !_WIN32 */ 152 153 #ifndef PATH_MAX 154 #define PATH_MAX MAX_PATH 155 #endif 156 157 #ifndef RETSIGTYPE 158 #define RETSIGTYPE void 145 159 #endif 146 160 … … 208 222 #endif 209 223 224 #ifndef AI_NUMERICSERV 225 #define AI_NUMERICSERV 0x08 226 #endif 227 210 228 /* flags for getnameinfo() */ 211 229 … … 262 280 263 281 #ifndef IRIX4 /* fix for compiler bug */ 282 #ifndef _WIN32 264 283 #ifdef RETSIGTYPE 265 284 typedef RETSIGTYPE (*SigAction)(int); … … 267 286 #endif 268 287 #endif 288 #endif 289 290 #define SE_E_UNSPECIFIED (-1) 291 #define SE_E_FORKFAILED (-2) 292 #define SE_E_WAITPIDFAILED (-3) 293 #define SE_E_EXECTIMEOUT (-4) 294 #define SE_E_NOEXEC 126 295 #define SE_E_NOTFOUND 127 296 297 #define SE_PROCSTATUS(st) (((st) >= 0 && (st) < 126)? st: -1) 298 #define SE_PROCSIGNAL(st) (((st) >= 128)? (st) - 128: -1) 299 #define SE_IS_ERROR(st) ((st) < 0 || (st) >= 126) 300 269 301 270 302 #define simple_execve rk_simple_execve 271 int ROKEN_LIB_FUNCTION 303 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 272 304 simple_execve(const char*, char*const[], char*const[]); 273 305 274 306 #define simple_execve_timed rk_simple_execve_timed 275 int ROKEN_LIB_FUNCTION 307 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 276 308 simple_execve_timed(const char *, char *const[], 277 309 char *const [], time_t (*)(void *), … … 279 311 280 312 #define simple_execvp rk_simple_execvp 281 int ROKEN_LIB_FUNCTION 313 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 282 314 simple_execvp(const char*, char *const[]); 283 315 284 316 #define simple_execvp_timed rk_simple_execvp_timed 285 int ROKEN_LIB_FUNCTION 317 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 286 318 simple_execvp_timed(const char *, char *const[], 287 319 time_t (*)(void *), void *, time_t); 288 320 289 321 #define simple_execlp rk_simple_execlp 290 int ROKEN_LIB_FUNCTION 322 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 291 323 simple_execlp(const char*, ...); 292 324 293 325 #define simple_execle rk_simple_execle 294 int ROKEN_LIB_FUNCTION 326 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 295 327 simple_execle(const char*, ...); 296 328 297 329 #define wait_for_process rk_wait_for_process 298 int ROKEN_LIB_FUNCTION 330 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 299 331 wait_for_process(pid_t); 300 332 301 333 #define wait_for_process_timed rk_wait_for_process_timed 302 int ROKEN_LIB_FUNCTION 334 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 303 335 wait_for_process_timed(pid_t, time_t (*)(void *), 304 void *, time_t); 336 void *, time_t); 337 305 338 #define pipe_execv rk_pipe_execv 306 int ROKEN_LIB_FUNCTION 339 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 307 340 pipe_execv(FILE**, FILE**, FILE**, const char*, ...); 308 341 309 342 #define print_version rk_print_version 310 void ROKEN_LIB_FUNCTION 343 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 311 344 print_version(const char *); 312 345 313 346 #define eread rk_eread 314 ssize_t ROKEN_LIB_FUNCTION 347 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 315 348 eread (int fd, void *buf, size_t nbytes); 316 349 317 350 #define ewrite rk_ewrite 318 ssize_t ROKEN_LIB_FUNCTION 351 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 319 352 ewrite (int fd, const void *buf, size_t nbytes); 320 353 … … 322 355 323 356 #define hostent_find_fqdn rk_hostent_find_fqdn 324 const char * ROKEN_LIB_FUNCTION 357 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL 325 358 hostent_find_fqdn (const struct hostent *); 326 359 327 360 #define esetenv rk_esetenv 328 void ROKEN_LIB_FUNCTION 361 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 329 362 esetenv(const char *, const char *, int); 330 363 331 364 #define socket_set_address_and_port rk_socket_set_address_and_port 332 void ROKEN_LIB_FUNCTION 365 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 333 366 socket_set_address_and_port (struct sockaddr *, const void *, int); 334 367 335 368 #define socket_addr_size rk_socket_addr_size 336 size_t ROKEN_LIB_FUNCTION 369 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 337 370 socket_addr_size (const struct sockaddr *); 338 371 339 372 #define socket_set_any rk_socket_set_any 340 void ROKEN_LIB_FUNCTION 373 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 341 374 socket_set_any (struct sockaddr *, int); 342 375 343 376 #define socket_sockaddr_size rk_socket_sockaddr_size 344 size_t ROKEN_LIB_FUNCTION 377 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 345 378 socket_sockaddr_size (const struct sockaddr *); 346 379 347 380 #define socket_get_address rk_socket_get_address 348 void * ROKEN_LIB_FUNCTION 381 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL 349 382 socket_get_address (const struct sockaddr *); 350 383 351 384 #define socket_get_port rk_socket_get_port 352 int ROKEN_LIB_FUNCTION 385 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 353 386 socket_get_port (const struct sockaddr *); 354 387 355 388 #define socket_set_port rk_socket_set_port 356 void ROKEN_LIB_FUNCTION 389 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 357 390 socket_set_port (struct sockaddr *, int); 358 391 359 392 #define socket_set_portrange rk_socket_set_portrange 360 void ROKEN_LIB_FUNCTION 361 socket_set_portrange ( int, int, int);393 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 394 socket_set_portrange (rk_socket_t, int, int); 362 395 363 396 #define socket_set_debug rk_socket_set_debug 364 void ROKEN_LIB_FUNCTION 365 socket_set_debug ( int);397 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 398 socket_set_debug (rk_socket_t); 366 399 367 400 #define socket_set_tos rk_socket_set_tos 368 void ROKEN_LIB_FUNCTION 369 socket_set_tos ( int, int);401 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 402 socket_set_tos (rk_socket_t, int); 370 403 371 404 #define socket_set_reuseaddr rk_socket_set_reuseaddr 372 void ROKEN_LIB_FUNCTION 373 socket_set_reuseaddr ( int, int);405 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 406 socket_set_reuseaddr (rk_socket_t, int); 374 407 375 408 #define socket_set_ipv6only rk_socket_set_ipv6only 376 void ROKEN_LIB_FUNCTION 377 socket_set_ipv6only (int, int); 409 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 410 socket_set_ipv6only (rk_socket_t, int); 411 412 #define socket_to_fd rk_socket_to_fd 413 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 414 socket_to_fd(rk_socket_t, int); 378 415 379 416 #define vstrcollect rk_vstrcollect 380 char ** ROKEN_LIB_FUNCTION 417 ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL 381 418 vstrcollect(va_list *ap); 382 419 383 420 #define strcollect rk_strcollect 384 char ** ROKEN_LIB_FUNCTION 421 ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL 385 422 strcollect(char *first, ...); 386 423 387 424 #define timevalfix rk_timevalfix 388 void ROKEN_LIB_FUNCTION 425 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 389 426 timevalfix(struct timeval *t1); 390 427 391 428 #define timevaladd rk_timevaladd 392 void ROKEN_LIB_FUNCTION 429 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 393 430 timevaladd(struct timeval *t1, const struct timeval *t2); 394 431 395 432 #define timevalsub rk_timevalsub 396 void ROKEN_LIB_FUNCTION 433 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 397 434 timevalsub(struct timeval *t1, const struct timeval *t2); 398 435 399 436 #define pid_file_write rk_pid_file_write 400 char *ROKEN_LIB_FUNCTION 437 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 401 438 pid_file_write (const char *progname); 402 439 403 440 #define pid_file_delete rk_pid_file_delete 404 void ROKEN_LIB_FUNCTION 441 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 405 442 pid_file_delete (char **); 406 443 407 444 #define read_environment rk_read_environment 408 int ROKEN_LIB_FUNCTION 445 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 409 446 read_environment(const char *file, char ***env); 410 447 411 448 #define free_environment rk_free_environment 412 void ROKEN_LIB_FUNCTION 449 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 413 450 free_environment(char **); 414 451 415 452 #define warnerr rk_warnerr 416 void ROKEN_LIB_FUNCTION 453 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 417 454 rk_warnerr(int doerrno, const char *fmt, va_list ap) 418 455 __attribute__ ((format (printf, 2, 0))); 419 456 420 void * ROKEN_LIB_FUNCTION 457 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL 421 458 rk_realloc(void *, size_t); 422 459 423 460 struct rk_strpool; 424 461 425 char * ROKEN_LIB_FUNCTION 462 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 426 463 rk_strpoolcollect(struct rk_strpool *); 427 464 428 struct rk_strpool * ROKEN_LIB_FUNCTION 465 ROKEN_LIB_FUNCTION struct rk_strpool * ROKEN_LIB_CALL 429 466 rk_strpoolprintf(struct rk_strpool *, const char *, ...) 430 467 __attribute__ ((format (printf, 2, 3))); 431 468 469 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 470 rk_strpoolfree(struct rk_strpool *); 471 472 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 473 rk_dumpdata (const char *, const void *, size_t); 474 475 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 476 rk_undumpdata (const char *, void **, size_t *); 477 478 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 479 rk_xfree (void *); 480 481 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 482 rk_cloexec(int); 483 484 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 485 rk_cloexec_file(FILE *); 486 487 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 488 rk_cloexec_dir(DIR *); 489 490 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 491 ct_memcmp(const void *, const void *, size_t); 492 432 493 void ROKEN_LIB_FUNCTION 433 rk_strpoolfree(struct rk_strpool *); 434 435 void ROKEN_LIB_FUNCTION 436 rk_dumpdata (const char *, const void *, size_t); 437 438 int ROKEN_LIB_FUNCTION 439 rk_undumpdata (const char *, void **, size_t *); 440 441 void ROKEN_LIB_FUNCTION 442 rk_xfree (void *); 443 444 void ROKEN_LIB_FUNCTION 445 rk_cloexec(int); 446 447 void ROKEN_LIB_FUNCTION 448 rk_cloexec_file(FILE *); 449 494 rk_random_init(void); 450 495 451 496 ROKEN_CPP_END -
trunk/server/source4/heimdal/lib/roken/roken.h.in
r414 r745 33 33 */ 34 34 35 /* $Id$ */36 37 35 #include <stdio.h> 38 36 #include <stdlib.h> … … 44 42 #include <signal.h> 45 43 44 #ifndef ROKEN_LIB_FUNCTION 45 #ifdef _WIN32 46 # define ROKEN_LIB_CALL __cdecl 47 # ifdef ROKEN_LIB_DYNAMIC 48 # define ROKEN_LIB_FUNCTION __declspec(dllimport) 49 # define ROKEN_LIB_VARIABLE __declspec(dllimport) 50 # else 51 # define ROKEN_LIB_FUNCTION 52 # define ROKEN_LIB_VARIABLE 53 # endif 54 #else 55 #define ROKEN_LIB_FUNCTION 56 #define ROKEN_LIB_CALL 57 #define ROKEN_LIB_VARIABLE 58 #endif 59 #endif 60 61 #ifdef HAVE_WINSOCK 62 /* Declarations for Microsoft Windows */ 63 64 #include <winsock2.h> 65 #include <ws2tcpip.h> 66 67 /* 68 * error codes for inet_ntop/inet_pton 69 */ 70 #define EAFNOSUPPORT WSAEAFNOSUPPORT 71 72 typedef SOCKET rk_socket_t; 73 74 #define rk_closesocket(x) closesocket(x) 75 #define rk_INVALID_SOCKET INVALID_SOCKET 76 #define rk_IS_BAD_SOCKET(s) ((s) == INVALID_SOCKET) 77 #define rk_IS_SOCKET_ERROR(rv) ((rv) == SOCKET_ERROR) 78 #define rk_SOCK_ERRNO WSAGetLastError() 79 80 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_SOCK_IOCTL(SOCKET s, long cmd, int * argp); 81 82 #define ETIMEDOUT WSAETIMEDOUT 83 #define EWOULDBLOCK WSAEWOULDBLOCK 84 #define ENOTSOCK WSAENOTSOCK 85 86 #define rk_SOCK_INIT() rk_WSAStartup() 87 #define rk_SOCK_EXIT() rk_WSACleanup() 88 89 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSAStartup(void); 90 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSACleanup(void); 91 92 #else /* not WinSock */ 93 94 typedef int rk_socket_t; 95 96 #define rk_closesocket(x) close(x) 97 #define rk_SOCK_IOCTL(s,c,a) ioctl((s),(c),(a)) 98 #define rk_IS_BAD_SOCKET(s) ((s) < 0) 99 #define rk_IS_SOCKET_ERROR(rv) ((rv) < 0) 100 #define rk_SOCK_ERRNO errno 101 #define rk_INVALID_SOCKET (-1) 102 103 #define rk_SOCK_INIT() 0 104 #define rk_SOCK_EXIT() do { } while(0) 105 106 #endif 107 108 #ifdef _MSC_VER 109 /* Declarations for Microsoft Visual C runtime on Windows */ 110 111 #include<process.h> 112 113 #include<io.h> 114 115 #ifndef __BIT_TYPES_DEFINED__ 116 #define __BIT_TYPES_DEFINED__ 117 118 typedef __int8 int8_t; 119 typedef __int16 int16_t; 120 typedef __int32 int32_t; 121 typedef __int64 int64_t; 122 typedef unsigned __int8 uint8_t; 123 typedef unsigned __int16 uint16_t; 124 typedef unsigned __int32 uint32_t; 125 typedef unsigned __int64 uint64_t; 126 typedef uint8_t u_int8_t; 127 typedef uint16_t u_int16_t; 128 typedef uint32_t u_int32_t; 129 typedef uint64_t u_int64_t; 130 131 #endif /* __BIT_TYPES_DEFINED__ */ 132 133 #define UNREACHABLE(x) x 134 #define UNUSED_ARGUMENT(x) ((void) x) 135 136 #define RETSIGTYPE void 137 138 #define VOID_RETSIGTYPE 1 139 140 #ifdef VOID_RETSIGTYPE 141 #define SIGRETURN(x) return 142 #else 143 #define SIGRETURN(x) return (RETSIGTYPE)(x) 144 #endif 145 146 #ifndef CPP_ONLY 147 148 typedef int pid_t; 149 150 typedef unsigned int gid_t; 151 152 typedef unsigned int uid_t; 153 154 typedef unsigned short mode_t; 155 156 #endif 157 158 #ifndef __cplusplus 159 #define inline __inline 160 #endif 161 162 #else 163 164 #define UNREACHABLE(x) 165 #define UNUSED_ARGUMENT(x) 166 167 #endif 168 46 169 #ifdef _AIX 47 170 struct ether_addr; … … 115 238 #include <termios.h> 116 239 #endif 117 #if defined(HAVE_SYS_IOCTL_H) && SunOS != 40240 #ifdef HAVE_SYS_IOCTL_H 118 241 #include <sys/ioctl.h> 119 242 #endif … … 131 254 #endif 132 255 256 #ifdef HAVE_DIRENT_H 257 #include <dirent.h> 258 #endif 259 260 #ifdef BACKSLASH_PATH_DELIM 261 #define rk_PATH_DELIM '\\' 262 #endif 263 133 264 #ifndef HAVE_SSIZE_T 265 #ifndef SSIZE_T_DEFINED 266 #ifdef ssize_t 267 #undef ssize_t 268 #endif 269 #ifdef _WIN64 270 typedef __int64 ssize_t; 271 #else 134 272 typedef int ssize_t; 135 273 #endif 274 #define SSIZE_T_DEFINED 275 #endif /* SSIZE_T_DEFINED */ 276 #endif /* HAVE_SSIZE_T */ 136 277 137 278 #include <roken-common.h> … … 149 290 #endif 150 291 292 #ifdef _MSC_VER 293 /* Additional macros for Visual C/C++ runtime */ 294 295 #define close _close 296 297 #define getpid _getpid 298 299 #define open _open 300 301 #define chdir _chdir 302 303 #define fsync _commit 304 305 /* The MSVC implementation of snprintf is not C99 compliant. */ 306 #define snprintf rk_snprintf 307 #define vsnprintf rk_vsnprintf 308 #define vasnprintf rk_vasnprintf 309 #define vasprintf rk_vasprintf 310 #define asnprintf rk_asnprintf 311 #define asprintf rk_asprintf 312 313 #define _PIPE_BUFFER_SZ 8192 314 #define pipe(fds) _pipe((fds), _PIPE_BUFFER_SZ, O_BINARY); 315 316 #define ftruncate(fd, sz) _chsize((fd), (sz)) 317 318 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 319 rk_snprintf (char *str, size_t sz, const char *format, ...); 320 321 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 322 rk_asprintf (char **ret, const char *format, ...); 323 324 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 325 rk_asnprintf (char **ret, size_t max_sz, const char *format, ...); 326 327 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 328 rk_vasprintf (char **ret, const char *format, va_list args); 329 330 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 331 rk_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args); 332 333 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 334 rk_vsnprintf (char *str, size_t sz, const char *format, va_list args); 335 336 /* missing stat.h predicates */ 337 338 #define S_ISREG(m) (((m) & _S_IFREG) == _S_IFREG) 339 340 #define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR) 341 342 #define S_ISCHR(m) (((m) & _S_IFCHR) == _S_IFCHR) 343 344 #define S_ISFIFO(m) (((m) & _S_IFIFO) == _S_IFIFO) 345 346 /* The following are not implemented: 347 348 S_ISLNK(m) 349 S_ISSOCK(m) 350 S_ISBLK(m) 351 */ 352 353 #endif /* _MSC_VER */ 354 355 #ifdef HAVE_WINSOCK 356 357 /* While we are at it, define WinSock specific scatter gather socket 358 I/O. */ 359 360 #define iovec _WSABUF 361 #define iov_base buf 362 #define iov_len len 363 364 struct msghdr { 365 void *msg_name; 366 socklen_t msg_namelen; 367 struct iovec *msg_iov; 368 size_t msg_iovlen; 369 void *msg_control; 370 socklen_t msg_controllen; 371 int msg_flags; 372 }; 373 374 #define sendmsg sendmsg_w32 375 376 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 377 sendmsg_w32(rk_socket_t s, const struct msghdr * msg, int flags); 378 379 #endif /* HAVE_WINSOCK */ 380 151 381 #ifndef HAVE_PUTENV 152 382 #define putenv rk_putenv 153 int ROKEN_LIB_FUNCTIONputenv(const char *);383 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL putenv(const char *); 154 384 #endif 155 385 … … 158 388 #define setenv rk_setenv 159 389 #endif 160 int ROKEN_LIB_FUNCTIONsetenv(const char *, const char *, int);390 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setenv(const char *, const char *, int); 161 391 #endif 162 392 … … 165 395 #define unsetenv rk_unsetenv 166 396 #endif 167 void ROKEN_LIB_FUNCTIONunsetenv(const char *);397 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL unsetenv(const char *); 168 398 #endif 169 399 … … 173 403 #define endusershell rk_endusershell 174 404 #endif 175 char * ROKEN_LIB_FUNCTIONgetusershell(void);176 void ROKEN_LIB_FUNCTIONendusershell(void);405 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL getusershell(void); 406 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL endusershell(void); 177 407 #endif 178 408 … … 181 411 #define snprintf rk_snprintf 182 412 #endif 183 int ROKEN_LIB_FUNCTION 413 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 184 414 rk_snprintf (char *, size_t, const char *, ...) 185 415 __attribute__ ((format (printf, 3, 4))); … … 190 420 #define vsnprintf rk_vsnprintf 191 421 #endif 192 int ROKEN_LIB_FUNCTION422 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 193 423 rk_vsnprintf (char *, size_t, const char *, va_list) 194 424 __attribute__((format (printf, 3, 0))); … … 199 429 #define asprintf rk_asprintf 200 430 #endif 201 int ROKEN_LIB_FUNCTION 431 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 202 432 rk_asprintf (char **, const char *, ...) 203 433 __attribute__ ((format (printf, 2, 3))); … … 208 438 #define vasprintf rk_vasprintf 209 439 #endif 210 int ROKEN_LIB_FUNCTION 440 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 211 441 rk_vasprintf (char **, const char *, va_list) 212 442 __attribute__((format (printf, 2, 0))); … … 217 447 #define asnprintf rk_asnprintf 218 448 #endif 219 int ROKEN_LIB_FUNCTION 449 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 220 450 rk_asnprintf (char **, size_t, const char *, ...) 221 451 __attribute__ ((format (printf, 3, 4))); … … 226 456 #define vasnprintf rk_vasnprintf 227 457 #endif 228 int ROKEN_LIB_FUNCTION 458 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 229 459 vasnprintf (char **, size_t, const char *, va_list) 230 460 __attribute__((format (printf, 3, 0))); … … 233 463 #ifndef HAVE_STRDUP 234 464 #define strdup rk_strdup 235 char * ROKEN_LIB_FUNCTIONstrdup(const char *);465 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strdup(const char *); 236 466 #endif 237 467 … … 240 470 #define strndup rk_strndup 241 471 #endif 242 char * ROKEN_LIB_FUNCTIONstrndup(const char *, size_t);472 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strndup(const char *, size_t); 243 473 #endif 244 474 245 475 #ifndef HAVE_STRLWR 246 476 #define strlwr rk_strlwr 247 char * ROKEN_LIB_FUNCTIONstrlwr(char *);477 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strlwr(char *); 248 478 #endif 249 479 250 480 #ifndef HAVE_STRNLEN 251 481 #define strnlen rk_strnlen 252 size_t ROKEN_LIB_FUNCTIONstrnlen(const char*, size_t);482 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strnlen(const char*, size_t); 253 483 #endif 254 484 … … 257 487 #define strsep rk_strsep 258 488 #endif 259 char * ROKEN_LIB_FUNCTIONstrsep(char**, const char*);489 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strsep(char**, const char*); 260 490 #endif 261 491 … … 264 494 #define strsep_copy rk_strsep_copy 265 495 #endif 266 ssize_t ROKEN_LIB_FUNCTIONstrsep_copy(const char**, const char*, char*, size_t);496 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL strsep_copy(const char**, const char*, char*, size_t); 267 497 #endif 268 498 269 499 #ifndef HAVE_STRCASECMP 270 500 #define strcasecmp rk_strcasecmp 271 int ROKEN_LIB_FUNCTIONstrcasecmp(const char *, const char *);501 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strcasecmp(const char *, const char *); 272 502 #endif 273 503 274 504 #ifdef NEED_FCLOSE_PROTO 275 int ROKEN_LIB_FUNCTIONfclose(FILE *);505 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fclose(FILE *); 276 506 #endif 277 507 278 508 #ifdef NEED_STRTOK_R_PROTO 279 char * ROKEN_LIB_FUNCTIONstrtok_r(char *, const char *, char **);509 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strtok_r(char *, const char *, char **); 280 510 #endif 281 511 282 512 #ifndef HAVE_STRUPR 283 513 #define strupr rk_strupr 284 char * ROKEN_LIB_FUNCTIONstrupr(char *);514 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strupr(char *); 285 515 #endif 286 516 287 517 #ifndef HAVE_STRLCPY 288 518 #define strlcpy rk_strlcpy 289 size_t ROKEN_LIB_FUNCTIONstrlcpy (char *, const char *, size_t);519 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcpy (char *, const char *, size_t); 290 520 #endif 291 521 292 522 #ifndef HAVE_STRLCAT 293 523 #define strlcat rk_strlcat 294 size_t ROKEN_LIB_FUNCTIONstrlcat (char *, const char *, size_t);524 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcat (char *, const char *, size_t); 295 525 #endif 296 526 297 527 #ifndef HAVE_GETDTABLESIZE 298 528 #define getdtablesize rk_getdtablesize 299 int ROKEN_LIB_FUNCTIONgetdtablesize(void);529 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void); 300 530 #endif 301 531 302 532 #if !defined(HAVE_STRERROR) && !defined(strerror) 303 533 #define strerror rk_strerror 304 char * ROKEN_LIB_FUNCTION strerror(int); 534 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int); 535 #endif 536 537 #if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R)) 538 int ROKEN_LIB_FUNCTION rk_strerror_r(int, char *, size_t); 539 #else 540 #define rk_strerror_r strerror_r 305 541 #endif 306 542 … … 310 546 #endif 311 547 /* This causes a fatal error under Psoriasis */ 312 #if !(defined(SunOS) && (SunOS >= 50))313 const char * ROKEN_LIB_FUNCTIONhstrerror(int);548 #ifndef SunOS 549 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL hstrerror(int); 314 550 #endif 315 551 #endif … … 323 559 #define inet_aton rk_inet_aton 324 560 #endif 325 int ROKEN_LIB_FUNCTIONinet_aton(const char *, struct in_addr *);561 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL inet_aton(const char *, struct in_addr *); 326 562 #endif 327 563 328 564 #ifndef HAVE_INET_NTOP 329 565 #define inet_ntop rk_inet_ntop 330 const char * ROKEN_LIB_FUNCTION 566 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL 331 567 inet_ntop(int af, const void *src, char *dst, size_t size); 332 568 #endif … … 334 570 #ifndef HAVE_INET_PTON 335 571 #define inet_pton rk_inet_pton 336 int ROKEN_LIB_FUNCTION 572 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 337 573 inet_pton(int, const char *, void *); 338 574 #endif 339 575 340 #if !defined(HAVE_GETCWD)576 #ifndef HAVE_GETCWD 341 577 #define getcwd rk_getcwd 342 char* ROKEN_LIB_FUNCTIONgetcwd(char *, size_t);578 ROKEN_LIB_FUNCTION char* ROKEN_LIB_CALL getcwd(char *, size_t); 343 579 #endif 344 580 345 581 #ifdef HAVE_PWD_H 346 582 #include <pwd.h> 347 struct passwd * ROKEN_LIB_FUNCTIONk_getpwnam (const char *);348 struct passwd * ROKEN_LIB_FUNCTIONk_getpwuid (uid_t);349 #endif 350 351 const char * ROKEN_LIB_FUNCTIONget_default_username (void);583 ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwnam (const char *); 584 ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwuid (uid_t); 585 #endif 586 587 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL get_default_username (void); 352 588 353 589 #ifndef HAVE_SETEUID 354 590 #define seteuid rk_seteuid 355 int ROKEN_LIB_FUNCTIONseteuid(uid_t);591 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL seteuid(uid_t); 356 592 #endif 357 593 358 594 #ifndef HAVE_SETEGID 359 595 #define setegid rk_setegid 360 int ROKEN_LIB_FUNCTIONsetegid(gid_t);596 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setegid(gid_t); 361 597 #endif 362 598 363 599 #ifndef HAVE_LSTAT 364 600 #define lstat rk_lstat 365 int ROKEN_LIB_FUNCTIONlstat(const char *, struct stat *);601 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL lstat(const char *, struct stat *); 366 602 #endif 367 603 … … 370 606 #define mkstemp rk_mkstemp 371 607 #endif 372 int ROKEN_LIB_FUNCTIONmkstemp(char *);608 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL mkstemp(char *); 373 609 #endif 374 610 … … 376 612 #define cgetent rk_cgetent 377 613 #define cgetstr rk_cgetstr 378 int ROKEN_LIB_FUNCTIONcgetent(char **, char **, const char *);379 int ROKEN_LIB_FUNCTIONcgetstr(char *, const char *, char **);614 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetent(char **, char **, const char *); 615 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetstr(char *, const char *, char **); 380 616 #endif 381 617 382 618 #ifndef HAVE_INITGROUPS 383 619 #define initgroups rk_initgroups 384 int ROKEN_LIB_FUNCTIONinitgroups(const char *, gid_t);620 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL initgroups(const char *, gid_t); 385 621 #endif 386 622 387 623 #ifndef HAVE_FCHOWN 388 624 #define fchown rk_fchown 389 int ROKEN_LIB_FUNCTION fchown(int, uid_t, gid_t); 625 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fchown(int, uid_t, gid_t); 626 #endif 627 628 #ifdef RENAME_DOES_NOT_UNLINK 629 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_rename(const char *, const char *); 630 #else 631 #define rk_rename(__rk_rn_from,__rk_rn_to) rename(__rk_rn_from,__rk_rn_to) 390 632 #endif 391 633 … … 394 636 #define daemon rk_daemon 395 637 #endif 396 int ROKEN_LIB_FUNCTIONdaemon(int, int);638 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL daemon(int, int); 397 639 #endif 398 640 399 641 #ifndef HAVE_CHOWN 400 642 #define chown rk_chown 401 int ROKEN_LIB_FUNCTIONchown(const char *, uid_t, gid_t);643 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL chown(const char *, uid_t, gid_t); 402 644 #endif 403 645 404 646 #ifndef HAVE_RCMD 405 647 #define rcmd rk_rcmd 406 int ROKEN_LIB_FUNCTION 648 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 407 649 rcmd(char **, unsigned short, const char *, 408 650 const char *, const char *, int *); … … 413 655 #define innetgr rk_innetgr 414 656 #endif 415 int ROKEN_LIB_FUNCTIONinnetgr(const char*, const char*,657 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL innetgr(const char*, const char*, 416 658 const char*, const char*); 417 659 #endif … … 419 661 #ifndef HAVE_IRUSEROK 420 662 #define iruserok rk_iruserok 421 int ROKEN_LIB_FUNCTIONiruserok(unsigned, int,663 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL iruserok(unsigned, int, 422 664 const char *, const char *); 423 665 #endif … … 427 669 #define gethostname rk_gethostname 428 670 #endif 429 int ROKEN_LIB_FUNCTIONgethostname(char *, int);671 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL gethostname(char *, int); 430 672 #endif 431 673 432 674 #ifndef HAVE_WRITEV 433 675 #define writev rk_writev 434 ssize_t ROKEN_LIB_FUNCTION 676 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 435 677 writev(int, const struct iovec *, int); 436 678 #endif … … 438 680 #ifndef HAVE_READV 439 681 #define readv rk_readv 440 ssize_t ROKEN_LIB_FUNCTION 682 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 441 683 readv(int, const struct iovec *, int); 442 684 #endif 443 685 444 686 #ifndef HAVE_PIDFILE 687 #ifdef NO_PIDFILES 688 #define pidfile(x) ((void) 0) 689 #else 445 690 #define pidfile rk_pidfile 446 void ROKEN_LIB_FUNCTION pidfile (const char*); 691 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL pidfile (const char*); 692 #endif 447 693 #endif 448 694 449 695 #ifndef HAVE_BSWAP32 450 696 #define bswap32 rk_bswap32 451 unsigned int ROKEN_LIB_FUNCTIONbswap32(unsigned int);697 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL bswap32(unsigned int); 452 698 #endif 453 699 454 700 #ifndef HAVE_BSWAP16 455 701 #define bswap16 rk_bswap16 456 unsigned short ROKEN_LIB_FUNCTIONbswap16(unsigned short);702 ROKEN_LIB_FUNCTION unsigned short ROKEN_LIB_CALL bswap16(unsigned short); 457 703 #endif 458 704 … … 471 717 #endif 472 718 473 #define flock rk_flock474 int flock(int fd, int operation);719 #define flock(_x,_y) rk_flock(_x,_y) 720 int rk_flock(int fd, int operation); 475 721 #endif /* HAVE_FLOCK */ 476 722 477 time_t ROKEN_LIB_FUNCTION tm2time (struct tm, int); 478 479 int ROKEN_LIB_FUNCTION unix_verify_user(char *, char *); 480 481 int ROKEN_LIB_FUNCTION roken_concat (char *, size_t, ...); 482 483 size_t ROKEN_LIB_FUNCTION roken_mconcat (char **, size_t, ...); 484 485 int ROKEN_LIB_FUNCTION roken_vconcat (char *, size_t, va_list); 486 487 size_t ROKEN_LIB_FUNCTION 723 #ifndef HAVE_DIRFD 724 #ifdef HAVE_DIR_DD_FD 725 #define dirfd(x) ((x)->dd_fd) 726 #else 727 #ifndef _WIN32 /* Windows code never calls dirfd */ 728 #error Missing dirfd() and ->dd_fd 729 #endif 730 #endif 731 #endif 732 733 ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL tm2time (struct tm, int); 734 735 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unix_verify_user(char *, char *); 736 737 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_concat (char *, size_t, ...); 738 739 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL roken_mconcat (char **, size_t, ...); 740 741 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_vconcat (char *, size_t, va_list); 742 743 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 488 744 roken_vmconcat (char **, size_t, va_list); 489 745 490 ssize_t ROKEN_LIB_FUNCTION net_write (int, const void *, size_t); 491 492 ssize_t ROKEN_LIB_FUNCTION net_read (int, void *, size_t); 493 494 int ROKEN_LIB_FUNCTION issuid(void); 746 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 747 net_write (rk_socket_t, const void *, size_t); 748 749 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 750 net_read (rk_socket_t, void *, size_t); 751 752 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 753 issuid(void); 495 754 496 755 #ifndef HAVE_STRUCT_WINSIZE … … 501 760 #endif 502 761 503 int ROKEN_LIB_FUNCTIONget_window_size(int fd, struct winsize *);762 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, struct winsize *); 504 763 505 764 #ifndef HAVE_VSYSLOG 506 765 #define vsyslog rk_vsyslog 507 void ROKEN_LIB_FUNCTION vsyslog(int, const char *, va_list); 766 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vsyslog(int, const char *, va_list); 767 #endif 768 769 #ifndef HAVE_GETOPT 770 #define getopt rk_getopt 771 #define optarg rk_optarg 772 #define optind rk_optind 773 #define opterr rk_opterr 774 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 775 getopt(int nargc, char * const *nargv, const char *ostr); 508 776 #endif 509 777 510 778 #if !HAVE_DECL_OPTARG 511 extern char *optarg;779 ROKEN_LIB_VARIABLE extern char *optarg; 512 780 #endif 513 781 #if !HAVE_DECL_OPTIND 514 extern int optind;782 ROKEN_LIB_VARIABLE extern int optind; 515 783 #endif 516 784 #if !HAVE_DECL_OPTERR 517 extern int opterr;785 ROKEN_LIB_VARIABLE extern int opterr; 518 786 #endif 519 787 520 788 #ifndef HAVE_GETIPNODEBYNAME 521 789 #define getipnodebyname rk_getipnodebyname 522 struct hostent * ROKEN_LIB_FUNCTION 790 ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL 523 791 getipnodebyname (const char *, int, int, int *); 524 792 #endif … … 526 794 #ifndef HAVE_GETIPNODEBYADDR 527 795 #define getipnodebyaddr rk_getipnodebyaddr 528 struct hostent * ROKEN_LIB_FUNCTION 796 ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL 529 797 getipnodebyaddr (const void *, size_t, int, int *); 530 798 #endif … … 532 800 #ifndef HAVE_FREEHOSTENT 533 801 #define freehostent rk_freehostent 534 void ROKEN_LIB_FUNCTION 802 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 535 803 freehostent (struct hostent *); 536 804 #endif … … 538 806 #ifndef HAVE_COPYHOSTENT 539 807 #define copyhostent rk_copyhostent 540 struct hostent * ROKEN_LIB_FUNCTION 808 ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL 541 809 copyhostent (const struct hostent *); 542 810 #endif … … 606 874 #ifndef HAVE_GETADDRINFO 607 875 #define getaddrinfo rk_getaddrinfo 608 int ROKEN_LIB_FUNCTION 876 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 609 877 getaddrinfo(const char *, 610 878 const char *, … … 615 883 #ifndef HAVE_GETNAMEINFO 616 884 #define getnameinfo rk_getnameinfo 617 int ROKEN_LIB_FUNCTION 885 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 618 886 getnameinfo(const struct sockaddr *, socklen_t, 619 887 char *, size_t, … … 624 892 #ifndef HAVE_FREEADDRINFO 625 893 #define freeaddrinfo rk_freeaddrinfo 626 void ROKEN_LIB_FUNCTION 894 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 627 895 freeaddrinfo(struct addrinfo *); 628 896 #endif … … 630 898 #ifndef HAVE_GAI_STRERROR 631 899 #define gai_strerror rk_gai_strerror 632 const char * ROKEN_LIB_FUNCTION 900 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL 633 901 gai_strerror(int); 634 902 #endif 635 903 636 int ROKEN_LIB_FUNCTION 904 #ifdef NO_SLEEP 905 906 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL 907 sleep(unsigned int seconds); 908 909 #endif 910 911 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 637 912 getnameinfo_verified(const struct sockaddr *, socklen_t, 638 913 char *, size_t, … … 640 915 int); 641 916 642 int ROKEN_LIB_FUNCTION 917 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 643 918 roken_getaddrinfo_hostspec(const char *, int, struct addrinfo **); 644 int ROKEN_LIB_FUNCTION 919 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 645 920 roken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **); 646 921 647 922 #ifndef HAVE_STRFTIME 648 923 #define strftime rk_strftime 649 size_t ROKEN_LIB_FUNCTION 924 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 650 925 strftime (char *, size_t, const char *, const struct tm *); 651 926 #endif … … 653 928 #ifndef HAVE_STRPTIME 654 929 #define strptime rk_strptime 655 char * ROKEN_LIB_FUNCTION 930 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 656 931 strptime (const char *, const char *, struct tm *); 932 #endif 933 934 #ifndef HAVE_GETTIMEOFDAY 935 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 936 gettimeofday (struct timeval *, void *); 657 937 #endif 658 938 659 939 #ifndef HAVE_EMALLOC 660 940 #define emalloc rk_emalloc 661 void * ROKEN_LIB_FUNCTIONemalloc (size_t);941 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL emalloc (size_t); 662 942 #endif 663 943 #ifndef HAVE_ECALLOC 664 944 #define ecalloc rk_ecalloc 665 void * ROKEN_LIB_FUNCTIONecalloc(size_t, size_t);945 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL ecalloc(size_t, size_t); 666 946 #endif 667 947 #ifndef HAVE_EREALLOC 668 948 #define erealloc rk_erealloc 669 void * ROKEN_LIB_FUNCTIONerealloc (void *, size_t);949 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL erealloc (void *, size_t); 670 950 #endif 671 951 #ifndef HAVE_ESTRDUP 672 952 #define estrdup rk_estrdup 673 char * ROKEN_LIB_FUNCTIONestrdup (const char *);953 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL estrdup (const char *); 674 954 #endif 675 955 … … 678 958 */ 679 959 680 #if 1 681 int ROKEN_LIB_FUNCTION 960 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 682 961 roken_gethostby_setup(const char*, const char*); 683 struct hostent* ROKEN_LIB_FUNCTION 962 ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL 684 963 roken_gethostbyname(const char*); 685 struct hostent* ROKEN_LIB_FUNCTION964 ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL 686 965 roken_gethostbyaddr(const void*, size_t, int); 687 #else688 #ifdef GETHOSTBYNAME_PROTO_COMPATIBLE689 #define roken_gethostbyname(x) gethostbyname(x)690 #else691 #define roken_gethostbyname(x) gethostbyname((char *)x)692 #endif693 694 #ifdef GETHOSTBYADDR_PROTO_COMPATIBLE695 #define roken_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t)696 #else697 #define roken_gethostbyaddr(a, l, t) gethostbyaddr((char *)a, l, t)698 #endif699 #endif700 966 701 967 #ifdef GETSERVBYNAME_PROTO_COMPATIBLE … … 719 985 #ifndef HAVE_SETPROGNAME 720 986 #define setprogname rk_setprogname 721 void ROKEN_LIB_FUNCTIONsetprogname(const char *);987 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL setprogname(const char *); 722 988 #endif 723 989 724 990 #ifndef HAVE_GETPROGNAME 725 991 #define getprogname rk_getprogname 726 const char * ROKEN_LIB_FUNCTIONgetprogname(void);992 ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL getprogname(void); 727 993 #endif 728 994 … … 731 997 #endif 732 998 733 void ROKEN_LIB_FUNCTION mini_inetd_addrinfo (struct addrinfo*); 734 void ROKEN_LIB_FUNCTION mini_inetd (int); 999 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 1000 mini_inetd_addrinfo (struct addrinfo*, rk_socket_t *); 1001 1002 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 1003 mini_inetd (int, rk_socket_t *); 735 1004 736 1005 #ifndef HAVE_LOCALTIME_R 737 1006 #define localtime_r rk_localtime_r 738 struct tm * ROKEN_LIB_FUNCTION 1007 ROKEN_LIB_FUNCTION struct tm * ROKEN_LIB_CALL 739 1008 localtime_r(const time_t *, struct tm *); 740 1009 #endif … … 744 1013 #define strsvis rk_strsvis 745 1014 #endif 746 int ROKEN_LIB_FUNCTION 1015 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 747 1016 strsvis(char *, const char *, int, const char *); 1017 #endif 1018 1019 #if !defined(HAVE_STRSVISX) || defined(NEED_STRSVISX_PROTO) 1020 #ifndef HAVE_STRSVISX 1021 #define strsvisx rk_strsvisx 1022 #endif 1023 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 1024 strsvisx(char *, const char *, size_t, int, const char *); 748 1025 #endif 749 1026 … … 752 1029 #define strunvis rk_strunvis 753 1030 #endif 754 int ROKEN_LIB_FUNCTION 1031 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 755 1032 strunvis(char *, const char *); 756 1033 #endif … … 760 1037 #define strvis rk_strvis 761 1038 #endif 762 int ROKEN_LIB_FUNCTION 1039 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 763 1040 strvis(char *, const char *, int); 764 1041 #endif … … 768 1045 #define strvisx rk_strvisx 769 1046 #endif 770 int ROKEN_LIB_FUNCTION 1047 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 771 1048 strvisx(char *, const char *, size_t, int); 772 1049 #endif … … 776 1053 #define svis rk_svis 777 1054 #endif 778 char * ROKEN_LIB_FUNCTION 1055 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 779 1056 svis(char *, int, int, int, const char *); 780 1057 #endif … … 784 1061 #define unvis rk_unvis 785 1062 #endif 786 int ROKEN_LIB_FUNCTION 1063 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 787 1064 unvis(char *, int, int *, int); 788 1065 #endif … … 792 1069 #define vis rk_vis 793 1070 #endif 794 char * ROKEN_LIB_FUNCTION 1071 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 795 1072 vis(char *, int, int, int); 796 1073 #endif … … 798 1075 #if !defined(HAVE_CLOSEFROM) 799 1076 #define closefrom rk_closefrom 800 int ROKEN_LIB_FUNCTION 1077 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 801 1078 closefrom(int); 802 1079 #endif … … 804 1081 #if !defined(HAVE_TIMEGM) 805 1082 #define timegm rk_timegm 806 time_t ROKEN_LIB_FUNCTION 1083 ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL 807 1084 rk_timegm(struct tm *tm); 1085 #endif 1086 1087 #ifdef NEED_QSORT 1088 #define qsort rk_qsort 1089 void 1090 rk_qsort(void *, size_t, size_t, int (*)(const void *, const void *)); 1091 #endif 1092 1093 #if defined(HAVE_ARC4RANDOM) 1094 #define rk_random() arc4random() 1095 #elif defined(HAVE_RANDOM) 1096 #define rk_random() random() 1097 #else 1098 #define rk_random() rand() 1099 #endif 1100 1101 1102 #if defined(__linux__) && defined(SOCK_CLOEXEC) && !defined(SOCKET_WRAPPER_REPLACE) && !defined(__SOCKET_WRAPPER_H__) 1103 #undef socket 1104 #define socket(_fam,_type,_prot) rk_socket(_fam,_type,_prot) 1105 int ROKEN_LIB_FUNCTION rk_socket(int, int, int); 808 1106 #endif 809 1107 -
trunk/server/source4/heimdal/lib/roken/roken_gethostby.c
r414 r745 67 67 if(dns_req) 68 68 free(dns_req); 69 dns_req = NULL; 69 70 if(proxy_host) { 70 71 if(make_address(proxy_host, &dns_addr.sin_addr) != 0) 71 72 return -1; 72 73 dns_addr.sin_port = htons(proxy_port); 73 asprintf(&dns_req, "http://%s:%d%s", dns_host, dns_port, dns_path); 74 if (asprintf(&dns_req, "http://%s:%d%s", dns_host, dns_port, dns_path) < 0) 75 return -1; 74 76 } else { 75 77 if(make_address(dns_host, &dns_addr.sin_addr) != 0) … … 105 107 106 108 107 int ROKEN_LIB_FUNCTION 109 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 108 110 roken_gethostby_setup(const char *proxy_spec, const char *dns_spec) 109 111 { … … 136 138 int s; 137 139 struct sockaddr_in addr; 138 char *request ;140 char *request = NULL; 139 141 char buf[1024]; 140 142 int offset = 0; … … 145 147 return NULL; /* no configured host */ 146 148 addr = dns_addr; 147 asprintf(&request, "GET %s?%s HTTP/1.0\r\n\r\n", dns_req, hostname); 149 if (asprintf(&request, "GET %s?%s HTTP/1.0\r\n\r\n", dns_req, hostname) < 0) 150 return NULL; 148 151 if(request == NULL) 149 152 return NULL; … … 208 211 } 209 212 210 struct hostent* 213 ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL 211 214 roken_gethostbyname(const char *hostname) 212 215 { … … 218 221 } 219 222 220 struct hostent* ROKEN_LIB_FUNCTION 223 ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL 221 224 roken_gethostbyaddr(const void *addr, size_t len, int type) 222 225 { -
trunk/server/source4/heimdal/lib/roken/rtbl.c
r414 r745 60 60 }; 61 61 62 rtbl_t ROKEN_LIB_FUNCTION 62 ROKEN_LIB_FUNCTION rtbl_t ROKEN_LIB_CALL 63 63 rtbl_create (void) 64 64 { … … 66 66 } 67 67 68 void ROKEN_LIB_FUNCTION 68 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 69 69 rtbl_set_flags (rtbl_t table, unsigned int flags) 70 70 { … … 72 72 } 73 73 74 unsigned int ROKEN_LIB_FUNCTION 74 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL 75 75 rtbl_get_flags (rtbl_t table) 76 76 { … … 81 81 rtbl_get_column_by_id (rtbl_t table, unsigned int id) 82 82 { 83 int i;83 size_t i; 84 84 for(i = 0; i < table->num_columns; i++) 85 85 if(table->columns[i]->column_id == id) … … 91 91 rtbl_get_column (rtbl_t table, const char *column) 92 92 { 93 int i;93 size_t i; 94 94 for(i = 0; i < table->num_columns; i++) 95 95 if(strcmp(table->columns[i]->header, column) == 0) … … 98 98 } 99 99 100 void ROKEN_LIB_FUNCTION 100 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 101 101 rtbl_destroy (rtbl_t table) 102 102 { 103 int i, j;103 size_t i, j; 104 104 105 105 for (i = 0; i < table->num_columns; i++) { … … 120 120 } 121 121 122 int ROKEN_LIB_FUNCTION 122 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 123 123 rtbl_add_column_by_id (rtbl_t table, unsigned int id, 124 124 const char *header, unsigned int flags) … … 149 149 } 150 150 151 int ROKEN_LIB_FUNCTION 151 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 152 152 rtbl_add_column (rtbl_t table, const char *header, unsigned int flags) 153 153 { … … 155 155 } 156 156 157 int ROKEN_LIB_FUNCTION 157 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 158 158 rtbl_new_row(rtbl_t table) 159 159 { … … 184 184 column_compute_width (rtbl_t table, struct column_data *column) 185 185 { 186 int i;186 size_t i; 187 187 188 188 if(table->flags & RTBL_HEADER_STYLE_NONE) … … 191 191 column->width = strlen (column->header); 192 192 for (i = 0; i < column->num_rows; i++) 193 column->width = max (column->width, strlen (column->rows[i].data));193 column->width = max (column->width, (int) strlen (column->rows[i].data)); 194 194 } 195 195 196 196 /* DEPRECATED */ 197 int ROKEN_LIB_FUNCTION 197 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 198 198 rtbl_set_prefix (rtbl_t table, const char *prefix) 199 199 { … … 206 206 } 207 207 208 int ROKEN_LIB_FUNCTION 208 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 209 209 rtbl_set_separator (rtbl_t table, const char *separator) 210 210 { … … 217 217 } 218 218 219 int ROKEN_LIB_FUNCTION 219 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 220 220 rtbl_set_column_prefix (rtbl_t table, const char *column, 221 221 const char *prefix) … … 233 233 } 234 234 235 int ROKEN_LIB_FUNCTION 235 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 236 236 rtbl_set_column_affix_by_id(rtbl_t table, unsigned int id, 237 237 const char *prefix, const char *suffix) … … 302 302 } 303 303 304 int ROKEN_LIB_FUNCTION 304 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 305 305 rtbl_add_column_entry_by_id (rtbl_t table, unsigned int id, const char *data) 306 306 { … … 313 313 } 314 314 315 int ROKEN_LIB_FUNCTION 315 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 316 316 rtbl_add_column_entryv_by_id (rtbl_t table, unsigned int id, 317 317 const char *fmt, ...) … … 331 331 } 332 332 333 int ROKEN_LIB_FUNCTION 333 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 334 334 rtbl_add_column_entry (rtbl_t table, const char *column, const char *data) 335 335 { … … 342 342 } 343 343 344 int ROKEN_LIB_FUNCTION 344 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 345 345 rtbl_add_column_entryv (rtbl_t table, const char *column, const char *fmt, ...) 346 346 { … … 360 360 361 361 362 int ROKEN_LIB_FUNCTION 362 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 363 363 rtbl_format (rtbl_t table, FILE * f) 364 364 { 365 int i, j;365 size_t i, j; 366 366 367 367 for (i = 0; i < table->num_columns; i++) -
trunk/server/source4/heimdal/lib/roken/rtbl.h
r414 r745 38 38 #ifndef ROKEN_LIB_FUNCTION 39 39 #ifdef _WIN32 40 #define ROKEN_LIB_FUNCTION _stdcall 40 #define ROKEN_LIB_FUNCTION 41 #define ROKEN_LIB_CALL __cdecl 41 42 #else 42 43 #define ROKEN_LIB_FUNCTION 44 #define ROKEN_LIB_CALL 43 45 #endif 44 46 #endif … … 61 63 #define RTBL_HEADER_STYLE_NONE 1 62 64 63 int ROKEN_LIB_FUNCTION 65 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 64 66 rtbl_add_column (rtbl_t, const char*, unsigned int); 65 67 66 int ROKEN_LIB_FUNCTION 68 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 67 69 rtbl_add_column_by_id (rtbl_t, unsigned int, const char*, unsigned int); 68 70 69 int ROKEN_LIB_FUNCTION 71 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 70 72 rtbl_add_column_entryv_by_id (rtbl_t table, unsigned int id, 71 73 const char *fmt, ...) 72 74 __attribute__ ((format (printf, 3, 0))); 73 75 74 int ROKEN_LIB_FUNCTION 76 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 75 77 rtbl_add_column_entry (rtbl_t, const char*, const char*); 76 78 77 int ROKEN_LIB_FUNCTION 79 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 78 80 rtbl_add_column_entryv (rtbl_t, const char*, const char*, ...) 79 81 __attribute__ ((format (printf, 3, 0))); 80 82 81 int ROKEN_LIB_FUNCTION 83 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 82 84 rtbl_add_column_entry_by_id (rtbl_t, unsigned int, const char*); 83 85 84 rtbl_t ROKEN_LIB_FUNCTION 86 ROKEN_LIB_FUNCTION rtbl_t ROKEN_LIB_CALL 85 87 rtbl_create (void); 86 88 87 void ROKEN_LIB_FUNCTION 89 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 88 90 rtbl_destroy (rtbl_t); 89 91 90 int ROKEN_LIB_FUNCTION 92 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 91 93 rtbl_format (rtbl_t, FILE*); 92 94 93 unsigned int ROKEN_LIB_FUNCTION 95 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL 94 96 rtbl_get_flags (rtbl_t); 95 97 96 int ROKEN_LIB_FUNCTION 98 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 97 99 rtbl_new_row (rtbl_t); 98 100 99 int ROKEN_LIB_FUNCTION 101 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 100 102 rtbl_set_column_affix_by_id (rtbl_t, unsigned int, const char*, const char*); 101 103 102 int ROKEN_LIB_FUNCTION 104 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 103 105 rtbl_set_column_prefix (rtbl_t, const char*, const char*); 104 106 105 void ROKEN_LIB_FUNCTION 107 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 106 108 rtbl_set_flags (rtbl_t, unsigned int); 107 109 108 int ROKEN_LIB_FUNCTION 110 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 109 111 rtbl_set_prefix (rtbl_t, const char*); 110 112 111 int ROKEN_LIB_FUNCTION 113 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 112 114 rtbl_set_separator (rtbl_t, const char*); 113 115 -
trunk/server/source4/heimdal/lib/roken/setprogname.c
r414 r745 41 41 42 42 #ifndef HAVE_SETPROGNAME 43 void ROKEN_LIB_FUNCTION 43 44 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 44 45 setprogname(const char *argv0) 45 46 { 47 46 48 #ifndef HAVE___PROGNAME 49 47 50 const char *p; 48 51 if(argv0 == NULL) 49 52 return; 50 53 p = strrchr(argv0, '/'); 54 55 #ifdef BACKSLASH_PATH_DELIM 56 { 57 const char * pb; 58 59 pb = strrchr((p != NULL)? p : argv0, '\\'); 60 if (pb != NULL) 61 p = pb; 62 } 63 #endif 64 51 65 if(p == NULL) 52 66 p = argv0; 53 67 else 54 68 p++; 69 70 #ifdef _WIN32 71 { 72 char * fn = strdup(p); 73 char * ext; 74 75 strlwr(fn); 76 ext = strrchr(fn, '.'); 77 if (ext != NULL && !strcmp(ext, ".exe")) 78 *ext = '\0'; 79 80 __progname = fn; 81 } 82 #else 83 55 84 __progname = p; 85 56 86 #endif 87 88 #endif /* HAVE___PROGNAME */ 57 89 } 90 58 91 #endif /* HAVE_SETPROGNAME */ -
trunk/server/source4/heimdal/lib/roken/signal.c
r414 r745 48 48 */ 49 49 50 SigAction ROKEN_LIB_FUNCTION 50 ROKEN_LIB_FUNCTION SigAction ROKEN_LIB_CALL 51 51 signal(int iSig, SigAction pAction) 52 52 { -
trunk/server/source4/heimdal/lib/roken/simple_exec.c
r414 r745 53 53 54 54 /* return values: 55 -1on `unspecified' system errors56 -2on fork failures57 -3on waitpid errors58 -4exec timeout55 SE_E_UNSPECIFIED on `unspecified' system errors 56 SE_E_FORKFAILED on fork failures 57 SE_E_WAITPIDFAILED on waitpid errors 58 SE_E_EXECTIMEOUT exec timeout 59 59 0- is return value from subprocess 60 126if the program couldn't be executed61 127if the program couldn't be found60 SE_E_NOEXEC if the program couldn't be executed 61 SE_E_NOTFOUND if the program couldn't be found 62 62 128- is 128 + signal that killed subprocess 63 63 … … 79 79 } 80 80 81 int ROKEN_LIB_FUNCTION 81 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 82 82 wait_for_process_timed(pid_t pid, time_t (*func)(void *), 83 83 void *ptr, time_t timeout) … … 99 99 while(waitpid(pid, &status, 0) < 0) { 100 100 if (errno != EINTR) { 101 ret = -3;101 ret = SE_E_WAITPIDFAILED; 102 102 goto out; 103 103 } … … 111 111 continue; 112 112 } else if (timeout == (time_t)-2) { 113 ret = -4;113 ret = SE_E_EXECTIMEOUT; 114 114 goto out; 115 115 } … … 135 135 } 136 136 137 int ROKEN_LIB_FUNCTION 137 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 138 138 wait_for_process(pid_t pid) 139 139 { … … 141 141 } 142 142 143 int ROKEN_LIB_FUNCTION 143 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 144 144 pipe_execv(FILE **stdin_fd, FILE **stdout_fd, FILE **stderr_fd, 145 145 const char *file, ...) … … 212 212 close(err_fd[1]); 213 213 } 214 return -2;214 return SE_E_FORKFAILED; 215 215 default: 216 216 if(stdin_fd != NULL) { … … 230 230 } 231 231 232 int ROKEN_LIB_FUNCTION 232 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 233 233 simple_execvp_timed(const char *file, char *const args[], 234 234 time_t (*func)(void *), void *ptr, time_t timeout) … … 237 237 switch(pid){ 238 238 case -1: 239 return -2;239 return SE_E_FORKFAILED; 240 240 case 0: 241 241 execvp(file, args); … … 246 246 } 247 247 248 int ROKEN_LIB_FUNCTION 248 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 249 249 simple_execvp(const char *file, char *const args[]) 250 250 { … … 253 253 254 254 /* gee, I'd like a execvpe */ 255 int ROKEN_LIB_FUNCTION 255 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 256 256 simple_execve_timed(const char *file, char *const args[], char *const envp[], 257 257 time_t (*func)(void *), void *ptr, time_t timeout) … … 260 260 switch(pid){ 261 261 case -1: 262 return -2;262 return SE_E_FORKFAILED; 263 263 case 0: 264 264 execve(file, args, envp); … … 269 269 } 270 270 271 int ROKEN_LIB_FUNCTION 271 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 272 272 simple_execve(const char *file, char *const args[], char *const envp[]) 273 273 { … … 275 275 } 276 276 277 int ROKEN_LIB_FUNCTION 277 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 278 278 simple_execlp(const char *file, ...) 279 279 { … … 286 286 va_end(ap); 287 287 if(argv == NULL) 288 return -1;288 return SE_E_UNSPECIFIED; 289 289 ret = simple_execvp(file, argv); 290 290 free(argv); … … 292 292 } 293 293 294 int ROKEN_LIB_FUNCTION 294 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 295 295 simple_execle(const char *file, ... /* ,char *const envp[] */) 296 296 { … … 305 305 va_end(ap); 306 306 if(argv == NULL) 307 return -1;307 return SE_E_UNSPECIFIED; 308 308 ret = simple_execve(file, argv, envp); 309 309 free(argv); -
trunk/server/source4/heimdal/lib/roken/socket.c
r414 r745 41 41 */ 42 42 43 void ROKEN_LIB_FUNCTION 43 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 44 44 socket_set_any (struct sockaddr *sa, int af) 45 45 { … … 75 75 */ 76 76 77 void ROKEN_LIB_FUNCTION 77 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 78 78 socket_set_address_and_port (struct sockaddr *sa, const void *ptr, int port) 79 79 { … … 109 109 */ 110 110 111 size_t ROKEN_LIB_FUNCTION 111 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 112 112 socket_addr_size (const struct sockaddr *sa) 113 113 { … … 120 120 #endif 121 121 default : 122 errx (1, "unknown address family %d", sa->sa_family); 123 break; 122 return 0; 124 123 } 125 124 } … … 129 128 */ 130 129 131 size_t ROKEN_LIB_FUNCTION 130 ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 132 131 socket_sockaddr_size (const struct sockaddr *sa) 133 132 { … … 139 138 return sizeof(struct sockaddr_in6); 140 139 #endif 141 default : 142 errx (1, "unknown address family %d", sa->sa_family); 143 break; 140 default: 141 return 0; 144 142 } 145 143 } … … 149 147 */ 150 148 151 void * ROKEN_LIB_FUNCTION 149 ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL 152 150 socket_get_address (const struct sockaddr *sa) 153 151 { … … 163 161 } 164 162 #endif 165 default : 166 errx (1, "unknown address family %d", sa->sa_family); 167 break; 163 default: 164 return NULL; 168 165 } 169 166 } … … 173 170 */ 174 171 175 int ROKEN_LIB_FUNCTION 172 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 176 173 socket_get_port (const struct sockaddr *sa) 177 174 { … … 188 185 #endif 189 186 default : 190 errx (1, "unknown address family %d", sa->sa_family); 191 break; 187 return 0; 192 188 } 193 189 } … … 197 193 */ 198 194 199 void ROKEN_LIB_FUNCTION 195 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 200 196 socket_set_port (struct sockaddr *sa, int port) 201 197 { … … 222 218 * Set the range of ports to use when binding with port = 0. 223 219 */ 224 void ROKEN_LIB_FUNCTION 225 socket_set_portrange ( int sock, int restr, int af)220 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 221 socket_set_portrange (rk_socket_t sock, int restr, int af) 226 222 { 227 223 #if defined(IP_PORTRANGE) 228 224 if (af == AF_INET) { 229 225 int on = restr ? IP_PORTRANGE_HIGH : IP_PORTRANGE_DEFAULT; 230 if (setsockopt (sock, IPPROTO_IP, IP_PORTRANGE, &on, 231 sizeof(on)) < 0) 232 warn ("setsockopt IP_PORTRANGE (ignored)"); 226 setsockopt (sock, IPPROTO_IP, IP_PORTRANGE, &on, sizeof(on)); 233 227 } 234 228 #endif 235 229 #if defined(IPV6_PORTRANGE) 236 230 if (af == AF_INET6) { 237 int on = restr ? IPV6_PORTRANGE_HIGH : 238 IPV6_PORTRANGE_DEFAULT; 239 if (setsockopt (sock, IPPROTO_IPV6, IPV6_PORTRANGE, &on, 240 sizeof(on)) < 0) 241 warn ("setsockopt IPV6_PORTRANGE (ignored)"); 231 int on = restr ? IPV6_PORTRANGE_HIGH : IPV6_PORTRANGE_DEFAULT; 232 setsockopt (sock, IPPROTO_IPV6, IPV6_PORTRANGE, &on, sizeof(on)); 242 233 } 243 234 #endif … … 248 239 */ 249 240 250 void ROKEN_LIB_FUNCTION 251 socket_set_debug ( int sock)241 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 242 socket_set_debug (rk_socket_t sock) 252 243 { 253 244 #if defined(SO_DEBUG) && defined(HAVE_SETSOCKOPT) 254 245 int on = 1; 255 256 if (setsockopt (sock, SOL_SOCKET, SO_DEBUG, (void *) &on, sizeof (on)) < 0) 257 warn ("setsockopt SO_DEBUG (ignored)"); 246 setsockopt (sock, SOL_SOCKET, SO_DEBUG, (void *) &on, sizeof (on)); 258 247 #endif 259 248 } … … 263 252 */ 264 253 265 void ROKEN_LIB_FUNCTION 266 socket_set_tos ( int sock, int tos)254 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 255 socket_set_tos (rk_socket_t sock, int tos) 267 256 { 268 257 #if defined(IP_TOS) && defined(HAVE_SETSOCKOPT) 269 if (setsockopt (sock, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof (int)) < 0) 270 if (errno != EINVAL) 271 warn ("setsockopt TOS (ignored)"); 258 setsockopt (sock, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(int)); 272 259 #endif 273 260 } … … 277 264 */ 278 265 279 void ROKEN_LIB_FUNCTION 280 socket_set_reuseaddr ( int sock, int val)266 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 267 socket_set_reuseaddr (rk_socket_t sock, int val) 281 268 { 282 269 #if defined(SO_REUSEADDR) && defined(HAVE_SETSOCKOPT) 283 if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&val, 284 sizeof(val)) < 0) 285 err (1, "setsockopt SO_REUSEADDR"); 270 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&val, sizeof(val)); 286 271 #endif 287 272 } … … 291 276 */ 292 277 293 void ROKEN_LIB_FUNCTION 294 socket_set_ipv6only ( int sock, int val)278 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 279 socket_set_ipv6only (rk_socket_t sock, int val) 295 280 { 296 281 #if defined(IPV6_V6ONLY) && defined(HAVE_SETSOCKOPT) … … 298 283 #endif 299 284 } 285 286 /** 287 * Create a file descriptor from a socket 288 * 289 * While the socket handle in \a sock can be used with WinSock 290 * functions after calling socket_to_fd(), it should not be closed 291 * with rk_closesocket(). The socket will be closed when the associated 292 * file descriptor is closed. 293 */ 294 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 295 socket_to_fd(rk_socket_t sock, int flags) 296 { 297 #ifndef _WIN32 298 return sock; 299 #else 300 return _open_osfhandle((intptr_t) sock, flags); 301 #endif 302 } 303 304 #ifdef HAVE_WINSOCK 305 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 306 rk_SOCK_IOCTL(SOCKET s, long cmd, int * argp) { 307 u_long ul = (argp)? *argp : 0; 308 int rv; 309 310 rv = ioctlsocket(s, cmd, &ul); 311 if (argp) 312 *argp = (int) ul; 313 return rv; 314 } 315 #endif 316 317 #ifndef HEIMDAL_SMALLER 318 #undef socket 319 320 int rk_socket(int, int, int); 321 322 int 323 rk_socket(int domain, int type, int protocol) 324 { 325 int s; 326 s = socket (domain, type, protocol); 327 #ifdef SOCK_CLOEXEC 328 if ((SOCK_CLOEXEC & type) && s < 0 && errno == EINVAL) { 329 type &= ~SOCK_CLOEXEC; 330 s = socket (domain, type, protocol); 331 } 332 #endif 333 return s; 334 } 335 336 #endif /* HEIMDAL_SMALLER */ -
trunk/server/source4/heimdal/lib/roken/strcollect.c
r414 r745 67 67 */ 68 68 69 char ** ROKEN_LIB_FUNCTION 69 ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL 70 70 vstrcollect(va_list *ap) 71 71 { … … 77 77 */ 78 78 79 char ** ROKEN_LIB_FUNCTION 79 ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL 80 80 strcollect(char *first, ...) 81 81 { -
trunk/server/source4/heimdal/lib/roken/strlwr.c
r414 r745 39 39 40 40 #ifndef HAVE_STRLWR 41 char * ROKEN_LIB_FUNCTION 41 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 42 42 strlwr(char *str) 43 43 { -
trunk/server/source4/heimdal/lib/roken/strpool.c
r414 r745 47 47 */ 48 48 49 void ROKEN_LIB_FUNCTION 49 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 50 50 rk_strpoolfree(struct rk_strpool *p) 51 51 { … … 61 61 */ 62 62 63 struct rk_strpool * ROKEN_LIB_FUNCTION 63 ROKEN_LIB_FUNCTION struct rk_strpool * ROKEN_LIB_CALL 64 64 rk_strpoolprintf(struct rk_strpool *p, const char *fmt, ...) 65 65 { … … 98 98 */ 99 99 100 char * ROKEN_LIB_FUNCTION 100 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 101 101 rk_strpoolcollect(struct rk_strpool *p) 102 102 { -
trunk/server/source4/heimdal/lib/roken/strsep.c
r414 r745 40 40 #ifndef HAVE_STRSEP 41 41 42 char * ROKEN_LIB_FUNCTION 42 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 43 43 strsep(char **str, const char *delim) 44 44 { -
trunk/server/source4/heimdal/lib/roken/strsep_copy.c
r414 r745 42 42 /* strsep, but with const stringp, so return string in buf */ 43 43 44 ssize_t ROKEN_LIB_FUNCTION 44 ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 45 45 strsep_copy(const char **stringp, const char *delim, char *buf, size_t len) 46 46 { -
trunk/server/source4/heimdal/lib/roken/strupr.c
r414 r745 39 39 40 40 #ifndef HAVE_STRUPR 41 char * ROKEN_LIB_FUNCTION 41 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 42 42 strupr(char *str) 43 43 { -
trunk/server/source4/heimdal/lib/roken/vis.c
r414 r745 107 107 #endif 108 108 109 char * ROKEN_LIB_FUNCTION 109 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 110 110 rk_vis (char *, int, int, int); 111 char * ROKEN_LIB_FUNCTION 111 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 112 112 rk_svis (char *, int, int, int, const char *); 113 int ROKEN_LIB_FUNCTION 113 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 114 114 rk_strvis (char *, const char *, int); 115 int ROKEN_LIB_FUNCTION 115 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 116 116 rk_strsvis (char *, const char *, int, const char *); 117 int ROKEN_LIB_FUNCTION 117 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 118 118 rk_strvisx (char *, const char *, size_t, int); 119 int ROKEN_LIB_FUNCTION 119 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 120 120 rk_strsvisx (char *, const char *, size_t, int, const char *); 121 121 … … 224 224 if (isextra || ((c & 0177) == ' ') || (flag & VIS_OCTAL)) { 225 225 *dst++ = '\\'; 226 *dst++ = (u_char)(((u _int32_t)(u_char)c >> 6) & 03) + '0';227 *dst++ = (u_char)(((u _int32_t)(u_char)c >> 3) & 07) + '0';228 *dst++ = (c& 07) + '0';226 *dst++ = (u_char)(((unsigned int)(u_char)c >> 6) & 03) + '0'; 227 *dst++ = (u_char)(((unsigned int)(u_char)c >> 3) & 07) + '0'; 228 *dst++ = (u_char)( c & 07) + '0'; 229 229 } else { 230 230 if ((flag & VIS_NOSLASH) == 0) *dst++ = '\\'; … … 250 250 * pointed to by `extra' 251 251 */ 252 char * ROKEN_LIB_FUNCTION 252 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 253 253 rk_svis(char *dst, int c, int flag, int nextc, const char *extra) 254 254 { … … 287 287 * This is useful for encoding a block of data. 288 288 */ 289 int ROKEN_LIB_FUNCTION 289 290 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 290 291 rk_strsvis(char *dst, const char *csrc, int flag, const char *extra) 291 292 { … … 316 317 317 318 318 int ROKEN_LIB_FUNCTION 319 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 319 320 rk_strsvisx(char *dst, const char *csrc, size_t len, int flag, const char *extra) 320 321 { … … 354 355 * vis - visually encode characters 355 356 */ 356 char * ROKEN_LIB_FUNCTION 357 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 357 358 rk_vis(char *dst, int c, int flag, int nextc) 358 359 { … … 387 388 * This is useful for encoding a block of data. 388 389 */ 389 int ROKEN_LIB_FUNCTION 390 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 390 391 rk_strvis(char *dst, const char *src, int flag) 391 392 { … … 404 405 405 406 406 int ROKEN_LIB_FUNCTION 407 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 407 408 rk_strvisx(char *dst, const char *src, size_t len, int flag) 408 409 { -
trunk/server/source4/heimdal/lib/roken/vis.hin
r414 r745 37 37 #ifndef ROKEN_LIB_FUNCTION 38 38 #ifdef _WIN32 39 #define ROKEN_LIB_FUNCTION _stdcall 39 #define ROKEN_LIB_FUNCTION 40 #define ROKEN_LIB_CALL __cdecl 40 41 #else 41 42 #define ROKEN_LIB_FUNCTION 43 #define ROKEN_LIB_CALL 42 44 #endif 43 45 #endif … … 85 87 ROKEN_CPP_START 86 88 87 char * ROKEN_LIB_FUNCTION 89 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 88 90 rk_vis(char *, int, int, int); 89 char * ROKEN_LIB_FUNCTION 91 ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL 90 92 rk_svis(char *, int, int, int, const char *); 91 int ROKEN_LIB_FUNCTION 93 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 92 94 rk_strvis(char *, const char *, int); 93 int ROKEN_LIB_FUNCTION 95 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 94 96 rk_strsvis(char *, const char *, int, const char *); 95 int ROKEN_LIB_FUNCTION 97 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 96 98 rk_strvisx(char *, const char *, size_t, int); 97 int ROKEN_LIB_FUNCTION 99 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 98 100 rk_strsvisx(char *, const char *, size_t, int, const char *); 99 int ROKEN_LIB_FUNCTION 101 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 100 102 rk_strunvis(char *, const char *); 101 int ROKEN_LIB_FUNCTION 103 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 102 104 rk_strunvisx(char *, const char *, int); 103 int ROKEN_LIB_FUNCTION 105 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 104 106 rk_unvis(char *, int, int *, int); 107 105 108 ROKEN_CPP_END 106 109 -
trunk/server/source4/heimdal/lib/roken/xfree.c
r414 r745 34 34 #include <config.h> 35 35 36 #include <unistd.h>37 38 36 #include "roken.h" 39 37
Note:
See TracChangeset
for help on using the changeset viewer.