diff options
Diffstat (limited to 'usr/src')
172 files changed, 1235 insertions, 2539 deletions
diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c index ee7a987003..d692509d09 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +34,7 @@ #include <unistd.h> #include <signal.h> #include <stdio.h> +#include <stdio_ext.h> #include <dhcp_hostconf.h> #include <dhcp_symbol.h> #include <dhcpagent_ipc.h> @@ -216,6 +216,8 @@ main(int argc, char **argv) if (setrlimit(RLIMIT_NOFILE, &rl) == -1) dhcpmsg(MSG_ERR, "setrlimit failed"); + (void) enable_extended_FILE_stdio(-1, -1); + /* * create the ipc channel that the agent will listen for * requests on, and register it with the event handler so that diff --git a/usr/src/cmd/cmd-inet/usr.lib/dsvclockd/dsvclockd.c b/usr/src/cmd/cmd-inet/usr.lib/dsvclockd/dsvclockd.c index 38f51b92a2..b0684c958b 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/dsvclockd/dsvclockd.c +++ b/usr/src/cmd/cmd-inet/usr.lib/dsvclockd/dsvclockd.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -43,6 +42,7 @@ #include <assert.h> #include <stddef.h> #include <stdio.h> +#include <stdio_ext.h> #include <string.h> #include <unistd.h> #include <signal.h> @@ -192,6 +192,8 @@ main(int argc, char **argv) if (setrlimit(RLIMIT_NOFILE, &rl) == -1) dhcpmsg(MSG_ERR, "setrlimit failed"); + (void) enable_extended_FILE_stdio(-1, -1); + if (enumerate_dd(&modules, &nmodules) != DSVC_SUCCESS) { dhcpmsg(MSG_ERROR, "cannot enumerate public modules, exiting"); return (EXIT_FAILURE); diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/main.c b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/main.c index 6661e294a0..7555def813 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/main.c +++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/main.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -104,6 +103,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -437,6 +437,7 @@ duplicate IP address detection!\n\n")); strerror(errno)); return (err); } + (void) enable_extended_FILE_stdio(-1, -1); /* Detach console */ (void) setsid(); diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_client.c b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_client.c index 0f84bc8f66..9aae3f7e95 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_client.c +++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_client.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 1993-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -1147,6 +1147,8 @@ main(int argc, char *argv[]) (void) fprintf(stderr, "Cannot set open file limit: %s\n", strerror(errno)); } + (void) enable_extended_FILE_stdio(-1, -1); + if (argc < 5) { (void) fprintf(stderr, "%s <interface> <ether_addr> <protocol> " "<clients> [time] [desynch] [avg] [relayaddr]\n", argv[0]); diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_dstore.c b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_dstore.c index ea68bc135b..d96dec51e9 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_dstore.c +++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/tests/test_dstore.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright (c) 2001-2002 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> @@ -784,6 +784,8 @@ main(int c, char **v) (void) fprintf(stderr, "Cannot set open file limit: %s\n", strerror(errno)); } + (void) enable_extended_FILE_stdio(-1, -1); + if (c == 1) { (void) fprintf(stderr, "/*\n"\ diff --git a/usr/src/cmd/cmd-inet/usr.lib/inetd/inetd.c b/usr/src/cmd/cmd-inet/usr.lib/inetd/inetd.c index c0a1051f73..eefcc1d6b8 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/inetd/inetd.c +++ b/usr/src/cmd/cmd-inet/usr.lib/inetd/inetd.c @@ -88,6 +88,7 @@ #include <netdb.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <strings.h> #include <unistd.h> @@ -3790,6 +3791,8 @@ main(int argc, char *argv[]) msg_init(); /* setup logging */ + (void) enable_extended_FILE_stdio(-1, -1); + /* inetd invocation syntax is inetd [alt_conf_file] method_name */ switch (argc) { diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.rarpd.c b/usr/src/cmd/cmd-inet/usr.sbin/in.rarpd.c index 709aa39e03..f18bb2e0cf 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/in.rarpd.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/in.rarpd.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * 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 */ @@ -46,6 +45,7 @@ #include <unistd.h> #include <sys/resource.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdarg.h> #include <string.h> #include <ctype.h> @@ -217,6 +217,7 @@ main(int argc, char *argv[]) rl.rlim_max = RLIM_INFINITY; if (setrlimit(RLIMIT_NOFILE, &rl) == -1) syserr("setrlimit"); + (void) enable_extended_FILE_stdio(-1, -1); (void) openlog(cmdname, LOG_PID, LOG_DAEMON); diff --git a/usr/src/cmd/fs.d/autofs/autod_main.c b/usr/src/cmd/fs.d/autofs/autod_main.c index ce57a1fc80..a796b05836 100644 --- a/usr/src/cmd/fs.d/autofs/autod_main.c +++ b/usr/src/cmd/fs.d/autofs/autod_main.c @@ -26,6 +26,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> @@ -281,6 +282,7 @@ main(argc, argv) } closefrom(3); } + (void) enable_extended_FILE_stdio(-1, -1); } else { syslog(LOG_ERR, "unable to increase threads - continue with default"); diff --git a/usr/src/cmd/fs.d/cachefs/cfsd/cfsd_main.c b/usr/src/cmd/fs.d/cachefs/cfsd/cfsd_main.c index ee2551313c..4f1fdeb8d3 100644 --- a/usr/src/cmd/fs.d/cachefs/cfsd/cfsd_main.c +++ b/usr/src/cmd/fs.d/cachefs/cfsd/cfsd_main.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1998-2000, 2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <string.h> #include <errno.h> @@ -150,6 +150,7 @@ main(int argc, char **argv) dbug_leave("main"); return (1); } + (void) enable_extended_FILE_stdio(-1, -1); while ((c = getopt(argc, argv, "fmr:#:")) != EOF) { switch (c) { diff --git a/usr/src/cmd/fs.d/mount.c b/usr/src/cmd/fs.d/mount.c index f0c9e9c760..238ef3c00a 100644 --- a/usr/src/cmd/fs.d/mount.c +++ b/usr/src/cmd/fs.d/mount.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -24,13 +23,14 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.82 */ #include <stdio.h> +#include <stdio_ext.h> #include <limits.h> #include <fcntl.h> #include <unistd.h> @@ -920,6 +920,7 @@ parmount(char **mntlist, int count, char *fstype) if (setrlimit(RLIMIT_NOFILE, &rl) == 0) maxfd = (int)rl.rlim_cur; } + (void) enable_extended_FILE_stdio(-1, -1); /* * The parent needs to maintain 3 of its own fd's, plus 2 for diff --git a/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c b/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c index 818552f821..6dbb8053c4 100644 --- a/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c +++ b/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c @@ -57,6 +57,7 @@ #include <nfs/nfs_acl.h> #include <nfs/nfssys.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <signal.h> #include <netconfig.h> @@ -155,6 +156,8 @@ main(int ac, char *av[]) exit(1); } + (void) enable_extended_FILE_stdio(-1, -1); + /* * Read in the values from config file first before we check * commandline options so the options override the file. diff --git a/usr/src/cmd/fs.d/nfs/statd/sm_svc.c b/usr/src/cmd/fs.d/nfs/statd/sm_svc.c index a3dca0ca5f..bf0d9e2e0d 100644 --- a/usr/src/cmd/fs.d/nfs/statd/sm_svc.c +++ b/usr/src/cmd/fs.d/nfs/statd/sm_svc.c @@ -39,6 +39,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <ftw.h> #include <signal.h> @@ -536,6 +537,8 @@ main(int argc, char *argv[]) syslog(LOG_ERR, "statd: unable to set RLIMIT_NOFILE to %d\n", MAX_FDS); + (void) enable_extended_FILE_stdio(-1, -1); + if (!debug) { ppid = fork(); if (ppid == -1) { diff --git a/usr/src/cmd/fs.d/umount.c b/usr/src/cmd/fs.d/umount.c index 0139e68205..9d75f87544 100644 --- a/usr/src/cmd/fs.d/umount.c +++ b/usr/src/cmd/fs.d/umount.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <limits.h> #include <unistd.h> #include <stdlib.h> @@ -594,6 +594,7 @@ parumount(char **mntlist, int count) rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rl) == 0) maxfd = (int)rl.rlim_cur; + (void) enable_extended_FILE_stdio(-1, -1); } /* diff --git a/usr/src/cmd/gcore/gcore.c b/usr/src/cmd/gcore/gcore.c index b782d14c6b..4966fe0b8e 100644 --- a/usr/src/cmd/gcore/gcore.c +++ b/usr/src/cmd/gcore/gcore.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -28,6 +27,7 @@ #include <stdlib.h> #include <stdio.h> +#include <stdio_ext.h> #include <limits.h> #include <libproc.h> #include <sys/corectl.h> @@ -232,6 +232,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } for (i = 0; i < argc; i++) { diff --git a/usr/src/cmd/gss/gssd/gssd_proc.c b/usr/src/cmd/gss/gssd/gssd_proc.c index 1cb640ca89..9e69195a41 100644 --- a/usr/src/cmd/gss/gssd/gssd_proc.c +++ b/usr/src/cmd/gss/gssd/gssd_proc.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <unistd.h> #include <pwd.h> #include <grp.h> @@ -103,6 +103,7 @@ gssd_setup(char *arg) GSSD_FD_LIMIT : rl.rlim_max; if ((setrlimit(RLIMIT_NOFILE, &rl)) == 0) max_contexts = rl.rlim_cur * FDCACHE_PERCENTAGE; + (void) enable_extended_FILE_stdio(-1, -1); } gssd_ctx_slot_tbl = (struct gssd_ctx_slot *) diff --git a/usr/src/cmd/keyserv/keyserv.c b/usr/src/cmd/keyserv/keyserv.c index 1c5804142d..a998b605aa 100644 --- a/usr/src/cmd/keyserv/keyserv.c +++ b/usr/src/cmd/keyserv/keyserv.c @@ -47,6 +47,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> @@ -185,6 +186,7 @@ main(int argc, char *argv[]) limit = FD_SETSIZE; rl.rlim_cur = limit; (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); } __key_encryptsession_pk_LOCAL = &__key_encrypt_pk_2_svc; diff --git a/usr/src/cmd/krb5/kadmin/server/ovsec_kadmd.c b/usr/src/cmd/krb5/kadmin/server/ovsec_kadmd.c index cad8745566..9f8ab69426 100644 --- a/usr/src/cmd/krb5/kadmin/server/ovsec_kadmd.c +++ b/usr/src/cmd/krb5/kadmin/server/ovsec_kadmd.c @@ -33,6 +33,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <signal.h> #include <syslog.h> #include <sys/types.h> @@ -465,7 +466,8 @@ main(int argc, char *argv[]) if (getrlimit(RLIMIT_NOFILE, &rl) == 0) { rl.rlim_cur = rl.rlim_max = MAX(rl.rlim_max, FD_SETSIZE); - setrlimit(RLIMIT_NOFILE, &rl); + (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); } if (!nofork && (ret = daemon(0, 0))) { diff --git a/usr/src/cmd/lp/cmd/lpsched/lpsched.c b/usr/src/cmd/lp/cmd/lpsched/lpsched.c index c69e14434a..82d9a80204 100644 --- a/usr/src/cmd/lp/cmd/lpsched/lpsched.c +++ b/usr/src/cmd/lp/cmd/lpsched/lpsched.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -40,6 +39,7 @@ #include <sys/resource.h> #include <syslog.h> #include <locale.h> +#include <stdio_ext.h> int lock_fd = -1; @@ -199,6 +199,7 @@ SkipD: rlim.rlim_max = rlim.rlim_cur = fd_limit; setrlimit(RLIMIT_NOFILE, &rlim); getrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); syslog(LOG_DEBUG, "file descriptor resource limit is %d (~%d printers)", rlim.rlim_cur, (rlim.rlim_cur - 12)/ 2); diff --git a/usr/src/cmd/lvm/rpc.metamhd/mhd_init.c b/usr/src/cmd/lvm/rpc.metamhd/mhd_init.c index 97fc778ff4..7428d9213e 100644 --- a/usr/src/cmd/lvm/rpc.metamhd/mhd_init.c +++ b/usr/src/cmd/lvm/rpc.metamhd/mhd_init.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ #include <grp.h> #include <pwd.h> #include <signal.h> +#include <stdio_ext.h> #include <syslog.h> #include <netdir.h> #include <netdb.h> @@ -121,6 +121,7 @@ mhd_setup( rlimit.rlim_cur = rlimit.rlim_max = 1024; if (setrlimit(RLIMIT_NOFILE, &rlimit) != 0) return (mhd_error(mhep, errno, "setrlimit(RLIMIT_NOFILE)")); + (void) enable_extended_FILE_stdio(-1, -1); /* set default RT priority */ (void) memset(&pcinfo, 0, sizeof (pcinfo)); diff --git a/usr/src/cmd/mdb/common/mdb/mdb_proc.c b/usr/src/cmd/mdb/common/mdb/mdb_proc.c index 70fe311d0e..be50280b4c 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_proc.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_proc.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -98,6 +97,7 @@ #include <sys/stat.h> #include <termio.h> #include <signal.h> +#include <stdio_ext.h> #include <stdlib.h> #include <string.h> @@ -5176,6 +5176,7 @@ mdb_proc_tgt_create(mdb_tgt_t *t, int argc, const char *argv[]) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } /* diff --git a/usr/src/cmd/prstat/prutil.c b/usr/src/cmd/prstat/prutil.c index 4f2019989b..8785f6a107 100644 --- a/usr/src/cmd/prstat/prutil.c +++ b/usr/src/cmd/prstat/prutil.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -42,6 +41,7 @@ #include <stdlib.h> #include <stdarg.h> #include <stdio.h> +#include <stdio_ext.h> #include <errno.h> #include <ctype.h> #include <poll.h> @@ -252,6 +252,7 @@ Setrlimit() fd_limit = rlim.rlim_cur; rlim.rlim_max = MIN(rlim.rlim_max, RLIMIT_NOFILE_MAX); rlim.rlim_cur = rlim.rlim_max; + (void) enable_extended_FILE_stdio(-1, -1); if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) return (fd_limit); else diff --git a/usr/src/cmd/ptools/pcred/pcred.c b/usr/src/cmd/ptools/pcred/pcred.c index 62d4c7b94f..028666ab66 100644 --- a/usr/src/cmd/ptools/pcred/pcred.c +++ b/usr/src/cmd/ptools/pcred/pcred.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> @@ -127,6 +127,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } while (argc-- > 0) diff --git a/usr/src/cmd/ptools/pflags/pflags.c b/usr/src/cmd/ptools/pflags/pflags.c index 79a02f4bbd..cdb2feb645 100644 --- a/usr/src/cmd/ptools/pflags/pflags.c +++ b/usr/src/cmd/ptools/pflags/pflags.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -113,6 +113,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } while (argc-- > 0) diff --git a/usr/src/cmd/ptools/pldd/pldd.c b/usr/src/cmd/ptools/pldd/pldd.c index 75540e58c3..72f3c9bf8d 100644 --- a/usr/src/cmd/ptools/pldd/pldd.c +++ b/usr/src/cmd/ptools/pldd/pldd.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -86,6 +86,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } (void) proc_initstdio(); diff --git a/usr/src/cmd/ptools/pmap/pmap.c b/usr/src/cmd/ptools/pmap/pmap.c index d0d11de3c8..7d2234aced 100644 --- a/usr/src/cmd/ptools/pmap/pmap.c +++ b/usr/src/cmd/ptools/pmap/pmap.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -234,6 +234,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } while (argc-- > 0) { diff --git a/usr/src/cmd/ptools/ppriv/ppriv.c b/usr/src/cmd/ptools/ppriv/ppriv.c index 596ceed347..21d25b4b9f 100644 --- a/usr/src/cmd/ptools/ppriv/ppriv.c +++ b/usr/src/cmd/ptools/ppriv/ppriv.c @@ -28,6 +28,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> @@ -129,6 +130,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } if (exec) { diff --git a/usr/src/cmd/ptools/psig/psig.c b/usr/src/cmd/ptools/psig/psig.c index fe62cea5e0..70af35cb5e 100644 --- a/usr/src/cmd/ptools/psig/psig.c +++ b/usr/src/cmd/ptools/psig/psig.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> @@ -90,6 +90,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } for (; optind != argc; optind++) { diff --git a/usr/src/cmd/ptools/pstack/pstack.c b/usr/src/cmd/ptools/pstack/pstack.c index 39c99484e4..53f07e433c 100644 --- a/usr/src/cmd/ptools/pstack/pstack.c +++ b/usr/src/cmd/ptools/pstack/pstack.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -29,6 +28,7 @@ #include <sys/isa_defs.h> #include <stdio.h> +#include <stdio_ext.h> #include <fcntl.h> #include <ctype.h> #include <string.h> @@ -181,6 +181,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); + (void) enable_extended_FILE_stdio(-1, -1); } (void) proc_initstdio(); diff --git a/usr/src/cmd/ptools/pwait/pwait.c b/usr/src/cmd/ptools/pwait/pwait.c index 0d85200bab..0733c355cf 100644 --- a/usr/src/cmd/ptools/pwait/pwait.c +++ b/usr/src/cmd/ptools/pwait/pwait.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,14 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 1994-2000, 2002 Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <ctype.h> #include <stdlib.h> #include <unistd.h> @@ -93,6 +92,7 @@ main(int argc, char **argv) return (2); } } + (void) enable_extended_FILE_stdio(-1, -1); } pollfd = (struct pollfd *)malloc(argc*sizeof (struct pollfd)); diff --git a/usr/src/cmd/rcap/rcapd/rcapd_main.c b/usr/src/cmd/rcap/rcapd/rcapd_main.c index 98d2859e8f..ce6ac7381c 100644 --- a/usr/src/cmd/rcap/rcapd/rcapd_main.c +++ b/usr/src/cmd/rcap/rcapd/rcapd_main.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -55,6 +54,7 @@ #include <signal.h> #include <stdarg.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <strings.h> #include <time.h> @@ -1137,6 +1137,8 @@ main(int argc, char *argv[]) rl.rlim_cur = rl.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rl); } + (void) enable_extended_FILE_stdio(-1, -1); + if (getrlimit(RLIMIT_NOFILE, &rl) == 0) debug("fd limit: %lu\n", rl.rlim_cur); else diff --git a/usr/src/cmd/rcm_daemon/common/rcm_impl.h b/usr/src/cmd/rcm_daemon/common/rcm_impl.h index 3b70289ca3..5c6ca23e9f 100644 --- a/usr/src/cmd/rcm_daemon/common/rcm_impl.h +++ b/usr/src/cmd/rcm_daemon/common/rcm_impl.h @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -18,8 +17,9 @@ * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +35,7 @@ extern "C" { #include <assert.h> #include <stdarg.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <dirent.h> #include <dlfcn.h> diff --git a/usr/src/cmd/rcm_daemon/common/rcm_main.c b/usr/src/cmd/rcm_daemon/common/rcm_main.c index 6709f1d6a9..6d369a3615 100644 --- a/usr/src/cmd/rcm_daemon/common/rcm_main.c +++ b/usr/src/cmd/rcm_daemon/common/rcm_main.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -310,6 +309,8 @@ main(int argc, char **argv) prog++; } + (void) enable_extended_FILE_stdio(-1, -1); + /* * process arguments */ diff --git a/usr/src/cmd/rpcbind/rpcbind.c b/usr/src/cmd/rpcbind/rpcbind.c index 4a31ac0283..89d2d5714d 100644 --- a/usr/src/cmd/rpcbind/rpcbind.c +++ b/usr/src/cmd/rpcbind/rpcbind.c @@ -44,6 +44,7 @@ #include <dlfcn.h> #include <stdio.h> +#include <stdio_ext.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> @@ -153,6 +154,8 @@ main(int argc, char *argv[]) rl.rlim_cur = MAX_FILEDESC_LIMIT; setrlimit(RLIMIT_NOFILE, &rl); } + (void) enable_extended_FILE_stdio(-1, -1); + openlog("rpcbind", LOG_CONS, LOG_DAEMON); /* diff --git a/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_main.c b/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_main.c index 4a41a1dfcc..e7c6fb35a5 100644 --- a/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_main.c +++ b/usr/src/cmd/rpcsvc/nis/rpc.nisd/nis_main.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +34,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <rpc/rpc.h> #include <syslog.h> @@ -693,7 +693,6 @@ main(int argc, char *argv[]) int pid; int force = 0, mb; struct rlimit rl; - int minfd; int open_console = 0; struct sigaction sigactn; bool_t massage_dict; @@ -967,19 +966,15 @@ main(int argc, char *argv[]) } /* - * The data base functions use stdio. The stdio routines - * can only handle file descriptors up to 255. To make - * more of these low-numbered descriptors available, we - * bump up the file descriptor limit, and tell the RPC - * library (our other main source of file descriptors) to - * try to use descriptors numbered 256 and above. + * The database functions use stdio. Since we know + * the database routines are fileno() safe, we enable + * large file descriptors. */ - getrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); + rl.rlim_cur = RLIM_INFINITY; rl.rlim_max = RLIM_INFINITY; - setrlimit(RLIMIT_NOFILE, &rl); - minfd = 256; - rpc_control(__RPC_CLNT_MINFD_SET, (char *)&minfd); + (void) setrlimit(RLIMIT_NOFILE, &rl); if (nis_local_directory() == NULL) { if (debug) diff --git a/usr/src/cmd/rpcsvc/rwall.c b/usr/src/cmd/rpcsvc/rwall.c index 2984e41bcb..9efadba216 100644 --- a/usr/src/cmd/rpcsvc/rwall.c +++ b/usr/src/cmd/rpcsvc/rwall.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -18,8 +17,9 @@ * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + */ +/* + * 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 */ @@ -42,6 +42,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <sys/types.h> #include <stdlib.h> #include <unistd.h> @@ -89,6 +90,7 @@ main(int argc, char *argv[]) rl.rlim_cur = (rl.rlim_max < MAX_THREADS ? rl.rlim_max : MAX_THREADS); (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); } (void) gethostname(hostname, sizeof (hostname)); diff --git a/usr/src/cmd/smserverd/smediad.c b/usr/src/cmd/smserverd/smediad.c index c37c97402d..ae862bfb9c 100644 --- a/usr/src/cmd/smserverd/smediad.c +++ b/usr/src/cmd/smserverd/smediad.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <errno.h> #include <ctype.h> #include <syslog.h> @@ -2695,6 +2695,7 @@ init_server(void *argp) if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) { warning(gettext("setrlimit for fd's failed; %m\n")); } + (void) enable_extended_FILE_stdio(-1, -1); server_door = door_create(main_servproc, (void *)&server_data, 0); if (server_door == -1) { diff --git a/usr/src/cmd/svc/configd/configd.c b/usr/src/cmd/svc/configd/configd.c index 5632735834..8aa37492f1 100644 --- a/usr/src/cmd/svc/configd/configd.c +++ b/usr/src/cmd/svc/configd/configd.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,6 +36,7 @@ #include <signal.h> #include <stdarg.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <string.h> #include <syslog.h> @@ -664,6 +664,10 @@ main(int argc, char *argv[]) fd_new.rlim_max = fd_new.rlim_cur = CONFIGD_MAX_FDS; (void) setrlimit(RLIMIT_NOFILE, &fd_new); +#ifndef NATIVE_BUILD /* Allow building on snv_38 and earlier; remove later. */ + (void) enable_extended_FILE_stdio(-1, -1); +#endif + if ((ret = backend_init(dbpath, npdbpath, have_npdb)) != CONFIGD_EXIT_OKAY) exit(ret); diff --git a/usr/src/cmd/svc/startd/startd.c b/usr/src/cmd/svc/startd/startd.c index 97edf352ae..bb0a30f0de 100644 --- a/usr/src/cmd/svc/startd/startd.c +++ b/usr/src/cmd/svc/startd/startd.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -59,6 +58,7 @@ */ #include <stdio.h> +#include <stdio_ext.h> #include <sys/mnttab.h> /* uses FILE * without including stdio.h */ #include <alloca.h> #include <sys/mount.h> @@ -891,6 +891,8 @@ main(int argc, char *argv[]) if (optind != argc) usage(argv[0]); + (void) enable_extended_FILE_stdio(-1, -1); + if (daemonize) if (daemonize_start() < 0) uu_die("Can't daemonize\n"); diff --git a/usr/src/cmd/syslogd/syslogd.c b/usr/src/cmd/syslogd/syslogd.c index 58405d5d06..69e8f693f4 100644 --- a/usr/src/cmd/syslogd/syslogd.c +++ b/usr/src/cmd/syslogd/syslogd.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -65,6 +64,7 @@ #include <errno.h> #include <sys/types.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <ctype.h> #include <signal.h> @@ -407,6 +407,7 @@ main(int argc, char **argv) rlim.rlim_cur = rlim.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) logerror("Unable to increase file descriptor limit."); + (void) enable_extended_FILE_stdio(-1, -1); /* block all signals from all threads initially */ (void) sigfillset(&allsigs); diff --git a/usr/src/cmd/th_tools/th_define.c b/usr/src/cmd/th_tools/th_define.c index 6f139954a8..fb85c81e9a 100644 --- a/usr/src/cmd/th_tools/th_define.c +++ b/usr/src/cmd/th_tools/th_define.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -29,6 +28,7 @@ #include <sys/time_impl.h> #include <sys/wait.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <stdarg.h> #include <ctype.h> @@ -1627,6 +1627,7 @@ up_resources() if (setrlimit(RLIMIT_NOFILE, &rl) < 0) msg(0, "failed to set RLIMIT_NOFILE: %s\n", strerror(errno)); + (void) enable_extended_FILE_stdio(-1, -1); } if (getrlimit(RLIMIT_DATA, &rl) < 0) msg(0, "failed to obtain RLIMIT_DATA: %s\n", strerror(errno)); diff --git a/usr/src/cmd/truss/main.c b/usr/src/cmd/truss/main.c index 3101ea602e..9b2cf3f603 100644 --- a/usr/src/cmd/truss/main.c +++ b/usr/src/cmd/truss/main.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -30,6 +29,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> @@ -545,6 +545,7 @@ main(int argc, char *argv[]) rlim.rlim_cur = rlim.rlim_max; (void) setrlimit(RLIMIT_NOFILE, &rlim); } + (void) enable_extended_FILE_stdio(-1, -1); setoutput(ofd); /* establish truss output */ istty = isatty(1); diff --git a/usr/src/cmd/ttymon/ttymon.c b/usr/src/cmd/ttymon/ttymon.c index 309b2bec58..e7996b7fed 100644 --- a/usr/src/cmd/ttymon/ttymon.c +++ b/usr/src/cmd/ttymon/ttymon.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" +#include <stdio_ext.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> @@ -197,6 +197,8 @@ initialize() if (setrlimit(RLIMIT_NOFILE, &rlimit) == -1) fatal("setrlimit failed: %s", strerror(errno)); + (void) enable_extended_FILE_stdio(-1, -1); + Maxfiles = rlimit.rlim_cur; Maxfds = Maxfiles - FILE_RESERVED; diff --git a/usr/src/cmd/utmpd/utmpd.c b/usr/src/cmd/utmpd/utmpd.c index 7756e92549..252a0eb940 100644 --- a/usr/src/cmd/utmpd/utmpd.c +++ b/usr/src/cmd/utmpd/utmpd.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -56,6 +55,7 @@ #include <sys/types.h> #include <signal.h> #include <stdio.h> +#include <stdio_ext.h> #include <unistd.h> #include <utmpx.h> #include <errno.h> @@ -277,6 +277,8 @@ main(argc, argv) } else fatal("getrlimit returned failure"); + (void) enable_extended_FILE_stdio(-1, -1); + if ((WTMPXfd = open(WTMPX_FILE, O_RDONLY)) < 0) nonfatal("WARNING: unable to open " WTMPX_FILE "for update."); diff --git a/usr/src/cmd/volmgt/vold/vold_main.c b/usr/src/cmd/volmgt/vold/vold_main.c index 86ace216a7..39bac740e0 100644 --- a/usr/src/cmd/volmgt/vold/vold_main.c +++ b/usr/src/cmd/volmgt/vold/vold_main.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +34,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <syslog.h> @@ -244,6 +244,12 @@ main(int argc, char **argv) original_nofile = rlim.rlim_cur; rlim.rlim_cur = rlim.rlim_max; + /* + * Make sure fopen() still works if we open more than + * 255 devices or files. + */ + (void) enable_extended_FILE_stdio(-1, -1); + if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) { fatal("setrlimit for fd's failed; %m\n"); } diff --git a/usr/src/cmd/wbem/provider/tools/rds/rds.c b/usr/src/cmd/wbem/provider/tools/rds/rds.c index 9879176b1a..e1a24b085f 100644 --- a/usr/src/cmd/wbem/provider/tools/rds/rds.c +++ b/usr/src/cmd/wbem/provider/tools/rds/rds.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,13 +19,14 @@ * CDDL HEADER END */ /* - * Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <sys/time.h> #include <strings.h> @@ -941,6 +941,8 @@ main(int argc, char *argv[]) (void) signal(SIGTERM, sig_rds); (void) sigignore(SIGPIPE); + (void) enable_extended_FILE_stdio(-1, -1); + /* initialize the log mutex */ rv = pthread_mutex_init(&logLock, NULL); if (rv != 0) { diff --git a/usr/src/cmd/xntpd/xntpd/ntp_io.c b/usr/src/cmd/xntpd/xntpd/ntp_io.c index db7fe56ed6..50a06e38b9 100644 --- a/usr/src/cmd/xntpd/xntpd/ntp_io.c +++ b/usr/src/cmd/xntpd/xntpd/ntp_io.c @@ -1,5 +1,5 @@ /* - * Copyright 1996, 1999-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -16,6 +16,7 @@ #ifdef SYS_SOLARIS # define FD_SETSIZE 65536 +#include <stdio_ext.h> #endif #include <stdio.h> @@ -235,6 +236,9 @@ max_fdlimit() msyslog(LOG_ERR, "setrlimit(RLIMIT_NOFILE): %m"); return; } +#ifdef SYS_SOLARIS + enable_extended_FILE_stdio(-1, -1); +#endif } #endif diff --git a/usr/src/cmd/ypcmd/yp_b_svc.c b/usr/src/cmd/ypcmd/yp_b_svc.c index 4f5820f0e0..4bf45d9def 100644 --- a/usr/src/cmd/ypcmd/yp_b_svc.c +++ b/usr/src/cmd/ypcmd/yp_b_svc.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,6 +35,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <signal.h> #include <rpc/rpc.h> @@ -158,6 +158,8 @@ main(argc, argv) rl.rlim_cur = rl.rlim_max; setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); + openlog("ypbind", LOG_PID, LOG_DAEMON); /* diff --git a/usr/src/cmd/zdb/zdb.c b/usr/src/cmd/zdb/zdb.c index 2e8c7595aa..f283148ef8 100644 --- a/usr/src/cmd/zdb/zdb.c +++ b/usr/src/cmd/zdb/zdb.c @@ -26,6 +26,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <ctype.h> #include <sys/zfs_context.h> @@ -2051,6 +2052,7 @@ main(int argc, char **argv) vdev_knob_t *vk; (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); dprintf_setup(&argc, argv); diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c index d47601bc0c..c74f227bed 100644 --- a/usr/src/cmd/ztest/ztest.c +++ b/usr/src/cmd/ztest/ztest.c @@ -96,6 +96,7 @@ #include <sys/dsl_prop.h> #include <sys/refcount.h> #include <stdio.h> +#include <stdio_ext.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> @@ -3307,6 +3308,7 @@ main(int argc, char **argv) if (pid == 0) { /* child */ struct rlimit rl = { 1024, 1024 }; (void) setrlimit(RLIMIT_NOFILE, &rl); + (void) enable_extended_FILE_stdio(-1, -1); ztest_run(zopt_pool); exit(0); } diff --git a/usr/src/lib/abi/apptrace/common/apptrace.c b/usr/src/lib/abi/apptrace/common/apptrace.c index e886265766..d3a9700254 100644 --- a/usr/src/lib/abi/apptrace/common/apptrace.c +++ b/usr/src/lib/abi/apptrace/common/apptrace.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -299,7 +298,7 @@ la_version(uint_t version) exit(EXIT_FAILURE); } - if ((fp = fdopen(newfd, "w")) != NULL) { + if ((fp = fdopen(newfd, "wF")) != NULL) { ABISTREAM = fp; } else { (void) fprintf(stderr, diff --git a/usr/src/lib/gss_mechs/mech_dummy/mech/dmech.c b/usr/src/lib/gss_mechs/mech_dummy/mech/dmech.c index 48987744f7..205c409c1b 100644 --- a/usr/src/lib/gss_mechs/mech_dummy/mech/dmech.c +++ b/usr/src/lib/gss_mechs/mech_dummy/mech/dmech.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -22,7 +21,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * A module that implements a dummy security mechanism. @@ -186,7 +185,7 @@ const gss_OID oid; return (NULL); } - fp = fopen("/etc/dummy_mech_token.conf", "r"); + fp = fopen("/etc/dummy_mech_token.conf", "rF"); if (fp == NULL) { fprintf(stderr, "dummy_mech.conf is not found.\n"); fprintf(stderr, "Setting number tokens exchanged to 1\n"); diff --git a/usr/src/lib/gss_mechs/mech_krb5/krb5/keytab/kt_file.c b/usr/src/lib/gss_mechs/mech_krb5/krb5/keytab/kt_file.c index e2feb149d0..16a9b51fca 100644 --- a/usr/src/lib/gss_mechs/mech_krb5/krb5/keytab/kt_file.c +++ b/usr/src/lib/gss_mechs/mech_krb5/krb5/keytab/kt_file.c @@ -1,5 +1,5 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1061,11 +1061,11 @@ typedef krb5_int16 krb5_kt_vno; #define xfread(a, b, c, d) fread((char *)a, b, (unsigned) c, d) #ifdef ANSI_STDIO -static char *const fopen_mode_rbplus= "rb+"; -static char *const fopen_mode_rb = "rb"; +static char *const fopen_mode_rbplus= "rb+F"; +static char *const fopen_mode_rb = "rbF"; #else -static char *const fopen_mode_rbplus= "r+"; -static char *const fopen_mode_rb = "r"; +static char *const fopen_mode_rbplus= "r+F"; +static char *const fopen_mode_rb = "rF"; #endif static krb5_error_code diff --git a/usr/src/lib/gss_mechs/mech_krb5/krb5/keytab/kt_srvtab.c b/usr/src/lib/gss_mechs/mech_krb5/krb5/keytab/kt_srvtab.c index b312acc4ea..0315798832 100644 --- a/usr/src/lib/gss_mechs/mech_krb5/krb5/keytab/kt_srvtab.c +++ b/usr/src/lib/gss_mechs/mech_krb5/krb5/keytab/kt_srvtab.c @@ -1,3 +1,7 @@ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #pragma ident "%Z%%M% %I% %E% SMI" /* @@ -122,7 +126,7 @@ krb5_ktsrvtab_resolve(krb5_context context, const char *name, krb5_keytab *id) FILE *fp; /* Make sure we can open the srvtab file for reading. */ - fp = fopen(name, "r"); + fp = fopen(name, "rF"); if (!fp) return(errno); fclose(fp); @@ -387,9 +391,9 @@ const struct _krb5_kt_ops krb5_kts_ops = { #include <stdio.h> #ifdef ANSI_STDIO -#define READ_MODE "rb" +#define READ_MODE "rbF" #else -#define READ_MODE "r" +#define READ_MODE "rF" #endif /* The maximum sizes for V4 aname, realm, sname, and instance +1 */ diff --git a/usr/src/lib/gss_mechs/mech_krb5/krb5/os/kuserok.c b/usr/src/lib/gss_mechs/mech_krb5/krb5/os/kuserok.c index f1abe171ff..cde2b285ba 100644 --- a/usr/src/lib/gss_mechs/mech_krb5/krb5/os/kuserok.c +++ b/usr/src/lib/gss_mechs/mech_krb5/krb5/os/kuserok.c @@ -1,5 +1,5 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -308,7 +308,7 @@ krb5_kuserok(krb5_context context, krb5_principal principal, const char *luser) if (krb5_move_ccache(context, principal, pwd)) return (FALSE); return (TRUE); - } + } } } @@ -316,7 +316,7 @@ krb5_kuserok(krb5_context context, krb5_principal principal, const char *luser) return(FALSE); /* no hope of matching */ /* open ~/.k5login */ - if ((fp = fopen(pbuf, "r")) == NULL) { + if ((fp = fopen(pbuf, "rF")) == NULL) { free(princname); return(FALSE); } @@ -359,7 +359,7 @@ krb5_kuserok(krb5_context context, krb5_principal principal, const char *luser) } OM_uint32 -krb5_gss_userok(void *ctxt, +krb5_gss_userok(void *ctxt, OM_uint32 *minor, const gss_name_t pname, const char *user, @@ -370,12 +370,12 @@ krb5_gss_userok(void *ctxt, if (minor == NULL || user_ok == NULL) return (GSS_S_CALL_INACCESSIBLE_WRITE); - + *user_ok = 0; if (! kg_validate_name(pname)) { - *minor = (OM_uint32) G_VALIDATE_FAILED; - return (GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME); + *minor = (OM_uint32) G_VALIDATE_FAILED; + return (GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME); } if (krb5_kuserok(ctxt, (krb5_principal) pname, user)) { diff --git a/usr/src/lib/gss_mechs/mech_krb5/profile/prof_file.c b/usr/src/lib/gss_mechs/mech_krb5/profile/prof_file.c index 4e55c269a1..3b33f25ccf 100644 --- a/usr/src/lib/gss_mechs/mech_krb5/profile/prof_file.c +++ b/usr/src/lib/gss_mechs/mech_krb5/profile/prof_file.c @@ -1,3 +1,7 @@ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #pragma ident "%Z%%M% %I% %E% SMI" /* * prof_file.c ---- routines that manipulate an individual profile file. @@ -115,7 +119,7 @@ static int rw_access(const_profile_filespec_t filespec) */ FILE *f; - f = fopen(filespec, "r+"); + f = fopen(filespec, "r+F"); if (f) { fclose(f); return 1; @@ -139,7 +143,7 @@ static int r_access(const_profile_filespec_t filespec) */ FILE *f; - f = fopen(filespec, "r"); + f = fopen(filespec, "rF"); if (f) { fclose(f); return 1; @@ -357,7 +361,7 @@ errcode_t profile_update_file_data(prf_data_t data) } #endif errno = 0; - f = fopen(data->filespec, "r"); + f = fopen(data->filespec, "rF"); if (f == NULL) { retval = errno; k5_mutex_unlock(&data->lock); @@ -415,7 +419,7 @@ static errcode_t write_data_to_file(prf_data_t data, const char *outfile, errno = 0; - f = fopen(new_file, "w"); + f = fopen(new_file, "wF"); if (!f) { retval = errno; if (retval == 0) diff --git a/usr/src/lib/krb5/db2/btree/bt_debug.c b/usr/src/lib/krb5/db2/btree/bt_debug.c index b167d698e8..b840dd341b 100644 --- a/usr/src/lib/krb5/db2/btree/bt_debug.c +++ b/usr/src/lib/krb5/db2/btree/bt_debug.c @@ -1,5 +1,5 @@ /* - * Copyright 2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -74,7 +74,7 @@ __bt_dinit() first = 0; #ifndef TRACE_TO_STDERR - if ((tracefp = fopen("/tmp/__bt_debug", "w")) != NULL) + if ((tracefp = fopen("/tmp/__bt_debug", "wF")) != NULL) return; #endif tracefp = stderr; diff --git a/usr/src/lib/krb5/kadm5/clnt/logger.c b/usr/src/lib/krb5/kadm5/clnt/logger.c index 646c8b00d2..790b6f6a8f 100644 --- a/usr/src/lib/krb5/kadm5/clnt/logger.c +++ b/usr/src/lib/krb5/kadm5/clnt/logger.c @@ -23,7 +23,7 @@ */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -578,7 +578,7 @@ krb5_klog_init(kcontext, ename, whoami, do_com_err) */ if (cp[4] == ':' || cp[4] == '=') { log_control.log_entries[i].lfu_fopen_mode = - (cp[4] == ':') ? "a+" : "w"; + (cp[4] == ':') ? "a+F" : "wF"; f = fopen(&cp[5], log_control.log_entries[i].lfu_fopen_mode); if (f) { @@ -773,7 +773,7 @@ krb5_klog_init(kcontext, ename, whoami, do_com_err) */ else if (!strcasecmp(cp, "STDERR")) { if (log_control.log_entries[i].lfu_filep = - fdopen(fileno(stderr), "a+")) { + fdopen(fileno(stderr), "a+F")) { log_control.log_entries[i].log_type = K_LOG_STDERR; log_control.log_entries[i].lfu_fname = "standard error"; @@ -784,7 +784,7 @@ krb5_klog_init(kcontext, ename, whoami, do_com_err) */ else if (!strcasecmp(cp, "CONSOLE")) { if (log_control.log_entries[i].ldu_filep = - CONSOLE_OPEN("a+")) { + CONSOLE_OPEN("a+F")) { log_control.log_entries[i].log_type = K_LOG_CONSOLE; log_control.log_entries[i].ldu_devname = "console"; } @@ -798,7 +798,7 @@ krb5_klog_init(kcontext, ename, whoami, do_com_err) */ if (cp[6] == '=') { if (log_control.log_entries[i].ldu_filep = - DEVICE_OPEN(&cp[7], "w")) { + DEVICE_OPEN(&cp[7], "wF")) { log_control.log_entries[i].log_type = K_LOG_DEVICE; log_control.log_entries[i].ldu_devname = &cp[7]; } diff --git a/usr/src/lib/krb5/kadm5/get_admhst.c b/usr/src/lib/krb5/kadm5/get_admhst.c index 3a66d75ff6..577abd2b8d 100644 --- a/usr/src/lib/krb5/kadm5/get_admhst.c +++ b/usr/src/lib/krb5/kadm5/get_admhst.c @@ -1,3 +1,7 @@ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #pragma ident "%Z%%M% %I% %E% SMI" /* @@ -72,7 +76,7 @@ krb5_get_admhst(char *h, char *r, int n) return ret; r = realm; } - if ((cnffile = fopen(DEFAULT_CONFIG_FILENAME, "r")) == NULL) { + if ((cnffile = fopen(DEFAULT_CONFIG_FILENAME, "rF")) == NULL) { return(0); } if (fgets(linebuf, BUFSIZ, cnffile) == NULL) { diff --git a/usr/src/lib/krb5/kadm5/srv/adb_openclose.c b/usr/src/lib/krb5/kadm5/srv/adb_openclose.c index 6b1e5e3bb8..b3a0fedde2 100644 --- a/usr/src/lib/krb5/kadm5/srv/adb_openclose.c +++ b/usr/src/lib/krb5/kadm5/srv/adb_openclose.c @@ -1,3 +1,7 @@ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #pragma ident "%Z%%M% %I% %E% SMI" /* @@ -207,12 +211,12 @@ osa_adb_ret_t osa_adb_init_db(osa_adb_db_t *dbp, char *filename, * POSIX systems */ lockp->lockinfo.filename = strdup(lockfilename); - if ((lockp->lockinfo.lockfile = fopen(lockfilename, "r+")) == NULL) { + if ((lockp->lockinfo.lockfile = fopen(lockfilename, "r+F")) == NULL) { /* * maybe someone took away write permission so we could only * get shared locks? */ - if ((lockp->lockinfo.lockfile = fopen(lockfilename, "r")) + if ((lockp->lockinfo.lockfile = fopen(lockfilename, "rF")) == NULL) { free(db); return OSA_ADB_NOLOCKFILE; @@ -363,7 +367,7 @@ osa_adb_ret_t osa_adb_release_lock(osa_adb_db_t db) /* now we need to create the file since it does not exist */ fd = THREEPARAMOPEN(db->lock->filename,O_RDWR | O_CREAT | O_EXCL, 0600); - if ((db->lock->lockfile = fdopen(fd, "w+")) == NULL) + if ((db->lock->lockfile = fdopen(fd, "w+F")) == NULL) return OSA_ADB_NOLOCKFILE; } else if (ret = krb5_lock_file(db->lock->context, fileno(db->lock->lockfile), diff --git a/usr/src/lib/krb5/kadm5/srv/logger.c b/usr/src/lib/krb5/kadm5/srv/logger.c index 8c2ecbcabe..d94083500d 100644 --- a/usr/src/lib/krb5/kadm5/srv/logger.c +++ b/usr/src/lib/krb5/kadm5/srv/logger.c @@ -1,5 +1,5 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -587,7 +587,7 @@ krb5_klog_init(kcontext, ename, whoami, do_com_err) */ if (cp[4] == ':' || cp[4] == '=') { log_control.log_entries[i].lfu_fopen_mode = - (cp[4] == ':') ? "a+" : "w"; + (cp[4] == ':') ? "a+F" : "wF"; old_umask = umask(077); f = fopen(&cp[5], log_control.log_entries[i].lfu_fopen_mode); @@ -776,7 +776,7 @@ krb5_klog_init(kcontext, ename, whoami, do_com_err) */ else if (!strcasecmp(cp, "STDERR")) { if (log_control.log_entries[i].lfu_filep = - fdopen(fileno(stderr), "a+")) { + fdopen(fileno(stderr), "a+F")) { log_control.log_entries[i].log_type = K_LOG_STDERR; log_control.log_entries[i].lfu_fname = "standard error"; @@ -787,7 +787,7 @@ krb5_klog_init(kcontext, ename, whoami, do_com_err) */ else if (!strcasecmp(cp, "CONSOLE")) { if (log_control.log_entries[i].ldu_filep = - CONSOLE_OPEN("a+")) { + CONSOLE_OPEN("a+F")) { log_control.log_entries[i].log_type = K_LOG_CONSOLE; log_control.log_entries[i].ldu_devname = "console"; } @@ -801,7 +801,7 @@ krb5_klog_init(kcontext, ename, whoami, do_com_err) */ if (cp[6] == '=') { if (log_control.log_entries[i].ldu_filep = - DEVICE_OPEN(&cp[7], "w")) { + DEVICE_OPEN(&cp[7], "wF")) { log_control.log_entries[i].log_type = K_LOG_DEVICE; log_control.log_entries[i].ldu_devname = &cp[7]; } @@ -1087,7 +1087,7 @@ krb5_context kcontext; * In case the old logfile did not get moved out of the * way, open for append to prevent squashing the old logs. */ - f = fopen(log_control.log_entries[lindex].lfu_fname, "a+"); + f = fopen(log_control.log_entries[lindex].lfu_fname, "a+F"); if (f) { log_control.log_entries[lindex].lfu_filep = f; } else { diff --git a/usr/src/lib/krb5/kadm5/srv/server_acl.c b/usr/src/lib/krb5/kadm5/srv/server_acl.c index c561cf75a0..fe31b9312d 100644 --- a/usr/src/lib/krb5/kadm5/srv/server_acl.c +++ b/usr/src/lib/krb5/kadm5/srv/server_acl.c @@ -1,5 +1,5 @@ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -514,7 +514,7 @@ acl_load_acl_file() DPRINT(DEBUG_CALLS, acl_debug_level, ("* acl_load_acl_file()\n")); /* Open the ACL file for read */ - if (afp = fopen(acl_acl_file, "r")) { + if (afp = fopen(acl_acl_file, "rF")) { alineno = 1; aentpp = &acl_list_head; diff --git a/usr/src/lib/krb5/kdb/fetch_mkey.c b/usr/src/lib/krb5/kdb/fetch_mkey.c index c4c7535038..8a34949597 100644 --- a/usr/src/lib/krb5/kdb/fetch_mkey.c +++ b/usr/src/lib/krb5/kdb/fetch_mkey.c @@ -149,9 +149,9 @@ krb5_db_fetch_mkey(context, mname, etype, fromkeyboard, twice, keyfile, defkeyfile[sizeof(defkeyfile) - 1] = '\0'; #ifdef ANSI_STDIO - if (!(kf = fopen((keyfile) ? keyfile : defkeyfile, "rb"))) + if (!(kf = fopen((keyfile) ? keyfile : defkeyfile, "rbF"))) #else - if (!(kf = fopen((keyfile) ? keyfile : defkeyfile, "r"))) + if (!(kf = fopen((keyfile) ? keyfile : defkeyfile, "rF"))) #endif return KRB5_KDB_CANTREAD_STORED; if (fread((krb5_pointer) &enctype, 2, 1, kf) != 1) { diff --git a/usr/src/lib/krb5/kdb/store_mkey.c b/usr/src/lib/krb5/kdb/store_mkey.c index 28277ab900..196d5e7287 100644 --- a/usr/src/lib/krb5/kdb/store_mkey.c +++ b/usr/src/lib/krb5/kdb/store_mkey.c @@ -1,3 +1,7 @@ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #pragma ident "%Z%%M% %I% %E% SMI" /* @@ -78,9 +82,9 @@ krb5_db_store_mkey(context, keyfile, mname, key) oumask = umask(077); #endif #ifdef ANSI_STDIO - if (!(kf = fopen(keyfile, "wb"))) + if (!(kf = fopen(keyfile, "wbF"))) #else - if (!(kf = fopen(keyfile, "w"))) + if (!(kf = fopen(keyfile, "wF"))) #endif { #if HAVE_UMASK diff --git a/usr/src/lib/krb5/ss/mk_cmds.c b/usr/src/lib/krb5/ss/mk_cmds.c index 8b2a25a010..858ebc4e6c 100644 --- a/usr/src/lib/krb5/ss/mk_cmds.c +++ b/usr/src/lib/krb5/ss/mk_cmds.c @@ -1,3 +1,7 @@ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #pragma ident "%Z%%M% %I% %E% SMI" /* @@ -55,7 +59,7 @@ int main(argc, argv) p = strrchr(p, '.'); if (p == (char *)NULL || strcmp(p, ".ct")) strcat(path, ".ct"); - yyin = fopen(path, "r"); + yyin = fopen(path, "rF"); if (!yyin) { perror(path); exit(1); @@ -68,7 +72,7 @@ int main(argc, argv) strcat(c_file, ".c"); *p = '.'; - output_file = fopen(c_file, "w+"); + output_file = fopen(c_file, "w+F"); if (!output_file) { perror(c_file); exit(1); diff --git a/usr/src/lib/libbsm/common/audit_class.c b/usr/src/lib/libbsm/common/audit_class.c index f7c10f46a5..d727a6b033 100644 --- a/usr/src/lib/libbsm/common/audit_class.c +++ b/usr/src/lib/libbsm/common/audit_class.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -127,7 +126,7 @@ getauclassent_r(au_class_entry) /* open audit class file if it isn't already */ _mutex_lock(&mutex_classfile); if (!au_class_file) { - if (!(au_class_file = fopen(au_class_fname, "r"))) { + if (!(au_class_file = fopen(au_class_fname, "rF"))) { _mutex_unlock(&mutex_classfile); return ((au_class_ent_t *)0); } @@ -250,7 +249,7 @@ xcacheauclass(result, class_name, class_no, flags) if (called_once == 0) { /* Count number of lines in the class file */ - if ((fp = fopen(au_class_fname, "r")) == NULL) { + if ((fp = fopen(au_class_fname, "rF")) == NULL) { _mutex_unlock(&mutex_classcache); return (-1); } diff --git a/usr/src/lib/libbsm/common/audit_event.c b/usr/src/lib/libbsm/common/audit_event.c index 1964c5f0fe..7f66ecb803 100644 --- a/usr/src/lib/libbsm/common/audit_event.c +++ b/usr/src/lib/libbsm/common/audit_event.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -26,7 +25,7 @@ static char sccsid[] = "%Z%%M% %I% %E% SMI"; #endif /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -132,7 +131,7 @@ getauevent_r(au_event_entry) /* open audit event file if it isn't already */ _mutex_lock(&mutex_eventfile); if (!au_event_file) - if (!(au_event_file = fopen(au_event_fname, "r"))) { + if (!(au_event_file = fopen(au_event_fname, "rF"))) { _mutex_unlock(&mutex_eventfile); return ((au_event_ent_t *)0); } @@ -328,7 +327,7 @@ cacheauevent(result, event_number) if (called_once == 0) { /* Count number of lines in the events file */ - if ((fp = fopen(au_event_fname, "r")) == NULL) { + if ((fp = fopen(au_event_fname, "rF")) == NULL) { _mutex_unlock(&mutex_eventcache); return (-1); } diff --git a/usr/src/lib/libbsm/common/audit_plugin.c b/usr/src/lib/libbsm/common/audit_plugin.c index 3bac9b0279..6cdeb70587 100644 --- a/usr/src/lib/libbsm/common/audit_plugin.c +++ b/usr/src/lib/libbsm/common/audit_plugin.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * private interfaces for auditd plugins and auditd. @@ -272,7 +271,7 @@ __auditd_debug_file_open() { if (fp != NULL) return (fp); - if ((fp = fopen("/var/audit/dump", "a")) == NULL) + if ((fp = fopen("/var/audit/dump", "aF")) == NULL) (void) fprintf(stderr, "failed to open debug file: %s\n", strerror(errno)); diff --git a/usr/src/lib/libbsm/common/audit_user.c b/usr/src/lib/libbsm/common/audit_user.c index a8f55d82e6..27c8967162 100644 --- a/usr/src/lib/libbsm/common/audit_user.c +++ b/usr/src/lib/libbsm/common/audit_user.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -142,7 +141,7 @@ getauuserent_r(au_user_ent_t *au_user_entry) /* open audit user file if it isn't already */ if (!au_user_file) - if (!(au_user_file = fopen(au_user_fname, "r"))) { + if (!(au_user_file = fopen(au_user_fname, "rF"))) { _mutex_unlock(&mutex_userfile); return (NULL); } diff --git a/usr/src/lib/libbsm/common/devalloc.c b/usr/src/lib/libbsm/common/devalloc.c index 4541191349..08db0f0325 100644 --- a/usr/src/lib/libbsm/common/devalloc.c +++ b/usr/src/lib/libbsm/common/devalloc.c @@ -97,7 +97,7 @@ da_check_logindevperm(char *devname) (void) close(fd); return (0); } - if ((fp = fdopen(fd, "r")) == NULL) { + if ((fp = fdopen(fd, "rF")) == NULL) { free(fbuf); (void) close(fd); return (0); @@ -179,7 +179,6 @@ _da_read_file(char *fname, char **fbuf, time_t *ftime, rwlock_t *flock, int fd = -1; int fsize = 0; time_t newtime; - FILE *fp = NULL; struct stat f_stat; if (flag & DA_FORCE) @@ -204,11 +203,10 @@ _da_read_file(char *fname, char **fbuf, time_t *ftime, rwlock_t *flock, */ if (rw_wrlock(flock) != 0) return (-1); - if ((fp = fopen(fname, "r")) == NULL) { + if ((fd = open(fname, O_RDONLY)) == -1) { (void) rw_unlock(flock); return (-1); } - fd = fileno(fp); if (*fbuf != NULL) { free(*fbuf); *fbuf = NULL; @@ -913,10 +911,10 @@ da_open_devdb(char *rootdir, FILE **dafp, FILE **dmfp, int flag) if (flag & DA_RDWR) { oflag = DA_RDWR; - fmode = "r+"; + fmode = "r+F"; } else if (flag & DA_RDONLY) { oflag = DA_RDONLY; - fmode = "r"; + fmode = "rF"; } if ((lockfd = _da_lock_devdb(rootdir)) == -1) diff --git a/usr/src/lib/libbsm/common/getacinfo.c b/usr/src/lib/libbsm/common/getacinfo.c index a79ffd7ca2..1a117301b1 100644 --- a/usr/src/lib/libbsm/common/getacinfo.c +++ b/usr/src/lib/libbsm/common/getacinfo.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -109,7 +108,7 @@ getacdir(dir, len) /* open file if it is not already opened */ _mutex_lock(&mutex_acf); - if (acf == NULL && (acf = fopen(AUDIT_CTRL, "r")) == NULL) + if (acf == NULL && (acf = fopen(AUDIT_CTRL, "rF")) == NULL) retstat = ERROR; else if (LASTOP != DIROP && DIRINIT == 1) { retstat = REW_WARN; @@ -205,7 +204,7 @@ getacmin(min_val) /* open file if it is not already opened */ _mutex_lock(&mutex_acf); - if (acf == NULL && (acf = fopen(AUDIT_CTRL, "r")) == NULL) + if (acf == NULL && (acf = fopen(AUDIT_CTRL, "rF")) == NULL) retstat = ERROR; else rewind(acf); @@ -283,7 +282,7 @@ getacflg(auditstring, len) /* open file if it is not already opened */ _mutex_lock(&mutex_acf); - if (acf == NULL && (acf = fopen(AUDIT_CTRL, "r")) == NULL) + if (acf == NULL && (acf = fopen(AUDIT_CTRL, "rF")) == NULL) retstat = ERROR; else rewind(acf); @@ -376,7 +375,7 @@ getacna(auditstring, len) /* open file if it is not already opened */ _mutex_lock(&mutex_acf); - if (acf == NULL && (acf = fopen(AUDIT_CTRL, "r")) == NULL) { + if (acf == NULL && (acf = fopen(AUDIT_CTRL, "rF")) == NULL) { retstat = ERROR; } else { rewind(acf); @@ -455,7 +454,7 @@ setac() { _mutex_lock(&mutex_acf); if (acf == NULL) - acf = fopen(AUDIT_CTRL, "r"); + acf = fopen(AUDIT_CTRL, "rF"); else rewind(acf); LASTOP = DIROP; diff --git a/usr/src/lib/libbsm/common/getacval.c b/usr/src/lib/libbsm/common/getacval.c index 6feeaf813f..6372ee6291 100644 --- a/usr/src/lib/libbsm/common/getacval.c +++ b/usr/src/lib/libbsm/common/getacval.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -482,7 +481,7 @@ _openac(char *filepath) free(context); return (NULL); } - context->fp = fopen(filepath, "r"); + context->fp = fopen(filepath, "rF"); if (context->fp == NULL) { free(context->file); free(context); diff --git a/usr/src/lib/libbsm/common/getdadefs.c b/usr/src/lib/libbsm/common/getdadefs.c index 3f62566293..537713f6fd 100644 --- a/usr/src/lib/libbsm/common/getdadefs.c +++ b/usr/src/lib/libbsm/common/getdadefs.c @@ -91,7 +91,7 @@ setdadefent(void) if (_df == NULL) return; if (dadeff == NULL) - dadeff = fopen(DADEFS_FILE, "r"); + dadeff = fopen(DADEFS_FILE, "rF"); else rewind(dadeff); } diff --git a/usr/src/lib/libbsm/common/getdaent.c b/usr/src/lib/libbsm/common/getdaent.c index 2deb5a65d6..fe83e7b1b2 100644 --- a/usr/src/lib/libbsm/common/getdaent.c +++ b/usr/src/lib/libbsm/common/getdaent.c @@ -238,7 +238,7 @@ setdaent(void) if (_da == NULL) return; if (daf == NULL) - daf = fopen(DEVALLOC_FILE, "r"); + daf = fopen(DEVALLOC_FILE, "rF"); else rewind(daf); } diff --git a/usr/src/lib/libbsm/common/getdment.c b/usr/src/lib/libbsm/common/getdment.c index 2b13f5bc6e..0bf82e86e3 100644 --- a/usr/src/lib/libbsm/common/getdment.c +++ b/usr/src/lib/libbsm/common/getdment.c @@ -93,7 +93,7 @@ setdmapent(void) if (_dmap == NULL) return; if (dmapf == NULL) - dmapf = fopen(DEVMAPS_FILE, "r"); + dmapf = fopen(DEVMAPS_FILE, "rF"); else rewind(dmapf); } @@ -401,7 +401,7 @@ dmap_dlexpand(devmap_t *dmp) (void) strcpy(tmplist, dmp->dmap_devlist + 1); if ((cp = strchr(tmplist, '`')) != NULL) *cp = '\0'; - if ((expansion = popen(tmplist, "r")) == NULL) + if ((expansion = popen(tmplist, "rF")) == NULL) return (NULL); count = fread(tmplist, 1, sizeof (tmplist) - 1, expansion); (void) pclose(expansion); diff --git a/usr/src/lib/libc/inc/nsswitch_priv.h b/usr/src/lib/libc/inc/nsswitch_priv.h index 4dc8027dd0..70baa39fb3 100644 --- a/usr/src/lib/libc/inc/nsswitch_priv.h +++ b/usr/src/lib/libc/inc/nsswitch_priv.h @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -94,23 +93,6 @@ extern "C" { #define __NSW_STR_FOREVER "forever" #ifdef __NSS_PRIVATE_INTERFACE -#define __NSL_FILE_BUF_SIZE 1024 - -/* 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. We support only read mode access in */ -/* this private stdio implementation. */ - -typedef struct { - unsigned char *_nsl_base; /* __NSL_FILE_BUF_SIZE */ - int _nsl_file; /* an integer datatype to hold */ - /* the file pointer */ - - int _nsl_cnt; /* number of bytes available to read */ - /* in the buffer */ - - unsigned char *_nsl_ptr; /* location of next byte in buffer to read */ -} __NSL_FILE; struct __nsw_lookup_v1 { char *service_name; @@ -142,10 +124,6 @@ struct __nsw_switchconfig_v1 *__nsw_getconfig_v1 int __nsw_freeconfig_v1(struct __nsw_switchconfig_v1 *); action_t __nsw_extended_action_v1(struct __nsw_lookup_v1 *, int); -extern __NSL_FILE *__nsl_c_fopen(const char *filename, const char *mode); -extern int __nsl_c_fclose(__NSL_FILE *stream); -extern char *__nsl_c_fgets(char *s, int n, __NSL_FILE *stream); - #endif /* __NSS_PRIVATE_INTERFACE */ #ifdef __cplusplus diff --git a/usr/src/lib/libc/port/gen/crypt.c b/usr/src/lib/libc/port/gen/crypt.c index f24c732924..52286d4822 100644 --- a/usr/src/lib/libc/port/gen/crypt.c +++ b/usr/src/lib/libc/port/gen/crypt.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -374,7 +373,7 @@ getcryptpolicy(void) char line[BUFSIZ]; struct crypt_policy_s *policy; - if ((pconf = fopen(POLICY_CONF_FILE, "r")) == NULL) { + if ((pconf = fopen(POLICY_CONF_FILE, "rF")) == NULL) { return (NULL); } @@ -539,7 +538,7 @@ getalgbyname(const char *algname, boolean_t *found) goto cleanup; } - if ((fconf = fdopen(configfd, "r")) == NULL) { + if ((fconf = fdopen(configfd, "rF")) == NULL) { syslog(LOG_ALERT, "crypt: fdopen(%d) failed: %s", configfd, strerror(errno)); goto cleanup; diff --git a/usr/src/lib/libc/port/gen/fmtmsg.c b/usr/src/lib/libc/port/gen/fmtmsg.c index 0d55d9f6b5..50a0fdbabb 100644 --- a/usr/src/lib/libc/port/gen/fmtmsg.c +++ b/usr/src/lib/libc/port/gen/fmtmsg.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1150,7 +1149,7 @@ const char *text, const char *action, const char *tag) /* Write the message to the console if requested */ if (class & MM_CONSOLE) { - if ((console = fopen(CONNAME, "w")) != NULL) { + if ((console = fopen(CONNAME, "wF")) != NULL) { clearerr(console); (void) fputs(message2, console); if (ferror(console)) diff --git a/usr/src/lib/libc/port/gen/getgrnam_r.c b/usr/src/lib/libc/port/gen/getgrnam_r.c index 8dc3d85111..adaa8ce918 100644 --- a/usr/src/lib/libc/port/gen/getgrnam_r.c +++ b/usr/src/lib/libc/port/gen/getgrnam_r.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -48,10 +47,6 @@ #include <sys/param.h> #include <sys/mman.h> -#define __NSS_PRIVATE_INTERFACE -#include "nsswitch_priv.h" -#undef __NSS_PRIVATE_INTERFACE - extern int _getgroupsbymember(const char *, gid_t[], int, int); int str2group(const char *, int, void *, char *, int); @@ -467,7 +462,7 @@ _getgroupsbymember(const char *username, gid_t gid_array[], { struct nss_groupsbymem arg; char defval[BUFSIZ]; - __NSL_FILE *defl; + FILE *defl; arg.username = username; arg.gid_array = gid_array; @@ -496,15 +491,15 @@ _getgroupsbymember(const char *username, gid_t gid_array[], * link ourselfs against libcmd, so instead we just do it by hand */ - if ((defl = __nsl_c_fopen(__NSW_DEFAULT_FILE, "r")) != NULL) { - while (__nsl_c_fgets(defval, sizeof (defval), defl) != NULL) { + if ((defl = fopen(__NSW_DEFAULT_FILE, "rF")) != NULL) { + while (fgets(defval, sizeof (defval), defl) != NULL) { if (strncmp(USE_NETID_STR, defval, sizeof (USE_NETID_STR) - 1) == 0) { arg.force_slow_way = 0; break; } } - (void) __nsl_c_fclose(defl); + (void) fclose(defl); } (void) nss_search(&db_root, _nss_initf_group, diff --git a/usr/src/lib/libc/port/gen/getpw.c b/usr/src/lib/libc/port/gen/getpw.c index bcef781b48..9155894497 100644 --- a/usr/src/lib/libc/port/gen/getpw.c +++ b/usr/src/lib/libc/port/gen/getpw.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -57,7 +56,7 @@ getpw(uid_t uid, char buf[]) rmutex_t *lk; if (pwf == NULL) { - fp = fopen(PASSWD, "r"); + fp = fopen(PASSWD, "rF"); lmutex_lock(&_pwlock); if (pwf == NULL) { if ((pwf = fp) == NULL) { diff --git a/usr/src/lib/libc/port/gen/getusershell.c b/usr/src/lib/libc/port/gen/getusershell.c index b7edd9e4dd..289ae3c4a2 100644 --- a/usr/src/lib/libc/port/gen/getusershell.c +++ b/usr/src/lib/libc/port/gen/getusershell.c @@ -1,5 +1,5 @@ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -113,7 +113,7 @@ initshells(void) if (strings != NULL) (void) free(strings); strings = NULL; - if ((fp = fopen(SHELLS, "r")) == (FILE *)0) + if ((fp = fopen(SHELLS, "rF")) == (FILE *)0) return ((char **)okshells); /* * The +1 in the malloc() below is needed to handle the final diff --git a/usr/src/lib/libc/port/gen/getut.c b/usr/src/lib/libc/port/gen/getut.c index 87b4a660f2..e60a041b23 100644 --- a/usr/src/lib/libc/port/gen/getut.c +++ b/usr/src/lib/libc/port/gen/getut.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -705,7 +704,7 @@ gdebug(const char *fmt, ...) int errnum; va_list ap; - if ((fp = fopen("/etc/dbg.getut", "a+")) == NULL) + if ((fp = fopen("/etc/dbg.getut", "a+F")) == NULL) return; va_start(ap, fmt); (void) vfprintf(fp, fmt, ap); diff --git a/usr/src/lib/libc/port/gen/getutx.c b/usr/src/lib/libc/port/gen/getutx.c index 73a1c5cf32..c091a27013 100644 --- a/usr/src/lib/libc/port/gen/getutx.c +++ b/usr/src/lib/libc/port/gen/getutx.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -226,7 +225,7 @@ getutxent_frec(void) if ((fd = open(utmpxfile, O_RDONLY)) < 0) return (NULL); - if ((fp = fopen(utmpxfile, "r")) == NULL) { + if ((fp = fopen(utmpxfile, "rF")) == NULL) { (void) close(fd); fd = -1; return (NULL); @@ -236,7 +235,7 @@ getutxent_frec(void) /* * Get the stream pointer */ - if ((fp = fopen(utmpxfile, "r+")) == NULL) { + if ((fp = fopen(utmpxfile, "r+F")) == NULL) { (void) close(fd); fd = -1; return (NULL); diff --git a/usr/src/lib/libc/port/gen/nsparse.c b/usr/src/lib/libc/port/gen/nsparse.c index ab879934cf..6af1f25278 100644 --- a/usr/src/lib/libc/port/gen/nsparse.c +++ b/usr/src/lib/libc/port/gen/nsparse.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,26 +19,27 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include "synonyms.h" +#include "file64.h" #include "mtlib.h" #include "libc.h" #include <synch.h> #include <sys/types.h> #include <stdlib.h> #include <stdio.h> +#include <stdio_ext.h> #include <string.h> #include <ctype.h> #include <limits.h> #include <dlfcn.h> -#include <fcntl.h> -#include <unistd.h> #include <errno.h> +#include "stdiom.h" #define __NSS_PRIVATE_INTERFACE #include "nsswitch_priv.h" @@ -489,37 +489,63 @@ syslog_warning(const char *dbase) dbase, __NSW_CONFIG_FILE); } +/* + * Since we cannot call malloc() or lock any of the ordinary mutexes + * while we hold an lmutex_lock(), we open the file outside the lock + * and disable locking on the file; the latter is fine because we're + * reading the fp only from a single thread. + */ +static FILE * +open_conf(void) +{ + FILE *fp = fopen(__NSW_CONFIG_FILE, "rF"); + + if (fp != NULL) { + if (_findbuf(fp) == NULL) { + (void) fclose(fp); + return (NULL); + } + SET_IONOLOCK(fp); + } + return (fp); +} + struct __nsw_switchconfig_v1 * __nsw_getconfig_v1(const char *dbase, enum __nsw_parse_err *errp) { struct __nsw_switchconfig_v1 *cfp, *retp = NULL; int syslog_error = 0; - __NSL_FILE *fp; + FILE *fp = NULL; char *linep; char lineq[BUFSIZ]; - /* - * ==== I don't feel entirely comfortable disabling signals for the - * duration of this, but maybe we have to. Or maybe we should - * use mutex_trylock to detect recursion? (Not clear what's - * the right thing to do when it happens, though). - */ lmutex_lock(&serialize_config_v1); - +top: if (cfp = scrounge_cache_v1(dbase)) { *errp = __NSW_CONF_PARSE_SUCCESS; lmutex_unlock(&serialize_config_v1); + if (fp != NULL) + (void) fclose(fp); return (cfp); } - if ((fp = __nsl_c_fopen(__NSW_CONFIG_FILE, "r")) == NULL) { - *errp = __NSW_CONF_PARSE_NOFILE; + if (fp == NULL) { + struct cons_cell_v1 *cp = concell_list_v1; + lmutex_unlock(&serialize_config_v1); - return (NULL); + /* open_conf() must be called w/o locks held */ + if ((fp = open_conf()) == NULL) { + *errp = __NSW_CONF_PARSE_NOFILE; + return (NULL); + } + lmutex_lock(&serialize_config_v1); + /* Cache changed? */ + if (cp != concell_list_v1) + goto top; } *errp = __NSW_CONF_PARSE_NOPOLICY; - while (linep = __nsl_c_fgets(lineq, BUFSIZ, fp)) { + while (linep = fgets(lineq, BUFSIZ, fp)) { enum __nsw_parse_err line_err; char *tokenp, *comment; @@ -572,11 +598,11 @@ __nsw_getconfig_v1(const char *dbase, enum __nsw_parse_err *errp) */ } } - (void) __nsl_c_fclose(fp); lmutex_unlock(&serialize_config_v1); /* - * We have to drop the lock before calling syslog(). + * We have to drop the lock before calling fclose()/syslog(). */ + (void) fclose(fp); if (syslog_error) syslog_warning(dbase); return (retp); @@ -587,32 +613,36 @@ __nsw_getconfig(const char *dbase, enum __nsw_parse_err *errp) { struct __nsw_switchconfig *cfp, *retp = NULL; int syslog_error = 0; - __NSL_FILE *fp; + FILE *fp = NULL; char *linep; char lineq[BUFSIZ]; - /* - * ==== I don't feel entirely comfortable disabling signals for the - * duration of this, but maybe we have to. Or maybe we should - * use mutex_trylock to detect recursion? (Not clear what's - * the right thing to do when it happens, though). - */ lmutex_lock(&serialize_config); - +top: if (cfp = scrounge_cache(dbase)) { *errp = __NSW_CONF_PARSE_SUCCESS; lmutex_unlock(&serialize_config); + if (fp != NULL) + (void) fclose(fp); return (cfp); } - if ((fp = __nsl_c_fopen(__NSW_CONFIG_FILE, "r")) == NULL) { - *errp = __NSW_CONF_PARSE_NOFILE; + if (fp == NULL) { + struct cons_cell *cp = concell_list; + /* open_conf() must be called w/o locks held */ lmutex_unlock(&serialize_config); - return (NULL); + if ((fp = open_conf()) == NULL) { + *errp = __NSW_CONF_PARSE_NOFILE; + return (NULL); + } + lmutex_lock(&serialize_config); + /* Cache changed? */ + if (cp != concell_list) + goto top; } *errp = __NSW_CONF_PARSE_NOPOLICY; - while (linep = __nsl_c_fgets(lineq, BUFSIZ, fp)) { + while (linep = fgets(lineq, BUFSIZ, fp)) { enum __nsw_parse_err line_err; char *tokenp, *comment; @@ -665,11 +695,11 @@ __nsw_getconfig(const char *dbase, enum __nsw_parse_err *errp) */ } } - (void) __nsl_c_fclose(fp); lmutex_unlock(&serialize_config); /* - * We have to drop the lock before calling syslog(). + * We have to drop the lock before calling fclose()/syslog(). */ + (void) fclose(fp); if (syslog_error) syslog_warning(dbase); return (retp); @@ -918,138 +948,3 @@ alldigits(char *s) return (0); return (1); } - - -/* - * To avoid the 256 open file descriptor limitation in stdio, - * we are using a private limited implementation of stdio calls. - * The private implementation is closely based on the implementation - * in the standard C library. - * To simplify, certain assumptions are made: - * - a file may be opened only in read mode. - * - Only sequential reads allowed - * - file descriptors should not be shared between threads - */ - -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_c_fopen(const char *filename, const char *mode) -{ - int fd; - __NSL_FILE *stream; - void *buf; - - if (mode == NULL || filename == NULL) { - return (NULL); - } - - if (strcmp(mode, "r") != 0) { - return (NULL); - } - - fd = open(filename, O_RDONLY | O_LARGEFILE, 0666); - if (fd < 0) - return (NULL); - - stream = libc_malloc(sizeof (__NSL_FILE)); - buf = lmalloc(__NSL_FILE_BUF_SIZE); - if (stream != NULL && buf != NULL) { - stream->_nsl_base = buf; - stream->_nsl_file = _raise_fd(fd); - stream->_nsl_cnt = 0; - stream->_nsl_ptr = stream->_nsl_base; - } else { - (void) close(fd); - if (buf) - lfree(buf, __NSL_FILE_BUF_SIZE); - if (stream) - libc_free(stream); - stream = NULL; - } - - return (stream); -} - -int -__nsl_c_fclose(__NSL_FILE *stream) -{ - int res = 0; - - if (stream == NULL) - return (EOF); - - if (close(stream->_nsl_file) < 0) - res = EOF; - - lfree(stream->_nsl_base, __NSL_FILE_BUF_SIZE); - libc_free(stream); - - return (res); -} - -char * -__nsl_c_fgets(char *buf, int size, __NSL_FILE *stream) -{ - char *ptr = buf; - char *p; - int n; - int res; - - size--; /* room for '\0' */ - while (size > 0) { - if (stream->_nsl_cnt == 0) { - stream->_nsl_ptr = stream->_nsl_base; - - if ((res = read(stream->_nsl_file, stream->_nsl_base, - __NSL_FILE_BUF_SIZE)) > 0) { - stream->_nsl_cnt = res; - } else { - stream->_nsl_cnt = 0; - break; - } - } - 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); -} diff --git a/usr/src/lib/libc/port/gen/nss_common.c b/usr/src/lib/libc/port/gen/nss_common.c index a233cbd40b..ad27e0f807 100644 --- a/usr/src/lib/libc/port/gen/nss_common.c +++ b/usr/src/lib/libc/port/gen/nss_common.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -206,7 +205,7 @@ set_option(struct option *opt, char *name, char *val) break; #ifdef DEBUG case OPT_FILE: - fp = fopen(val, "w"); + fp = fopen(val, "wF"); *((FILE **)opt->address) = fp; break; #endif diff --git a/usr/src/lib/libc/port/gen/priv_str_xlate.c b/usr/src/lib/libc/port/gen/priv_str_xlate.c index 90e16ee580..4fa3e86f9d 100644 --- a/usr/src/lib/libc/port/gen/priv_str_xlate.c +++ b/usr/src/lib/libc/port/gen/priv_str_xlate.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -364,11 +363,11 @@ priv_gettext(const char *priv) if (snprintf(file, sizeof (file), _DFLT_LOC_PATH "%s/LC_MESSAGES/priv_names", loc) < sizeof (file)) - namefp = fopen(file, "r"); + namefp = fopen(file, "rF"); /* If the path is too long or can't be opened, punt to default */ if (namefp == NULL) - namefp = fopen("/etc/security/priv_names", "r"); + namefp = fopen("/etc/security/priv_names", "rF"); if (namefp == NULL) return (NULL); diff --git a/usr/src/lib/libc/port/gen/ttyslot.c b/usr/src/lib/libc/port/gen/ttyslot.c index 2a3e2b3423..f8921bac65 100644 --- a/usr/src/lib/libc/port/gen/ttyslot.c +++ b/usr/src/lib/libc/port/gen/ttyslot.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -75,7 +74,7 @@ ttyslot(void) console = TRUE; s = 0; - if ((fp = fopen(UTMPX_FILE, "r")) == NULL) + if ((fp = fopen(UTMPX_FILE, "rF")) == NULL) return (-1); while ((fread(&ubuf, sizeof (ubuf), 1, fp)) == 1) { if ((ubuf.ut_type == INIT_PROCESS || diff --git a/usr/src/lib/libc/port/regex/wordexp.c b/usr/src/lib/libc/port/regex/wordexp.c index 812889826b..ec83da4dee 100644 --- a/usr/src/lib/libc/port/regex/wordexp.c +++ b/usr/src/lib/libc/port/regex/wordexp.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -206,7 +205,7 @@ wordexp(const char *word, wordexp_t *wp, int flags) (void) close(pv[1]); - if ((fp = fdopen(pv[0], "rb")) == NULL) { + if ((fp = fdopen(pv[0], "rF")) == NULL) { serrno = errno; (void) close(pv[0]); errno = serrno; diff --git a/usr/src/lib/libc/port/stdio/getpass.c b/usr/src/lib/libc/port/stdio/getpass.c index 379fe24238..b25ef5efa6 100644 --- a/usr/src/lib/libc/port/stdio/getpass.c +++ b/usr/src/lib/libc/port/stdio/getpass.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -81,7 +80,7 @@ __getpass(const char *prompt, int size) rmutex_t *lk; if (pbuf == NULL || - (fi = fopen("/dev/tty", "r")) == NULL) + (fi = fopen("/dev/tty", "rF")) == NULL) return (NULL); setbuf(fi, NULL); sig = signal(SIGINT, catch); diff --git a/usr/src/lib/libcmd/common/deflt.c b/usr/src/lib/libcmd/common/deflt.c index 42f09bc532..a8f82edd8a 100644 --- a/usr/src/lib/libcmd/common/deflt.c +++ b/usr/src/lib/libcmd/common/deflt.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -135,7 +134,7 @@ defopen(char *fn) return (0); } - if ((thr_data->fp = fopen(fn, "r")) == NULL) + if ((thr_data->fp = fopen(fn, "rF")) == NULL) return (-1); thr_data->Dcflags = DC_STD; diff --git a/usr/src/lib/libcryptoutil/common/config_parsing.c b/usr/src/lib/libcryptoutil/common/config_parsing.c index 09f9073b7c..1c01db6de5 100644 --- a/usr/src/lib/libcryptoutil/common/config_parsing.c +++ b/usr/src/lib/libcryptoutil/common/config_parsing.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -54,7 +53,7 @@ get_pkcs11conf_info(uentrylist_t **ppliblist) int rc = SUCCESS; *ppliblist = NULL; - if ((pfile = fopen(_PATH_PKCS11_CONF, "r")) == NULL) { + if ((pfile = fopen(_PATH_PKCS11_CONF, "rF")) == NULL) { cryptoerror(LOG_ERR, "failed to open %s.\n", _PATH_PKCS11_CONF); return (FAILURE); } diff --git a/usr/src/lib/libcurses/screen/print.c b/usr/src/lib/libcurses/screen/print.c index 870515a0e3..f4648c2939 100644 --- a/usr/src/lib/libcurses/screen/print.c +++ b/usr/src/lib/libcurses/screen/print.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2001 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -170,7 +169,7 @@ pr_heading(char *term, char *synonyms) /* * Attempt to open the file. */ - if ((work_fp = fopen(buffer, "r")) == NULL) { + if ((work_fp = fopen(buffer, "rF")) == NULL) { /* * Open failed. If we were looking in /usr/share/lib/terminfo * we are done, otherwise look there next. @@ -189,7 +188,7 @@ pr_heading(char *term, char *synonyms) */ (void) sprintf(buffer, "%s%s%s", _ULIBTI, tail, term); - if ((work_fp = fopen(buffer, "r")) == NULL) { + if ((work_fp = fopen(buffer, "rF")) == NULL) { /* * All hope is lost */ diff --git a/usr/src/lib/libcurses/screen/scr_all.c b/usr/src/lib/libcurses/screen/scr_all.c index 66c794581b..4c8a9da3fa 100644 --- a/usr/src/lib/libcurses/screen/scr_all.c +++ b/usr/src/lib/libcurses/screen/scr_all.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -53,7 +52,7 @@ _scr_all(char *file, int which) int rv; FILE *filep; - if ((filep = fopen(file, "r")) == NULL) + if ((filep = fopen(file, "rF")) == NULL) return (ERR); rv = scr_reset(filep, which); (void) fclose(filep); diff --git a/usr/src/lib/libcurses/screen/scr_dump.c b/usr/src/lib/libcurses/screen/scr_dump.c index 494914f034..1597025e64 100644 --- a/usr/src/lib/libcurses/screen/scr_dump.c +++ b/usr/src/lib/libcurses/screen/scr_dump.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -56,7 +55,7 @@ scr_dump(char *file) int rv; FILE *filep; - if ((filep = fopen(file, "w")) == NULL) { + if ((filep = fopen(file, "wF")) == NULL) { #ifdef DEBUG if (outf) (void) fprintf(outf, "scr_dump: cannot open " diff --git a/usr/src/lib/libdtrace/common/dt_printf.c b/usr/src/lib/libdtrace/common/dt_printf.c index b3911b83e3..953511b1d0 100644 --- a/usr/src/lib/libdtrace/common/dt_printf.c +++ b/usr/src/lib/libdtrace/common/dt_printf.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -1597,7 +1596,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata, * file descriptor for the fopen()'d file. This way, if the fopen() * fails, we can fail the operation without destroying stdout. */ - if ((nfp = fopen(filename, "aw")) == NULL) { + if ((nfp = fopen(filename, "aF")) == NULL) { char *msg = strerror(errno), *faultstr; int len = 80; @@ -1628,7 +1627,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata, } } - if (freopen(selfbuf, "aw", fp) == NULL) { + if (freopen(selfbuf, "aF", fp) == NULL) { (void) fclose(nfp); return (dt_set_errno(dtp, errno)); } diff --git a/usr/src/lib/libgen/common/copylist.c b/usr/src/lib/libgen/common/copylist.c index 3f620f759f..10153bb06d 100644 --- a/usr/src/lib/libgen/common/copylist.c +++ b/usr/src/lib/libgen/common/copylist.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -71,7 +70,7 @@ common_copylist(const char *filenm, off64_t size) /* copy contents of file into memory block, replacing newlines */ /* with null characters */ - if ((strm = fopen(filenm, "r")) == NULL) { + if ((strm = fopen(filenm, "rF")) == NULL) { return (NULL); } for (p = ptr; p < ptr + size && (c = getc(strm)) != EOF; p++) { diff --git a/usr/src/lib/libgss/g_initialize.c b/usr/src/lib/libgss/g_initialize.c index 24d70252e5..dbfa43d405 100644 --- a/usr/src/lib/libgss/g_initialize.c +++ b/usr/src/lib/libgss/g_initialize.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -721,7 +720,7 @@ const char *fileName; OM_uint32 minor; gss_buffer_desc oidBuf; - if ((confFile = fopen(fileName, "r")) == NULL) { + if ((confFile = fopen(fileName, "rF")) == NULL) { return; } diff --git a/usr/src/lib/libgss/g_utils.c b/usr/src/lib/libgss/g_utils.c index 7e7183f912..1fc34b1108 100644 --- a/usr/src/lib/libgss/g_utils.c +++ b/usr/src/lib/libgss/g_utils.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -76,7 +75,7 @@ __gss_read_qop_file(void) } last = stbuf.st_mtime; - fp = fopen(QOP_NUM_FILE, "r"); + fp = fopen(QOP_NUM_FILE, "rF"); if (fp == (FILE *)0) { major = GSS_S_FAILURE; goto done; diff --git a/usr/src/lib/libldap5/sources/ldap/common/disptmpl.c b/usr/src/lib/libldap5/sources/ldap/common/disptmpl.c index 216f93af03..7e97b33dee 100644 --- a/usr/src/lib/libldap5/sources/ldap/common/disptmpl.c +++ b/usr/src/lib/libldap5/sources/ldap/common/disptmpl.c @@ -1,5 +1,5 @@ /* - * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -112,7 +112,7 @@ ldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp ) *tmpllistp = NULLDISPTMPL; - if (( fp = fopen( file, "r" )) == NULL ) { + if (( fp = fopen( file, "rF" )) == NULL ) { return( LDAP_TMPL_ERR_FILE ); } diff --git a/usr/src/lib/libldap5/sources/ldap/common/friendly.c b/usr/src/lib/libldap5/sources/ldap/common/friendly.c index 91bb491469..79d602160d 100644 --- a/usr/src/lib/libldap5/sources/ldap/common/friendly.c +++ b/usr/src/lib/libldap5/sources/ldap/common/friendly.c @@ -1,3 +1,7 @@ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #pragma ident "%Z%%M% %I% %E% SMI" /* @@ -55,7 +59,7 @@ ldap_friendly_name( char *filename, char *name, FriendlyMap *map ) } if ( *map == NULL ) { - if ( (fp = fopen( filename, "r" )) == NULL ) + if ( (fp = fopen( filename, "rF" )) == NULL ) return( name ); entries = 0; diff --git a/usr/src/lib/libldap5/sources/ldap/common/getfilter.c b/usr/src/lib/libldap5/sources/ldap/common/getfilter.c index 3ecdfbb8ab..65934ea54a 100644 --- a/usr/src/lib/libldap5/sources/ldap/common/getfilter.c +++ b/usr/src/lib/libldap5/sources/ldap/common/getfilter.c @@ -1,5 +1,5 @@ /* - * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -60,7 +60,7 @@ ldap_init_getfilter( char *fname ) int eof; LDAPFiltDesc *lfdp; - if (( fp = fopen( fname, "r" )) == NULL ) { + if (( fp = fopen( fname, "rF" )) == NULL ) { return( NULL ); } diff --git a/usr/src/lib/libldap5/sources/ldap/common/srchpref.c b/usr/src/lib/libldap5/sources/ldap/common/srchpref.c index 50105e50ab..bd3f61eebe 100644 --- a/usr/src/lib/libldap5/sources/ldap/common/srchpref.c +++ b/usr/src/lib/libldap5/sources/ldap/common/srchpref.c @@ -1,3 +1,7 @@ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #pragma ident "%Z%%M% %I% %E% SMI" /* @@ -65,7 +69,7 @@ ldap_init_searchprefs( char *file, struct ldap_searchobj **solistp ) long rlen, len; int rc, eof; - if (( fp = fopen( file, "r" )) == NULL ) { + if (( fp = fopen( file, "rF" )) == NULL ) { return( LDAP_SEARCHPREF_ERR_FILE ); } diff --git a/usr/src/lib/libldap5/sources/ldap/util/log.c b/usr/src/lib/libldap5/sources/ldap/util/log.c index 3e8780a381..956feaac71 100644 --- a/usr/src/lib/libldap5/sources/ldap/util/log.c +++ b/usr/src/lib/libldap5/sources/ldap/util/log.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -144,7 +144,7 @@ ldaplog(int level, char *fmt, ...) * send the message into a regular log file */ if (!logfd) { - logfd = fopen(logfile, "a"); + logfd = fopen(logfile, "aF"); } /* end if */ /* * finally write the message into the log file diff --git a/usr/src/lib/libnsl/Makefile.com b/usr/src/lib/libnsl/Makefile.com index 9b845c9daf..e2c38be80a 100644 --- a/usr/src/lib/libnsl/Makefile.com +++ b/usr/src/lib/libnsl/Makefile.com @@ -32,7 +32,7 @@ VERS= .1 # objects are listed by source directory # common utility code used in more than one directory -COMMON= common.o daemon_utils.o nsl_stdio_prv.o +COMMON= common.o daemon_utils.o DES= des_crypt.o des_soft.o @@ -70,7 +70,7 @@ authsys_prot.o can_use_af.o \ clnt_bcast.o clnt_dg.o clnt_door.o clnt_generic.o clnt_perror.o \ clnt_raw.o clnt_simple.o clnt_vc.o fdsync.o getdname.o \ inet_ntoa.o key_call.o key_prot.o mt_misc.o \ -netname.o netnamer.o openchild.o pmap_clnt.o pmap_prot.o \ +netname.o netnamer.o pmap_clnt.o pmap_prot.o \ rpc_callmsg.o rpc_comdata.o rpc_comdata1.o rpc_generic.o rpc_prot.o \ rpc_sel2poll.o \ rpc_soc.o rpc_td.o rpcb_clnt.o rpcb_prot.o \ @@ -79,7 +79,7 @@ svc_auth.o svc_auth_loopb.o svc_auth_sys.o svc_dg.o \ svc_door.o svc_generic.o svc_raw.o svc_run.o svc_simple.o \ svc_vc.o svcauth_des.o svid_funcs.o ti_opts.o xdr.o \ xdr_array.o xdr_float.o xdr_mem.o xdr_rec.o xdr_refer.o \ -xdr_sizeof.o xdr_stdio.o xdr_stdio_prv.o +xdr_sizeof.o xdr_stdio.o SAF= checkver.o doconfig.o diff --git a/usr/src/lib/libnsl/common/nsl_stdio_prv.c b/usr/src/lib/libnsl/common/nsl_stdio_prv.c deleted file mode 100644 index efa8388262..0000000000 --- a/usr/src/lib/libnsl/common/nsl_stdio_prv.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - * 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/usr/src/lib/libnsl/dial/callers.c b/usr/src/lib/libnsl/dial/callers.c index 11b09aeb2b..8d4cea8dd0 100644 --- a/usr/src/lib/libnsl/dial/callers.c +++ b/usr/src/lib/libnsl/dial/callers.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -103,7 +102,7 @@ exphone(char *in, char *out) *s1 = NULLCHAR; tpre[0] = NULLCHAR; - fn = fopen(DIALCODES, "r"); + fn = fopen(DIALCODES, "rF"); if (fn != NULL) { while (fgets(buf, BUFSIZ, fn)) { if (sscanf(buf, "%60s%60s", p, tpre) < 1) diff --git a/usr/src/lib/libnsl/dial/sysfiles.c b/usr/src/lib/libnsl/dial/sysfiles.c index afeea1da06..2cca59c053 100644 --- a/usr/src/lib/libnsl/dial/sysfiles.c +++ b/usr/src/lib/libnsl/dial/sysfiles.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -163,7 +162,7 @@ scansys(const char *service) char *tok, buf[BUFSIZ]; Systems[0] = Devices[0] = Dialers[0] = NULL; - if ((f = fopen(SYSFILES, "r")) != 0) { + if ((f = fopen(SYSFILES, "rF")) != 0) { while (getline(f, buf) > 0) { /* got a (logical) line from Sysfiles */ /* strtok's of this buf continue in tokenize() */ @@ -213,7 +212,7 @@ scancfg(char *service, char *device) connecttime = CONNECTTIME; expecttime = EXPECTTIME; - if ((f = fopen(DEVCONFIG, "r")) != 0) { + if ((f = fopen(DEVCONFIG, "rF")) != 0) { while (getline(f, buf) > 0) { /* got a (logical) line from Devconfig */ /* strtok's of this buf continue in tokenize() */ @@ -494,7 +493,7 @@ nextsystems(void) nsystems = 0; } for (; Systems[nsystems] != NULL; nsystems++) - if ((fsystems = fopen(Systems[nsystems], "r")) != NULL) + if ((fsystems = fopen(Systems[nsystems], "rF")) != NULL) return (TRUE); return (FALSE); } @@ -534,7 +533,7 @@ nextdevices(void) ndevices = 0; } for (; Devices[ndevices] != NULL; ndevices++) - if ((fdevices = fopen(Devices[ndevices], "r")) != NULL) + if ((fdevices = fopen(Devices[ndevices], "rF")) != NULL) return (TRUE); return (FALSE); } @@ -577,7 +576,7 @@ nextdialers(void) } for (; Dialers[ndialers] != NULL; ndialers++) - if ((fdialers = fopen(Dialers[ndialers], "r")) != NULL) + if ((fdialers = fopen(Dialers[ndialers], "rF")) != NULL) return (TRUE); return (FALSE); } @@ -707,7 +706,7 @@ setconfig(void) char *tok; extern char _ProtoCfg[]; - if ((f = fopen(CONFIG, "r")) != 0) { + if ((f = fopen(CONFIG, "rF")) != 0) { while (getline(f, buf) > 0) { /* got a (logical) line from Config file */ tok = strtok(buf, " \t"); diff --git a/usr/src/lib/libnsl/include/nsl_stdio_prv.h b/usr/src/lib/libnsl/include/nsl_stdio_prv.h deleted file mode 100644 index 94847760e4..0000000000 --- a/usr/src/lib/libnsl/include/nsl_stdio_prv.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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/usr/src/lib/libnsl/ipsec/algs.c b/usr/src/lib/libnsl/ipsec/algs.c index c75f99a894..b3ce54206b 100644 --- a/usr/src/lib/libnsl/ipsec/algs.c +++ b/usr/src/lib/libnsl/ipsec/algs.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -550,8 +549,8 @@ bail: void _build_internal_algs(ipsec_proto_t **alg_context, int *alg_nums) { - FILE *f = NULL; - int fd, rc, trash_num; + FILE *f; + int rc, trash_num; ipsec_proto_t *new_protos = NULL, *trash; time_t filetime; struct stat statbuf; @@ -572,24 +571,21 @@ _build_internal_algs(ipsec_proto_t **alg_context, int *alg_nums) (void) rw_wrlock(&proto_rw); } - fd = open(INET_IPSECALGSFILE, O_RDONLY); - if (fd != -1) { - f = fdopen(fd, "r"); - if (f == NULL) { - (void) close(fd); - } else { - rc = fstat(fd, &statbuf); - if (rc != -1) { - /* - * Update if the file is newer than our - * last cached copy. - */ - filetime = statbuf.st_mtime; - if (alg_context != NULL || - filetime > proto_last_update) - new_protos = build_list(f, &rc); - } + f = fopen(INET_IPSECALGSFILE, "rF"); + if (f != NULL) { + rc = fstat(fileno(f), &statbuf); + if (rc != -1) { + /* + * Update if the file is newer than our + * last cached copy. + */ + filetime = statbuf.st_mtime; + if (alg_context != NULL || + filetime > proto_last_update) + new_protos = build_list(f, &rc); } + /* Since f is read-only, can avoid all of the failures... */ + (void) fclose(f); } if (alg_context == NULL) { @@ -622,9 +618,6 @@ _build_internal_algs(ipsec_proto_t **alg_context, int *alg_nums) *alg_nums = rc; } - /* Since f is read-only, can avoid all of the failures... */ - if (f != NULL) - (void) fclose(f); } /* diff --git a/usr/src/lib/libnsl/key/publickey.c b/usr/src/lib/libnsl/key/publickey.c index 56144f070f..febc30e423 100644 --- a/usr/src/lib/libnsl/key/publickey.c +++ b/usr/src/lib/libnsl/key/publickey.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -74,7 +73,6 @@ #include <thread.h> #include "../nis/gen/nis_clnt.h" #include <nss_dbdefs.h> -#include "nsl_stdio_prv.h" static const char *PKTABLE = "cred.org_dir"; static const char *PKMAP = "publickey.byname"; @@ -229,18 +227,18 @@ getkeys_files(int *errp, char *netname, char *pkey, char *skey, char *passwd) char buf[WORKBUFSIZE]; int r = 0; char *res; - __NSL_FILE *fd; + FILE *fd; char *p; char *lasts; - fd = __nsl_fopen(PKFILE, "r"); - if (fd == (__NSL_FILE *)0) { + fd = fopen(PKFILE, "rF"); + if (fd == NULL) { *errp = __NSW_UNAVAIL; return (0); } /* Search through the file linearly :-( */ - while ((res = __nsl_fgets(buf, WORKBUFSIZE, fd)) != NULL) { + while ((res = fgets(buf, WORKBUFSIZE, fd)) != NULL) { if ((res[0] == '#') || (res[0] == '\n')) continue; @@ -285,14 +283,14 @@ getkeys_files(int *errp, char *netname, char *pkey, char *skey, char *passwd) p++; if (skey && extract_secret(p, skey, passwd)) r |= 2; - (void) __nsl_fclose(fd); + (void) fclose(fd); *errp = __NSW_SUCCESS; return (r); } } } - (void) __nsl_fclose(fd); + (void) fclose(fd); *errp = __NSW_NOTFOUND; return (0); } diff --git a/usr/src/lib/libnsl/netselect/netselect.c b/usr/src/lib/libnsl/netselect/netselect.c index 7b7698f940..33128e2101 100644 --- a/usr/src/lib/libnsl/netselect/netselect.c +++ b/usr/src/lib/libnsl/netselect/netselect.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -47,7 +46,6 @@ #include <libintl.h> #include <syslog.h> #include "netcspace.h" -#include "nsl_stdio_prv.h" #define FAILURE (unsigned)(-1) @@ -57,7 +55,7 @@ static int blank(char *); static int comment(char *); -static struct netconfig *fgetnetconfig(__NSL_FILE *, char *); +static struct netconfig *fgetnetconfig(FILE *, char *); static void netconfig_free(struct netconfig *); static unsigned int getflag(char *); static char **getlookups(char *); @@ -268,33 +266,33 @@ static struct netconfig ** getnetlist(void) { char line[BUFSIZ]; /* holds each line of NETCONFIG */ - __NSL_FILE *fp; /* file stream for NETCONFIG */ + FILE *fp; /* file stream for NETCONFIG */ struct netconfig **listpp; /* the beginning of the netconfig list */ struct netconfig **tpp; /* used to traverse the netconfig list */ int count; /* the number of entries in file */ - if ((fp = __nsl_fopen(NETCONFIG, "r")) == NULL) { + if ((fp = fopen(NETCONFIG, "rF")) == NULL) { nc_error = NC_OPENFAIL; return (NULL); } count = 0; - while (__nsl_fgets(line, BUFSIZ, fp)) { + while (fgets(line, BUFSIZ, fp)) { if (!(blank(line) || comment(line))) { ++count; } } - __nsl_rewind(fp); + rewind(fp); if (count == 0) { nc_error = NC_NOTFOUND; - (void) __nsl_fclose(fp); + (void) fclose(fp); return (NULL); } if ((listpp = malloc((count + 1) * sizeof (struct netconfig *))) == NULL) { nc_error = NC_NOMEM; - (void) __nsl_fclose(fp); + (void) fclose(fp); return (NULL); } @@ -309,7 +307,7 @@ getnetlist(void) linenum = 0; for (tpp = listpp; *tpp = fgetnetconfig(fp, NULL); tpp++) ; - (void) __nsl_fclose(fp); + (void) fclose(fp); if (nc_error != NC_NOMOREENTRIES) /* Something is screwed up */ netlist_free(&listpp); @@ -323,7 +321,7 @@ getnetlist(void) */ static struct netconfig * -fgetnetconfig(__NSL_FILE *fp, char *netid) +fgetnetconfig(FILE *fp, char *netid) { char linep[BUFSIZ]; /* pointer to a line in the file */ struct netconfig *netconfigp; /* holds the new netconfig structure */ @@ -332,7 +330,7 @@ fgetnetconfig(__NSL_FILE *fp, char *netid) char *entnetid; /* netid for the current entry */ /* skip past blank lines and comments. */ - while (retvalp = __nsl_fgets(linep, BUFSIZ, fp)) { + while (retvalp = fgets(linep, BUFSIZ, fp)) { linenum++; if (!(blank(linep) || comment(linep))) { break; diff --git a/usr/src/lib/libnsl/nis/cache/cache.cc b/usr/src/lib/libnsl/nis/cache/cache.cc index dc7272954a..52112ddf6f 100644 --- a/usr/src/lib/libnsl/nis/cache/cache.cc +++ b/usr/src/lib/libnsl/nis/cache/cache.cc @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,7 +34,6 @@ #include <syslog.h> #include "cache.h" #include "cold_start.h" -#include "nsl_stdio_prv.h" #include "nis_cache.h" int __nis_debuglevel = 0; @@ -1024,7 +1022,7 @@ NisCache::resetPreference() void -NisCache::writePreference(__NSL_FILE *fp) +NisCache::writePreference(FILE *fp) { (void) prefer.dumpList(fp); prefer.dumpOption(fp); @@ -1331,13 +1329,13 @@ NisCache::okay() uint32_t NisCache::loadDotFile() { - __NSL_FILE *fp; + FILE *fp; char *p, buf[2048]; size_t l; uint32_t exptime; struct timeval now; - fp = __nsl_fopen(DOT_FILE, "r"); + fp = fopen(DOT_FILE, "rF"); if (fp == NULL) return (0); @@ -1345,22 +1343,22 @@ NisCache::loadDotFile() * read TTL: TTL must be the first line in this file * unless the file is empty. */ - if ((p = __nsl_fgets(buf, sizeof (buf), fp)) == NULL) { + if ((p = fgets(buf, sizeof (buf), fp)) == NULL) { /* empty file */ - (void) __nsl_fclose(fp); + (void) fclose(fp); return (0); } if (!isdigit(*p)) { /* invalid TTL */ syslog(LOG_ERR, "invalid TTL in %s", DOT_FILE); - (void) __nsl_fclose(fp); + (void) fclose(fp); return (0); } exptime = (uint32_t)atol(p); (void) gettimeofday(&now, NULL); if (exptime < now.tv_sec) { /* TTL expired */ - (void) __nsl_fclose(fp); + (void) fclose(fp); return (0); } @@ -1368,9 +1366,9 @@ NisCache::loadDotFile() * read preferred server list * This line can be empty */ - if ((p = __nsl_fgets(buf, sizeof (buf), fp)) == NULL) { + if ((p = fgets(buf, sizeof (buf), fp)) == NULL) { /* file without any preferred info */ - (void) __nsl_fclose(fp); + (void) fclose(fp); return (exptime); } l = strlen(p) - 1; @@ -1382,9 +1380,9 @@ NisCache::loadDotFile() * read options: valid options are "all" and * "pref_only". Default is "all". */ - if ((p = __nsl_fgets(buf, sizeof (buf), fp)) == NULL) { + if ((p = fgets(buf, sizeof (buf), fp)) == NULL) { /* file without any preferred info */ - (void) __nsl_fclose(fp); + (void) fclose(fp); mergeOption(PREF_ALL); return (exptime); } @@ -1397,7 +1395,7 @@ NisCache::loadDotFile() mergeOption(PREF_ALL); /* ignore the rest of the file */ - (void) __nsl_fclose(fp); + (void) fclose(fp); return (exptime); } @@ -1741,24 +1739,20 @@ HostList::serves(directory_obj *dobj) int -HostList::dumpList(__NSL_FILE *fp) +HostList::dumpList(FILE *fp) { HostEnt *scan; - int n = 0; - char buf[64]; + int n = 0; for (scan = entries; scan; scan = scan->next) { if (n++) - (void) __nsl_fputc(',', fp); - (void) __nsl_fputstring(scan->name, fp); - if (scan->interface && *scan->interface) { - (void) __nsl_fputc('/', fp); - (void) __nsl_fputstring(scan->interface, fp); - } - (void) snprintf(buf, sizeof (buf), "(%d)", scan->rank); - (void) __nsl_fputstring(buf, fp); + (void) fprintf(fp, ","); + (void) fprintf(fp, "%s", scan->name); + if (scan->interface && *scan->interface) + (void) fprintf(fp, "/%s", scan->interface); + (void) fprintf(fp, "(%d)", scan->rank); } - (void) __nsl_fputc('\n', fp); + (void) fprintf(fp, "\n"); return (n); } @@ -1771,16 +1765,14 @@ HostList::addOption(int value) void -HostList::dumpOption(__NSL_FILE *fp) +HostList::dumpOption(FILE *fp) { switch (pref_option) { case PREF_ALL_VAL: - (void) __nsl_fputstring(PREF_ALL, fp); - (void) __nsl_fputc('\n', fp); + (void) fprintf(fp, "%s\n", PREF_ALL); break; case PREF_ONLY_VAL: - (void) __nsl_fputstring(PREF_ONLY, fp); - (void) __nsl_fputc('\n', fp); + (void) fprintf(fp, "%s\n", PREF_ONLY); break; } } diff --git a/usr/src/lib/libnsl/nis/cache/cache.h b/usr/src/lib/libnsl/nis/cache/cache.h index 00637f84c9..5664a8cd29 100644 --- a/usr/src/lib/libnsl/nis/cache/cache.h +++ b/usr/src/lib/libnsl/nis/cache/cache.h @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -38,7 +37,6 @@ extern "C" { #include <stdlib.h> #include "../gen/nis_local.h" #include "../gen/nis_clnt.h" -#include "nsl_stdio_prv.h" #define CLIENT_FILE "/var/nis/client_info" @@ -82,9 +80,9 @@ class HostList { int checkHost(char *value, char *interface, int *rank); int matchHost(char *name, char *uaddr, int *rank); int serves(directory_obj *dobj); - int dumpList(__NSL_FILE *fp); + int dumpList(FILE *fp); void addOption(int value); - void dumpOption(__NSL_FILE *fp); + void dumpOption(FILE *fp); void deleteBackupList(); void deleteList(); void backupList(); @@ -164,7 +162,7 @@ class NisCache { uint32_t expireTime(uint32_t ttl); int nextGeneration(); void rerankServers(); - void writePreference(__NSL_FILE *fp); + void writePreference(FILE *fp); void mergePreference(char *value); void mergeOption(char *value); void resetPreference(); diff --git a/usr/src/lib/libnsl/nis/cache/cold_start.cc b/usr/src/lib/libnsl/nis/cache/cold_start.cc index 68130ec575..91ae40b620 100644 --- a/usr/src/lib/libnsl/nis/cache/cold_start.cc +++ b/usr/src/lib/libnsl/nis/cache/cold_start.cc @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -58,7 +57,6 @@ #include <unistd.h> #include <fcntl.h> #include "cache.h" -#include "nsl_stdio_prv.h" #include "nis_cache.h" extern "C" void prime_pkey_cache(directory_obj *); @@ -80,21 +78,21 @@ static bool_t readColdStartFile(char *fileName, directory_obj *dobj, int prime) { - __NSL_FILE *fp; + FILE *fp; XDR xdrs; struct timeval now; bool_t ret_val = TRUE; (void) memset((void*)dobj, 0, sizeof (directory_obj)); - if (!(fp = __nsl_fopen(fileName, "r"))) { + if (!(fp = fopen(fileName, "rF"))) { return (FALSE); } - __nsl_xdrstdio_create(&xdrs, fp, XDR_DECODE); + xdrstdio_create(&xdrs, fp, XDR_DECODE); if (!xdr_directory_obj(&xdrs, dobj)) { ret_val = FALSE; } - (void) __nsl_fclose(fp); + (void) fclose(fp); // change the absolute time in the stored directory object // back into a ttl that is the field in the directory object. @@ -139,7 +137,7 @@ loadColdStartFile(char *fileName, directory_obj *dobj) bool_t __nis_writeColdStartFile(char *fileName, directory_obj *dobj) { - __NSL_FILE *fp; + FILE *fp; int fd; XDR xdrs; struct timeval now; @@ -161,7 +159,7 @@ __nis_writeColdStartFile(char *fileName, directory_obj *dobj) return (FALSE); } // get a stream for xdr - if (!(fp = __nsl_fdopen(fd, "w"))) { + if (!(fp = fdopen(fd, "wF"))) { syslog(LOG_ERR, "NIS+: writeColdStartFile: fdopen() failed for '%s': %m", tempName); @@ -176,7 +174,7 @@ __nis_writeColdStartFile(char *fileName, directory_obj *dobj) "NIS+: writeColdStartFile: could not chmod cold_start file: %m"); goto err; } - __nsl_xdrstdio_create(&xdrs, fp, XDR_ENCODE); + xdrstdio_create(&xdrs, fp, XDR_ENCODE); // change time to live in the directory object into absolute time. // this has to be reconverted back into a ttl when the directory @@ -189,7 +187,7 @@ __nis_writeColdStartFile(char *fileName, directory_obj *dobj) goto err; } - (void) __nsl_fclose(fp); + (void) fclose(fp); (void) close(fd); // rename the temporary file to the actual cold start file file @@ -203,7 +201,7 @@ __nis_writeColdStartFile(char *fileName, directory_obj *dobj) return (TRUE); err: - (void) __nsl_fclose(fp); + (void) fclose(fp); (void) close(fd); (void) unlink(tempName); return (FALSE); diff --git a/usr/src/lib/libnsl/nis/cache/mgr_cache.cc b/usr/src/lib/libnsl/nis/cache/mgr_cache.cc index 5b486ca219..6e1f51f7c0 100644 --- a/usr/src/lib/libnsl/nis/cache/mgr_cache.cc +++ b/usr/src/lib/libnsl/nis/cache/mgr_cache.cc @@ -211,19 +211,17 @@ NisMgrCache::checkUp() uint32_t NisMgrCache::writeDotFile() { - __NSL_FILE *fp; + FILE *fp; char tempName[MAXPATHLEN+1]; - char buf[64]; (void) sprintf(tempName, "%s.tmp", DOT_FILE); - fp = __nsl_fopen(tempName, "w"); + fp = fopen(tempName, "wF"); if (fp == NULL) return (0); - (void) snprintf(buf, sizeof (buf), "%u\n", config_time); - (void) __nsl_fputstring(buf, fp); + (void) fprintf(fp, "%u\n", config_time); writePreference(fp); - (void) __nsl_fclose(fp); + (void) fclose(fp); if (rename(tempName, DOT_FILE) == -1) { (void) unlink(tempName); syslog(LOG_ERR, "cannot rename %s file", DOT_FILE); @@ -345,7 +343,7 @@ NisMgrCache::loadLocalFile() /* For IPv4, we want the loopback net, not the loopback address */ in4addr_loopback.s_addr = IN_LOOPBACKNET << IN_CLASSA_NSHIFT; - fp = fopen(CLIENT_FILE, "r"); + fp = fopen(CLIENT_FILE, "rF"); if (fp == NULL) return (0); diff --git a/usr/src/lib/libnsl/nis/gen/nis_sec_mechs.c b/usr/src/lib/libnsl/nis/gen/nis_sec_mechs.c index 3819433a59..a9d0a3e930 100644 --- a/usr/src/lib/libnsl/nis/gen/nis_sec_mechs.c +++ b/usr/src/lib/libnsl/nis/gen/nis_sec_mechs.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -46,7 +45,6 @@ #include <dlfcn.h> #include <rpcsvc/nis_dhext.h> -#include "nsl_stdio_prv.h" /* * NIS+ security file @@ -178,12 +176,12 @@ list_copy(void *(*cp_ent)(), void **mpp) static char * nextline(fd, line) - __NSL_FILE *fd; + FILE *fd; char *line; { char *cp; - if (__nsl_fgets(line, NIS_SEC_CF_MAX_LINELEN, fd) == NULL) + if (fgets(line, NIS_SEC_CF_MAX_LINELEN, fd) == NULL) return (NULL); cp = index(line, '\n'); if (cp) @@ -352,7 +350,7 @@ parse_line(char *linep, int minflds, int maxflds, int bufsiz) */ static mechanism_t * -get_secfile_ent(__NSL_FILE *fptr) +get_secfile_ent(FILE *fptr) { mechanism_t *m; char *cp; @@ -559,7 +557,7 @@ __nis_get_mechanisms(bool_t qop_secserv) int ent_cnt_no_dups = 0; /* valid cf count, no dups */ static uint_t last = 0; struct stat sbuf; - __NSL_FILE *fptr; + FILE *fptr; if (stat(NIS_SEC_CF_PATHNAME, &sbuf) != 0) return (NULL); @@ -576,7 +574,7 @@ __nis_get_mechanisms(bool_t qop_secserv) } mechs = mechs_no_dups = NULL; - if (!(fptr = __nsl_fopen(NIS_SEC_CF_PATHNAME, "r"))) { + if (!(fptr = fopen(NIS_SEC_CF_PATHNAME, "rF"))) { (void) mutex_unlock(&nis_sec_cf_lock); return (NULL); } @@ -597,7 +595,7 @@ __nis_get_mechanisms(bool_t qop_secserv) list_append_ent((void *)mp, (void **)tmechs, ent_cnt, (void (*)())sf_free_mech_ent); if (tmechs == NULL) { - (void) __nsl_fclose(fptr); + (void) fclose(fptr); (void) mutex_unlock(&nis_sec_cf_lock); return (NULL); } @@ -610,12 +608,12 @@ __nis_get_mechanisms(bool_t qop_secserv) list_append_ent((void *)mp, (void **)tmechs_no_dups, ent_cnt_no_dups, (void (*)())sf_free_mech_ent); if (tmechs_no_dups == NULL) { - (void) __nsl_fclose(fptr); + (void) fclose(fptr); (void) mutex_unlock(&nis_sec_cf_lock); return (NULL); } } - (void) __nsl_fclose(fptr); + (void) fclose(fptr); /* set master lists to point to new built ones */ mechs = tmechs; @@ -920,7 +918,7 @@ __nis_keyalg2authtype( * The caller should free the storage of a successful return. */ static mfent_t * -get_mechfile_ent(__NSL_FILE *fptr) +get_mechfile_ent(FILE *fptr) { mfent_t *m; char *cp; @@ -1007,7 +1005,7 @@ mf_get_mechs() uint_t ent_cnt = 0; /* valid cf file entry count */ static uint_t last = 0; /* file last modified date */ struct stat sbuf; - __NSL_FILE *fptr; + FILE *fptr; if (stat(mech_file, &sbuf) != 0) return (NULL); @@ -1022,7 +1020,7 @@ mf_get_mechs() mechs = NULL; } - if (!(fptr = __nsl_fopen(mech_file, "r"))) { + if (!(fptr = fopen(mech_file, "rF"))) { (void) mutex_unlock(&mech_file_lock); return (NULL); } @@ -1032,12 +1030,12 @@ mf_get_mechs() tmechs = (mfent_t **)list_append_ent((void *)mp, (void **)tmechs, ent_cnt, (void (*)()) mf_free_ent); if (tmechs == NULL) { - (void) __nsl_fclose(fptr); + (void) fclose(fptr); (void) mutex_unlock(&mech_file_lock); return (NULL); } } - (void) __nsl_fclose(fptr); + (void) fclose(fptr); mechs = tmechs; /* set master list to pt to newly built one */ } diff --git a/usr/src/lib/libnsl/nis/gen/nis_subr.c b/usr/src/lib/libnsl/nis/gen/nis_subr.c index 4efce4de88..386b780927 100644 --- a/usr/src/lib/libnsl/nis/gen/nis_subr.c +++ b/usr/src/lib/libnsl/nis/gen/nis_subr.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -1310,7 +1309,7 @@ nis_read_obj(char *f) /* name of the object to read */ if (!res) return (NULL); - rootfile = fopen(f, "r"); + rootfile = fopen(f, "rF"); if (rootfile == NULL) { /* This is ok if we are the root of roots. */ free(res); @@ -1339,7 +1338,7 @@ nis_write_obj( int status; /* Status of the XDR decoding */ XDR xdrs; /* An xdr stream handle */ - rootfile = fopen(f, "w"); + rootfile = fopen(f, "wF"); if (rootfile == NULL) { return (0); } diff --git a/usr/src/lib/libnsl/nss/netdir_inet.c b/usr/src/lib/libnsl/nss/netdir_inet.c index 1c71bc100a..a8fc687daf 100644 --- a/usr/src/lib/libnsl/nss/netdir_inet.c +++ b/usr/src/lib/libnsl/nss/netdir_inet.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -86,7 +85,6 @@ #include <syslog.h> #include <nsswitch.h> #include "nss.h" -#include "nsl_stdio_prv.h" #define MAXIFS 32 #define UDPDEV "/dev/udp" @@ -3056,18 +3054,18 @@ static boolean_t _read_nsw_file(void) { char defval[LINESIZE]; - __NSL_FILE *defl; + FILE *defl; boolean_t nosort = B_FALSE; do { - defl = __nsl_fopen(__NSW_DEFAULT_FILE, "r"); + defl = fopen(__NSW_DEFAULT_FILE, "rF"); } while ((defl == NULL) && (errno == EINTR)); if (defl == NULL) return (B_FALSE); - while (__nsl_fgets(defval, sizeof (defval), defl) != NULL) { + while (fgets(defval, sizeof (defval), defl) != NULL) { if ((strncmp(DONT_SORT, defval, sizeof (DONT_SORT) - 1) == 0) || (strncmp(DONT_SORT2, defval, sizeof (DONT_SORT2) - 1) == 0)) { @@ -3075,6 +3073,6 @@ _read_nsw_file(void) break; } } - (void) __nsl_fclose(defl); + (void) fclose(defl); return (nosort); } diff --git a/usr/src/lib/libnsl/rpc/clnt_generic.c b/usr/src/lib/libnsl/rpc/clnt_generic.c index f3507134ce..f89c1d5f75 100644 --- a/usr/src/lib/libnsl/rpc/clnt_generic.c +++ b/usr/src/lib/libnsl/rpc/clnt_generic.c @@ -307,8 +307,6 @@ clnt_create_service_timed(const char *host, const char *service, char *nettype = &nettype_array[0]; char *hostname, *serv; bool_t try_others; - extern int __rpc_minfd; - /* * handle const of netclass @@ -399,8 +397,7 @@ clnt_create_service_timed(const char *host, const char *service, continue; } - if (fd < __rpc_minfd) - fd = __rpc_raise_fd(fd); + RPC_RAISEFD(fd); __rpc_set_mac_options(fd, nconf, prog); @@ -609,7 +606,6 @@ _clnt_tli_create_timed(int fd, const struct netconfig *nconf, bool_t madefd; /* whether fd opened here */ t_scalar_t servtype; int retval; - extern int __rpc_minfd; if (fd == RPC_ANYFD) { if (nconf == NULL) { @@ -620,8 +616,7 @@ _clnt_tli_create_timed(int fd, const struct netconfig *nconf, fd = t_open(nconf->nc_device, O_RDWR, NULL); if (fd == -1) goto err; - if (fd < __rpc_minfd) - fd = __rpc_raise_fd(fd); + RPC_RAISEFD(fd); madefd = TRUE; __rpc_set_mac_options(fd, nconf, prog); if (t_bind(fd, NULL, NULL) == -1) @@ -761,17 +756,12 @@ err1: if (madefd) * a descriptor to a higher value. If we fail to do it, we continue * to use the old one (and hope for the best). */ -int __rpc_minfd = 3; - int __rpc_raise_fd(int fd) { int nfd; - if (fd >= __rpc_minfd) - return (fd); - - if ((nfd = fcntl(fd, F_DUPFD, __rpc_minfd)) == -1) + if ((nfd = fcntl(fd, F_DUPFD, RPC_MINFD)) == -1) return (fd); if (t_sync(nfd) == -1) { diff --git a/usr/src/lib/libnsl/rpc/netnamer.c b/usr/src/lib/libnsl/rpc/netnamer.c index 38f964ca44..ee54f94151 100644 --- a/usr/src/lib/libnsl/rpc/netnamer.c +++ b/usr/src/lib/libnsl/rpc/netnamer.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * 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 */ @@ -64,7 +63,6 @@ #include <rpc/rpc.h> #include <rpcsvc/nis.h> #include <rpcsvc/ypclnt.h> -#include "nsl_stdio_prv.h" #include <nss_dbdefs.h> static const char OPSYS[] = "unix"; @@ -218,10 +216,10 @@ netname2user_files(int *err, char *netname, struct netid_userdata *argp) char *name; char *value; char *res; - __NSL_FILE *fd; + FILE *fd; - fd = __nsl_fopen(NETIDFILE, "r"); - if (fd == (__NSL_FILE *)0) { + fd = fopen(NETIDFILE, "rF"); + if (fd == NULL) { *err = __NSW_UNAVAIL; return (0); } @@ -231,8 +229,8 @@ netname2user_files(int *err, char *netname, struct netid_userdata *argp) * netid uid:grp,grp,grp # for users * netid 0:hostname # for hosts */ - while (!__nsl_feof(fd)) { - res = __nsl_fgets(buf, 512, fd); + while (!feof(fd)) { + res = fgets(buf, 512, fd); if (res == NULL) break; @@ -257,14 +255,14 @@ netname2user_files(int *err, char *netname, struct netid_userdata *argp) *value++ = '\0'; /* nul terminate the name */ if (strcasecmp(name, netname) == 0) { - (void) __nsl_fclose(fd); + (void) fclose(fd); while (isspace(*value)) value++; *err = parse_netid_str(value, argp); return (*err == __NSW_SUCCESS); } } - (void) __nsl_fclose(fd); + (void) fclose(fd); *err = __NSW_NOTFOUND; return (0); } diff --git a/usr/src/lib/libnsl/rpc/openchild.c b/usr/src/lib/libnsl/rpc/openchild.c deleted file mode 100644 index a3bd50f72d..0000000000 --- a/usr/src/lib/libnsl/rpc/openchild.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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/usr/src/lib/libnsl/rpc/rpc_mt.h b/usr/src/lib/libnsl/rpc/rpc_mt.h index 75e93f390f..02dacdef2d 100644 --- a/usr/src/lib/libnsl/rpc/rpc_mt.h +++ b/usr/src/lib/libnsl/rpc/rpc_mt.h @@ -90,6 +90,11 @@ extern void rpc_fd_unlock(const void *handle, int fd); * way to avoid the warnings. */ +#define RPC_MINFD 3 + +#define RPC_RAISEFD(fd) if (fd < RPC_MINFD) \ + fd = __rpc_raise_fd(fd) + extern int __getpublickey_cached(char *, char *, int *); extern void __getpublickey_flush(const char *); extern int __can_use_af(sa_family_t); diff --git a/usr/src/lib/libnsl/rpc/rpc_soc.c b/usr/src/lib/libnsl/rpc/rpc_soc.c index 2dbf168273..1cb3f56b4e 100644 --- a/usr/src/lib/libnsl/rpc/rpc_soc.c +++ b/usr/src/lib/libnsl/rpc/rpc_soc.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * 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 */ @@ -83,7 +82,6 @@ clnt_com_create(struct sockaddr_in *raddr, rpcprog_t prog, rpcvers_t vers, struct netconfig *nconf; int port; struct netbuf bindaddr; - extern int __rpc_minfd; bool_t locked = TRUE; (void) mutex_lock(&rpcsoc_lock); @@ -96,8 +94,7 @@ clnt_com_create(struct sockaddr_in *raddr, rpcprog_t prog, rpcvers_t vers, fd = t_open(nconf->nc_device, O_RDWR, &tinfo); if (fd == -1) goto syserror; - if (fd < __rpc_minfd) - fd = __rpc_raise_fd(fd); + RPC_RAISEFD(fd); madefd = TRUE; } else { if (t_getinfo(fd, &tinfo) == -1) diff --git a/usr/src/lib/libnsl/rpc/svc_run.c b/usr/src/lib/libnsl/rpc/svc_run.c index 2d0d5faad8..cb91ad6515 100644 --- a/usr/src/lib/libnsl/rpc/svc_run.c +++ b/usr/src/lib/libnsl/rpc/svc_run.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -1035,7 +1034,6 @@ bool_t rpc_control(int op, void *info) { int tmp; - extern int __rpc_minfd; switch (op) { case RPC_SVC_MTMODE_SET: @@ -1075,15 +1073,6 @@ rpc_control(int op, void *info) return (TRUE); } return (FALSE); - case __RPC_CLNT_MINFD_SET: - tmp = *((int *)info); - if (tmp < 0) - return (FALSE); - __rpc_minfd = tmp; - return (TRUE); - case __RPC_CLNT_MINFD_GET: - *((int *)info) = __rpc_minfd; - return (TRUE); case RPC_SVC_CONNMAXREC_SET: tmp = __rpc_legal_connmaxrec(*(int *)info); if (tmp >= 0) { diff --git a/usr/src/lib/libnsl/rpc/svc_vc.c b/usr/src/lib/libnsl/rpc/svc_vc.c index 7bb9b35553..dced5a210c 100644 --- a/usr/src/lib/libnsl/rpc/svc_vc.c +++ b/usr/src/lib/libnsl/rpc/svc_vc.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -789,34 +788,6 @@ do_accept(int srcfd, char *tpname, char *netid, struct t_call *tcp, (void) t_snddis(srcfd, tcp); return; } - if (destfd < 256) { - int nfd; - - nfd = fcntl(destfd, F_DUPFD, 256); - if (nfd != -1) { - if (t_close(destfd) == -1) { - char errorstr[100]; - - __tli_sys_strerror(errorstr, sizeof (errorstr), - t_errno, errno); - (void) syslog(LOG_ERR, - "could not t_close() old fd %d; mem & fd leak error: %s", - destfd, errorstr); - } - destfd = nfd; - if (t_sync(destfd) == -1) { - char errorstr[100]; - - __tli_sys_strerror(errorstr, sizeof (errorstr), - t_errno, errno); - (void) syslog(LOG_ERR, - "could not t_sync() duped fd %d: %s", - destfd, errorstr); - (void) t_snddis(srcfd, tcp); - return; - } - } - } if (RPC_FD_NOTIN_FDSET(destfd)) { (void) syslog(LOG_ERR, errstring, do_accept_str, svc_vc_fderr); diff --git a/usr/src/lib/libnsl/rpc/xdr_stdio_prv.c b/usr/src/lib/libnsl/rpc/xdr_stdio_prv.c deleted file mode 100644 index 4c5f7fd292..0000000000 --- a/usr/src/lib/libnsl/rpc/xdr_stdio_prv.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * 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/usr/src/lib/libnsl/saf/checkver.c b/usr/src/lib/libnsl/saf/checkver.c index ad533d077c..867c2f0a84 100644 --- a/usr/src/lib/libnsl/saf/checkver.c +++ b/usr/src/lib/libnsl/saf/checkver.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -56,7 +55,7 @@ check_version(int ver, char *fname) char *p; /* working pointer */ int version; /* version number from sactab */ - if ((fp = fopen(fname, "r")) == NULL) + if ((fp = fopen(fname, "rF")) == NULL) return (2); p = line; while (fgets(p, BUFSIZ, fp)) { diff --git a/usr/src/lib/libnsl/saf/doconfig.c b/usr/src/lib/libnsl/saf/doconfig.c index b0bafd059e..db2b6c2bd7 100644 --- a/usr/src/lib/libnsl/saf/doconfig.c +++ b/usr/src/lib/libnsl/saf/doconfig.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -85,7 +84,7 @@ doconfig(int fd, char *script, long rflag) if (stat(script, &statbuf) < 0) return (0); - fp = fopen(script, "r"); + fp = fopen(script, "rF"); if (fp == NULL) return (-1); diff --git a/usr/src/lib/libnsl/spec/private.spec b/usr/src/lib/libnsl/spec/private.spec index 04bda504f9..85c5ce9ef9 100644 --- a/usr/src/lib/libnsl/spec/private.spec +++ b/usr/src/lib/libnsl/spec/private.spec @@ -1,13 +1,12 @@ #pragma ident "%Z%%M% %I% %E% SMI" -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # 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. +# Common Development and Distribution License (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. @@ -27,27 +26,27 @@ function cbc_crypt version SUNWprivate_1.1 -end +end function ecb_crypt version SUNWprivate_1.1 -end +end function __npd_cbc_crypt version SUNWprivate_1.1 -end +end function __npd_ecb_crypt version SUNWprivate_1.1 -end +end function xencrypt version SUNWprivate_1.1 -end +end function xdecrypt version SUNWprivate_1.1 -end +end function _check_daemon_lock version SUNWprivate_1.4 @@ -63,7 +62,7 @@ end function _herrno2nss version SUNWprivate_1.1 -end +end function _create_daemon_lock version SUNWprivate_1.4 @@ -87,27 +86,27 @@ end function __authenticate version SUNWprivate_1.1 -end +end function __break_name version SUNWprivate_1.1 -end +end function __clear_directory_ptr version SUNWprivate_1.1 -end +end function __clnt_create_loopback version SUNWprivate_1.1 -end +end function __cvt2attr version SUNWprivate_1.1 -end +end function __do_ismember version SUNWprivate_1.1 -end +end function __endhostent6 version SUNWprivate_1.2 @@ -115,7 +114,7 @@ end function __gen_dhkeys version SUNWprivate_1.1 -end +end function __gethostent6 version SUNWprivate_1.2 @@ -123,71 +122,71 @@ end function __getnetnamebyuid version SUNWprivate_1.1 -end +end function __key_decryptsession_pk_LOCAL version SUNWprivate_1.1 -end +end function __key_encryptsession_pk_LOCAL version SUNWprivate_1.1 -end +end function __key_gendes_LOCAL version SUNWprivate_1.1 -end +end function __name_distance version SUNWprivate_1.1 -end +end function __nderror version SUNWprivate_1.1 -end +end function __nis_CacheBind version SUNWprivate_1.1 -end +end function __nis_CacheInit version SUNWprivate_1.1 -end +end function __nis_CachePrint version SUNWprivate_1.1 -end +end function __nis_CacheAddEntry version SUNWprivate_1.1 -end +end function __nis_CacheRemoveEntry version SUNWprivate_1.1 -end +end function __nis_CacheRestart version SUNWprivate_1.1 -end +end function __nis_CacheSearch version SUNWprivate_1.1 -end +end function __nis_auth2princ version SUNWprivate_1.1 -end +end function __nis_bad_auth_server version SUNWprivate_1.1 -end +end function __nis_cast_proc version SUNWprivate_1.1 -end +end function __nis_ck_perms version SUNWprivate_1.1 -end +end function __nis_clnt_create version SUNWprivate_1.1 @@ -195,63 +194,63 @@ end function __nis_creategroup_obj version SUNWprivate_1.1 -end +end function __nis_core_lookup version SUNWprivate_1.1 -end +end function __nis_debuglevel version SUNWprivate_1.1 -end +end function __nis_destroy_callback version SUNWprivate_1.1 -end +end function __nis_flush_group_exp_name version SUNWprivate_1.1 -end +end function __nis_get_netconfig version SUNWprivate_1.1 -end +end function __nis_get_server version SUNWprivate_1.1 -end +end function __nis_group_cache_stats version SUNWprivate_1.1 -end +end function __nis_host2nis_server version SUNWprivate_1.1 -end +end function __nis_init_callback version SUNWprivate_1.1 -end +end function __nis_isadmin version SUNWprivate_1.1 -end +end function __nis_ismaster version SUNWprivate_1.1 -end +end function __nis_list_localcb version SUNWprivate_1.1 -end +end function __nis_local_root version SUNWprivate_1.1 -end +end function __nis_map_group_r version SUNWprivate_1.1 -end +end function __nis_netconfig2ep version SUNWprivate_1.2 @@ -263,51 +262,51 @@ end function __nis_parse_path version SUNWprivate_1.1 -end +end function __nis_pingproc version SUNWprivate_1.1 -end +end function __nis_principal version SUNWprivate_1.1 -end +end function __nis_release_server version SUNWprivate_1.1 -end +end function __nis_reset_state version SUNWprivate_1.1 -end +end function __nis_rpc_domain version SUNWprivate_1.1 -end +end function __nis_run_callback version SUNWprivate_1.1 -end +end function __nis_ss_used version SUNWprivate_1.1 -end +end function __nsl_dom version SUNWprivate_1.1 -end +end function __free_nis_server version SUNWprivate_1.1 -end +end function __nss2herrno version SUNWprivate_1.1 -end +end function __rpc_bindresvport version SUNWprivate_1.1 -end +end function __rpc_bindresvport_ipv6 version SUNWprivate_1.2 @@ -315,59 +314,59 @@ end function __rpc_control version SUNWprivate_1.1 -end +end function __rpc_dtbsize version SUNWprivate_1.1 -end +end function __rpc_endconf version SUNWprivate_1.1 -end +end function __rpc_get_a_size version SUNWprivate_1.1 -end +end function __rpc_get_default_domain version SUNWprivate_1.1 -end +end function __rpc_get_local_uid version SUNWprivate_1.1 -end +end function __rpc_get_t_size version SUNWprivate_1.1 -end +end function __rpc_getconf version SUNWprivate_1.1 -end +end function __rpc_getconfip version SUNWprivate_1.1 -end +end function __rpc_matchserv version SUNWprivate_1.1 -end +end function __rpc_negotiate_uid version SUNWprivate_1.1 -end +end function __rpc_select_to_poll version SUNWprivate_1.1 -end +end function __rpc_setconf version SUNWprivate_1.1 -end +end function __rpc_timeval_to_msec version SUNWprivate_1.1 -end +end function __rpc_tli_set_options declaration int __rpc_tli_set_options(int fd, int optlevel, int optname,\ @@ -377,15 +376,15 @@ end function __rpcbind_is_up version SUNWprivate_1.1 -end +end function __rpcfd_to_nconf version SUNWprivate_1.1 -end +end function __seterr_reply version SUNWprivate_1.1 -end +end function __sethostent6 version SUNWprivate_1.2 @@ -393,975 +392,975 @@ end function __svc_get_svcauth version SUNWprivate_1.1 -end +end function __svc_nisplus_fdcleanup_hack version SUNWprivate_1.1 -end +end function __svc_set_proc_cleanup_cb version SUNWprivate_1.1 -end +end function __svc_vc_dup version SUNWprivate_1.1 -end +end function __svc_vc_dupcache_init version SUNWprivate_1.1 -end +end function __svc_vc_dupdone version SUNWprivate_1.1 -end +end function __svcauth_des version SUNWprivate_1.1 -end +end function __start_clock version SUNWprivate_1.1 -end +end function __stop_clock version SUNWprivate_1.1 -end +end function __yp_dobind version SUNWprivate_1.1 -end +end function __yp_master_rsvdport version SUNWprivate_1.1 -end +end function __yp_all_rsvdport version SUNWprivate_1.1 -end +end function __yp_clnt_create_rsvdport version SUNWprivate_1.1 -end +end function __yp_rel_binding version SUNWprivate_1.1 -end +end function __yp_add_binding version SUNWprivate_1.1 -end +end function __empty_yp_cache version SUNWprivate_1.1 -end +end function _get_hostserv_inetnetdir_byaddr version SUNWprivate_1.1 -end +end function _get_hostserv_inetnetdir_byname version SUNWprivate_1.1 -end +end function _rawcombuf version SUNWprivate_1.1 -end +end function _switch_gethostbyaddr_r version SUNWprivate_1.1 -end +end function _switch_gethostbyname_r version SUNWprivate_1.1 -end +end function _svc_getreqset_proc version SUNWprivate_1.1 -end +end function _uncached_gethostbyaddr_r version SUNWprivate_1.1 -end +end function _uncached_gethostbyname_r version SUNWprivate_1.1 -end +end function bitno version SUNWprivate_1.1 -end +end function blkno version SUNWprivate_1.1 -end +end function calchash version SUNWprivate_1.1 -end +end function check_version version SUNWprivate_1.1 -end +end function dbrdonly version SUNWprivate_1.1 -end +end function dirbuf version SUNWprivate_1.1 -end +end function dirf version SUNWprivate_1.1 -end +end function firsthash version SUNWprivate_1.1 -end +end function getdomainname version SUNWprivate_1.1 -end +end function hashinc version SUNWprivate_1.1 -end +end function hmask version SUNWprivate_1.1 -end +end function key_call version SUNWprivate_1.1 -end +end function key_call_ruid version SUNWprivate_1.3 -end +end function key_decryptsession_pk version SUNWprivate_1.1 -end +end function key_encryptsession_pk version SUNWprivate_1.1 -end +end function key_get_conv version SUNWprivate_1.1 -end +end function key_setnet version SUNWprivate_1.1 -end +end function key_setnet_ruid version SUNWprivate_1.3 -end +end function makdatum version SUNWprivate_1.1 -end +end function nis_flushgroups version SUNWprivate_1.1 -end +end function nis_old_data version SUNWprivate_1.1 -end +end function nis_pop_item version SUNWprivate_1.1 -end +end -function pagbuf +function pagbuf version SUNWprivate_1.1 -end +end function pagf version SUNWprivate_1.1 -end +end function passwd2des version SUNWprivate_1.1 -end +end function rpcb_taddr2uaddr version SUNWprivate_1.1 -end +end function rpcb_uaddr2taddr version SUNWprivate_1.1 -end +end function rtime_tli version SUNWprivate_1.1 -end +end function setdomainname version SUNWprivate_1.1 -end +end function str2servent version SUNWprivate_1.1 -end +end function str2hostent version SUNWprivate_1.1 -end +end function str2hostent6 version SUNWprivate_1.4 -end +end function svc_xprt_alloc version SUNWprivate_1.1 -end +end function svc_xprt_free version SUNWprivate_1.1 -end +end function t_errlist version SUNWprivate_1.1 -end +end function tiusr_statetbl version SUNWprivate_1.1 -end +end function usingypmap version SUNWprivate_1.1 -end +end function writeColdStartFile version SUNWprivate_1.1 -end +end function xdr_authdes_cred version SUNWprivate_1.1 -end +end function xdr_authdes_verf version SUNWprivate_1.1 -end +end function xdr_cback_data version SUNWprivate_1.1 -end +end function xdr_cp_result version SUNWprivate_1.1 -end +end function xdr_cryptkeyarg2 version SUNWprivate_1.1 -end +end function xdr_cryptkeyarg version SUNWprivate_1.1 -end +end function xdr_cryptkeyres version SUNWprivate_1.1 -end +end function xdr_datum version SUNWprivate_1.1 -end +end function xdr_des_block version SUNWprivate_1.1 -end +end function xdr_directory_obj version SUNWprivate_1.1 -end +end function xdr_dump_args version SUNWprivate_1.1 -end +end function xdr_entry_obj version SUNWprivate_1.1 -end +end function xdr_fd_args version SUNWprivate_1.1 -end +end function xdr_fd_result version SUNWprivate_1.1 -end +end function xdr_getcredres version SUNWprivate_1.1 -end +end function xdr_gid_t version SUNWprivate_1.1 -end +end function xdr_uid_t version SUNWprivate_1.1 -end +end function xdr_ib_request version SUNWprivate_1.1 -end +end function xdr_log_entry version SUNWprivate_1.1 -end +end function xdr_log_result version SUNWprivate_1.1 -end +end function xdr_key_netstarg version SUNWprivate_1.1 -end +end function xdr_key_netstres version SUNWprivate_1.1 -end +end function xdr_keybuf version SUNWprivate_1.1 -end +end function xdr_keystatus version SUNWprivate_1.1 -end +end function xdr_netbuf version SUNWprivate_1.1 -end +end function xdr_netnamestr version SUNWprivate_1.1 -end +end function xdr_netobj version SUNWprivate_1.1 -end +end function xdr_nis_attr version SUNWprivate_1.1 -end +end function xdr_nis_error version SUNWprivate_1.1 -end +end function xdr_nis_name version SUNWprivate_1.1 -end +end function xdr_nis_object version SUNWprivate_1.1 -end +end function xdr_nis_oid version SUNWprivate_1.1 -end +end function xdr_nis_result version SUNWprivate_1.1 -end +end function xdr_nis_server version SUNWprivate_1.1 -end +end function xdr_nis_taglist version SUNWprivate_1.1 -end +end function xdr_ns_request version SUNWprivate_1.1 -end +end function xdr_obj_p version SUNWprivate_1.1 -end +end function xdr_objdata version SUNWprivate_1.1 -end +end function xdr_ping_args version SUNWprivate_1.1 -end +end function xdr_pmap version SUNWprivate_1.1 -end +end function xdr_pmaplist version SUNWprivate_1.1 -end +end function xdr_pmaplist_ptr version SUNWprivate_1.1 -end +end function xdr_rmtcallargs version SUNWprivate_1.1 -end +end function xdr_rmtcallres version SUNWprivate_1.1 -end +end function xdr_rpcb version SUNWprivate_1.1 -end +end function xdr_rpcb_entry version SUNWprivate_1.1 -end +end function xdr_rpcb_entry_list_ptr version SUNWprivate_1.1 -end +end function xdr_rpcb_rmtcallargs version SUNWprivate_1.1 -end +end function xdr_rpcb_rmtcallres version SUNWprivate_1.1 -end +end function xdr_rpcb_stat version SUNWprivate_1.1 -end +end function xdr_rpcb_stat_byvers version SUNWprivate_1.1 -end +end function xdr_rpcblist version SUNWprivate_1.1 -end +end function xdr_rpcblist_ptr version SUNWprivate_1.1 -end +end function xdr_rpcbs_addrlist version SUNWprivate_1.1 -end +end function xdr_rpcbs_addrlist_ptr version SUNWprivate_1.1 -end +end function xdr_rpcbs_proc version SUNWprivate_1.1 -end +end function xdr_rpcbs_rmtcalllist version SUNWprivate_1.1 -end +end function xdr_rpcbs_rmtcalllist_ptr version SUNWprivate_1.1 -end +end function xdr_table_obj version SUNWprivate_1.1 -end +end function xdr_ulonglong_t version SUNWprivate_1.1 -end +end function xdr_unixcred version SUNWprivate_1.1 -end +end function xdr_yp_buf version SUNWprivate_1.1 -end +end function xdr_ypall version SUNWprivate_1.1 -end +end function xdr_ypbind_domain version SUNWprivate_1.1 -end +end function xdr_ypbind_resp version SUNWprivate_1.1 -end +end function xdr_ypbind_resptype version SUNWprivate_1.1 -end +end function xdr_ypbind_setdom version SUNWprivate_1.1 -end +end function xdr_ypdelete_args version SUNWprivate_1.1 -end +end function xdr_ypdomain_wrap_string version SUNWprivate_1.1 -end +end function xdr_ypmap_parms version SUNWprivate_1.1 -end +end function xdr_ypmap_wrap_string version SUNWprivate_1.1 -end +end function xdr_ypowner_wrap_string version SUNWprivate_1.1 -end +end function xdr_yppasswd version SUNWprivate_1.1 -end +end function xdr_yppushresp_xfr version SUNWprivate_1.1 -end +end function xdr_ypreq_key version SUNWprivate_1.1 -end +end function xdr_ypreq_newxfr version SUNWprivate_1.1 -end +end function xdr_ypreq_nokey version SUNWprivate_1.1 -end +end function xdr_ypreq_xfr version SUNWprivate_1.1 -end +end function xdr_ypresp_key_val version SUNWprivate_1.1 -end +end function xdr_ypresp_maplist version SUNWprivate_1.1 -end +end function xdr_ypresp_master version SUNWprivate_1.1 -end +end function xdr_ypresp_order version SUNWprivate_1.1 -end +end function xdr_ypresp_val version SUNWprivate_1.1 -end +end function xdr_ypupdate_args version SUNWprivate_1.1 -end +end function yp_match_rsvdport version SUNWprivate_1.1 -end +end function ypbindproc_domain_3 version SUNWprivate_1.1 -end +end function __nis_host_is_server version SUNWprivate_1.1 -end +end function __nis_remote_lookup version SUNWprivate_1.1 -end +end function __nis_finddirectory_remote version SUNWprivate_1.1 -end +end function __nis_finddirectory version SUNWprivate_1.1 -end +end function nis_bind_dir version SUNWprivate_1.1 -end +end function nis_free_binding version SUNWprivate_1.1 -end +end function __nis_CacheLocalInit version SUNWprivate_1.1 -end +end function __nis_CacheLocalLoadPref version SUNWprivate_1.1 -end +end function __nis_serverRefreshCache version SUNWprivate_1.1 -end +end function __nis_CacheMgrBindMaster version SUNWprivate_1.1 -end +end function __inet_address_count version SUNWprivate_1.1 -end +end function xdr_nis_bound_directory version SUNWprivate_1.1 -end +end function __nis_CacheMgrRefreshAddress version SUNWprivate_1.1 -end +end function __nis_CacheMgrRefreshCallback version SUNWprivate_1.1 -end +end function __nis_CacheMgrRefreshBinding version SUNWprivate_1.1 -end +end function __nis_CacheMgrTimers version SUNWprivate_1.1 -end +end function __nis_CacheMgrRefreshCache version SUNWprivate_1.1 -end +end function __nis_CacheMgrInit version SUNWprivate_1.1 -end +end function __nis_CacheMgrInit_discard version SUNWprivate_1.1 -end +end function __nis_CacheMgrBindReplica version SUNWprivate_1.1 -end +end function __inet_get_uaddr version SUNWprivate_1.1 -end +end function __nis_CacheMgrCleanup version SUNWprivate_1.1 -end +end function __inet_get_networka version SUNWprivate_1.1 -end +end function xdr_endpoint version SUNWprivate_1.1 -end +end function __nis_CacheMgrBindServer version SUNWprivate_1.1 -end +end function __nis_CacheMgrUpdateUaddr version SUNWprivate_1.1 -end +end function __inet_uaddr_is_local version SUNWprivate_1.1 -end +end function __nis_CacheMgrMarkUp version SUNWprivate_1.1 -end +end function xdr_nis_bound_endpoint version SUNWprivate_1.1 -end +end function __nis_path version SUNWprivate_1.1 -end +end function __nis_path_free version SUNWprivate_1.1 -end +end function __nis_print_result version SUNWprivate_1.1 -end +end function __nis_send_msg version SUNWprivate_1.1 -end +end function __inet_get_local_interfaces version SUNWprivate_1.1 -end +end function __inet_get_addr version SUNWprivate_1.1 -end +end function __inet_free_local_interfaces version SUNWprivate_1.1 -end +end function __getpublickey_cached version SUNWprivate_1.1 -end +end function __getpublickey_flush version SUNWprivate_1.1 -end +end function __nis_freelogresult version SUNWprivate_1.1 -end +end function __svc_nisplus_purge_since version SUNWprivate_1.1 -end +end function __svc_nisplus_enable_timestamps version SUNWprivate_1.1 -end +end function __nis_force_hard_lookups version SUNWprivate_1.1 -end +end function __readColdStartFile version SUNWprivate_1.1 -end +end function xdr_setkeyarg3 version SUNWprivate_1.1 -end +end function xdr_key_netstarg3 version SUNWprivate_1.1 -end +end function xdr_key_netstres3 version SUNWprivate_1.1 -end +end function xdr_keybuf3 version SUNWprivate_1.1 -end +end function xdr_keynum_t version SUNWprivate_1.1 -end +end function xdr_mechtype version SUNWprivate_1.1 -end +end function xdr_getcredres3 version SUNWprivate_1.1 -end +end function xdr_cryptkeyarg3 version SUNWprivate_1.1 -end +end function xdr_cryptkeyres3 version SUNWprivate_1.1 -end +end function xdr_deskeyarg3 version SUNWprivate_1.1 -end +end function xdr_deskeyarray version SUNWprivate_1.1 -end +end function __nis_host2nis_server_g version SUNWprivate_1.1 -end +end function nis_make_rpchandle_gss_svc version SUNWprivate_1.1 -end +end function nis_make_rpchandle_gss_svc_ruid version SUNWprivate_1.4 -end +end function __nis_gssprin2netname version SUNWprivate_1.1 -end +end function __nis_auth2princ_rpcgss version SUNWprivate_1.1 -end +end function __nis_dhext_extract_pkey version SUNWprivate_1.1 -end +end function __cbc_triple_crypt version SUNWprivate_1.1 -end +end function xencrypt_g version SUNWprivate_1.1 -end +end function xdecrypt_g version SUNWprivate_1.1 -end +end function __nis_authtype2mechalias version SUNWprivate_1.1 -end +end function __nis_get_mechanisms version SUNWprivate_1.1 -end +end function __nis_get_mechanism_library version SUNWprivate_1.1 -end +end function __nis_get_mechanism_symbol version SUNWprivate_1.1 -end +end function __nis_mechalias2authtype version SUNWprivate_1.1 -end +end function __nis_mechname2alias version SUNWprivate_1.1 -end +end function __nis_translate_mechanism version SUNWprivate_1.1 -end +end function __nis_release_mechanisms version SUNWprivate_1.1 -end +end function __nis_keyalg2authtype version SUNWprivate_1.1 -end +end function __nis_keyalg2mechalias version SUNWprivate_1.1 -end +end function __gen_dhkeys_g version SUNWprivate_1.1 -end +end function __gen_common_dhkeys_g version SUNWprivate_1.1 -end +end function passwd2des_g version SUNWprivate_1.1 -end +end function des_setparity_g version SUNWprivate_1.1 -end +end function getpublickey_g version SUNWprivate_1.1 -end +end function __getpublickey_cached_g version SUNWprivate_1.1 -end +end function __getpublickey_flush_g version SUNWprivate_1.1 -end +end function getsecretkey_g version SUNWprivate_1.1 -end +end function key_secretkey_is_set_g version SUNWprivate_1.1 -end +end function key_secretkey_is_set_g_ruid version SUNWprivate_1.3 -end +end function key_removesecret_g version SUNWprivate_1.1 -end +end function key_removesecret_g_ruid version SUNWprivate_1.3 -end +end function key_gendes_g version SUNWprivate_1.1 -end +end function key_encryptsession_g version SUNWprivate_1.1 -end +end function key_decryptsession_g version SUNWprivate_1.1 -end +end function key_setsecret_g version SUNWprivate_1.1 -end +end function key_decryptsession_pk_g version SUNWprivate_1.1 -end +end function key_encryptsession_pk_g version SUNWprivate_1.1 -end +end function key_get_conv_g version SUNWprivate_1.1 -end +end function key_setnet_g version SUNWprivate_1.1 -end +end function key_setnet_g_ruid version SUNWprivate_1.3 -end +end function __netdir_getbyaddr_nosrv version SUNWprivate_1.1 -end +end function nss_ioctl version SUNWprivate_1.1 @@ -1373,7 +1372,7 @@ end function __des_crypt version SUNWprivate_1.1 -end +end # PSARC 1997/332; User Attr databases START @@ -1513,25 +1512,25 @@ function __yp_match_cflookup declaration int __yp_match_cflookup(char *, char *, char *, int, char **,\ int *, int *); version SUNWprivate_1.2 -end +end function __yp_match_rsvdport_cflookup declaration int __yp_match_rsvdport_cflookup(char *, char *, char *,\ int, char **, int *, int *); version SUNWprivate_1.2 -end +end function __yp_first_cflookup declaration int __yp_first_cflookup(char *, char *, char **, int *,\ char **, int *, int); version SUNWprivate_1.2 -end +end function __yp_next_cflookup declaration int __yp_next_cflookup(char *, char *, char *, int, char **,\ int *, char **, int *, int); version SUNWprivate_1.2 -end +end # PSARC/1998/452; Bug 4181371; NSS Lookup Control END @@ -1539,40 +1538,4 @@ function __yp_all_cflookup #declaration int __yp_all_cflookup(char *, char *, \ # struct ypall_callback *, int); version SUNWprivate_1.4 -end - -# stdio_prv - -function __nsl_fopen -version SUNWprivate_1.4 -end - -function __nsl_fclose -version SUNWprivate_1.4 -end - -function __nsl_fgets -version SUNWprivate_1.4 -end - -function __nsl_feof -version SUNWprivate_1.4 -end - -function __nsl_fseek -version SUNWprivate_1.4 -end - -function __nsl_frewind -version SUNWprivate_1.4 -end - -function __nsl_fgetc -version SUNWprivate_1.4 -end - -function __nsl_ungetc -version SUNWprivate_1.4 -end - -# stdio_prv end +end diff --git a/usr/src/lib/libnsl/yp/yp_bind.c b/usr/src/lib/libnsl/yp/yp_bind.c index 8504bfb03c..1aafe0c694 100644 --- a/usr/src/lib/libnsl/yp/yp_bind.c +++ b/usr/src/lib/libnsl/yp/yp_bind.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -53,7 +52,6 @@ #include <rpcsvc/yp_prot.h> #include <rpcsvc/ypclnt.h> #include <sys/tiuser.h> -#include "nsl_stdio_prv.h" #define BFSIZE (YPMAXDOMAIN + 32) /* size of binding file */ int __ypipbufsize = 8192; /* size used for clnt_tli_create */ @@ -1113,7 +1111,7 @@ get_cached_transport(struct netconfig *nconf, int vers, char *uaddress, static ypbind_resp * get_cached_domain(char *domain) { - __NSL_FILE *fp; + FILE *fp; int st; char filename[300]; static ypbind_resp res; @@ -1121,24 +1119,24 @@ get_cached_domain(char *domain) (void) snprintf(filename, sizeof (filename), "%s/%s/cache_binding", BINDING, domain); - fp = __nsl_fopen(filename, "r"); + fp = fopen(filename, "rF"); if (fp == 0) return (0); /* if first byte is not locked, then ypbind must not be running */ - st = lockf(__nsl_fileno(fp), F_TEST, 1); + st = lockf(fileno(fp), F_TEST, 1); if (st != -1 || (errno != EAGAIN && errno != EACCES)) { - (void) __nsl_fclose(fp); + (void) fclose(fp); return (0); } - __nsl_xdrstdio_create(&xdrs, fp, XDR_DECODE); + xdrstdio_create(&xdrs, fp, XDR_DECODE); (void) memset((char *)&res, 0, sizeof (res)); st = xdr_ypbind_resp(&xdrs, &res); xdr_destroy(&xdrs); - (void) __nsl_fclose(fp); + (void) fclose(fp); if (st) return (&res); diff --git a/usr/src/lib/libpool/common/pool.c b/usr/src/lib/libpool/common/pool.c index 1bd996cc8c..5c6c6a9c1b 100644 --- a/usr/src/lib/libpool/common/pool.c +++ b/usr/src/lib/libpool/common/pool.c @@ -737,13 +737,13 @@ pool_set_status(int state) if (state) { char *cmd = "/usr/sbin/svcadm enable -s " \ SMF_SVC_INSTANCE; - if ((p = popen(cmd, "w")) == NULL || + if ((p = popen(cmd, "wF")) == NULL || pclose(p) != 0) return (PO_FAIL); } else { char *cmd = "/usr/sbin/svcadm disable -s " \ SMF_SVC_INSTANCE; - if ((p = popen(cmd, "w")) == NULL || + if ((p = popen(cmd, "wF")) == NULL || pclose(p) != 0) return (PO_FAIL); } diff --git a/usr/src/lib/libpool/common/pool_xml.c b/usr/src/lib/libpool/common/pool_xml.c index 31cbe2add0..78ea8f5156 100644 --- a/usr/src/lib/libpool/common/pool_xml.c +++ b/usr/src/lib/libpool/common/pool_xml.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -2026,9 +2025,9 @@ pool_xml_open_file(pool_conf_t *conf) } if ((prov->pc_oflags & PO_RDWR) != 0) - prov->pxc_file = fopen(conf->pc_location, "r+"); + prov->pxc_file = fopen(conf->pc_location, "r+F"); else /* Assume opening PO_RDONLY */ - prov->pxc_file = fopen(conf->pc_location, "r"); + prov->pxc_file = fopen(conf->pc_location, "rF"); if (prov->pxc_file == NULL) { pool_seterror(POE_SYSTEM); diff --git a/usr/src/lib/libresolv2/common/irs/lcl_ho.c b/usr/src/lib/libresolv2/common/irs/lcl_ho.c index cebf63ef08..469cbb7f41 100644 --- a/usr/src/lib/libresolv2/common/irs/lcl_ho.c +++ b/usr/src/lib/libresolv2/common/irs/lcl_ho.c @@ -1,5 +1,5 @@ /* - * Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -87,9 +87,6 @@ static const char rcsid[] = "$Id: lcl_ho.c,v 1.26 2001/05/29 05:49:04 marka Exp #include <isc/memcluster.h> #include "port_after.h" -#ifdef SUNW_AVOIDSTDIO_FDLIMIT -#include "../../../libnsl/include/nsl_stdio_prv.h" -#endif #include "irs_p.h" #include "dns_p.h" @@ -114,11 +111,7 @@ static const char rcsid[] = "$Id: lcl_ho.c,v 1.26 2001/05/29 05:49:04 marka Exp #endif struct pvt { -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - __NSL_FILE * fp; -#else FILE * fp; -#endif struct hostent host; char * h_addr_ptrs[MAXADDRS + 1]; char * host_aliases[MAXALIASES]; @@ -205,11 +198,7 @@ ho_close(struct irs_ho *this) { ho_minimize(this); if (pvt->fp) -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - (void) __nsl_fclose(pvt->fp); -#else (void) fclose(pvt->fp); -#endif if (pvt->res && pvt->free_res) (*pvt->free_res)(pvt->res); memput(pvt, sizeof *pvt); @@ -358,21 +347,13 @@ ho_next(struct irs_ho *this) { bufsiz = sizeof pvt->hostbuf; offset = 0; again: -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - if (!(p = __nsl_fgets(bufp + offset, bufsiz - offset, pvt->fp))) { -#else if (!(p = fgets(bufp + offset, bufsiz - offset, pvt->fp))) { -#endif RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND); if (dbuf) free(dbuf); return (NULL); } -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - if (!strchr(p, '\n') && !__nsl_feof(pvt->fp)) { -#else if (!strchr(p, '\n') && !feof(pvt->fp)) { -#endif #define GROWBUF 1024 /* allocate space for longer line */ if (dbuf == NULL) { @@ -387,19 +368,11 @@ ho_next(struct irs_ho *this) { offset = strlen(dbuf); } else { /* allocation failed; skip this long line */ -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - while ((c = __nsl_getc(pvt->fp)) != EOF) -#else while ((c = getc(pvt->fp)) != EOF) -#endif if (c == '\n') break; if (c != EOF) -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - __nsl_ungetc(c, pvt->fp); -#else ungetc(c, pvt->fp); -#endif } goto again; } @@ -462,32 +435,21 @@ static void ho_rewind(struct irs_ho *this) { struct pvt *pvt = (struct pvt *)this->private; -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - if (pvt->fp) { - if (__nsl_fseek(pvt->fp, 0L, SEEK_SET) == 0) - return; - (void)__nsl_fclose(pvt->fp); - } - if (!(pvt->fp = __nsl_fopen(_PATH_HOSTS, "r"))) - return; - if (fcntl(__nsl_fileno(pvt->fp), F_SETFD, 1) < 0) { - (void)__nsl_fclose(pvt->fp); - pvt->fp = NULL; - } -#else if (pvt->fp) { if (fseek(pvt->fp, 0L, SEEK_SET) == 0) return; (void)fclose(pvt->fp); } +#ifdef SUNW_AVOIDSTDIO_FDLIMIT + if (!(pvt->fp = fopen(_PATH_HOSTS, "rF"))) +#else if (!(pvt->fp = fopen(_PATH_HOSTS, "r"))) +#endif return; if (fcntl(fileno(pvt->fp), F_SETFD, 1) < 0) { (void)fclose(pvt->fp); pvt->fp = NULL; } -#endif - } static void @@ -495,11 +457,7 @@ ho_minimize(struct irs_ho *this) { struct pvt *pvt = (struct pvt *)this->private; if (pvt->fp != NULL) { -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - (void)__nsl_fclose(pvt->fp); -#else (void)fclose(pvt->fp); -#endif pvt->fp = NULL; } if (pvt->res) diff --git a/usr/src/lib/libresolv2/common/isc/logging.c b/usr/src/lib/libresolv2/common/isc/logging.c index 48ce0859c9..f279ea525d 100644 --- a/usr/src/lib/libresolv2/common/isc/logging.c +++ b/usr/src/lib/libresolv2/common/isc/logging.c @@ -1,5 +1,5 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -158,7 +158,11 @@ log_open_stream(log_channel chan) { chan->flags |= LOG_CHANNEL_BROKEN; return (NULL); } +#ifdef SUNW_AVOIDSTDIO_FDLIMIT + stream = fdopen(fd, "aF"); +#else stream = fdopen(fd, "a"); +#endif if (stream == NULL) { syslog(LOG_ERR, "log_open_stream: fdopen() failed"); chan->flags |= LOG_CHANNEL_BROKEN; diff --git a/usr/src/lib/libresolv2/common/resolv/res_init.c b/usr/src/lib/libresolv2/common/resolv/res_init.c index 06b35591b1..e0eac579e4 100644 --- a/usr/src/lib/libresolv2/common/resolv/res_init.c +++ b/usr/src/lib/libresolv2/common/resolv/res_init.c @@ -1,5 +1,5 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -99,9 +99,6 @@ static const char rcsid[] = "$Id: res_init.c,v 8.32 2003/04/03 06:31:10 marka Ex #include <netdb.h> #include "port_after.h" -#ifdef SUNW_AVOIDSTDIO_FDLIMIT -#include "../../../libnsl/include/nsl_stdio_prv.h" -#endif /* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */ #include <resolv.h> @@ -176,11 +173,7 @@ res_ninit(res_state statp) { /* This function has to be reachable by res_data.c but not publically. */ int __res_vinit(res_state statp, int preinit) { -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - register __NSL_FILE *fp; -#else register FILE *fp; -#endif register char *cp, **pp; register int n; char buf[BUFSIZ]; @@ -396,15 +389,13 @@ __res_vinit(res_state statp, int preinit) { nserv = 0; -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - if ((fp = __nsl_fopen(_PATH_RESCONF, "r")) != NULL) { - /* read the config file */ - while (__nsl_fgets(buf, sizeof(buf), fp) != NULL) { +#ifdef SUNW_AVOIDSTDIO_FDLIMIT + if ((fp = fopen(_PATH_RESCONF, "rF")) != NULL) { #else if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) { +#endif /* read the config file */ while (fgets(buf, sizeof(buf), fp) != NULL) { -#endif /* skip comments */ if (*buf == ';' || *buf == '#') continue; @@ -550,12 +541,7 @@ __res_vinit(res_state statp, int preinit) { #ifdef RESOLVSORT statp->nsort = nsort; #endif - -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - (void) __nsl_fclose(fp); -#else (void) fclose(fp); -#endif } /* * Last chance to get a nameserver. This should not normally diff --git a/usr/src/lib/libresolv2/common/resolv/res_query.c b/usr/src/lib/libresolv2/common/resolv/res_query.c index 55746f572f..b592f4e72f 100644 --- a/usr/src/lib/libresolv2/common/resolv/res_query.c +++ b/usr/src/lib/libresolv2/common/resolv/res_query.c @@ -1,5 +1,5 @@ /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -94,9 +94,6 @@ static const char rcsid[] = "$Id: res_query.c,v 8.24 2003/01/31 15:25:58 vixie E #include <stdlib.h> #include <string.h> #include "port_after.h" -#ifdef SUNW_AVOIDSTDIO_FDLIMIT -#include "../../../libnsl/include/nsl_stdio_prv.h" -#endif /* Options. Leave them on. */ #define DEBUG @@ -407,30 +404,20 @@ const char * res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) { char *file, *cp1, *cp2; char buf[BUFSIZ]; -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - __NSL_FILE *fp; -#else FILE *fp; -#endif if (statp->options & RES_NOALIASES) return (NULL); file = getenv("HOSTALIASES"); -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - if (file == NULL || (fp = __nsl_fopen(file, "r")) == NULL) +#ifdef SUNW_AVOIDSTDIO_FDLIMIT + if (file == NULL || (fp = fopen(file, "rF")) == NULL) #else if (file == NULL || (fp = fopen(file, "r")) == NULL) #endif return (NULL); -#ifndef SUNW_AVOIDSTDIO_FDLIMIT setbuf(fp, NULL); -#endif buf[sizeof(buf) - 1] = '\0'; -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - while (__nsl_fgets(buf, sizeof(buf), fp)) { -#else while (fgets(buf, sizeof(buf), fp)) { -#endif for (cp1 = buf; *cp1 && !isspace((unsigned char)*cp1); ++cp1) ; if (!*cp1) @@ -447,18 +434,10 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) { *cp2 = '\0'; strncpy(dst, cp1, siz - 1); dst[siz - 1] = '\0'; -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - __nsl_fclose(fp); -#else fclose(fp); -#endif return (dst); } } -#ifdef SUNW_AVOIDSTDIO_FDLIMIT - __nsl_fclose(fp); -#else fclose(fp); -#endif return (NULL); } diff --git a/usr/src/lib/libresolv2/req.flg b/usr/src/lib/libresolv2/req.flg deleted file mode 100644 index 9ca59f35c3..0000000000 --- a/usr/src/lib/libresolv2/req.flg +++ /dev/null @@ -1,9 +0,0 @@ -#!/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/usr/src/lib/librsm/common/rsmlib.c b/usr/src/lib/librsm/common/rsmlib.c index 193e5f85fa..e109b64f02 100644 --- a/usr/src/lib/librsm/common/rsmlib.c +++ b/usr/src/lib/librsm/common/rsmlib.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -185,7 +184,7 @@ _rsm_librsm_init() #ifdef DEBUG mutex_init(&rsmlog_lock, USYNC_THREAD, NULL); sprintf(logname, "%s.%d", TRACELOG, getpid()); - rsmlog_fd = fopen(logname, "w+"); + rsmlog_fd = fopen(logname, "w+F"); if (rsmlog_fd == NULL) { fprintf(stderr, "Log file open failed\n"); return (errno); @@ -3076,7 +3075,7 @@ _rsm_get_segmentid_range(const char *appid, rsm_memseg_id_t *baseid, if (appid == NULL || baseid == NULL || length == NULL) return (RSMERR_BAD_ADDR); - if ((fp = fopen(RSMSEGIDFILE, "r")) == NULL) { + if ((fp = fopen(RSMSEGIDFILE, "rF")) == NULL) { DBPRINTF((RSM_LIBRARY, RSM_DEBUG_VERBOSE, "cannot open <%s>\n", RSMSEGIDFILE)); return (RSMERR_BAD_CONF); diff --git a/usr/src/lib/libsasl/lib/config.c b/usr/src/lib/libsasl/lib/config.c index 265d95d0b7..a2883ad0ac 100644 --- a/usr/src/lib/libsasl/lib/config.c +++ b/usr/src/lib/libsasl/lib/config.c @@ -1,5 +1,5 @@ /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -102,7 +102,7 @@ int sasl_config_init(const char *filename) nconfiglist=0; #endif /* _SUN_SDK_ */ - infile = fopen(filename, "r"); + infile = fopen(filename, "rF"); if (!infile) { return SASL_CONTINUE; } diff --git a/usr/src/lib/libsasl/lib/dlopen.c b/usr/src/lib/libsasl/lib/dlopen.c index 0412efa5e8..b8b15b8ce4 100644 --- a/usr/src/lib/libsasl/lib/dlopen.c +++ b/usr/src/lib/libsasl/lib/dlopen.c @@ -1,5 +1,5 @@ /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -304,7 +304,7 @@ static int _parse_la(const char *prefix, const char *in, char *out) length = strlen(line); *(line + (length - strlen(SO_SUFFIX))) = '\0'; strcat(line, LA_SUFFIX); - file = fopen(line, "r"); + file = fopen(line, "rF"); if(file) { /* We'll get it on the .la open */ fclose(file); @@ -319,7 +319,7 @@ static int _parse_la(const char *prefix, const char *in, char *out) strcpy(line, prefix); strcat(line, in); - file = fopen(line, "r"); + file = fopen(line, "rF"); if(!file) { _sasl_log(NULL, SASL_LOG_WARN, "unable to open LA file: %s", line); diff --git a/usr/src/lib/libsasl/lib/server.c b/usr/src/lib/libsasl/lib/server.c index 50e967cd67..f76f973583 100644 --- a/usr/src/lib/libsasl/lib/server.c +++ b/usr/src/lib/libsasl/lib/server.c @@ -1,5 +1,5 @@ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -884,7 +884,7 @@ static int parse_mechlist_file(const char *mechlistfile) char *t, *ptr; int r = 0; - f = fopen(mechlistfile, "r"); + f = fopen(mechlistfile, "rF"); if (!f) return SASL_FAIL; r = SASL_OK; diff --git a/usr/src/lib/libsldap/common/ns_confmgr.c b/usr/src/lib/libsldap/common/ns_confmgr.c index 833f993682..02a8db32fd 100644 --- a/usr/src/lib/libsldap/common/ns_confmgr.c +++ b/usr/src/lib/libsldap/common/ns_confmgr.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -121,7 +120,7 @@ read_file(ns_config_t *ptr, int cred_file, ns_ldap_error_t **error) } else { file = NSCONFIGFILE; } - fp = fopen(file, "r"); + fp = fopen(file, "rF"); if (fp == NULL) { (void) snprintf(errstr, sizeof (errstr), gettext("Unable to open filename '%s' " @@ -414,7 +413,7 @@ __ns_ldap_DumpLdif(char *filename) if (filename == NULL) { fp = stdout; } else { - fp = fopen(filename, "w"); + fp = fopen(filename, "wF"); if (fp == NULL) { (void) snprintf(errstr, sizeof (errstr), gettext("Unable to open filename %s for ldif " @@ -526,7 +525,7 @@ __ns_ldap_DumpConfigFiles(char **files) if (fi == 1) docred++; rc = stat(filename, &buf); - fp = fopen(filename, "w"); + fp = fopen(filename, "wF"); if (fp == NULL) { (void) snprintf(errstr, sizeof (errstr), gettext("Unable to open filename %s" diff --git a/usr/src/lib/libslp/clib/slp_config.c b/usr/src/lib/libslp/clib/slp_config.c index b84fda0114..d48c1cce9a 100644 --- a/usr/src/lib/libslp/clib/slp_config.c +++ b/usr/src/lib/libslp/clib/slp_config.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,8 +19,8 @@ * CDDL HEADER END */ /* - * Copyright (c) 1999 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -101,9 +100,9 @@ void slp_readConfig() { /* check env for alternate config file */ fp = NULL; if (cfile = getenv("SLP_CONF_FILE")) - fp = fopen(cfile, "r"); + fp = fopen(cfile, "rF"); if (!fp) - if (!(fp = fopen(SLP_DEFAULT_CONFIG_FILE, "r"))) { + if (!(fp = fopen(SLP_DEFAULT_CONFIG_FILE, "rF"))) { slp_err(LOG_INFO, 0, "readConfig", "cannot open config file"); return; diff --git a/usr/src/lib/libsocket/inet/rcmd.c b/usr/src/lib/libsocket/inet/rcmd.c index 8cb2cd1291..0bfecc28c6 100644 --- a/usr/src/lib/libsocket/inet/rcmd.c +++ b/usr/src/lib/libsocket/inet/rcmd.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -588,7 +587,7 @@ ruserok(const char *rhost, int superuser, const char *ruser, const char *luser) /* check /etc/hosts.equiv */ if (!superuser) { - if ((hostf = fopen("/etc/hosts.equiv", "r")) != NULL) { + if ((hostf = fopen("/etc/hosts.equiv", "rF")) != NULL) { if (!_validuser(hostf, fhost, luser, ruser, baselen)) { (void) fclose(hostf); return (0); @@ -616,7 +615,7 @@ ruserok(const char *rhost, int superuser, const char *ruser, const char *luser) (void) setegid(pwd->pw_gid); initgroups(pwd->pw_name, pwd->pw_gid); (void) seteuid(pwd->pw_uid); - if ((hostf = fopen(pbuf, "r")) == NULL) { + if ((hostf = fopen(pbuf, "rF")) == NULL) { if (gid != (gid_t)-1) (void) setegid(gid); if (uid != (uid_t)-1) diff --git a/usr/src/lib/libsocket/inet/ruserpass.c b/usr/src/lib/libsocket/inet/ruserpass.c index 475bcf0ae3..4d9780f2af 100644 --- a/usr/src/lib/libsocket/inet/ruserpass.c +++ b/usr/src/lib/libsocket/inet/ruserpass.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1998 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -127,7 +126,8 @@ _ruserpass(const char *host, char **aname, char **apass) *aname = malloc(MAXANAME + 1); (void) cuserid(myname); - (void) printf(_dgettext(TEXT_DOMAIN, "Name (%s:%s): "), host, myname); + (void) printf(_dgettext(TEXT_DOMAIN, "Name (%s:%s): "), + host, myname); (void) fflush(stdout); if (read(2, *aname, MAXANAME) <= 0) exit(1); @@ -139,7 +139,7 @@ _ruserpass(const char *host, char **aname, char **apass) *index(*aname, '\n') = 0; } if (*aname && *apass == 0) { - (void) printf(_dgettext(TEXT_DOMAIN, "Password (%s:%s): "), + (void) printf(_dgettext(TEXT_DOMAIN, "Password (%s:%s): "), host, *aname); (void) fflush(stdout); *apass = getpass(""); @@ -162,7 +162,7 @@ rnetrc(const char *host, char **aname, char **apass) if (hdir == NULL) hdir = "."; (void) sprintf(buf, "%s/.netrc", hdir); - d->cfile = fopen(buf, "r"); + d->cfile = fopen(buf, "rF"); if (d->cfile == NULL) { if (errno != ENOENT) perror(buf); @@ -196,11 +196,11 @@ next: if (fstat64(fileno(d->cfile), &stb) >= 0 && (stb.st_mode & 077) != 0) { (void) fprintf(stderr, - _dgettext(TEXT_DOMAIN, - "Error - .netrc file not correct mode.\n")); + _dgettext(TEXT_DOMAIN, + "Error - .netrc file not correct mode.\n")); (void) fprintf(stderr, - _dgettext(TEXT_DOMAIN, - "Remove password or correct mode.\n")); + _dgettext(TEXT_DOMAIN, + "Remove password or correct mode.\n")); exit(1); } if (token() && *apass == 0) { @@ -215,9 +215,8 @@ next: (void) token(); break; default: - (void) fprintf(stderr, - _dgettext(TEXT_DOMAIN, "Unknown .netrc option %s\n"), - d->tokval); + (void) fprintf(stderr, _dgettext(TEXT_DOMAIN, + "Unknown .netrc option %s\n"), d->tokval); break; } goto done; diff --git a/usr/src/lib/libsysevent/libsysevent.c b/usr/src/lib/libsysevent/libsysevent.c index ba5451ef32..dc2ebe9858 100644 --- a/usr/src/lib/libsysevent/libsysevent.c +++ b/usr/src/lib/libsysevent/libsysevent.c @@ -1824,7 +1824,7 @@ sysevent_open_channel(const char *channel) * Check that /var/run is mounted as tmpfs before allowing a channel * to be opened. */ - if ((fp = fopen(MNTTAB, "r")) == NULL) { + if ((fp = fopen(MNTTAB, "rF")) == NULL) { errno = EACCES; return (NULL); } diff --git a/usr/src/lib/libtsol/common/getpathbylabel.c b/usr/src/lib/libtsol/common/getpathbylabel.c index 0f8c5597d0..cb7f489738 100644 --- a/usr/src/lib/libtsol/common/getpathbylabel.c +++ b/usr/src/lib/libtsol/common/getpathbylabel.c @@ -173,7 +173,7 @@ tsol_mkmntlist(void) struct mntlist *mntst = NULL; struct mnttab mnt; - if ((mounted = fopen(MNTTAB, "r")) == NULL) { + if ((mounted = fopen(MNTTAB, "rF")) == NULL) { perror(MNTTAB); return (NULL); } diff --git a/usr/src/lib/libvolmgt/common/volmgt_fsidbi.c b/usr/src/lib/libvolmgt/common/volmgt_fsidbi.c index c5f2628baf..5a08d7b06b 100644 --- a/usr/src/lib/libvolmgt/common/volmgt_fsidbi.c +++ b/usr/src/lib/libvolmgt/common/volmgt_fsidbi.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1996-2002 by Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -214,7 +213,7 @@ vol_db_open(void) * file doesn't exist so create it, open for update, and * make sure the file mode is read/write-able by the world */ - if ((fp = fopen(dbpath, "w+")) == NULL) { + if ((fp = fopen(dbpath, "w+F")) == NULL) { #ifdef DEBUG dprintf("can't open (w+) \"%s\" (%d)\n", dbpath, errno); @@ -223,7 +222,7 @@ vol_db_open(void) } } else { /* does exist so open it for update */ - if ((fp = fopen(dbpath, "r+")) == NULL) { + if ((fp = fopen(dbpath, "r+F")) == NULL) { #ifdef DEBUG dprintf("can't open (r+) \"%s\" (%d)\n", dbpath, errno); diff --git a/usr/src/lib/libvolmgt/common/volmgt_on_private.c b/usr/src/lib/libvolmgt/common/volmgt_on_private.c index 41ab35208b..2dd2f6f2cc 100644 --- a/usr/src/lib/libvolmgt/common/volmgt_on_private.c +++ b/usr/src/lib/libvolmgt/common/volmgt_on_private.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,8 +19,8 @@ * CDDL HEADER END */ /* - * Copyright (c) 1996 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -101,7 +100,7 @@ _dev_mounted(char *path) #ifdef DEBUG_OPEN dprintf("_dev_mounted: fopen()ing \"%s\"\n", MNTTAB); #endif - if ((fp = fopen(MNTTAB, "r")) == NULL) { + if ((fp = fopen(MNTTAB, "rF")) == NULL) { /* mtab is gone... let him go */ #ifdef DEBUG perror(MNTTAB); @@ -511,7 +510,7 @@ get_media_info(char *path, char **mtypep, int *mnump, char **spclp) #ifdef DEBUG_OPEN dprintf("get_media_info: fopen()ing \"%s\"\n", MNTTAB); #endif - if ((fp = fopen(MNTTAB, "r")) == NULL) { + if ((fp = fopen(MNTTAB, "rF")) == NULL) { /* mtab is gone... let him go */ #ifdef DEBUG dprintf("get_media_info: can't open \"%s\" (%d)\n", MNTTAB, diff --git a/usr/src/lib/libxcurses/src/libc/xcurses/scr_dump.c b/usr/src/lib/libxcurses/src/libc/xcurses/scr_dump.c index e2e8c7efdc..5ab6a62a56 100644 --- a/usr/src/lib/libxcurses/src/libc/xcurses/scr_dump.c +++ b/usr/src/lib/libxcurses/src/libc/xcurses/scr_dump.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,15 +19,15 @@ * CDDL HEADER END */ /* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" /* * scr_dump.c - * + * * XCurses Library * * Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved. @@ -61,7 +60,7 @@ const char *f; code = ERR; - if ((fp = fopen(f, "wb")) != (FILE *) 0) { + if ((fp = fopen(f, "wF")) != (FILE *) 0) { code = putwin(curscr, fp); (void) fclose(fp); } @@ -78,7 +77,7 @@ const char *f; FILE *fp; WINDOW *new; - if ((fp = fopen(f, "rb")) == (FILE *) 0) + if ((fp = fopen(f, "rF")) == (FILE *) 0) return ERR; new = getwin(fp); @@ -150,8 +149,8 @@ const char *f; } /* - * Get the screen image that really reflects what is on the screen, - * though the applicatiion may not want it. A subsequent doupdate() + * Get the screen image that really reflects what is on the screen, + * though the applicatiion may not want it. A subsequent doupdate() * will compared and make changes against this image. */ int @@ -165,11 +164,11 @@ const char *f; __m_trace("scr_init(%p=\"%s\")", f); #endif - if ((non_rev_rmcup && exit_ca_mode != (char *) 0) - || stat(f, &dump) != 0 || stat(ctermid((char *) 0), &tty) != 0 - || dump.st_mtime < tty.st_mtime) + if ((non_rev_rmcup && exit_ca_mode != (char *) 0) + || stat(f, &dump) != 0 || stat(ctermid((char *) 0), &tty) != 0 + || dump.st_mtime < tty.st_mtime) code = ERR; - else + else code = scr_replace(__m_screen->_curscr, f); return __m_return_code("scr_init", code); @@ -177,7 +176,7 @@ const char *f; /* * Get the screen image that is really on the screen and that the - * application wants on the screen. + * application wants on the screen. */ int scr_set(f) diff --git a/usr/src/lib/libxcurses/src/libc/xcurses/trace.c b/usr/src/lib/libxcurses/src/libc/xcurses/trace.c index 19f9f6131d..3e2b408ba8 100644 --- a/usr/src/lib/libxcurses/src/libc/xcurses/trace.c +++ b/usr/src/lib/libxcurses/src/libc/xcurses/trace.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,8 +19,8 @@ * CDDL HEADER END */ /* - * Copyright (c) 1995, by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -63,7 +62,7 @@ __m_trace(const char *fmt, ...) return; if (!initialized) { - fp = fopen("trace.out", "w"); + fp = fopen("trace.out", "wF"); if (fp == (FILE *) 0) { fprintf(stderr, "Program cannot open \"trace.out\".\n"); exit(1); diff --git a/usr/src/lib/libxcurses2/src/libc/xcurses/scr_dump.c b/usr/src/lib/libxcurses2/src/libc/xcurses/scr_dump.c index 08b7897586..542f6df9db 100644 --- a/usr/src/lib/libxcurses2/src/libc/xcurses/scr_dump.c +++ b/usr/src/lib/libxcurses2/src/libc/xcurses/scr_dump.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,8 +19,8 @@ * CDDL HEADER END */ /* - * Copyright (c) 1995-1998 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -61,7 +60,7 @@ scr_dump(const char *f) code = ERR; - if ((fp = fopen(f, "wb")) != NULL) { + if ((fp = fopen(f, "wF")) != NULL) { code = putwin(curscr, fp); (void) fclose(fp); } @@ -76,7 +75,7 @@ scr_replace(WINDOW *w, const char *f) FILE *fp; WINDOW *new; - if ((fp = fopen(f, "rb")) == NULL) + if ((fp = fopen(f, "rF")) == NULL) return (ERR); new = getwin(fp); diff --git a/usr/src/lib/madv/common/madv.c b/usr/src/lib/madv/common/madv.c index c2f21565f4..5656a1fec1 100644 --- a/usr/src/lib/madv/common/madv.c +++ b/usr/src/lib/madv/common/madv.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -458,7 +457,7 @@ __madvmain() * and thus come from the default C locale. */ if ((errfile = getenv(ENV_MADVERRFILE)) != NULL) { - errfp = fopen(errfile, "a"); + errfp = fopen(errfile, "aF"); if (errfp) { locale = setlocale(LC_MESSAGES, ""); } else { @@ -486,7 +485,7 @@ __madvmain() * Open specified cfg file or default one. */ if (cfgfile = getenv(ENV_MADVCFGFILE)) { - fp = fopen(cfgfile, "r"); + fp = fopen(cfgfile, "rF"); if (!fp) { madverr(errfp, dgettext(TEXT_DOMAIN, "%s: cannot open configuration file: %s [%s]\n"), @@ -494,7 +493,7 @@ __madvmain() } } else { cfgfile = DEF_MADVCFGFILE; - fp = fopen(cfgfile, "r"); + fp = fopen(cfgfile, "rF"); } if (fp) { diff --git a/usr/src/lib/mpss/common/mpss.c b/usr/src/lib/mpss/common/mpss.c index 74239ce994..c052953d87 100644 --- a/usr/src/lib/mpss/common/mpss.c +++ b/usr/src/lib/mpss/common/mpss.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -319,7 +318,7 @@ __mpssmain() * and thus come from the default C locale. */ if ((errfile = getenv(ENV_MPSSERRFILE)) != NULL) { - errfp = fopen(errfile, "a"); + errfp = fopen(errfile, "aF"); if (errfp) { locale = setlocale(LC_MESSAGES, ""); } else { @@ -362,7 +361,7 @@ __mpssmain() * Open specified cfg file or default one. */ if (cfgfile = getenv(ENV_MPSSCFGFILE)) { - fp = fopen(cfgfile, "r"); + fp = fopen(cfgfile, "rF"); if (!fp) { mpsserr(errfp, dgettext(TEXT_DOMAIN, "%s: cannot open configuration file: %s [%s]\n"), @@ -370,7 +369,7 @@ __mpssmain() } } else { cfgfile = DEF_MPSSCFGFILE; - fp = fopen(cfgfile, "r"); + fp = fopen(cfgfile, "rF"); } execname = mygetexecname(); diff --git a/usr/src/lib/nametoaddr/straddr/common/straddr.c b/usr/src/lib/nametoaddr/straddr/common/straddr.c index a77c365c22..69995ba6c9 100644 --- a/usr/src/lib/nametoaddr/straddr/common/straddr.c +++ b/usr/src/lib/nametoaddr/straddr/common/straddr.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -452,7 +451,7 @@ searchhost(struct netconfig *netconfigp, char *token, int field, char *hostbuf) (void) snprintf(searchfile, sizeof (searchfile), HOSTFILE, netconfigp->nc_netid); - fp = fopen(searchfile, "r"); + fp = fopen(searchfile, "rF"); if (fp == NULL) return (0); @@ -529,7 +528,7 @@ searchserv(struct netconfig *netconfigp, char *token, int field, char *servname) (void) snprintf(searchfile, sizeof (searchfile), SERVICEFILE, netconfigp->nc_netid); - fp = fopen(searchfile, "r"); + fp = fopen(searchfile, "rF"); if (fp == NULL) return (0); diff --git a/usr/src/lib/ncad_addr/common/ncad_addr.c b/usr/src/lib/ncad_addr/common/ncad_addr.c index 5fa5e907c1..40367e9f03 100644 --- a/usr/src/lib/ncad_addr/common/ncad_addr.c +++ b/usr/src/lib/ncad_addr/common/ncad_addr.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -101,7 +100,7 @@ ncad_init(void) real_socket = (sfunc1_t *)dlsym(RTLD_NEXT, "socket"); real_bind = (sfunc2_t *)dlsym(RTLD_NEXT, "bind"); - if ((fp = fopen(filename, "r")) == NULL) { + if ((fp = fopen(filename, "rF")) == NULL) { (void) fprintf(stderr, "Failed to open file %s for reading in " " ncad_addr.so. Error = %s\n", filename, diff --git a/usr/src/lib/nsswitch/compat/common/compat_common.c b/usr/src/lib/nsswitch/compat/common/compat_common.c index ed16ed3ac6..fe21797abf 100644 --- a/usr/src/lib/nsswitch/compat/common/compat_common.c +++ b/usr/src/lib/nsswitch/compat/common/compat_common.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Common code and structures used by name-service-switch "compat" backends. @@ -38,7 +37,6 @@ #include <bsm/libbsm.h> #include <user_attr.h> #include "compat_common.h" -#include "../../../libnsl/include/nsl_stdio_prv.h" /* * This should be in a header. @@ -116,7 +114,7 @@ struct compat_backend { compat_backend_op_t *ops; int n_ops; const char *filename; - __NSL_FILE *f; + FILE *f; int minbuf; char *buf; int linelen; /* <== Explain use, lifetime */ @@ -359,11 +357,11 @@ _nss_compat_setent(be, dummy) /* Backend isn't initialized properly? */ return (NSS_UNAVAIL); } - if ((be->f = __nsl_fopen(be->filename, "r")) == 0) { + if ((be->f = fopen(be->filename, "rF")) == 0) { return (NSS_UNAVAIL); } } else { - __nsl_rewind(be->f); + rewind(be->f); } strset_free(&be->minuses); /* ===> ??? nss_endent(be->db_rootp, be->db_initf, &be->db_context); */ @@ -385,7 +383,7 @@ _nss_compat_endent(be, dummy) void *dummy; { if (be->f != 0) { - __nsl_fclose(be->f); + fclose(be->f); be->f = 0; } if (be->buf != 0) { @@ -425,7 +423,7 @@ _nss_compat_destr(be, dummy) static int read_line(f, buffer, buflen) - __NSL_FILE *f; + FILE *f; char *buffer; int buflen; { @@ -433,7 +431,7 @@ read_line(f, buffer, buflen) while (1) { int linelen; - if (__nsl_fgets(buffer, buflen, f) == 0) { + if (fgets(buffer, buflen, f) == 0) { /* End of file */ return (-1); } @@ -450,13 +448,13 @@ read_line(f, buffer, buflen) buffer[--linelen] = '\0'; return (linelen); } - if (__nsl_feof(f)) { + if (feof(f)) { /* Line is last line in file, and has no newline */ return (linelen); } /* Line too long for buffer; toss it and loop for next line */ /* ===== should syslog() in cases where previous code did */ - while (__nsl_fgets(buffer, buflen, f) != 0 && + while (fgets(buffer, buflen, f) != 0 && buffer[strlen(buffer) - 1] != '\n') { ; } diff --git a/usr/src/lib/nsswitch/compat/req.flg b/usr/src/lib/nsswitch/compat/req.flg deleted file mode 100644 index 6d6493b45c..0000000000 --- a/usr/src/lib/nsswitch/compat/req.flg +++ /dev/null @@ -1,30 +0,0 @@ -#!/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/usr/src/lib/nsswitch/files/common/files_common.c b/usr/src/lib/nsswitch/files/common/files_common.c index 2a8c30bc43..bdf03a3ca9 100644 --- a/usr/src/lib/nsswitch/files/common/files_common.c +++ b/usr/src/lib/nsswitch/files/common/files_common.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1995-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Common code and structures used by name-service-switch "files" backends. @@ -54,11 +53,11 @@ _nss_files_setent(be, dummy) /* Backend isn't initialized properly? */ return (NSS_UNAVAIL); } - if ((be->f = __nsl_fopen(be->filename, "r")) == 0) { + if ((be->f = fopen(be->filename, "rF")) == 0) { return (NSS_UNAVAIL); } } else { - __nsl_rewind(be->f); + rewind(be->f); } return (NSS_SUCCESS); } @@ -70,7 +69,7 @@ _nss_files_endent(be, dummy) void *dummy; { if (be->f != 0) { - __nsl_fclose(be->f); + fclose(be->f); be->f = 0; } if (be->buf != 0) { @@ -93,7 +92,7 @@ _nss_files_endent(be, dummy) */ int _nss_files_read_line(f, buffer, buflen) - __NSL_FILE *f; + FILE *f; char *buffer; int buflen; { @@ -104,7 +103,7 @@ _nss_files_read_line(f, buffer, buflen) while (1) { linelen = 0; while (linelen < buflen - 1) { /* "- 1" saves room for \n\0 */ - switch (c = __nsl_getc_unlocked(f)) { + switch (c = getc_unlocked(f)) { case EOF: if (linelen == 0 || buffer[linelen - 1] == '\\') { @@ -131,7 +130,7 @@ _nss_files_read_line(f, buffer, buflen) /* Buffer overflow -- eat rest of line and loop again */ /* ===> Should syslog() */ do { - c = __nsl_getc_unlocked(f); + c = getc_unlocked(f); if (c == EOF) { return (-1); } diff --git a/usr/src/lib/nsswitch/files/common/files_common.h b/usr/src/lib/nsswitch/files/common/files_common.h index 06ba03b576..87980f8310 100644 --- a/usr/src/lib/nsswitch/files/common/files_common.h +++ b/usr/src/lib/nsswitch/files/common/files_common.h @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -39,8 +38,6 @@ #include <nss_dbdefs.h> #include <stdio.h> -#include "../../../libnsl/include/nsl_stdio_prv.h" - #ifdef __cplusplus extern "C" { #endif @@ -80,7 +77,7 @@ struct files_backend { files_backend_op_t *ops; int n_ops; const char *filename; - __NSL_FILE *f; + FILE *f; int minbuf; char *buf; files_hash_t *hashinfo; @@ -103,7 +100,7 @@ extern nss_backend_t *_nss_files_constr(files_backend_op_t *ops, const char *filename, int min_bufsize, files_hash_t *fhp); -extern nss_status_t _nss_files_destr (files_backend_ptr_t, void *dummy); +extern nss_status_t _nss_files_destr(files_backend_ptr_t, void *dummy); extern nss_status_t _nss_files_setent(files_backend_ptr_t, void *dummy); extern nss_status_t _nss_files_endent(files_backend_ptr_t, void *dummy); extern nss_status_t _nss_files_getent_rigid(files_backend_ptr_t, void *); @@ -123,10 +120,10 @@ extern nss_status_t _nss_files_XY_hash(files_backend_ptr_t be, files_hash_t *fhp, int hashop, files_XY_check_func check); -int _nss_files_read_line(__NSL_FILE *f, char *buffer, int buflen); +int _nss_files_read_line(FILE *f, char *buffer, int buflen); #else extern nss_backend_t *_nss_files_constr(); -extern nss_status_t _nss_files_destr (); +extern nss_status_t _nss_files_destr(); extern nss_status_t _nss_files_setent(); extern nss_status_t _nss_files_endent(); extern nss_status_t _nss_files_getent_rigid(); diff --git a/usr/src/lib/nsswitch/files/common/getexecattr.c b/usr/src/lib/nsswitch/files/common/getexecattr.c index 2c5f5b482d..502c0112b9 100644 --- a/usr/src/lib/nsswitch/files/common/getexecattr.c +++ b/usr/src/lib/nsswitch/files/common/getexecattr.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -129,12 +128,12 @@ _exec_files_XY_all(files_backend_ptr_t be, (void) _nss_files_endent(be, 0); return (NSS_UNAVAIL); } - if ((be->f = __nsl_fopen(be->filename, "r")) == 0) { + if ((be->f = fopen(be->filename, "rF")) == 0) { (void) _nss_files_endent(be, 0); (void) rw_unlock(&exec_lock); return (NSS_UNAVAIL); } - exec_fd = __nsl_fileno(be->f); + exec_fd = fileno(be->f); if (f_buf != NULL) free(f_buf); if ((f_buf = malloc(f_size)) == NULL) { diff --git a/usr/src/lib/nsswitch/files/req.flg b/usr/src/lib/nsswitch/files/req.flg deleted file mode 100644 index 6d6493b45c..0000000000 --- a/usr/src/lib/nsswitch/files/req.flg +++ /dev/null @@ -1,30 +0,0 @@ -#!/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/usr/src/lib/nsswitch/req.flg b/usr/src/lib/nsswitch/req.flg deleted file mode 100644 index 6d6493b45c..0000000000 --- a/usr/src/lib/nsswitch/req.flg +++ /dev/null @@ -1,30 +0,0 @@ -#!/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/usr/src/lib/nsswitch/user/Makefile.com b/usr/src/lib/nsswitch/user/Makefile.com index dc99a72441..c51cc34604 100644 --- a/usr/src/lib/nsswitch/user/Makefile.com +++ b/usr/src/lib/nsswitch/user/Makefile.com @@ -2,9 +2,8 @@ # 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. +# Common Development and Distribution License (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. @@ -41,7 +40,6 @@ include ../../../Makefile.rootfs CPPFLAGS += -I../../../common/inc -LDLIBS += -lnsl DYNLIB1 = nss_user.so$(VERS) all: $(DYNLIB1) fnamecheck diff --git a/usr/src/lib/nsswitch/user/common/user_common.c b/usr/src/lib/nsswitch/user/common/user_common.c index 6959ba4a3d..1a52140be3 100644 --- a/usr/src/lib/nsswitch/user/common/user_common.c +++ b/usr/src/lib/nsswitch/user/common/user_common.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Common code and structures used by name-service-switch "user" backends. @@ -34,15 +33,14 @@ * but this here is just yer standard fgets() thang. */ +#include "user_common.h" #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <fcntl.h> #include <poll.h> #include <unistd.h> -#include "user_common.h" #include <sys/stat.h> -#include "../../../libnsl/include/nsl_stdio_prv.h" #include <string.h> nss_status_t @@ -55,11 +53,11 @@ _nss_user_setent(be, dummy) /* Backend isn't initialized properly? */ return (NSS_UNAVAIL); } - if ((be->f = __nsl_fopen(be->filename, "r")) == 0) { + if ((be->f = fopen(be->filename, "rF")) == 0) { return (NSS_UNAVAIL); } } else { - __nsl_rewind(be->f); + rewind(be->f); } return (NSS_SUCCESS); } @@ -70,7 +68,7 @@ _nss_user_endent(be, dummy) void *dummy; { if (be->f != 0) { - __nsl_fclose(be->f); + fclose(be->f); be->f = 0; } if (be->buf != 0) { @@ -93,7 +91,7 @@ _nss_user_endent(be, dummy) */ int _nss_user_read_line(f, buffer, buflen) - __NSL_FILE *f; + FILE *f; char *buffer; int buflen; { @@ -103,7 +101,7 @@ _nss_user_read_line(f, buffer, buflen) while (1) { linelen = 0; while (linelen < buflen - 1) { /* "- 1" saves room for \n\0 */ - switch (c = __nsl_getc_unlocked(f)) { + switch (c = getc_unlocked(f)) { case EOF: if (linelen == 0 || buffer[linelen - 1] == '\\') { @@ -130,7 +128,7 @@ _nss_user_read_line(f, buffer, buflen) /* Buffer overflow -- eat rest of line and loop again */ /* ===> Should syslog() */ do { - c = __nsl_getc_unlocked(f); + c = getc_unlocked(f); if (c == EOF) { return (-1); } @@ -276,7 +274,7 @@ _nss_user_constr(ops, n_ops, filename, min_bufsize) { user_backend_ptr_t be; - if ((be = (user_backend_ptr_t) malloc(sizeof (*be))) == 0) { + if ((be = (user_backend_ptr_t)malloc(sizeof (*be))) == 0) { return (0); } be->ops = ops; @@ -289,5 +287,5 @@ _nss_user_constr(ops, n_ops, filename, min_bufsize) be->f = 0; be->buf = 0; - return ((nss_backend_t *) be); + return ((nss_backend_t *)be); } diff --git a/usr/src/lib/nsswitch/user/common/user_common.h b/usr/src/lib/nsswitch/user/common/user_common.h index d0539447b0..2f1b79a42f 100644 --- a/usr/src/lib/nsswitch/user/common/user_common.h +++ b/usr/src/lib/nsswitch/user/common/user_common.h @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -38,7 +37,6 @@ #include <nss_common.h> #include <nss_dbdefs.h> #include <stdio.h> -#include "../../../libnsl/include/nsl_stdio_prv.h" #ifdef __cplusplus extern "C" { @@ -53,7 +51,7 @@ struct user_backend { user_backend_op_t *ops; int n_ops; const char *filename; - __NSL_FILE *f; + FILE *f; int minbuf; char *buf; }; @@ -74,7 +72,7 @@ extern nss_backend_t *_nss_user_constr(user_backend_op_t *ops, int n_ops, const char *filename, int min_bufsize); -extern nss_status_t _nss_user_destr (user_backend_ptr_t, void *dummy); +extern nss_status_t _nss_user_destr(user_backend_ptr_t, void *dummy); extern nss_status_t _nss_user_setent(user_backend_ptr_t, void *dummy); extern nss_status_t _nss_user_endent(user_backend_ptr_t, void *dummy); extern nss_status_t _nss_user_do_all(user_backend_ptr_t, @@ -86,12 +84,12 @@ extern nss_status_t _nss_user_XY_all(user_backend_ptr_t be, int netdb, const char *filter, user_XY_check_func check); -extern int _nss_user_read_line(__NSL_FILE *f, +extern int _nss_user_read_line(FILE *f, char *buffer, int buflen); #else extern nss_backend_t *_nss_user_constr(); -extern nss_status_t _nss_user_destr (); +extern nss_status_t _nss_user_destr(); extern nss_status_t _nss_user_setent(); extern nss_status_t _nss_user_endent(); extern nss_status_t _nss_user_do_all(); diff --git a/usr/src/lib/nsswitch/user/req.flg b/usr/src/lib/nsswitch/user/req.flg deleted file mode 100644 index 6d6493b45c..0000000000 --- a/usr/src/lib/nsswitch/user/req.flg +++ /dev/null @@ -1,30 +0,0 @@ -#!/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/usr/src/lib/pam_modules/authtok_check/fascist.c b/usr/src/lib/pam_modules/authtok_check/fascist.c index e68e74ed60..5e8a6d1637 100644 --- a/usr/src/lib/pam_modules/authtok_check/fascist.c +++ b/usr/src/lib/pam_modules/authtok_check/fascist.c @@ -1,5 +1,5 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -441,7 +441,7 @@ DictCheck(char *password, char *path) PWDICT *pwp; int r; - if ((pwp = PWOpen(path, "r")) == NULL) + if ((pwp = PWOpen(path, "rF")) == NULL) return (DATABASE_OPEN_FAIL); r = FascistLook(pwp, password); diff --git a/usr/src/lib/pam_modules/authtok_check/packer.c b/usr/src/lib/pam_modules/authtok_check/packer.c index 491e3f75fd..1c34f86bca 100644 --- a/usr/src/lib/pam_modules/authtok_check/packer.c +++ b/usr/src/lib/pam_modules/authtok_check/packer.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -99,7 +98,7 @@ writeout(void) } (void) unlink(tmpname); - if ((tmpfp[tmpfp_idx] = fdopen(fd, "w+")) == NULL) { + if ((tmpfp[tmpfp_idx] = fdopen(fd, "w+F")) == NULL) { syslog(LOG_ERR, MODNAME ": fdopen failed: %s", strerror(errno)); (void) close(fd); @@ -360,7 +359,7 @@ packer(char *list, char *path) return (-1); } - if (!(pwp = PWOpen(path, "w"))) + if (!(pwp = PWOpen(path, "wF"))) return (-1); fname = strtok(listcopy, " \t,"); diff --git a/usr/src/lib/pam_modules/dial_auth/dial_auth.c b/usr/src/lib/pam_modules/dial_auth/dial_auth.c index b82cfdff0c..0ae0554086 100644 --- a/usr/src/lib/pam_modules/dial_auth/dial_auth.c +++ b/usr/src/lib/pam_modules/dial_auth/dial_auth.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -99,7 +98,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv) if (getpwnam_r(user, &pwd, pwd_buffer, sizeof (pwd_buffer)) == NULL) return (PAM_USER_UNKNOWN); - if ((fp = fopen(DIAL_FILE, "r")) == NULL) + if ((fp = fopen(DIAL_FILE, "rF")) == NULL) return (PAM_IGNORE); while ((p1 = fgets(line, sizeof (line), fp)) != NULL) { @@ -112,7 +111,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv) (void) fclose(fp); - if ((fp = fopen(DPASS_FILE, "r")) == NULL) { + if ((fp = fopen(DPASS_FILE, "rF")) == NULL) { syslog(LOG_ERR, "pam_dial_auth: %s without %s, returning %s.", DIAL_FILE, DPASS_FILE, pam_strerror(pamh, PAM_SYSTEM_ERR)); diff --git a/usr/src/lib/passwdutil/files_attr.c b/usr/src/lib/passwdutil/files_attr.c index d5514d780d..9f1eab04f2 100644 --- a/usr/src/lib/passwdutil/files_attr.c +++ b/usr/src/lib/passwdutil/files_attr.c @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -156,7 +155,7 @@ private_getpwnam_r(const char *name, struct passwd *result, char *buffer, FILE *fp; int found; - if ((fp = fopen(PASSWD, "r")) == NULL) + if ((fp = fopen(PASSWD, "rF")) == NULL) return (NULL); found = 0; @@ -193,7 +192,7 @@ private_getspnam_r(const char *name, struct spwd *result, char *buffer, FILE *fp; int found; - fp = fopen(SHADOW, "r"); + fp = fopen(SHADOW, "rF"); if (fp == NULL) return (NULL); @@ -530,7 +529,7 @@ files_getattr(char *name, attrlist *items, pwu_repository_t *rep) debug("files_getattr: Get password history for %s ", name); - if ((history = fopen(HISTORY, "r")) == NULL) { + if ((history = fopen(HISTORY, "rF")) == NULL) { debug("files_getattr: %s not found", HISTORY); res = PWU_OPEN_FAILED; goto getattr_exit; @@ -927,12 +926,12 @@ files_update_shadow(char *name, struct spwd *spwd) } (void) fchown(tempfd, (uid_t)0, stbuf.st_gid); - if ((dst = fdopen(tempfd, "w")) == NULL) { + if ((dst = fdopen(tempfd, "wF")) == NULL) { err = PWU_OPEN_FAILED; goto shadow_exit; } - if ((src = fopen(SHADOW, "r")) == NULL) { + if ((src = fopen(SHADOW, "rF")) == NULL) { err = PWU_OPEN_FAILED; (void) fclose(dst); (void) unlink(SHADTEMP); @@ -1021,11 +1020,11 @@ files_update_passwd(char *name, struct passwd *pwd) err = PWU_OPEN_FAILED; goto passwd_exit; } - if ((dst = fdopen(tempfd, "w")) == NULL) { + if ((dst = fdopen(tempfd, "wF")) == NULL) { err = PWU_OPEN_FAILED; goto passwd_exit; } - if ((src = fopen(PASSWD, "r")) == NULL) { + if ((src = fopen(PASSWD, "rF")) == NULL) { err = PWU_OPEN_FAILED; (void) fclose(dst); (void) unlink(PASSTEMP); @@ -1163,12 +1162,12 @@ files_update_history(char *name, struct spwd *spwd) (void) fchown(tmpfd, (uid_t)0, (gid_t)0); /* get ready to copy */ - if (((src = fopen(HISTORY, "r")) == NULL) && + if (((src = fopen(HISTORY, "rF")) == NULL) && (errno != ENOENT)) { (void) unlink(HISTEMP); return (PWU_OPEN_FAILED); } - if ((dst = fdopen(tmpfd, "w")) == NULL) { + if ((dst = fdopen(tmpfd, "wF")) == NULL) { (void) fclose(src); (void) unlink(HISTEMP); return (PWU_OPEN_FAILED); diff --git a/usr/src/lib/udapl/libdat/include/dat_osd.h b/usr/src/lib/udapl/libdat/include/dat_osd.h index f52a91acec..96110ddd7b 100644 --- a/usr/src/lib/udapl/libdat/include/dat_osd.h +++ b/usr/src/lib/udapl/libdat/include/dat_osd.h @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -24,7 +23,7 @@ */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -177,7 +176,7 @@ typedef fpos_t DAT_OS_FILE_POS; * DAT_OS_FILE *dat_os_fopen(const char *path) * always open files in read only mode */ -#define dat_os_fopen(path) ((DAT_OS_FILE *)fopen((path), "r")) +#define dat_os_fopen(path) ((DAT_OS_FILE *)fopen((path), "rF")) /* DAT_RETURN dat_os_fgetpos(DAT_OS_FILE *file, DAT_OS_FILE_POS *pos) */ diff --git a/usr/src/uts/common/rpc/rpc_com.h b/usr/src/uts/common/rpc/rpc_com.h index 1374afe255..c0aa33f85e 100644 --- a/usr/src/uts/common/rpc/rpc_com.h +++ b/usr/src/uts/common/rpc/rpc_com.h @@ -2,9 +2,8 @@ * 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. + * Common Development and Distribution License (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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * 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 */ @@ -110,8 +109,6 @@ bool_t rpc_control(); #define RPC_SVC_THRTOTAL_GET 5 /* get total number of threads */ #define RPC_SVC_THRCREATES_GET 6 /* get total threads created */ #define RPC_SVC_THRERRORS_GET 7 /* get total thread create errors */ -#define __RPC_CLNT_MINFD_SET 8 /* set min fd used for a clnt handle */ -#define __RPC_CLNT_MINFD_GET 9 /* get min fd used for a clnt handle */ #define RPC_SVC_USE_POLLFD 10 /* unlimit fd used beyond 1024 */ #define RPC_SVC_CONNMAXREC_SET 11 /* set COT maximum record size */ #define RPC_SVC_CONNMAXREC_GET 12 /* get COT maximum record size */ |