Send inn-committers mailing list submissions to inn-committers@lists.isc.org
To subscribe or unsubscribe via the World Wide Web, visit https://lists.isc.org/mailman/listinfo/inn-committers or, via email, send a message with subject or body 'help' to inn-committers-requ...@lists.isc.org You can reach the person managing the list at inn-committers-ow...@lists.isc.org When replying, please edit your Subject line so it is more specific than "Re: Contents of inn-committers digest..." Today's Topics: 1. INN commit: trunk/lib (inet_ntop.c) (INN Commit) 2. INN commit: branches/2.5/lib (inet_ntop.c) (INN Commit) 3. INN commit: trunk/lib (7 files) (INN Commit) ---------------------------------------------------------------------- Message: 1 Date: Tue, 5 Nov 2013 12:09:30 -0800 (PST) From: INN Commit <r...@isc.org> To: inn-committ...@isc.org Subject: INN commit: trunk/lib (inet_ntop.c) Message-ID: <20131105200930.67cdd67...@hope.eyrie.org> Date: Tuesday, November 5, 2013 @ 12:09:30 Author: iulius Revision: 9556 inet_ntop.c: sync with rra-c-util - Use socket_set_errno instead of assigning to errno. - Check the return status of snprintf in the inet_ntop replacement function instead of assuming that it will always succeed. Modified: trunk/lib/inet_ntop.c -------------+ inet_ntop.c | 63 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 23 deletions(-) Modified: inet_ntop.c =================================================================== --- inet_ntop.c 2013-11-03 19:19:52 UTC (rev 9555) +++ inet_ntop.c 2013-11-05 20:09:30 UTC (rev 9556) @@ -1,22 +1,32 @@ -/* $Id$ -** -** Replacement for a missing inet_ntop. -** -** Written by Russ Allbery <r...@stanford.edu> -** This work is hereby placed in the public domain by its author. -** -** Provides an implementation of inet_ntop that only supports IPv4 addresses -** for hosts that are missing it. If you want IPv6 support, you need to have -** a real inet_ntop function; this function is only provided so that code can -** call inet_ntop unconditionally without needing to worry about whether the -** host supports IPv6. -*/ +/* $Id$ + * + * Replacement for a missing inet_ntop. + * + * Provides an implementation of inet_ntop that only supports IPv4 addresses + * for hosts that are missing it. If you want IPv6 support, you need to have + * a real inet_ntop function; this function is only provided so that code can + * call inet_ntop unconditionally without needing to worry about whether the + * host supports IPv6. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Written by Russ Allbery <r...@stanford.edu> + * + * The authors hereby relinquish any claim to any copyright that they may have + * in this work, whether granted under contract or by operation of law or + * international treaty, and hereby commit to the public, at large, that they + * shall not, at any time in the future, seek to enforce any copyright in this + * work against any person or entity, or prevent any person or entity from + * copying, publishing, distributing or creating derivative works of this + * work. + */ #include "config.h" #include "clibrary.h" +#include "portable/socket.h" + #include <errno.h> -#include <netinet/in.h> -#include <sys/socket.h> /* This may already be defined by the system headers. */ #ifndef INET_ADDRSTRLEN @@ -28,29 +38,36 @@ # define EAFNOSUPPORT EDOM #endif -/* If we're running the test suite, rename inet_ntop to avoid conflicts with - the system version. */ +/* + * If we're running the test suite, rename inet_ntop to avoid conflicts with + * the system version. + */ #if TESTING # define inet_ntop test_inet_ntop const char *test_inet_ntop(int, const void *, char *, socklen_t); #endif const char * -inet_ntop(int af, const void *src, char *dst, socklen_t cnt) +inet_ntop(int af, const void *src, char *dst, socklen_t size) { const unsigned char *p; + int status; if (af != AF_INET) { - errno = EAFNOSUPPORT; + socket_set_errno(EAFNOSUPPORT); return NULL; } - if (cnt < INET_ADDRSTRLEN) { + if (size < INET_ADDRSTRLEN) { errno = ENOSPC; return NULL; } p = src; - snprintf(dst, cnt, "%u.%u.%u.%u", - (unsigned int) (p[0] & 0xff), (unsigned int) (p[1] & 0xff), - (unsigned int) (p[2] & 0xff), (unsigned int) (p[3] & 0xff)); + status = snprintf(dst, size, "%u.%u.%u.%u", + (unsigned int) (p[0] & 0xff), + (unsigned int) (p[1] & 0xff), + (unsigned int) (p[2] & 0xff), + (unsigned int) (p[3] & 0xff)); + if (status < 0) + return NULL; return dst; } ------------------------------ Message: 2 Date: Tue, 5 Nov 2013 12:11:17 -0800 (PST) From: INN Commit <r...@isc.org> To: inn-committ...@isc.org Subject: INN commit: branches/2.5/lib (inet_ntop.c) Message-ID: <20131105201117.a650f67...@hope.eyrie.org> Date: Tuesday, November 5, 2013 @ 12:11:17 Author: iulius Revision: 9557 inet_ntop.c: sync with rra-c-util - Use socket_set_errno instead of assigning to errno. - Check the return status of snprintf in the inet_ntop replacement function instead of assuming that it will always succeed. Modified: branches/2.5/lib/inet_ntop.c -------------+ inet_ntop.c | 63 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 23 deletions(-) Modified: inet_ntop.c =================================================================== --- inet_ntop.c 2013-11-05 20:09:30 UTC (rev 9556) +++ inet_ntop.c 2013-11-05 20:11:17 UTC (rev 9557) @@ -1,22 +1,32 @@ -/* $Id$ -** -** Replacement for a missing inet_ntop. -** -** Written by Russ Allbery <r...@stanford.edu> -** This work is hereby placed in the public domain by its author. -** -** Provides an implementation of inet_ntop that only supports IPv4 addresses -** for hosts that are missing it. If you want IPv6 support, you need to have -** a real inet_ntop function; this function is only provided so that code can -** call inet_ntop unconditionally without needing to worry about whether the -** host supports IPv6. -*/ +/* $Id$ + * + * Replacement for a missing inet_ntop. + * + * Provides an implementation of inet_ntop that only supports IPv4 addresses + * for hosts that are missing it. If you want IPv6 support, you need to have + * a real inet_ntop function; this function is only provided so that code can + * call inet_ntop unconditionally without needing to worry about whether the + * host supports IPv6. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Written by Russ Allbery <r...@stanford.edu> + * + * The authors hereby relinquish any claim to any copyright that they may have + * in this work, whether granted under contract or by operation of law or + * international treaty, and hereby commit to the public, at large, that they + * shall not, at any time in the future, seek to enforce any copyright in this + * work against any person or entity, or prevent any person or entity from + * copying, publishing, distributing or creating derivative works of this + * work. + */ #include "config.h" #include "clibrary.h" +#include "portable/socket.h" + #include <errno.h> -#include <netinet/in.h> -#include <sys/socket.h> /* This may already be defined by the system headers. */ #ifndef INET_ADDRSTRLEN @@ -28,29 +38,36 @@ # define EAFNOSUPPORT EDOM #endif -/* If we're running the test suite, rename inet_ntop to avoid conflicts with - the system version. */ +/* + * If we're running the test suite, rename inet_ntop to avoid conflicts with + * the system version. + */ #if TESTING # define inet_ntop test_inet_ntop const char *test_inet_ntop(int, const void *, char *, socklen_t); #endif const char * -inet_ntop(int af, const void *src, char *dst, socklen_t cnt) +inet_ntop(int af, const void *src, char *dst, socklen_t size) { const unsigned char *p; + int status; if (af != AF_INET) { - errno = EAFNOSUPPORT; + socket_set_errno(EAFNOSUPPORT); return NULL; } - if (cnt < INET_ADDRSTRLEN) { + if (size < INET_ADDRSTRLEN) { errno = ENOSPC; return NULL; } p = src; - snprintf(dst, cnt, "%u.%u.%u.%u", - (unsigned int) (p[0] & 0xff), (unsigned int) (p[1] & 0xff), - (unsigned int) (p[2] & 0xff), (unsigned int) (p[3] & 0xff)); + status = snprintf(dst, size, "%u.%u.%u.%u", + (unsigned int) (p[0] & 0xff), + (unsigned int) (p[1] & 0xff), + (unsigned int) (p[2] & 0xff), + (unsigned int) (p[3] & 0xff)); + if (status < 0) + return NULL; return dst; } ------------------------------ Message: 3 Date: Tue, 5 Nov 2013 12:57:58 -0800 (PST) From: INN Commit <r...@isc.org> To: inn-committ...@isc.org Subject: INN commit: trunk/lib (7 files) Message-ID: <20131105205758.bab7667...@hope.eyrie.org> Date: Tuesday, November 5, 2013 @ 12:57:58 Author: iulius Revision: 9558 sync with rra-c-util Modified: trunk/lib/inet_aton.c trunk/lib/inet_ntoa.c trunk/lib/mkstemp.c trunk/lib/setenv.c trunk/lib/seteuid.c trunk/lib/strlcat.c trunk/lib/strlcpy.c -------------+ inet_aton.c | 187 ++++++++++++++++++++++++++++++++++------------------------ inet_ntoa.c | 43 ++++++++----- mkstemp.c | 59 ++++++++++++------ setenv.c | 67 +++++++++++++------- seteuid.c | 46 ++++++++------ strlcat.c | 46 ++++++++------ strlcpy.c | 44 ++++++++----- 7 files changed, 304 insertions(+), 188 deletions(-) Modified: inet_aton.c =================================================================== --- inet_aton.c 2013-11-05 20:11:17 UTC (rev 9557) +++ inet_aton.c 2013-11-05 20:57:58 UTC (rev 9558) @@ -1,21 +1,33 @@ -/* $Id$ -** -** Replacement for a missing inet_aton. -** -** Written by Russ Allbery <r...@stanford.edu> -** This work is hereby placed in the public domain by its author. -** -** Provides the same functionality as the standard library routine -** inet_aton for those platforms that don't have it. inet_aton is -** thread-safe. -*/ +/* $Id$ + * + * Replacement for a missing inet_aton. + * + * Provides the same functionality as the standard library routine + * inet_aton for those platforms that don't have it. inet_aton is + * thread-safe. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Written by Russ Allbery <r...@stanford.edu> + * + * The authors hereby relinquish any claim to any copyright that they may have + * in this work, whether granted under contract or by operation of law or + * international treaty, and hereby commit to the public, at large, that they + * shall not, at any time in the future, seek to enforce any copyright in this + * work against any person or entity, or prevent any person or entity from + * copying, publishing, distributing or creating derivative works of this + * work. + */ #include "config.h" #include "clibrary.h" -#include <netinet/in.h> +#include "portable/socket.h" -/* If we're running the test suite, rename inet_ntoa to avoid conflicts with - the system version. */ +/* + * If we're running the test suite, rename inet_ntoa to avoid conflicts with + * the system version. + */ #if TESTING # define inet_aton test_inet_aton int test_inet_aton(const char *, struct in_addr *); @@ -29,16 +41,22 @@ int base, i; int part = 0; - if (s == NULL) return 0; + if (s == NULL) + return 0; - /* Step through each period-separated part of the address. If we see - more than four parts, the address is invalid. */ + /* + * Step through each period-separated part of the address. If we see + * more than four parts, the address is invalid. + */ for (p = s; *p != 0; part++) { - if (part > 3) return 0; + if (part > 3) + return 0; - /* Determine the base of the section we're looking at. Numbers are - represented the same as in C; octal starts with 0, hex starts - with 0x, and anything else is decimal. */ + /* + * Determine the base of the section we're looking at. Numbers are + * represented the same as in C; octal starts with 0, hex starts + * with 0x, and anything else is decimal. + */ if (*p == '0') { p++; if (*p == 'x') { @@ -51,80 +69,97 @@ base = 10; } - /* Make sure there's actually a number. (A section of just "0" - would set base to 8 and leave us pointing at a period; allow - that.) */ - if (*p == '.' && base != 8) return 0; + /* + * Make sure there's actually a number. (A section of just "0" + * would set base to 8 and leave us pointing at a period; allow + * that.) + */ + if (*p == '.' && base != 8) + return 0; octet[part] = 0; - /* Now, parse this segment of the address. For each digit, multiply - the result so far by the base and then add the value of the - digit. Be careful of arithmetic overflow in cases where an - unsigned long is 32 bits; we need to detect it *before* we - multiply by the base since otherwise we could overflow and wrap - and then not detect the error. */ + /* + * Now, parse this segment of the address. For each digit, multiply + * the result so far by the base and then add the value of the digit. + * Be careful of arithmetic overflow in cases where an unsigned long + * is 32 bits; we need to detect it *before* we multiply by the base + * since otherwise we could overflow and wrap and then not detect the + * error. + */ for (; *p != 0 && *p != '.'; p++) { - if (octet[part] > 0xffffffffUL / base) return 0; + if (octet[part] > 0xffffffffUL / base) + return 0; - /* Use a switch statement to parse each digit rather than - assuming ASCII. Probably pointless portability.... */ + /* + * Use a switch statement to parse each digit rather than assuming + * ASCII. Probably pointless portability. + */ switch (*p) { - case '0': i = 0; break; - case '1': i = 1; break; - case '2': i = 2; break; - case '3': i = 3; break; - case '4': i = 4; break; - case '5': i = 5; break; - case '6': i = 6; break; - case '7': i = 7; break; - case '8': i = 8; break; - case '9': i = 9; break; - case 'A': case 'a': i = 10; break; - case 'B': case 'b': i = 11; break; - case 'C': case 'c': i = 12; break; - case 'D': case 'd': i = 13; break; - case 'E': case 'e': i = 14; break; - case 'F': case 'f': i = 15; break; - default: return 0; + case '0': i = 0; break; + case '1': i = 1; break; + case '2': i = 2; break; + case '3': i = 3; break; + case '4': i = 4; break; + case '5': i = 5; break; + case '6': i = 6; break; + case '7': i = 7; break; + case '8': i = 8; break; + case '9': i = 9; break; + case 'A': case 'a': i = 10; break; + case 'B': case 'b': i = 11; break; + case 'C': case 'c': i = 12; break; + case 'D': case 'd': i = 13; break; + case 'E': case 'e': i = 14; break; + case 'F': case 'f': i = 15; break; + default: return 0; } - if (i >= base) return 0; + if (i >= base) + return 0; octet[part] = (octet[part] * base) + i; } - /* Advance over periods; the top of the loop will increment the - count of parts we've seen. We need a check here to detect an - illegal trailing period. */ + /* + * Advance over periods; the top of the loop will increment the count + * of parts we've seen. We need a check here to detect an illegal + * trailing period. + */ if (*p == '.') { p++; - if (*p == 0) return 0; + if (*p == 0) + return 0; } } - if (part == 0) return 0; + if (part == 0) + return 0; /* IPv4 allows three types of address specification: - - a.b - a.b.c - a.b.c.d - - If there are fewer than four segments, the final segment accounts for - all of the remaining portion of the address. For example, in the a.b - form, b is the final 24 bits of the address. We also allow a simple - number, which is interpreted as the 32-bit number corresponding to - the full IPv4 address. - - The first for loop below ensures that any initial segments represent - only 8 bits of the address and builds the upper portion of the IPv4 - address. Then, the remaining segment is checked to make sure it's no - bigger than the remaining space in the address and then is added into - the result. */ + * + * a.b + * a.b.c + * a.b.c.d + * + * If there are fewer than four segments, the final segment accounts for + * all of the remaining portion of the address. For example, in the a.b + * form, b is the final 24 bits of the address. We also allow a simple + * number, which is interpreted as the 32-bit number corresponding to the + * full IPv4 address. + * + * The first for loop below ensures that any initial segments represent + * only 8 bits of the address and builds the upper portion of the IPv4 + * address. Then, the remaining segment is checked to make sure it's no + * bigger than the remaining space in the address and then is added into + * the result. + */ address = 0; for (i = 0; i < part - 1; i++) { - if (octet[i] > 0xff) return 0; + if (octet[i] > 0xff) + return 0; address |= octet[i] << (8 * (3 - i)); } - if (octet[i] > (0xffffffffUL >> (i * 8))) return 0; + if (octet[i] > (0xffffffffUL >> (i * 8))) + return 0; address |= octet[i]; - if (addr != NULL) addr->s_addr = htonl(address); + if (addr != NULL) + addr->s_addr = htonl(address); return 1; } Modified: inet_ntoa.c =================================================================== --- inet_ntoa.c 2013-11-05 20:11:17 UTC (rev 9557) +++ inet_ntoa.c 2013-11-05 20:57:58 UTC (rev 9558) @@ -1,23 +1,34 @@ -/* $Id$ -** -** Replacement for a missing or broken inet_ntoa. -** -** Written by Russ Allbery <r...@stanford.edu> -** This work is hereby placed in the public domain by its author. -** -** Provides the same functionality as the standard library routine -** inet_ntoa for those platforms that don't have it or where it doesn't -** work right (such as on IRIX when using gcc to compile). inet_ntoa is -** not thread-safe since it uses static storage (inet_ntop should be used -** instead when available). -*/ +/* $Id$ + * + * Replacement for a missing or broken inet_ntoa. + * + * Provides the same functionality as the standard library routine inet_ntoa + * for those platforms that don't have it or where it doesn't work right (such + * as on IRIX when using gcc to compile). inet_ntoa is not thread-safe since + * it uses static storage (inet_ntop should be used instead when available). + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Written by Russ Allbery <r...@stanford.edu> + * + * The authors hereby relinquish any claim to any copyright that they may have + * in this work, whether granted under contract or by operation of law or + * international treaty, and hereby commit to the public, at large, that they + * shall not, at any time in the future, seek to enforce any copyright in this + * work against any person or entity, or prevent any person or entity from + * copying, publishing, distributing or creating derivative works of this + * work. + */ #include "config.h" #include "clibrary.h" -#include <netinet/in.h> +#include "portable/socket.h" -/* If we're running the test suite, rename inet_ntoa to avoid conflicts with - the system version. */ +/* + * If we're running the test suite, rename inet_ntoa to avoid conflicts with + * the system version. + */ #if TESTING # define inet_ntoa test_inet_ntoa const char *test_inet_ntoa(const struct in_addr); Modified: mkstemp.c =================================================================== --- mkstemp.c 2013-11-05 20:11:17 UTC (rev 9557) +++ mkstemp.c 2013-11-05 20:57:58 UTC (rev 9558) @@ -1,23 +1,36 @@ -/* $Id$ -** -** Replacement for a missing mkstemp. -** -** Written by Russ Allbery <r...@stanford.edu> -** This work is hereby placed in the public domain by its author. -** -** Provides the same functionality as the library function mkstemp for those -** systems that don't have it. -*/ +/* $Id$ + * + * Replacement for a missing mkstemp. + * + * Provides the same functionality as the library function mkstemp for those + * systems that don't have it. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Written by Russ Allbery <r...@stanford.edu> + * + * The authors hereby relinquish any claim to any copyright that they may have + * in this work, whether granted under contract or by operation of law or + * international treaty, and hereby commit to the public, at large, that they + * shall not, at any time in the future, seek to enforce any copyright in this + * work against any person or entity, or prevent any person or entity from + * copying, publishing, distributing or creating derivative works of this + * work. + */ #include "config.h" #include "clibrary.h" -#include "portable/time.h" + #include <errno.h> #include <fcntl.h> +#include "portable/time.h" -/* If we're running the test suite, rename mkstemp to avoid conflicts with the - system version. #undef it first because some systems may define it to - another name. */ +/* + * If we're running the test suite, rename mkstemp to avoid conflicts with the + * system version. #undef it first because some systems may define it to + * another name. + */ #if TESTING # undef mkstemp # define mkstemp test_mkstemp @@ -42,8 +55,10 @@ long_int_type randnum, working; int i, tries, fd; - /* Make sure we have a valid template and initialize p to point at the - beginning of the template portion of the string. */ + /* + * Make sure we have a valid template and initialize p to point at the + * beginning of the template portion of the string. + */ length = strlen(template); if (length < 6) { errno = EINVAL; @@ -59,8 +74,10 @@ gettimeofday(&tv, NULL); randnum = ((long_int_type) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid(); - /* Now, try to find a working file name. We try no more than TMP_MAX file - names. */ + /* + * Now, try to find a working file name. We try no more than TMP_MAX file + * names. + */ for (tries = 0; tries < TMP_MAX; tries++) { for (working = randnum, i = 0; i < 6; i++) { XXXXXX[i] = letters[working % 62]; @@ -70,8 +87,10 @@ if (fd >= 0 || (errno != EEXIST && errno != EISDIR)) return fd; - /* This is a relatively random increment. Cut off the tail end of - tv_usec since it's often predictable. */ + /* + * This is a relatively random increment. Cut off the tail end of + * tv_usec since it's often predictable. + */ randnum += (tv.tv_usec >> 10) & 0xfff; } errno = EEXIST; Modified: setenv.c =================================================================== --- setenv.c 2013-11-05 20:11:17 UTC (rev 9557) +++ setenv.c 2013-11-05 20:57:58 UTC (rev 9558) @@ -1,19 +1,31 @@ -/* $Id$ -** -** Replacement for a missing setenv. -** -** Written by Russ Allbery <r...@stanford.edu> -** This work is hereby placed in the public domain by its author. -** -** Provides the same functionality as the standard library routine setenv -** for those platforms that don't have it. -*/ +/* $Id$ + * + * Replacement for a missing setenv. + * + * Provides the same functionality as the standard library routine setenv for + * those platforms that don't have it. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Written by Russ Allbery <r...@stanford.edu> + * + * The authors hereby relinquish any claim to any copyright that they may have + * in this work, whether granted under contract or by operation of law or + * international treaty, and hereby commit to the public, at large, that they + * shall not, at any time in the future, seek to enforce any copyright in this + * work against any person or entity, or prevent any person or entity from + * copying, publishing, distributing or creating derivative works of this + * work. + */ #include "config.h" #include "clibrary.h" -/* If we're running the test suite, rename setenv to avoid conflicts with - the system version. */ +/* + * If we're running the test suite, rename setenv to avoid conflicts with + * the system version. + */ #if TESTING # define setenv test_setenv int test_setenv(const char *, const char *, int); @@ -28,27 +40,32 @@ if (!overwrite && getenv(name) != NULL) return 0; - /* Allocate memory for the environment string. We intentionally don't - use concat here, or the xmalloc family of allocation routines, since - the intention is to provide a replacement for the standard library - function which sets errno and returns in the event of a memory - allocation failure. */ + /* + * Allocate memory for the environment string. We intentionally don't use + * the xmalloc family of allocation routines here, since the intention is + * to provide a replacement for the standard library function that sets + * errno and returns in the event of a memory allocation failure. + */ size = strlen(name) + 1 + strlen(value) + 1; envstring = malloc(size); if (envstring == NULL) return -1; - /* Build the environment string and add it to the environment using - putenv. Systems without putenv lose, but XPG4 requires it. */ + /* + * Build the environment string and add it to the environment using + * putenv. Systems without putenv lose, but XPG4 requires it. + */ strlcpy(envstring, name, size); strlcat(envstring, "=", size); strlcat(envstring, value, size); return putenv(envstring); - /* Note that the memory allocated is not freed. This is intentional; - many implementations of putenv assume that the string passed to - putenv will never be freed and don't make a copy of it. Repeated use - of this function will therefore leak memory, since most - implementations of putenv also don't free strings removed from the - environment (due to being overwritten). */ + /* + * Note that the memory allocated is not freed. This is intentional; many + * implementations of putenv assume that the string passed to putenv will + * never be freed and don't make a copy of it. Repeated use of this + * function will therefore leak memory, since most implementations of + * putenv also don't free strings removed from the environment (due to + * being overwritten). + */ } Modified: seteuid.c =================================================================== --- seteuid.c 2013-11-05 20:11:17 UTC (rev 9557) +++ seteuid.c 2013-11-05 20:57:58 UTC (rev 9558) @@ -1,21 +1,31 @@ -/* $Id$ -** -** Replacement for a missing seteuid. -** -** Written by Russ Allbery <r...@stanford.edu> -** This work is hereby placed in the public domain by its author. -** -** Some systems don't have seteuid but do have setreuid. setreuid with -** -1 given for the real UID is equivalent to seteuid on systems with -** POSIX saved UIDs. On systems without POSIX saved UIDs, we'd lose our -** ability to regain privileges if we just set the effective UID, so -** instead fake a saved UID by setting the real UID to the current -** effective UID, using the real UID as the saved UID. -** -** Note that swapping UIDs doesn't work on AIX, but AIX has saved UIDs. -** Note also that systems without setreuid lose, and that we assume that -** any system with seteuid has saved UIDs. -*/ +/* $Id$ + * + * Replacement for a missing seteuid. + * + * Some systems don't have seteuid but do have setreuid. setreuid with -1 + * given for the real UID is equivalent to seteuid on systems with POSIX saved + * UIDs. On systems without POSIX saved UIDs, we'd lose our ability to regain + * privileges if we just set the effective UID, so instead fake a saved UID by + * setting the real UID to the current effective UID, using the real UID as + * the saved UID. + * + * Note that swapping UIDs doesn't work on AIX, but AIX has saved UIDs. Note + * also that systems without setreuid lose, and that we assume that any system + * with seteuid has saved UIDs. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Written by Russ Allbery <r...@stanford.edu> + * + * The authors hereby relinquish any claim to any copyright that they may have + * in this work, whether granted under contract or by operation of law or + * international treaty, and hereby commit to the public, at large, that they + * shall not, at any time in the future, seek to enforce any copyright in this + * work against any person or entity, or prevent any person or entity from + * copying, publishing, distributing or creating derivative works of this + * work. + */ #include "config.h" #include "clibrary.h" Modified: strlcat.c =================================================================== --- strlcat.c 2013-11-05 20:11:17 UTC (rev 9557) +++ strlcat.c 2013-11-05 20:57:58 UTC (rev 9558) @@ -1,24 +1,36 @@ -/* $Id$ -** -** Replacement for a missing strlcat. -** -** Written by Russ Allbery <r...@stanford.edu> -** This work is hereby placed in the public domain by its author. -** -** Provides the same functionality as the *BSD function strlcat, originally -** developed by Todd Miller and Theo de Raadt. strlcat works similarly to -** strncat, except simpler. The result is always nul-terminated even if the -** source string is longer than the space remaining in the destination -** string, and the total space required is returned. The third argument is -** the total space available in the destination buffer, not just the amount -** of space remaining. -*/ +/* $Id$ + * + * Replacement for a missing strlcat. + * + * Provides the same functionality as the *BSD function strlcat, originally + * developed by Todd Miller and Theo de Raadt. strlcat works similarly to + * strncat, except simpler. The result is always nul-terminated even if the + * source string is longer than the space remaining in the destination string, + * and the total space required is returned. The third argument is the total + * space available in the destination buffer, not just the amount of space + * remaining. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Written by Russ Allbery <r...@stanford.edu> + * + * The authors hereby relinquish any claim to any copyright that they may have + * in this work, whether granted under contract or by operation of law or + * international treaty, and hereby commit to the public, at large, that they + * shall not, at any time in the future, seek to enforce any copyright in this + * work against any person or entity, or prevent any person or entity from + * copying, publishing, distributing or creating derivative works of this + * work. + */ #include "config.h" #include "clibrary.h" -/* If we're running the test suite, rename strlcat to avoid conflicts with - the system version. */ +/* + * If we're running the test suite, rename strlcat to avoid conflicts with + * the system version. + */ #if TESTING # define strlcat test_strlcat size_t test_strlcat(char *, const char *, size_t); Modified: strlcpy.c =================================================================== --- strlcpy.c 2013-11-05 20:11:17 UTC (rev 9557) +++ strlcpy.c 2013-11-05 20:57:58 UTC (rev 9558) @@ -1,23 +1,35 @@ -/* $Id$ -** -** Replacement for a missing strlcpy. -** -** Written by Russ Allbery <r...@stanford.edu> -** This work is hereby placed in the public domain by its author. -** -** Provides the same functionality as the *BSD function strlcpy, originally -** developed by Todd Miller and Theo de Raadt. strlcpy works similarly to -** strncpy, except saner and simpler. The result is always nul-terminated -** even if the source string is longer than the destination string, and the -** total space required is returned. The destination string is not -** nul-filled like strncpy does, just nul-terminated. -*/ +/* $Id$ + * + * Replacement for a missing strlcpy. + * + * Provides the same functionality as the *BSD function strlcpy, originally + * developed by Todd Miller and Theo de Raadt. strlcpy works similarly to + * strncpy, except saner and simpler. The result is always nul-terminated + * even if the source string is longer than the destination string, and the + * total space required is returned. The destination string is not nul-filled + * like strncpy does, just nul-terminated. + * + * The canonical version of this file is maintained in the rra-c-util package, + * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>. + * + * Written by Russ Allbery <r...@stanford.edu> + * + * The authors hereby relinquish any claim to any copyright that they may have + * in this work, whether granted under contract or by operation of law or + * international treaty, and hereby commit to the public, at large, that they + * shall not, at any time in the future, seek to enforce any copyright in this + * work against any person or entity, or prevent any person or entity from + * copying, publishing, distributing or creating derivative works of this + * work. + */ #include "config.h" #include "clibrary.h" -/* If we're running the test suite, rename strlcpy to avoid conflicts with - the system version. */ +/* + * If we're running the test suite, rename strlcpy to avoid conflicts with + * the system version. + */ #if TESTING # define strlcpy test_strlcpy size_t test_strlcpy(char *, const char *, size_t); ------------------------------ _______________________________________________ inn-committers mailing list inn-committers@lists.isc.org https://lists.isc.org/mailman/listinfo/inn-committers End of inn-committers Digest, Vol 57, Issue 2 *********************************************