diff options
Diffstat (limited to 'lib')
21 files changed, 0 insertions, 2279 deletions
diff --git a/lib/libc/net/base64.c b/lib/libc/net/base64.c deleted file mode 100644 index 868826a777dc3..0000000000000 --- a/lib/libc/net/base64.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* - * Portions Copyright (c) 1995 by International Business Machines, Inc. - * - * International Business Machines, Inc. (hereinafter called IBM) grants - * permission under its copyrights to use, copy, modify, and distribute this - * Software with or without fee, provided that the above copyright notice and - * all paragraphs of this notice appear in all copies, and that the name of IBM - * not be used in connection with the marketing of any product incorporating - * the Software or modifications thereof, without specific, written prior - * permission. - * - * To the extent it has a right to do so, IBM grants an immunity from suit - * under its patents, if any, for the use, sale or manufacture of products to - * the extent that such products are used for performing Domain Name System - * dynamic updates in TCP/IP networks by means of the Software. No immunity is - * granted for any product per se or for any other function of any product. - * - * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, - * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN - * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <arpa/nameser.h> - -#include <ctype.h> -#include <resolv.h> -#include <stdio.h> - -#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6) -# include <stdlib.h> -# include <string.h> -#else -# include "../conf/portability.h" -#endif - -#define Assert(Cond) if (!(Cond)) abort() - -static const char Base64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static const char Pad64 = '='; - -/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) - The following encoding technique is taken from RFC 1521 by Borenstein - and Freed. It is reproduced here in a slightly edited form for - convenience. - - A 65-character subset of US-ASCII is used, enabling 6 bits to be - represented per printable character. (The extra 65th character, "=", - is used to signify a special processing function.) - - The encoding process represents 24-bit groups of input bits as output - strings of 4 encoded characters. Proceeding from left to right, a - 24-bit input group is formed by concatenating 3 8-bit input groups. - These 24 bits are then treated as 4 concatenated 6-bit groups, each - of which is translated into a single digit in the base64 alphabet. - - Each 6-bit group is used as an index into an array of 64 printable - characters. The character referenced by the index is placed in the - output string. - - Table 1: The Base64 Alphabet - - Value Encoding Value Encoding Value Encoding Value Encoding - 0 A 17 R 34 i 51 z - 1 B 18 S 35 j 52 0 - 2 C 19 T 36 k 53 1 - 3 D 20 U 37 l 54 2 - 4 E 21 V 38 m 55 3 - 5 F 22 W 39 n 56 4 - 6 G 23 X 40 o 57 5 - 7 H 24 Y 41 p 58 6 - 8 I 25 Z 42 q 59 7 - 9 J 26 a 43 r 60 8 - 10 K 27 b 44 s 61 9 - 11 L 28 c 45 t 62 + - 12 M 29 d 46 u 63 / - 13 N 30 e 47 v - 14 O 31 f 48 w (pad) = - 15 P 32 g 49 x - 16 Q 33 h 50 y - - Special processing is performed if fewer than 24 bits are available - at the end of the data being encoded. A full encoding quantum is - always completed at the end of a quantity. When fewer than 24 input - bits are available in an input group, zero bits are added (on the - right) to form an integral number of 6-bit groups. Padding at the - end of the data is performed using the '=' character. - - Since all base64 input is an integral number of octets, only the - ------------------------------------------------- - following cases can arise: - - (1) the final quantum of encoding input is an integral - multiple of 24 bits; here, the final unit of encoded - output will be an integral multiple of 4 characters - with no "=" padding, - (2) the final quantum of encoding input is exactly 8 bits; - here, the final unit of encoded output will be two - characters followed by two "=" padding characters, or - (3) the final quantum of encoding input is exactly 16 bits; - here, the final unit of encoded output will be three - characters followed by one "=" padding character. - */ - -int -b64_ntop(src, srclength, target, targsize) - u_char const *src; - size_t srclength; - char *target; - size_t targsize; -{ - size_t datalength = 0; - u_char input[3]; - u_char output[4]; - int i; - - while (2 < srclength) { - input[0] = *src++; - input[1] = *src++; - input[2] = *src++; - srclength -= 3; - - output[0] = input[0] >> 2; - output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); - output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); - output[3] = input[2] & 0x3f; - Assert(output[0] < 64); - Assert(output[1] < 64); - Assert(output[2] < 64); - Assert(output[3] < 64); - - if (datalength + 4 > targsize) - return (-1); - target[datalength++] = Base64[output[0]]; - target[datalength++] = Base64[output[1]]; - target[datalength++] = Base64[output[2]]; - target[datalength++] = Base64[output[3]]; - } - - /* Now we worry about padding. */ - if (0 != srclength) { - /* Get what's left. */ - input[0] = input[1] = input[2] = '\0'; - for (i = 0; i < srclength; i++) - input[i] = *src++; - - output[0] = input[0] >> 2; - output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); - output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); - Assert(output[0] < 64); - Assert(output[1] < 64); - Assert(output[2] < 64); - - if (datalength + 4 > targsize) - return (-1); - target[datalength++] = Base64[output[0]]; - target[datalength++] = Base64[output[1]]; - if (srclength == 1) - target[datalength++] = Pad64; - else - target[datalength++] = Base64[output[2]]; - target[datalength++] = Pad64; - } - if (datalength >= targsize) - return (-1); - target[datalength] = '\0'; /* Returned value doesn't count \0. */ - return (datalength); -} - -/* skips all whitespace anywhere. - converts characters, four at a time, starting at (or after) - src from base - 64 numbers into three 8 bit bytes in the target area. - it returns the number of data bytes stored at the target, or -1 on error. - */ - -int -b64_pton(src, target, targsize) - char const *src; - u_char *target; - size_t targsize; -{ - int tarindex, state, ch; - char *pos; - - state = 0; - tarindex = 0; - - while ((ch = *src++) != '\0') { - if (isspace(ch)) /* Skip whitespace anywhere. */ - continue; - - if (ch == Pad64) - break; - - pos = strchr(Base64, ch); - if (pos == 0) /* A non-base64 character. */ - return (-1); - - switch (state) { - case 0: - if (target) { - if (tarindex >= targsize) - return (-1); - target[tarindex] = (pos - Base64) << 2; - } - state = 1; - break; - case 1: - if (target) { - if (tarindex + 1 >= targsize) - return (-1); - target[tarindex] |= (pos - Base64) >> 4; - target[tarindex+1] = ((pos - Base64) & 0x0f) - << 4 ; - } - tarindex++; - state = 2; - break; - case 2: - if (target) { - if (tarindex + 1 >= targsize) - return (-1); - target[tarindex] |= (pos - Base64) >> 2; - target[tarindex+1] = ((pos - Base64) & 0x03) - << 6; - } - tarindex++; - state = 3; - break; - case 3: - if (target) { - if (tarindex >= targsize) - return (-1); - target[tarindex] |= (pos - Base64); - } - tarindex++; - state = 0; - break; - default: - abort(); - } - } - - /* - * We are done decoding Base-64 chars. Let's see if we ended - * on a byte boundary, and/or with erroneous trailing characters. - */ - - if (ch == Pad64) { /* We got a pad char. */ - ch = *src++; /* Skip it, get next. */ - switch (state) { - case 0: /* Invalid = in first position */ - case 1: /* Invalid = in second position */ - return (-1); - - case 2: /* Valid, means one byte of info */ - /* Skip any number of spaces. */ - for (NULL; ch != '\0'; ch = *src++) - if (!isspace(ch)) - break; - /* Make sure there is another trailing = sign. */ - if (ch != Pad64) - return (-1); - ch = *src++; /* Skip the = */ - /* Fall through to "single trailing =" case. */ - /* FALLTHROUGH */ - - case 3: /* Valid, means two bytes of info */ - /* - * We know this char is an =. Is there anything but - * whitespace after it? - */ - for (NULL; ch != '\0'; ch = *src++) - if (!isspace(ch)) - return (-1); - - /* - * Now make sure for cases 2 and 3 that the "extra" - * bits that slopped past the last full byte were - * zeros. If we don't check them, they become a - * subliminal channel. - */ - if (target && target[tarindex] != 0) - return (-1); - } - } else { - /* - * We ended by seeing the end of the string. Make sure we - * have no partial bytes lying around. - */ - if (state != 0) - return (-1); - } - - return (tarindex); -} diff --git a/lib/libc/net/inet_net_ntop.c b/lib/libc/net/inet_net_ntop.c deleted file mode 100644 index 4c7893d417ffa..0000000000000 --- a/lib/libc/net/inet_net_ntop.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static const char orig_rcsid[] = "From Id: inet_net_ntop.c,v 8.2 1996/08/08 06:54:44 vixie Exp"; -static const char rcsid[] = "$Id$"; -#endif - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -#include <errno.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#ifdef SPRINTF_CHAR -# define SPRINTF(x) strlen(sprintf/**/x) -#else -# define SPRINTF(x) ((size_t)sprintf x) -#endif - -static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits, - char *dst, size_t size)); - -/* - * char * - * inet_net_ntop(af, src, bits, dst, size) - * convert network number from network to presentation format. - * generates CIDR style result always. - * return: - * pointer to dst, or NULL if an error occurred (check errno). - * author: - * Paul Vixie (ISC), July 1996 - */ -char * -inet_net_ntop(af, src, bits, dst, size) - int af; - const void *src; - int bits; - char *dst; - size_t size; -{ - switch (af) { - case AF_INET: - return (inet_net_ntop_ipv4(src, bits, dst, size)); - default: - errno = EAFNOSUPPORT; - return (NULL); - } -} - -/* - * static char * - * inet_net_ntop_ipv4(src, bits, dst, size) - * convert IPv4 network number from network to presentation format. - * generates CIDR style result always. - * return: - * pointer to dst, or NULL if an error occurred (check errno). - * note: - * network byte order assumed. this means 192.5.5.240/28 has - * 0x11110000 in its fourth octet. - * author: - * Paul Vixie (ISC), July 1996 - */ -static char * -inet_net_ntop_ipv4(src, bits, dst, size) - const u_char *src; - int bits; - char *dst; - size_t size; -{ - char *odst = dst; - char *t; - u_int m; - int b; - - if (bits < 0 || bits > 32) { - errno = EINVAL; - return (NULL); - } - if (bits == 0) { - if (size < sizeof "0") - goto emsgsize; - *dst++ = '0'; - *dst = '\0'; - } - - /* Format whole octets. */ - for (b = bits / 8; b > 0; b--) { - if (size < sizeof "255.") - goto emsgsize; - t = dst; - dst += SPRINTF((dst, "%u", *src++)); - if (b > 1) { - *dst++ = '.'; - *dst = '\0'; - } - size -= (size_t)(dst - t); - } - - /* Format partial octet. */ - b = bits % 8; - if (b > 0) { - if (size < sizeof ".255") - goto emsgsize; - t = dst; - if (dst != odst) - *dst++ = '.'; - m = ((1 << b) - 1) << (8 - b); - dst += SPRINTF((dst, "%u", *src & m)); - size -= (size_t)(dst - t); - } - - /* Format CIDR /width. */ - if (size < sizeof "/32") - goto emsgsize; - dst += SPRINTF((dst, "/%u", bits)); - return (odst); - - emsgsize: - errno = EMSGSIZE; - return (NULL); -} diff --git a/lib/libc/net/inet_net_pton.c b/lib/libc/net/inet_net_pton.c deleted file mode 100644 index 6fd6a06c6da9b..0000000000000 --- a/lib/libc/net/inet_net_pton.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static const char orig_rcsid[] = "From Id: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp"; -static const char rcsid[] = "$Id$"; -#endif - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -#include <assert.h> -#include <ctype.h> -#include <errno.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#ifdef SPRINTF_CHAR -# define SPRINTF(x) strlen(sprintf/**/x) -#else -# define SPRINTF(x) ((size_t)sprintf x) -#endif - -static int inet_net_pton_ipv4 __P((const char *src, u_char *dst, - size_t size)); - -/* - * static int - * inet_net_pton(af, src, dst, size) - * convert network number from presentation to network format. - * accepts hex octets, hex strings, decimal octets, and /CIDR. - * "size" is in bytes and describes "dst". - * return: - * number of bits, either imputed classfully or specified with /CIDR, - * or -1 if some failure occurred (check errno). ENOENT means it was - * not a valid network specification. - * author: - * Paul Vixie (ISC), June 1996 - */ -int -inet_net_pton(af, src, dst, size) - int af; - const char *src; - void *dst; - size_t size; -{ - switch (af) { - case AF_INET: - return (inet_net_pton_ipv4(src, dst, size)); - default: - errno = EAFNOSUPPORT; - return (-1); - } -} - -/* - * static int - * inet_net_pton_ipv4(src, dst, size) - * convert IPv4 network number from presentation to network format. - * accepts hex octets, hex strings, decimal octets, and /CIDR. - * "size" is in bytes and describes "dst". - * return: - * number of bits, either imputed classfully or specified with /CIDR, - * or -1 if some failure occurred (check errno). ENOENT means it was - * not an IPv4 network specification. - * note: - * network byte order assumed. this means 192.5.5.240/28 has - * 0x11110000 in its fourth octet. - * author: - * Paul Vixie (ISC), June 1996 - */ -static int -inet_net_pton_ipv4(src, dst, size) - const char *src; - u_char *dst; - size_t size; -{ - static const char - xdigits[] = "0123456789abcdef", - digits[] = "0123456789"; - int n, ch, tmp, dirty, bits; - const u_char *odst = dst; - - ch = *src++; - if (ch == '0' && (src[0] == 'x' || src[0] == 'X') - && isascii(src[1]) && isxdigit(src[1])) { - /* Hexadecimal: Eat nybble string. */ - if (size <= 0) - goto emsgsize; - *dst = 0, dirty = 0; - src++; /* skip x or X. */ - while ((ch = *src++) != '\0' && - isascii(ch) && isxdigit(ch)) { - if (isupper(ch)) - ch = tolower(ch); - n = strchr(xdigits, ch) - xdigits; - assert(n >= 0 && n <= 15); - *dst |= n; - if (!dirty++) - *dst <<= 4; - else if (size-- > 0) - *++dst = 0, dirty = 0; - else - goto emsgsize; - } - if (dirty) - size--; - } else if (isascii(ch) && isdigit(ch)) { - /* Decimal: eat dotted digit string. */ - for (;;) { - tmp = 0; - do { - n = strchr(digits, ch) - digits; - assert(n >= 0 && n <= 9); - tmp *= 10; - tmp += n; - if (tmp > 255) - goto enoent; - } while ((ch = *src++) != '\0' && - isascii(ch) && isdigit(ch)); - if (size-- <= 0) - goto emsgsize; - *dst++ = (u_char) tmp; - if (ch == '\0' || ch == '/') - break; - if (ch != '.') - goto enoent; - ch = *src++; - if (!isascii(ch) || !isdigit(ch)) - goto enoent; - } - } else - goto enoent; - - bits = -1; - if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) { - /* CIDR width specifier. Nothing can follow it. */ - ch = *src++; /* Skip over the /. */ - bits = 0; - do { - n = strchr(digits, ch) - digits; - assert(n >= 0 && n <= 9); - bits *= 10; - bits += n; - } while ((ch = *src++) != '\0' && - isascii(ch) && isdigit(ch)); - if (ch != '\0') - goto enoent; - if (bits > 32) - goto emsgsize; - } - - /* Firey death and destruction unless we prefetched EOS. */ - if (ch != '\0') - goto enoent; - - /* If nothing was written to the destination, we found no address. */ - if (dst == odst) - goto enoent; - /* If no CIDR spec was given, infer width from net class. */ - if (bits == -1) { - if (*odst >= 240) /* Class E */ - bits = 32; - else if (*odst >= 224) /* Class D */ - bits = 4; - else if (*odst >= 192) /* Class C */ - bits = 24; - else if (*odst >= 128) /* Class B */ - bits = 16; - else /* Class A */ - bits = 8; - /* If imputed mask is narrower than specified octets, widen. */ - if (bits >= 8 && bits < ((dst - odst) * 8)) - bits = (dst - odst) * 8; - } - /* Extend network to cover the actual mask. */ - while (bits > ((dst - odst) * 8)) { - if (size-- <= 0) - goto emsgsize; - *dst++ = '\0'; - } - return (bits); - - enoent: - errno = ENOENT; - return (-1); - - emsgsize: - errno = EMSGSIZE; - return (-1); -} diff --git a/lib/libc/net/inet_neta.c b/lib/libc/net/inet_neta.c deleted file mode 100644 index 15a1c70529ac3..0000000000000 --- a/lib/libc/net/inet_neta.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static const char orig_rcsid[] = "From Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp"; -static const char rcsid[] = "$Id$"; -#endif - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -#include <errno.h> -#include <stdio.h> - -#ifdef SPRINTF_CHAR -# define SPRINTF(x) strlen(sprintf/**/x) -#else -# define SPRINTF(x) ((size_t)sprintf x) -#endif - -/* - * char * - * inet_neta(src, dst, size) - * format a u_long network number into presentation format. - * return: - * pointer to dst, or NULL if an error occurred (check errno). - * note: - * format of ``src'' is as for inet_network(). - * author: - * Paul Vixie (ISC), July 1996 - */ -char * -inet_neta(src, dst, size) - u_long src; - char *dst; - size_t size; -{ - char *odst = dst; - char *tp; - - while (src & 0xffffffff) { - u_char b = (src & 0xff000000) >> 24; - - src <<= 8; - if (b) { - if (size < sizeof "255.") - goto emsgsize; - tp = dst; - dst += SPRINTF((dst, "%u", b)); - if (src != 0L) { - *dst++ = '.'; - *dst = '\0'; - } - size -= (size_t)(dst - tp); - } - } - if (dst == odst) { - if (size < sizeof "0.0.0.0") - goto emsgsize; - strcpy(dst, "0.0.0.0"); - } - return (odst); - - emsgsize: - errno = EMSGSIZE; - return (NULL); -} diff --git a/lib/libc_r/uthread/uthread_attr_getdetachstate.c b/lib/libc_r/uthread/uthread_attr_getdetachstate.c deleted file mode 100644 index 4715cb6f24244..0000000000000 --- a/lib/libc_r/uthread/uthread_attr_getdetachstate.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int pthread_attr_getdetachstate(pthread_attr_t *attr, int *detachstate) -{ - int ret; - - /* Check for invalid arguments: */ - if (attr == NULL || *attr == NULL || detachstate == NULL) - ret = EINVAL; - else { - /* Check if the detached flag is set: */ - if ((*attr)->flags & PTHREAD_DETACHED) - /* Return detached: */ - *detachstate = PTHREAD_CREATE_DETACHED; - else - /* Return joinable: */ - *detachstate = PTHREAD_CREATE_JOINABLE; - ret = 0; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_attr_getstackaddr.c b/lib/libc_r/uthread/uthread_attr_getstackaddr.c deleted file mode 100644 index 1850a324c611f..0000000000000 --- a/lib/libc_r/uthread/uthread_attr_getstackaddr.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int pthread_attr_getstackaddr(pthread_attr_t *attr, void **stackaddr) -{ - int ret; - - /* Check for invalid arguments: */ - if (attr == NULL || *attr == NULL || stackaddr == NULL) - ret = EINVAL; - else { - /* Return the stack address: */ - *stackaddr = (*attr)->stackaddr_attr; - ret = 0; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_attr_getstacksize.c b/lib/libc_r/uthread/uthread_attr_getstacksize.c deleted file mode 100644 index de81106083d49..0000000000000 --- a/lib/libc_r/uthread/uthread_attr_getstacksize.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize) -{ - int ret; - - /* Check for invalid arguments: */ - if (attr == NULL || *attr == NULL || stacksize == NULL) - ret = EINVAL; - else { - /* Return the stack size: */ - *stacksize = (*attr)->stacksize_attr; - ret = 0; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_attr_setdetachstate.c b/lib/libc_r/uthread/uthread_attr_setdetachstate.c deleted file mode 100644 index 6ec0dbc1c585d..0000000000000 --- a/lib/libc_r/uthread/uthread_attr_setdetachstate.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) -{ - int ret; - - /* Check for invalid arguments: */ - if (attr == NULL || *attr == NULL || - (detachstate != PTHREAD_CREATE_DETACHED && - detachstate != PTHREAD_CREATE_JOINABLE)) - ret = EINVAL; - else { - /* Check if detached state: */ - if (detachstate == PTHREAD_CREATE_DETACHED) - /* Set the detached flag: */ - (*attr)->flags |= PTHREAD_DETACHED; - else - /* Reset the detached flag: */ - (*attr)->flags &= ~PTHREAD_DETACHED; - ret = 0; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_attr_setstackaddr.c b/lib/libc_r/uthread/uthread_attr_setstackaddr.c deleted file mode 100644 index ce54915d096d2..0000000000000 --- a/lib/libc_r/uthread/uthread_attr_setstackaddr.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) -{ - int ret; - - /* Check for invalid arguments: */ - if (attr == NULL || *attr == NULL || stackaddr == NULL) - ret = EINVAL; - else { - /* Save the stack address: */ - (*attr)->stackaddr_attr = stackaddr; - ret = 0; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_condattr_destroy.c b/lib/libc_r/uthread/uthread_condattr_destroy.c deleted file mode 100644 index b20f183bb6080..0000000000000 --- a/lib/libc_r/uthread/uthread_condattr_destroy.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <stdlib.h> -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int pthread_condattr_destroy(pthread_condattr_t *attr) -{ - int ret; - if (attr == NULL || *attr == NULL) { - errno = EINVAL; - ret = -1; - } else { - free(*attr); - *attr = NULL; - ret = 0; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_condattr_init.c b/lib/libc_r/uthread/uthread_condattr_init.c deleted file mode 100644 index f94e4384b925c..0000000000000 --- a/lib/libc_r/uthread/uthread_condattr_init.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int -pthread_condattr_init(pthread_condattr_t *attr) -{ - int ret; - pthread_condattr_t pattr; - - if ((pattr = (pthread_condattr_t) - malloc(sizeof(struct pthread_cond_attr))) == NULL) { - errno = ENOMEM; - ret = -1; - } else { - memcpy(pattr, &pthread_condattr_default, - sizeof(struct pthread_cond_attr)); - *attr = pattr; - ret = 0; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_kill.c b/lib/libc_r/uthread/uthread_kill.c deleted file mode 100644 index eb2c6b75d740b..0000000000000 --- a/lib/libc_r/uthread/uthread_kill.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <errno.h> -#include <signal.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int -pthread_kill(pthread_t pthread, int sig) -{ - int rval = 0; - int status; - pthread_t p_pthread; - - /* Check for invalid signal numbers: */ - if (sig < 0 || sig >= NSIG) - /* Invalid signal: */ - rval = EINVAL; - else { - /* Assume that the search will succeed: */ - rval = 0; - - /* Block signals: */ - _thread_kern_sig_block(&status); - - /* Search for the thread: */ - p_pthread = _thread_link_list; - while (p_pthread != NULL && p_pthread != pthread) { - p_pthread = p_pthread->nxt; - } - - /* Check if the thread was not found: */ - if (p_pthread == NULL) - /* Can't find the thread: */ - rval = ESRCH; - else - /* Increment the pending signal count: */ - p_pthread->sigpend[sig] += 1; - - /* Unblock signals: */ - _thread_kern_sig_unblock(status); - } - - /* Return the completion status: */ - return (rval); -} -#endif diff --git a/lib/libc_r/uthread/uthread_mattr_init.c b/lib/libc_r/uthread/uthread_mattr_init.c deleted file mode 100644 index 323c982355c5d..0000000000000 --- a/lib/libc_r/uthread/uthread_mattr_init.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1996 Jeffrey Hsu <hsu@freebsd.org>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int -pthread_mutexattr_init(pthread_mutexattr_t *attr) -{ - int ret; - pthread_mutexattr_t pattr; - - if ((pattr = (pthread_mutexattr_t) - malloc(sizeof(struct pthread_mutex_attr))) == NULL) { - errno = ENOMEM; - ret = -1; - } else { - memcpy(pattr, &pthread_mutexattr_default, - sizeof(struct pthread_mutex_attr)); - *attr = pattr; - ret = 0; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_mattr_kind_np.c b/lib/libc_r/uthread/uthread_mattr_kind_np.c deleted file mode 100644 index 3eeabff038a73..0000000000000 --- a/lib/libc_r/uthread/uthread_mattr_kind_np.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1996 Jeffrey Hsu <hsu@freebsd.org>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int -pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind) -{ - int ret; - if (attr == NULL || *attr == NULL) { - errno = EINVAL; - ret = -1; - } else { - (*attr)->m_type = kind; - ret = 0; - } - return(ret); -} - -int -pthread_mutexattr_getkind_np(pthread_mutexattr_t attr) -{ - int ret; - if (attr == NULL) { - errno = EINVAL; - ret = -1; - } else { - ret = attr->m_type; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_mutexattr_destroy.c b/lib/libc_r/uthread/uthread_mutexattr_destroy.c deleted file mode 100644 index cf2e09f44e236..0000000000000 --- a/lib/libc_r/uthread/uthread_mutexattr_destroy.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <stdlib.h> -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) -{ - int ret; - if (attr == NULL || *attr == NULL) { - errno = EINVAL; - ret = -1; - } else { - free(*attr); - *attr = NULL; - ret = 0; - } - return(ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_sigmask.c b/lib/libc_r/uthread/uthread_sigmask.c deleted file mode 100644 index 94f64cb7991ff..0000000000000 --- a/lib/libc_r/uthread/uthread_sigmask.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <errno.h> -#include <signal.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int -pthread_sigmask(int how, const sigset_t *set, sigset_t *oset) -{ - int ret = 0; - int status; - - /* Check if the existing signal process mask is to be returned: */ - if (oset != NULL) { - /* Return the current mask: */ - *oset = _thread_run->sigmask; - } - /* Check if a new signal set was provided by the caller: */ - if (set != NULL) { - /* Block signals while the signal mask is changed: */ - _thread_kern_sig_block(&status); - - /* Process according to what to do: */ - switch (how) { - /* Block signals: */ - case SIG_BLOCK: - /* Add signals to the existing mask: */ - _thread_run->sigmask |= *set; - break; - - /* Unblock signals: */ - case SIG_UNBLOCK: - /* Clear signals from the existing mask: */ - _thread_run->sigmask &= ~(*set); - break; - - /* Set the signal process mask: */ - case SIG_SETMASK: - /* Set the new mask: */ - _thread_run->sigmask = *set; - break; - - /* Trap invalid actions: */ - default: - /* Return an invalid argument: */ - errno = EINVAL; - ret = -1; - break; - } - - /* - * Schedule the next thread in case there are signals that - * now need to be acted on: - */ - _thread_kern_sched(NULL); - } - /* Return the completion status: */ - return (ret); -} -#endif diff --git a/lib/libc_r/uthread/uthread_sigwait.c b/lib/libc_r/uthread/uthread_sigwait.c deleted file mode 100644 index 4f95190e42163..0000000000000 --- a/lib/libc_r/uthread/uthread_sigwait.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include <signal.h> -#include <errno.h> -#ifdef _THREAD_SAFE -#include <pthread.h> -#include "pthread_private.h" - -int -sigwait(const sigset_t * set, int *sig) -{ - int ret; - int status; - sigset_t oset; - - /* Block signals: */ - _thread_kern_sig_block(&status); - - /* Save the current sigmal mask: */ - oset = _thread_run->sigmask; - - /* Combine the caller's mask with the current one: */ - _thread_run->sigmask |= *set; - - /* Wait for a signal: */ - _thread_kern_sched_state(PS_SIGWAIT, __FILE__, __LINE__); - - /* Block signals again: */ - _thread_kern_sig_block(NULL); - - /* Return the signal number to the caller: */ - *sig = _thread_run->signo; - - /* Restore the signal mask: */ - _thread_run->sigmask = oset; - - /* Unblock signals: */ - _thread_kern_sig_unblock(status); - - /* Return the completion status: */ - return (ret); -} -#endif diff --git a/lib/libutil/login.conf.5 b/lib/libutil/login.conf.5 deleted file mode 100644 index d56e94f599783..0000000000000 --- a/lib/libutil/login.conf.5 +++ /dev/null @@ -1,364 +0,0 @@ -.\" Copyright (c) 1996 David Nugent <davidn@blaze.net.au> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, is permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice immediately at the beginning of the file, without modification, -.\" this list of conditions, and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. This work was done expressly for inclusion into FreeBSD. Other use -.\" is permitted provided this notation is included. -.\" 4. Absolutely no warranty of function or purpose is made by the author -.\" David Nugent. -.\" 5. Modifications may be freely made to this file providing the above -.\" conditions are met. -.\" -.\" $Id$ -.\" -.Dd November 22, 1996 -.Dt LOGIN.CONF 5 -.Os FreeBSD -.Sh NAME -.Nm login.conf -.Nd login class capability database -.Sh SYNOPSIS -.Pa /etc/login.conf , -.Pa ~/.login_conf -.Sh DESCRIPTION -login.conf contains various attributes and capabilities of login classes. -A login class (an optional annotation against each record in the user -account database, -.Pa /etc/master.passwd ) -determines session accounting, resource limits and user environment settings. -It is used by various programs in the system to set up a user's login -environment and to enforce policy, accounting and administrative restrictions. -It also provides the means by which users are able to be -authenticated to the system and the types of authentication available. -.Pp -A special record "default" in the system user class capability database -.Pa /etc/login.conf -is used automatically for any -non-root user without a valid login class in -.Pa /etc/master.passwd . -A user with a uid of 0 without a valid login class will use the record -"root" if it exists, or "default" if not. -.Pp -In FreeBSD, users may individually create a file called -.Pa .login_conf -in their home directory using the same format, consisting of a single -entry with a record id of "me". -If present, this file is used by -.Xr login 1 -to set user-defined environment settings which override those specified -in the system login capabilities database. -Only a subset of login capabilities may be overridden, typically those -which do not involve authentication, resource limits and accounting. -.Pp -Records in a class capabilities database consist of a number of -colon-separated fields. -The first entry for each record gives one or more names that a record is -to be known by, each separated by a '|' character. -The first name is the most common abbreviation. -The last name given should be a long name that is more descriptive -of the capability entry, and all others are synonyms. -All names but the last should be in lower case and contain no blanks; -the last name may contain upper case characters and blanks for -readability. -.Pp -See -.Xr getcap 3 -for a more in-depth description of the format of a capability database. -.Sh CAPABILITIES -Fields within each record in the database follow the -.Xr getcap 3 -conventions for boolean, type string -.Ql \&= -and type numeric -.Ql \&# , -although type numeric is depreciated in favour of the string format and -either form is accepted for a numeric datum. -Values fall into the following categories: -.Bl -tag -width "program" -.It file -Path name to a data file -.It program -Path name to an executable file -.It list -A list of values (or pairs of values) separated by commas or spaces -.It path -A space or comma separated list of path names, following the usual csh -conventions (leading tilde with and without username being expanded to -home directories etc.) -.It number -A numeric value, either decimal (default), hexadecimal (with leading 0x), -or octal (with a leading 0). -With a numeric type, only one numeric value is allowed. -Numeric types may also be specified in string format (ie. the capability -tag being delimited from the value by '=' instead of '#'). -Whichever method is used, then all records in the database must use the -same method to allow values to be correctly overridden in interpolated -records. -.It size -A number which expresses a size. -The default interpretation of a value is the number of bytes, but a -suffix may specify alternate units: -.Bl -tag -offset indent -compact -width xxxx -.It b -explicitly selects 512-byte blocks -.It k -selects kilobytes (1024 bytes) -.It m -specifies a multiplier of 1 megabyte (1048576 bytes), -.It g -specifies units of gigabytes, and -.It t -represents terrabytes. -.El -A size value is a numeric quantity and case of the suffix is not significant. -Concatenated values are added together. -.It time -A period of time, by default in seconds. -A prefix may specify a different unit; -.Bl -tag -offset indent -compact -width xxxx -.It y -indicates the number of 365 day years, -.It w -indicates the number of weeks, -.It d -the number of days, -.It h -the number of minutes, and -.It s -the number of seconds. -.El -Concatenated values are added together. -For example, 2 hours and 40 minutes may be written either as -9600s, 160m or 2h40m. -.El -.Pp -The usual convention to interpolate capability entries using the special -.Em tc=value -notation may be used. -.Pp -.Sh RESOURCE LIMITS -.Bl -column coredumpsize indent indent -.Sy Name Type Notes Description -.It cputime time CPU usage limit. -.It filesize size Maximum file size limit. -.It datasize size Maximum data size limit. -.It stacksize size Maximum stack size limit. -.It coredumpsize size Maximum coredump size limit. -.It memoryuse size Maximum of core memory use size limit. -.It memorylocked size Maximum locked in core memory size limit. -.It maxproc number Maximum number of processes. -.It openfiles number Maximum number of open files per process. -.El -.Pp -These resource limit entries actually specify both the maximum -and current limits (see -.Xr getrlimit 2 ). -The current (soft) limit is the one normally used, although the user is permitted -to increase the current limit to the maximum (hard) limit. -The maximum and current limits may be specified individually by appending a --max or -cur to the capability name. -.Pp -.Sh ENVIRONMENT -.Bl -column ignorenologin indent xbinxxusrxbin -.Sy Name Type Notes Description -.It charset string Set $MM_CHARSET environment variable to the specified -value. -.It hushlogin bool false Same as having a ~/.hushlogin file. -.It ignorenologin bool false Login not prevented by nologin. -.It lang string Set $LANG environment variable to the specified value. -.It manpath path Default search path for manpages. -.It nologin file If the file exists it will be displayed and -the login session will be terminated. -.It path path /bin /usr/bin Default search path. -.It priority number Initial priority (nice) level. -.It requirehome bool false Require a valid home directory to login. -.It setenv list A comma-separated list of environment variables and -values to which they are to be set. -.It shell prog Session shell to execute rather than the -shell specified in the passwd file. The SHELL environment variable will -contain the shell specified in the password file. -.It term string su Default terminal type if not able to determine from -other means. -.It timezone string Default value of $TZ environment variable. -.It umask number 022 Initial umask. Should always have a leading 0 to -ensure octal interpretation. -.It welcome file /etc/motd File containing welcome message. -.El -.Pp -.Sh AUTHENTICATION -.Bl -column minpasswordlen indent indent -.Sy Name Type Notes Description -.It minpasswordlen number 6 The minimum length a local password may be. -.\" .It approve program Program to approve login. -.It auth list passwd Allowed authentication styles. The first value is the -default style. -.It auth-<type> list Allowed authentication styles for the -authentication type 'type'. -.It copyright file File containing additional copyright information -.\".It widepasswords bool false Use the wide password format. The wide password -.\" format allows up to 128 significant characters in the password. -.It host.allow list List of remote host wildcards from which users in -the class may access. -.It host.deny list List of remote host wildcards from which users in -the class may not access. -.It times.allow list List of time periods during which -logins are allowed. -.It times.deny list List of time periods during which logins are -disallowed. -.It tty.allow list List of ttys and ttygroups which users -in the class may use for access. -.It tty.deny list List of ttys and ttygroups which users -in the class may not use for access. -.El -.Pp -These fields are intended to be used by -.Xr passwd 1 -and other programs in the login authentication system. -.Pp -Capabilities that set environment variables are scanned for both -.Ql \&~ -and -.Ql \&$ -characters, which are substituted for a user's home directory and name -respectively. -To pass these characters literally into the environment variable, escape -the character by preceding it with a backslash '\\'. -.Pp -The -.Em host.allow -and -.Em host.deny -entries are comma separated lists used for checking remote access to the system, -and consist of a list of hostnames and/or IP addresses against which remote -network logins are checked. -Items in these lists may contain wildcards in the form used by shell programs -for wildcard matching (See -.Xr fnmatch 3 -for details on the implementation). -The check on hosts is made against both the remote system's Internet address -and hostname (if available). -If both lists are empty or not specified, then logins from any remote host -are allowed. -If host.allow contains one or more hosts, then only remote systems matching -any of the items in that list are allowed to log in. -If host.deny contains one or more hosts, then a login from any matching hosts -will be disallowed. -.Pp -The -.Em times.allow -and -.Em times.deny -entries consist of a comma-separated list of time periods during which the users -in a class are allowed to be logged in. -These are expressed as one or more day codes followed by a start and end times -expressed in 24 hour format, separated by a hyphen or dash. -For example, MoThSa0200-1300 translates to Monday, Thursday and Saturday between -the hours of 2 am and 1 p.m.. -If both of these time lists are empty, users in the class are allowed access at -any time. -If -.Em times.allow -is specified, then logins are only allowed during the periods given. -If -.Em times.deny -is specified, then logins are denied during the periods given, regardless of whether -one of the periods specified in -.Em times.allow -applies. -.Pp -Note that -.Xr login 1 -enforces only that the actual login falls within periods allowed by these entries. -Further enforcement over the life of a session requires a separate daemon to -monitor transitions from an allowed period to a non-allowed one. -.Pp -The -.Em tty.allow -and -.Em tty.deny -entries contain a comma-separated list of tty devices (without the /dev/ prefix) -that a user in a class may use to access the system, and/or a list of ttygroups -(See -.Xr getttyent 3 -and -.Xr ttys 5 -for information on ttygroups). -If neither entry exists, then the choice of login device used by the user is -unrestricted. -If only -.Em tty.allow -is specified, then the user is restricted only to ttys in the given -group or device list. -If only -.Em tty.deny -is specified, then the user is prevented from using the specified devices or -devices in the group. -If both lists are given and are non-empty, the user is restricted to those -devices allowed by tty.allow that are not available by tty.deny. -.Sh ACCOUNTING LIMITS -.Bl -column passwordperiod indent indent -.Sy Name Type Notes Description -.It accounted bool false Enable session time accounting for all users -in this class. -.It autodelete time Time after expiry when account is auto-deleted. -.It bootfull bool false Enable 'boot only if ttygroup is full' strategy -when terminating sessions. -.It daytime time Maximum login time per day. -.It expireperiod time Time for expiry allocation. -.It graceexpire time Grace days for expired account. -.It gracetime time Additional grace login time allowed. -.It host.accounted list List of remote host wildcards from which -login sessions will be accounted. -.It host.exempt list List of remote host wildcards from which -login session accounting is exempted. -.It idletime time Maximum idle time before logout. -.It monthtime time Maximum login time per month. -.It passwordtime time Time for password expiry. -.It refreshtime time New time allowed on account refresh. -.It refreshperiod str How often account time is refreshed. -.It sessiontime time Maximum login time per session. -.It sessionlimit number Maximum number of concurrent -login sessions on ttys in any group. -.It tty.accounted list List of ttys and ttygroups for which -login accounting is active. -.It tty.exempt list List of ttys and ttygroups for which login accounting -is exempt. -.It warnexpire time Advance notice for pending account expiry. -.It warnpassword time Advance notice for pending password expiry. -.It warntime time Advance notice for pending out-of-time. -.It weektime time Maximum login time per week. -.El -.Pp -These fields are used by the time accounting system, which regulates, -controls and records user login access. -.Pp -The -.Em ttys.accounted -and -.Em ttys.exempt -fields operate in a similar manner to -.Em ttys.allow -and -.Em ttys.deny -as explained -above. -Similarly with the -.Em host.accounted -and -.Em host.exempt -lists. -.Sh SEE ALSO -.Xr login 1 , -.Xr getcap 3 , -.Xr getttyent 3 , -.Xr login_cap 3 , -.Xr login_class 3 , -.Xr ttys 5 diff --git a/lib/libutil/login_auth.3 b/lib/libutil/login_auth.3 deleted file mode 100644 index 14a2a63fcf0f4..0000000000000 --- a/lib/libutil/login_auth.3 +++ /dev/null @@ -1,71 +0,0 @@ -.\" Copyright (c) 1995 David Nugent <davidn@blaze.net.au> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, is permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice immediately at the beginning of the file, without modification, -.\" this list of conditions, and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. This work was done expressly for inclusion into FreeBSD. Other use -.\" is permitted provided this notation is included. -.\" 4. Absolutely no warranty of function or purpose is made by the author -.\" David Nugent. -.\" 5. Modifications may be freely made to this file providing the above -.\" conditions are met. -.\" -.\" $Id$ -.\" -.Dd December 29, 1996 -.Os FreeBSD -.Dt LOGIN_AUTH 3 -.Sh NAME -.Nm authenticate -.Nm auth_script -.Nm auth_env -.Nm auth_scan -.Nm auth_rmfiles -.Nm auth_checknologin -.Nm auth_cat -.Nm auth_ttyok -.Nm auth_hostok -.Nm auth_timesok -.Nd Authentication style support library for login class capabilities database. -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <login_cap.h> -.Ft int -.Fn authenticate "const char *name" "const char *classname" "const char *style" "const char *service" -.Ft int -.Fn auth_script "const char * path" ... -.Ft int -.Fn auth_env "void" -.Ft int -.Fn auth_scan "int ok" -.Ft int -.Fn auth_rmfiles "void" -.Ft int -.Fn auth_checknologin "login_cap_t *lc" -.Ft int -.Fn auth_cat "const char *file" -.Ft int -.Fn auth_ttyok "login_cap_t *lc" "const char *tty" -.Ft int -.Fn auth_hostok "login_cap_t *lc" "const char *hostname" "char const *ip" -.Ft int -.Fn auth_timesok "login_cap_t *lc" "time_t now" -.Sh DESCRIPTION -This set of functions support the login class authorisation style interface provided -by -.Xr login.conf 5 . - -.Sh RETURN VALUES -.Sh SEE ALSO -.Xr getcap 3 , -.Xr login_cap 3 , -.Xr login_class 3 , -.Xr login.conf 5 , -.Xr termcap 5 diff --git a/lib/libutil/login_ok.3 b/lib/libutil/login_ok.3 deleted file mode 100644 index f90710f56ad70..0000000000000 --- a/lib/libutil/login_ok.3 +++ /dev/null @@ -1,138 +0,0 @@ -.\" Copyright (c) 1995 David Nugent <davidn@blaze.net.au> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, is permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice immediately at the beginning of the file, without modification, -.\" this list of conditions, and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. This work was done expressly for inclusion into FreeBSD. Other use -.\" is permitted provided this notation is included. -.\" 4. Absolutely no warranty of function or purpose is made by the author -.\" David Nugent. -.\" 5. Modifications may be freely made to this file providing the above -.\" conditions are met. -.\" -.\" $Id$ -.\" -.Dd January 2, 1997 -.Os FreeBSD -.Dt LOGIN_OK 3 -.Sh NAME -.Nm auth_ttyok -.Nm auth_hostok -.Nm auth_timeok -.Nd Functions for checking login class based login restrictions -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <time.h> -.Fd #include <login_cap.h> -.Ft int -.Fn auth_ttyok "login_cap_t *lc" "const char *tty" -.Ft int -.Fn auth_hostok "login_cap_t *lc" "const char *host" "char const *ip" -.Ft int -.Fn auth_timeok "login_cap_t *lc" "time_t t" -.Sh DESCRIPTION -This set of functions checks to see if login is allowed based on login -class capability entries in the login database, -.Xr login.conf 5 . -.Pp -.Fn auth_ttyok -checks to see if the named tty is available to users of a specific -class, and is either in the -.Em ttys.allow -access list, and not in -the -.Em ttys.deny -access list. -An empty -.Em ttys.allow -list (or if no such capability exists for -the give login class) logins via any tty device are allowed unless -the -.Em ttys.deny -list exists and is non-empty, and the device or its -tty group (see -.Xr ttys 5 ) -is not in the list. -Access to ttys may be allowed or restricted specifically by tty device -name, a device name which includes a wildcard (e.g. ttyD* or cuaD*), -or may name a ttygroup, when group=<name> tags have been assigned in -.Pa /etc/ttys . -Matching of ttys and ttygroups is case sensitive. -Passing a -.Dv NULL -or empty string as the -.Ar tty -parameter causes the function to return a non-zero value. -.Pp -.Fn auth_hostok -checks for any host restrictions for remote logins. -The function checks on both a host name and IP address (given in its -text form, typically n.n.n.n) against the -.Em host.allow -and -.Em host.deny -login class capabilities. -As with ttys and their groups, wildcards and character classes may be -used in the host allow and deny capability records. -The -.Xr fnmatch 3 -function is used for matching, and the matching on hostnames is case -insensitive. -Note that this function expects that the hostname is fully expanded -(i.e. the local domain name added if necessary) and the IP address -is in its canonical form. -No hostname or address lookups are attempted. -.Pp -It is possible to call this function with either the hostname or -the IP address missing (i.e. -.Dv NULL ) -and matching will be performed -only on the basis of the parameter given. -Passing -.Dv NULL -or empty strings in both parameters will result in -a non-zero return value. -.Pp -The -.Fn auth_timeok -function checks to see that a given time value is within the -.Em times.allow -login class capability and not within the -.Em times.deny -access lists. -An empty or non-existent -.Em times.allow -list allows access at any -time, except if a given time is falls within a period in the -.Em times.deny -list. -The format of time period records contained in both -.Em times.allow -and -.Em times.deny -capability fields is explained in detail in the -.Xr login_times 3 -manual page. -.Sh RETURN VALUES -A non-zero return value from any of these functions indicates that -login access is granted. -A zero return value means either that the item being tested is not -in the -.Em allow -access list, or is within the -.Em deny -access list. -.Sh SEE ALSO -.Xr getcap 3 , -.Xr login_cap 3 , -.Xr login_class 3 , -.Xr login_times 3 , -.Xr login.conf 5 , -.Xr termcap 5 diff --git a/lib/libutil/login_times.3 b/lib/libutil/login_times.3 deleted file mode 100644 index e2e7a3f885034..0000000000000 --- a/lib/libutil/login_times.3 +++ /dev/null @@ -1,155 +0,0 @@ -.\" Copyright (c) 1995 David Nugent <davidn@blaze.net.au> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, is permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice immediately at the beginning of the file, without modification, -.\" this list of conditions, and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. This work was done expressly for inclusion into FreeBSD. Other use -.\" is permitted provided this notation is included. -.\" 4. Absolutely no warranty of function or purpose is made by the author -.\" David Nugent. -.\" 5. Modifications may be freely made to this file providing the above -.\" conditions are met. -.\" -.\" $Id$ -.\" -.Dd January 2, 1997 -.Os FreeBSD -.Dt LOGIN_TIMES 3 -.Sh NAME -.Nm parse_lt -.Nm in_ltm -.Nm in_ltms -.Nd Functions for parsing and checking login time periods -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <time.h> -.Fd #include <login_cap.h> -.Ft login_time_t -.Fn parse_lt "const char *str" -.Ft int -.Fn in_ltm "const login_time_t *lt" "struct tm *t" "time_t *ends" -.Ft int -.Fn in_ltms "const login_time_t *lt" "struct tm *t" "time_t *ends" -.Sh DESCRIPTION -This set of functions may be used for parsing and checking login and -session times against a predefined list of allowed login times as -used in -.Xr login.conf 5 . -.Pp -The format of allowed and disallowed session times specified in the -.Ar times.allow -and -.Ar times.deny -capability fields in a login class are comprised of a prefix which -specifies one or more 2- or 3-character day codes, followed by -a start and end time in 24 hour format separated by a hyphen. -Day codes may be concatenated together to select specific days, or -the special mnemonics "Any" and "All" (for any/all days of the week), -"Wk" for any day of the week (excluding Saturdays and Sundays) and -"Wd" for any weekend day may be used. -.Pp -For example, the following time period: -.Dl MoThFrSa1400-2200 -is interpreted as Monday, Thursday through Saturday between the hours -of 2pm and 10pm. -.Dl Wd0600-1800 -means Saturday and Sunday, between the hours of 6am through 6pm, and -.Dl Any0400-1600 -means any day of the week, between 4am and 4pm. -.Pp -Note that all time periods reference system local time. -.Pp -The -.Fn parse_lt -function converts the ascii representation of a time period into -a structure of type -.Ft login_time_t . -This is defined as: -.Bd -literal -typedef struct login_time -{ - u_short lt_start; /* Start time */ - u_short lt_end; /* End time */ - u_char lt_dow; /* Days of week */ -} login_time_t; -.Ed -.Pp -The -.Ar lt_start -and -.Ar lt_end -fields contain the number of minutes past midnight at which the -described period begins and ends. -The -.Ar lt_dow -field is a bit field, containing one bit for each day of the week -and one bit unused. -A series -.Em LTM_* -macros may be used for testing bits individually and in combination. -If no bits are set in this field - ie. it contains the value -.Em LTM_NONE - -then the entire period is assumed invalid. -This is used as a convention to mark the termination of an array -of login_time_t values. -If -.Fn parse_lt -returns a -.Ar login_time_t -with -.Ar lt_dow -equal to -.Em LTM_NONE -then a parsing error was encountered. -.Pp -The remaining functions provide the ability to test a given time_t or -struct tm value against a specific time period or array of time -periods. -.Fn in_ltm -determines whether the given time described by the struct tm -passed as the second parameter falls within the period described -by the first parameter. -A boolean value is returned, indicating whether or not the time -specified falls within the period. -If the time does fall within the time period, and the third -parameter to the function is not NULL, the time at which the -period ends relative to the time passed is returned. -.Pp -The -.Fn in_ltms -function is similar to -.Fn in_ltm -except that the first parameter must be a pointer to an array -of login_time_t objects, which is up to LC_MAXTIMES (64) -elements in length, and terminated by an element with its -.Ar lt_dow -field set to -.Em LTM_NONE. -.Sh RETURN VALUES -.Fn parse_lt -returns a filled in structure of type login_time_t containing the -parsed time period. -If a parsing error occurs, the lt_dow field is set to -.Em LTM_NONE -(i.e. 0). -.Pp -.Fn in_ltm -returns non-zero if the given time falls within the period described -by the login_time_t passed as the first parameter. -.Pp -.Fn in_ltms -returns the index of the first time period found in which the given -time falls, or -1 if none of them apply. -.Sh SEE ALSO -.Xr getcap 3 , -.Xr login_cap 3 , -.Xr login_class 3 , -.Xr login.conf 5 , -.Xr termcap 5 |