summaryrefslogtreecommitdiff
path: root/deleted_files
diff options
context:
space:
mode:
authorcasper <none@none>2006-05-01 11:23:49 -0700
committercasper <none@none>2006-05-01 11:23:49 -0700
commit004388ebfdfe2ed7dfd2d153a876dfcc22d2c006 (patch)
tree9f3972760e2696f63065521871e50e1440bfbb75 /deleted_files
parent0ade2cf005fcaecc5255dacf7d76683de855a9da (diff)
downloadillumos-gate-004388ebfdfe2ed7dfd2d153a876dfcc22d2c006.tar.gz
4916205 libcmd should not use file operation routines from C library
6234782 Kerberos and GSSAPI should not use fopen 6259671 vold won't be killed by TERM signal when several removable devices are managed 6386770 pam_authenticate can fail if open files are >= 255 and the soft fd limit is greater than 256 6414401 Remove shadow stdio implementation obsoleted by PSARC 2006/162 6414404 __rpc_openchild never called and not exported by library 6416815 ON needs to be hardened against the 32-bit fopen/255 problem --HG-- rename : usr/src/lib/libnsl/common/nsl_stdio_prv.c => deleted_files/usr/src/lib/libnsl/common/nsl_stdio_prv.c rename : usr/src/lib/libnsl/include/nsl_stdio_prv.h => deleted_files/usr/src/lib/libnsl/include/nsl_stdio_prv.h rename : usr/src/lib/libnsl/rpc/openchild.c => deleted_files/usr/src/lib/libnsl/rpc/openchild.c rename : usr/src/lib/libnsl/rpc/xdr_stdio_prv.c => deleted_files/usr/src/lib/libnsl/rpc/xdr_stdio_prv.c rename : usr/src/lib/libresolv2/req.flg => deleted_files/usr/src/lib/libresolv2/req.flg rename : usr/src/lib/nsswitch/compat/req.flg => deleted_files/usr/src/lib/nsswitch/compat/req.flg rename : usr/src/lib/nsswitch/files/req.flg => deleted_files/usr/src/lib/nsswitch/files/req.flg rename : usr/src/lib/nsswitch/req.flg => deleted_files/usr/src/lib/nsswitch/req.flg rename : usr/src/lib/nsswitch/user/req.flg => deleted_files/usr/src/lib/nsswitch/user/req.flg
Diffstat (limited to 'deleted_files')
-rw-r--r--deleted_files/usr/src/lib/libnsl/common/nsl_stdio_prv.c469
-rw-r--r--deleted_files/usr/src/lib/libnsl/include/nsl_stdio_prv.h104
-rw-r--r--deleted_files/usr/src/lib/libnsl/rpc/openchild.c105
-rw-r--r--deleted_files/usr/src/lib/libnsl/rpc/xdr_stdio_prv.c215
-rw-r--r--deleted_files/usr/src/lib/libresolv2/req.flg9
-rw-r--r--deleted_files/usr/src/lib/nsswitch/compat/req.flg30
-rw-r--r--deleted_files/usr/src/lib/nsswitch/files/req.flg30
-rw-r--r--deleted_files/usr/src/lib/nsswitch/req.flg30
-rw-r--r--deleted_files/usr/src/lib/nsswitch/user/req.flg30
9 files changed, 1022 insertions, 0 deletions
diff --git a/deleted_files/usr/src/lib/libnsl/common/nsl_stdio_prv.c b/deleted_files/usr/src/lib/libnsl/common/nsl_stdio_prv.c
new file mode 100644
index 0000000000..efa8388262
--- /dev/null
+++ b/deleted_files/usr/src/lib/libnsl/common/nsl_stdio_prv.c
@@ -0,0 +1,469 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include "mt.h"
+#include <stdlib.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+
+#include "nsl_stdio_prv.h"
+
+/*
+ * This is a limited implementation to allow libraries to use
+ * stdio and avoid the limitation of 256 open file descriptors.
+ * The newly implemented stdio functions are closely based on
+ * the implementation in C library.
+ * To simplify, certain assumptions are made:
+ * - a file may be opened for either readonly or write only
+ * - file descriptors should not be shared between threads
+ * - only seek to beginning of file
+ * - ungetc may only work for the last char. ie., ungetc will work
+ * once (but not necessarily more) after a read
+ */
+
+static int
+_raise_fd(int fd)
+{
+ int nfd;
+ static const int min_fd = 256;
+
+ if (fd >= min_fd)
+ return (fd);
+
+ if ((nfd = fcntl(fd, F_DUPFD, min_fd)) == -1) {
+ /*
+ * If the shell limits [See limit(1)] the
+ * descriptors to 256, fcntl will fail
+ * and errno will be set to EINVAL. Since
+ * the intention is to ignore fcntl failures
+ * and continue working with 'fd', we should
+ * reset errno to _prevent_ apps relying on errno
+ * to treat this as an error.
+ */
+ errno = 0;
+ return (fd);
+ }
+
+ (void) close(fd);
+
+ return (nfd);
+}
+
+__NSL_FILE *
+__nsl_fopen(const char *filename, const char *mode)
+{
+ int flag;
+ int oflag;
+ int fd;
+ __NSL_FILE *stream;
+
+ if (mode == NULL || filename == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+ switch (mode[0]) {
+ default:
+ errno = EINVAL;
+ return (NULL);
+ case 'r':
+ flag = 0;
+ oflag = O_RDONLY;
+ break;
+ case 'w':
+ flag = __NSL_FILE_WRITE_ONLY;
+ oflag = O_WRONLY | O_TRUNC | O_CREAT;
+ break;
+ }
+ if (mode[1] != '\0') {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ fd = open(filename, oflag | O_LARGEFILE, 0666);
+ if (fd < 0)
+ return (NULL);
+
+ stream = (__NSL_FILE *)malloc(sizeof (__NSL_FILE));
+ if (stream != NULL) {
+ stream->_nsl_file = _raise_fd(fd);
+ stream->_nsl_cnt = flag & __NSL_FILE_WRITE_ONLY ?
+ sizeof (stream->_nsl_base) : 0;
+ stream->_nsl_ptr = stream->_nsl_base;
+ stream->_nsl_flag = flag;
+ } else {
+ (void) close(fd);
+ }
+
+ return (stream);
+}
+
+int
+__nsl_fclose(__NSL_FILE *stream)
+{
+ int res = 0;
+
+ if (stream == NULL)
+ return (EOF);
+
+ res = __nsl_fflush(stream);
+
+ if (close(stream->_nsl_file) < 0)
+ res = EOF;
+
+ free(stream);
+
+ return (res);
+}
+
+/* fill buffer, return 0 or EOF */
+static int
+_filbuf(__NSL_FILE *stream)
+{
+ int res;
+
+ stream->_nsl_ptr = stream->_nsl_base;
+
+ if ((res = read(stream->_nsl_file, (char *)stream->_nsl_base,
+ __NSL_FILE_BUF_SIZE)) > 0) {
+ stream->_nsl_cnt = res;
+ return (0);
+ } else {
+ stream->_nsl_cnt = 0;
+ if (res == 0)
+ stream->_nsl_flag |= __NSL_FILE_EOF;
+ else
+ stream->_nsl_flag |= __NSL_FILE_ERR;
+ return (EOF);
+ }
+}
+
+char *
+__nsl_fgets(char *buf, int size, __NSL_FILE *stream)
+{
+ char *ptr = buf;
+ char *p;
+ int n;
+
+ if (stream->_nsl_flag & __NSL_FILE_WRITE_ONLY) {
+ errno = EBADF;
+ return (NULL);
+ }
+
+ size--; /* room for '\0' */
+ while (size > 0) {
+ if (stream->_nsl_cnt == 0) {
+ if (_filbuf(stream) == EOF)
+ break; /* nothing left to read */
+ }
+ n = (int)(size < stream->_nsl_cnt ? size : stream->_nsl_cnt);
+ if ((p = memccpy(ptr, (char *)stream->_nsl_ptr, '\n',
+ (size_t)n)) != NULL)
+ n = (int)(p - ptr);
+ ptr += n;
+ stream->_nsl_cnt -= n;
+ stream->_nsl_ptr += n;
+ if (p != NULL)
+ break; /* newline found */
+ size -= n;
+ }
+
+ if (ptr == buf) /* never read anything */
+ return (NULL);
+
+ *ptr = '\0';
+ return (buf);
+}
+
+int
+__nsl_feof(__NSL_FILE *stream)
+{
+ return (stream->_nsl_flag & __NSL_FILE_EOF);
+}
+
+int
+__nsl_fseek(__NSL_FILE *stream, long offset, int whence)
+{
+ off_t p;
+
+ stream->_nsl_flag &= ~(__NSL_FILE_EOF | __NSL_FILE_ERR);
+
+ if (stream->_nsl_flag & __NSL_FILE_WRITE_ONLY) {
+ if (whence == SEEK_CUR)
+ offset -= sizeof (stream->_nsl_base) - stream->_nsl_cnt;
+ if (__nsl_fflush(stream) == EOF)
+ return (-1);
+ } else {
+ if (whence == SEEK_CUR)
+ offset -= stream->_nsl_cnt;
+
+ stream->_nsl_cnt = 0;
+ stream->_nsl_ptr = stream->_nsl_base;
+ }
+
+ p = lseek(stream->_nsl_file, (off_t)offset, whence);
+ return ((p == (off_t)-1) ? -1 : 0);
+}
+
+void
+__nsl_frewind(__NSL_FILE *stream)
+{
+ (void) __nsl_fseek(stream, 0, SEEK_SET);
+}
+
+long
+__nsl_ftell(__NSL_FILE *stream)
+{
+ ptrdiff_t adjust;
+ off64_t tres;
+
+ if (stream->_nsl_flag & __NSL_FILE_WRITE_ONLY)
+ adjust = (ptrdiff_t)
+ (sizeof (stream->_nsl_base) - stream->_nsl_cnt);
+ else
+ adjust = (ptrdiff_t)(-stream->_nsl_cnt);
+
+ tres = lseek64(stream->_nsl_file, 0, SEEK_CUR);
+ if (tres >= 0)
+ tres += adjust;
+
+ if (tres > LONG_MAX) {
+ errno = EOVERFLOW;
+ return (EOF);
+ }
+
+ return ((long)tres);
+}
+
+size_t
+__nsl_fread(void *ptr, size_t size, size_t nitems, __NSL_FILE *stream)
+{
+ ssize_t s;
+ char *dptr = (char *)ptr;
+
+ /* is it a readable stream */
+ if (stream->_nsl_flag & __NSL_FILE_WRITE_ONLY) {
+ stream->_nsl_flag |= __NSL_FILE_ERR;
+ errno = EBADF;
+ return (0);
+ }
+
+ if (stream->_nsl_flag & __NSL_FILE_EOF)
+ return (0);
+
+ s = size * nitems;
+
+ while (s > 0) {
+ if (stream->_nsl_cnt < s) {
+ if (stream->_nsl_cnt > 0) {
+ (void) memcpy((void*)dptr, stream->_nsl_ptr,
+ stream->_nsl_cnt);
+ dptr += stream->_nsl_cnt;
+ s -= stream->_nsl_cnt;
+ }
+ /*
+ * filbuf clobbers _cnt & _ptr,
+ * so don't waste time setting them.
+ */
+ if (_filbuf(stream) == EOF)
+ break;
+ }
+ if (stream->_nsl_cnt >= s) {
+ (void) memcpy((void*)dptr, stream->_nsl_ptr, (size_t)s);
+ stream->_nsl_ptr += s;
+ stream->_nsl_cnt -= s;
+ return (nitems);
+ }
+ }
+ return (size != 0 ? nitems - ((s + size - 1) / size) : 0);
+}
+
+int
+__nsl_fgetc(__NSL_FILE *stream)
+{
+ /* is it a readable stream */
+ if (stream->_nsl_flag & __NSL_FILE_WRITE_ONLY) {
+ stream->_nsl_flag |= __NSL_FILE_ERR;
+ errno = EBADF;
+ return (0);
+ }
+
+ if (stream->_nsl_cnt <= 0) {
+ if (_filbuf(stream) == EOF)
+ return (EOF);
+ }
+ --stream->_nsl_cnt;
+ return (*stream->_nsl_ptr++);
+}
+
+int
+__nsl_fflush(__NSL_FILE *stream)
+{
+ ssize_t n;
+ ssize_t num_wrote;
+ unsigned char *base;
+
+ if (!(stream->_nsl_flag & __NSL_FILE_DIRTY)) {
+ return (0);
+ }
+
+ base = stream->_nsl_base;
+ n = stream->_nsl_ptr - stream->_nsl_base;
+
+ stream->_nsl_flag &= ~__NSL_FILE_DIRTY;
+ if (n > 0) {
+ while ((num_wrote =
+ write(stream->_nsl_file, base, (size_t)n)) != n) {
+ if (num_wrote <= 0) {
+ stream->_nsl_flag |= __NSL_FILE_ERR;
+ return (EOF);
+ }
+ n -= num_wrote;
+ base += num_wrote;
+ }
+ }
+ stream->_nsl_ptr = stream->_nsl_base;
+ stream->_nsl_cnt = sizeof (stream->_nsl_base);
+ return (0);
+}
+
+int
+__nsl_ungetc(int c, __NSL_FILE *stream)
+{
+ if (stream->_nsl_flag & __NSL_FILE_WRITE_ONLY)
+ return (EOF);
+ if (c == EOF)
+ return (EOF);
+ if (stream->_nsl_ptr <= stream->_nsl_base)
+ return (EOF);
+ stream->_nsl_flag &= ~(__NSL_FILE_EOF | __NSL_FILE_ERR);
+ *--stream->_nsl_ptr = c;
+ ++stream->_nsl_cnt;
+ return (c);
+}
+
+__NSL_FILE *
+__nsl_fdopen(int fildes, const char *mode)
+{
+ int flag;
+ __NSL_FILE *stream;
+
+ if (mode == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+ switch (mode[0]) {
+ default:
+ errno = EINVAL;
+ return (NULL);
+ case 'r':
+ flag = 0;
+ break;
+ case 'w':
+ flag = __NSL_FILE_WRITE_ONLY;
+ break;
+ }
+ if (mode[1] != '\0') {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ stream = (__NSL_FILE *)malloc(sizeof (__NSL_FILE));
+ if (stream != NULL) {
+ stream->_nsl_file = fildes;
+ stream->_nsl_cnt = flag & __NSL_FILE_WRITE_ONLY ?
+ sizeof (stream->_nsl_base) : 0;
+ stream->_nsl_ptr = stream->_nsl_base;
+ stream->_nsl_flag = flag;
+ }
+
+ return (stream);
+}
+
+size_t
+__nsl_fwrite(const void *ptr, size_t size, size_t nitems,
+ __NSL_FILE *stream)
+{
+ ssize_t s;
+ const unsigned char *dptr = (const unsigned char *)ptr;
+
+ if (!(stream->_nsl_flag & __NSL_FILE_WRITE_ONLY))
+ return (0);
+
+ if (size < 1 || nitems < 1)
+ return (0);
+
+ s = size * nitems;
+
+ stream->_nsl_flag |= __NSL_FILE_DIRTY;
+
+ while (s > 0) {
+ if (stream->_nsl_cnt < s) {
+ if (stream->_nsl_cnt > 0) {
+ (void) memcpy(stream->_nsl_ptr, (void *)dptr,
+ stream->_nsl_cnt);
+ dptr += stream->_nsl_cnt;
+ stream->_nsl_ptr += stream->_nsl_cnt;
+ s -= stream->_nsl_cnt;
+ stream->_nsl_cnt = 0;
+ }
+ if (__nsl_fflush(stream) == EOF)
+ break;
+ }
+ if (stream->_nsl_cnt >= s) {
+ (void) memcpy(stream->_nsl_ptr, (void *)dptr, s);
+ stream->_nsl_ptr += s;
+ stream->_nsl_cnt -= s;
+
+ return (nitems);
+ }
+ }
+
+ return (size != 0 ? nitems - ((s + size - 1) / size) : 0);
+}
+
+int
+__nsl_fputc(int c, __NSL_FILE *stream)
+{
+ if (!(stream->_nsl_flag & __NSL_FILE_WRITE_ONLY))
+ return (EOF);
+
+ if (stream->_nsl_cnt == 0) {
+ if (__nsl_fflush(stream) == EOF)
+ return (EOF);
+ }
+ (*stream->_nsl_ptr++) = (unsigned char)c;
+ --stream->_nsl_cnt;
+
+ return ((unsigned char)c);
+}
diff --git a/deleted_files/usr/src/lib/libnsl/include/nsl_stdio_prv.h b/deleted_files/usr/src/lib/libnsl/include/nsl_stdio_prv.h
new file mode 100644
index 0000000000..94847760e4
--- /dev/null
+++ b/deleted_files/usr/src/lib/libnsl/include/nsl_stdio_prv.h
@@ -0,0 +1,104 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _NSL_STDIO_PRV_H
+#define _NSL_STDIO_PRV_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <rpc/xdr.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * To avoid the 256 file descriptor limitation in stdio, we use our own
+ * private version of stdio functions. A modified FILE structure is used
+ * in our private stdio functions.
+ * To simplify, certain assumptions are made:
+ * - a file may be opened for either readonly or write only
+ * - file descriptors should not be shared between threads
+ * - only seek to beginning of file
+ * - ungetc may only work for the last char. ie., ungetc will work
+ * once (but not necessarily more) after a read
+ */
+
+#define __NSL_FILE_BUF_SIZE 1024
+
+/* __NSL_FILE flags */
+#define __NSL_FILE_EOF 0x01
+#define __NSL_FILE_WRITE_ONLY 0x02
+#define __NSL_FILE_ERR 0x04
+#define __NSL_FILE_DIRTY 0x08
+
+typedef struct {
+ int _nsl_file; /* integer datatype to hold */
+ /* file descriptor */
+
+ int _nsl_cnt; /* number of bytes available to read */
+ /* or write as per the access mode */
+
+ unsigned char *_nsl_ptr; /* location of next byte in buffer to */
+ /* read or write as per access mode */
+
+ int _nsl_flag;
+ unsigned char _nsl_base[__NSL_FILE_BUF_SIZE];
+} __NSL_FILE;
+
+extern __NSL_FILE *__nsl_fopen(const char *filename, const char *mode);
+extern int __nsl_fclose(__NSL_FILE *stream);
+extern char *__nsl_fgets(char *s, int n, __NSL_FILE *stream);
+extern int __nsl_feof(__NSL_FILE *stream);
+extern int __nsl_fseek(__NSL_FILE *stream, long offset,
+ int whence);
+extern void __nsl_frewind(__NSL_FILE *stream);
+extern long __nsl_ftell(__NSL_FILE *stream);
+extern size_t __nsl_fread(void *ptr, size_t size, size_t nitems,
+ __NSL_FILE *stream);
+extern int __nsl_fflush(__NSL_FILE *stream);
+extern int __nsl_getc(__NSL_FILE *stream);
+extern int __nsl_fgetc(__NSL_FILE *stream);
+extern int __nsl_ungetc(int c, __NSL_FILE *stream);
+extern __NSL_FILE *__nsl_fdopen(int fildes, const char *mode);
+extern size_t __nsl_fwrite(const void *ptr, size_t size,
+ size_t nitems, __NSL_FILE *stream);
+extern int __nsl_fputc(int c, __NSL_FILE *stream);
+extern void __nsl_xdrstdio_create(XDR *xdrs, __NSL_FILE *file,
+ enum xdr_op op);
+
+#define __nsl_fputstring(s, stream) __nsl_fwrite(s, strlen(s), 1, stream)
+#define __nsl_fileno(s) s->_nsl_file
+#define __nsl_getc_unlocked(f) __nsl_fgetc(f)
+#define __nsl_getc(f) __nsl_fgetc(f)
+#define __nsl_rewind(f) __nsl_frewind(f)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NSL_STDIO_PRV_H */
diff --git a/deleted_files/usr/src/lib/libnsl/rpc/openchild.c b/deleted_files/usr/src/lib/libnsl/rpc/openchild.c
new file mode 100644
index 0000000000..a3bd50f72d
--- /dev/null
+++ b/deleted_files/usr/src/lib/libnsl/rpc/openchild.c
@@ -0,0 +1,105 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+/*
+ * Portions of this source code were derived from Berkeley
+ * 4.3 BSD under license from the Regents of the University of
+ * California.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Open two pipes to a child process, one for reading, one for writing. The
+ * pipes are accessed by FILE pointers. This is NOT a public interface, but
+ * for internal use only!
+ */
+#include "mt.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <rpc/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "rpc_mt.h"
+
+
+/*
+ * returns pid, or -1 for failure
+ */
+int
+__rpc_openchild(char *command, FILE **fto, FILE **ffrom)
+{
+ int pid;
+ int pdto[2];
+ int pdfrom[2];
+
+ if (pipe(pdto) < 0)
+ goto error1;
+ if (pipe(pdfrom) < 0)
+ goto error2;
+ switch (pid = fork()) {
+ case -1:
+ goto error3;
+
+ case 0:
+ /*
+ * child: read from pdto[0], write into pdfrom[1]
+ */
+ (void) dup2(pdto[0], 0);
+ (void) dup2(pdfrom[1], 1);
+ closefrom(3);
+ (void) fflush(stderr);
+ (void) execlp(command, command, 0);
+ perror("exec");
+ _exit(~0);
+
+ default:
+ /*
+ * parent: write into pdto[1], read from pdfrom[0]
+ */
+ *fto = fdopen(pdto[1], "w");
+ (void) close(pdto[0]);
+ *ffrom = fdopen(pdfrom[0], "r");
+ (void) close(pdfrom[1]);
+ break;
+ }
+ return (pid);
+
+ /*
+ * error cleanup and return
+ */
+error3:
+ (void) close(pdfrom[0]);
+ (void) close(pdfrom[1]);
+error2:
+ (void) close(pdto[0]);
+ (void) close(pdto[1]);
+error1:
+ return (-1);
+}
diff --git a/deleted_files/usr/src/lib/libnsl/rpc/xdr_stdio_prv.c b/deleted_files/usr/src/lib/libnsl/rpc/xdr_stdio_prv.c
new file mode 100644
index 0000000000..4c5f7fd292
--- /dev/null
+++ b/deleted_files/usr/src/lib/libnsl/rpc/xdr_stdio_prv.c
@@ -0,0 +1,215 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * XDR implementation on special standard i/o file.
+ *
+ * To avoid the file descriptor limitation in stdio, we implement
+ * a private version of the same routines from xdr_stdio.c using
+ * modified FILE structure. ( __NSL_FILE )
+ * This set of routines implements a XDR on a special stdio stream.
+ * XDR_ENCODE serializes onto the stream, XDR_DECODE de-serializes
+ * from the stream.
+ */
+
+#include "mt.h"
+#include "rpc_mt.h"
+#include <rpc/types.h>
+#include <stdio.h>
+#include <rpc/xdr.h>
+#include <sys/types.h>
+#include <inttypes.h>
+#include "nsl_stdio_prv.h"
+
+static struct xdr_ops *__nsl_xdrstdio_ops(void);
+
+/*
+ * Initialize a stdio xdr stream.
+ * Sets the xdr stream handle xdrs for use on the stream file.
+ * Operation flag is set to op.
+ */
+void
+__nsl_xdrstdio_create(XDR *xdrs, __NSL_FILE *file, enum xdr_op op)
+{
+ xdrs->x_op = op;
+ xdrs->x_ops = __nsl_xdrstdio_ops();
+ xdrs->x_private = (caddr_t)file;
+ xdrs->x_handy = 0;
+ xdrs->x_base = 0;
+}
+
+/*
+ * Destroy a stdio xdr stream.
+ * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
+ */
+static void
+__nsl_xdrstdio_destroy(XDR *xdrs)
+{
+ /* LINTED pointer cast */
+ (void) __nsl_fflush((__NSL_FILE *)xdrs->x_private);
+ /* xx should we close the file ?? */
+}
+
+
+static bool_t
+__nsl_xdrstdio_getint32(XDR *xdrs, int32_t *lp)
+{
+ if (__nsl_fread((caddr_t)lp, sizeof (int32_t), 1,
+ /* LINTED pointer cast */
+ (__NSL_FILE *)xdrs->x_private) != 1)
+ return (FALSE);
+ *lp = ntohl(*lp);
+ return (TRUE);
+}
+
+static bool_t
+__nsl_xdrstdio_putint32(XDR *xdrs, int32_t *lp)
+{
+ int32_t mycopy = htonl(*lp);
+ lp = &mycopy;
+
+ if (__nsl_fwrite((caddr_t)lp, sizeof (int32_t), 1,
+ /* LINTED pointer cast */
+ (__NSL_FILE *)xdrs->x_private) != 1)
+ return (FALSE);
+ return (TRUE);
+}
+
+static bool_t
+__nsl_xdrstdio_getlong(XDR *xdrs, long *lp)
+{
+ int32_t i;
+
+ if (!__nsl_xdrstdio_getint32(xdrs, &i))
+ return (FALSE);
+ *lp = (long)i;
+ return (TRUE);
+}
+
+static bool_t
+__nsl_xdrstdio_putlong(XDR *xdrs, long *lp)
+{
+ int32_t i;
+
+#if defined(_LP64)
+ if ((*lp > INT32_MAX) || (*lp < INT32_MIN))
+ return (FALSE);
+#endif
+ i = (int32_t)*lp;
+
+ return (__nsl_xdrstdio_putint32(xdrs, &i));
+}
+
+static bool_t
+__nsl_xdrstdio_getbytes(XDR *xdrs, caddr_t addr, int len)
+{
+ if ((len != 0) &&
+ (__nsl_fread(addr, (int)len, 1,
+ /* LINTED pointer cast */
+ (__NSL_FILE *)xdrs->x_private) != 1))
+ return (FALSE);
+ return (TRUE);
+}
+
+static bool_t
+__nsl_xdrstdio_putbytes(XDR *xdrs, caddr_t addr, int len)
+{
+ if ((len != 0) &&
+ (__nsl_fwrite(addr, (int)len, 1,
+ /* LINTED pointer cast */
+ (__NSL_FILE *)xdrs->x_private) != 1))
+ return (FALSE);
+ return (TRUE);
+}
+
+static uint_t
+__nsl_xdrstdio_getpos(XDR *xdrs)
+{
+ /* LINTED pointer cast */
+ return ((uint_t)__nsl_ftell((__NSL_FILE *)xdrs->x_private));
+}
+
+static bool_t
+__nsl_xdrstdio_setpos(XDR *xdrs, uint_t pos)
+{
+ /* LINTED pointer cast */
+ return ((__nsl_fseek((__NSL_FILE *)xdrs->x_private,
+ (int)pos, 0) < 0) ? FALSE : TRUE);
+}
+
+/* ARGSUSED */
+static rpc_inline_t *
+__nsl_xdrstdio_inline(XDR *xdrs, int len)
+{
+ /*
+ * Must do some work to implement this: must insure
+ * enough data in the underlying stdio buffer,
+ * that the buffer is aligned so that we can indirect through a
+ * long *, and stuff this pointer in xdrs->x_buf. Doing
+ * a fread or fwrite to a scratch buffer would defeat
+ * most of the gains to be had here and require storage
+ * management on this buffer, so we don't do this.
+ */
+ return (NULL);
+}
+
+/* ARGSUSED */
+static bool_t
+__nsl_xdrstdio_control(XDR *xdrs, int request, void *info)
+{
+ return (FALSE);
+}
+
+static struct xdr_ops *
+__nsl_xdrstdio_ops(void)
+{
+ static struct xdr_ops ops;
+ extern mutex_t ops_lock;
+
+/* VARIABLES PROTECTED BY ops_lock: ops */
+
+ (void) mutex_lock(&ops_lock);
+ if (ops.x_getlong == NULL) {
+ ops.x_getlong = __nsl_xdrstdio_getlong;
+ ops.x_putlong = __nsl_xdrstdio_putlong;
+ ops.x_getbytes = __nsl_xdrstdio_getbytes;
+ ops.x_putbytes = __nsl_xdrstdio_putbytes;
+ ops.x_getpostn = __nsl_xdrstdio_getpos;
+ ops.x_setpostn = __nsl_xdrstdio_setpos;
+ ops.x_inline = __nsl_xdrstdio_inline;
+ ops.x_destroy = __nsl_xdrstdio_destroy;
+ ops.x_control = __nsl_xdrstdio_control;
+#if defined(_LP64)
+ ops.x_getint32 = __nsl_xdrstdio_getint32;
+ ops.x_putint32 = __nsl_xdrstdio_putint32;
+#endif
+ }
+ (void) mutex_unlock(&ops_lock);
+ return (&ops);
+}
diff --git a/deleted_files/usr/src/lib/libresolv2/req.flg b/deleted_files/usr/src/lib/libresolv2/req.flg
new file mode 100644
index 0000000000..9ca59f35c3
--- /dev/null
+++ b/deleted_files/usr/src/lib/libresolv2/req.flg
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+echo_file usr/src/lib/libnsl/include/nsl_stdio_prv.h
diff --git a/deleted_files/usr/src/lib/nsswitch/compat/req.flg b/deleted_files/usr/src/lib/nsswitch/compat/req.flg
new file mode 100644
index 0000000000..6d6493b45c
--- /dev/null
+++ b/deleted_files/usr/src/lib/nsswitch/compat/req.flg
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+echo_file usr/src/lib/libnsl/include/nsl_stdio_prv.h
diff --git a/deleted_files/usr/src/lib/nsswitch/files/req.flg b/deleted_files/usr/src/lib/nsswitch/files/req.flg
new file mode 100644
index 0000000000..6d6493b45c
--- /dev/null
+++ b/deleted_files/usr/src/lib/nsswitch/files/req.flg
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+echo_file usr/src/lib/libnsl/include/nsl_stdio_prv.h
diff --git a/deleted_files/usr/src/lib/nsswitch/req.flg b/deleted_files/usr/src/lib/nsswitch/req.flg
new file mode 100644
index 0000000000..6d6493b45c
--- /dev/null
+++ b/deleted_files/usr/src/lib/nsswitch/req.flg
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+echo_file usr/src/lib/libnsl/include/nsl_stdio_prv.h
diff --git a/deleted_files/usr/src/lib/nsswitch/user/req.flg b/deleted_files/usr/src/lib/nsswitch/user/req.flg
new file mode 100644
index 0000000000..6d6493b45c
--- /dev/null
+++ b/deleted_files/usr/src/lib/nsswitch/user/req.flg
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+echo_file usr/src/lib/libnsl/include/nsl_stdio_prv.h