From 655ee11d2c5d449b676fd649931f6a59a380cfd6 Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Fri, 2 Feb 2018 15:20:18 -0500 Subject: [PATCH] libc: nuke getpw() --- FEATURES.txt | 1 + include/stdlib.h | 1 - share/man/man3c/Makefile | 1 - share/man/man3c/getpw.3c | 58 -------------- usr/src/lib/c_synonyms/syn_common | 1 - usr/src/lib/libc/amd64/Makefile | 1 - usr/src/lib/libc/i386/Makefile.com | 1 - usr/src/lib/libc/port/gen/getpw.c | 101 ------------------------- usr/src/lib/libc/port/mapfile-vers | 1 - usr/src/pkg/manifests/system-library.man3c.inc | 1 - 10 files changed, 1 insertion(+), 166 deletions(-) delete mode 100644 share/man/man3c/getpw.3c delete mode 100644 usr/src/lib/libc/port/gen/getpw.c diff --git a/FEATURES.txt b/FEATURES.txt index a92411cc2e..a9ebe8dc6a 100644 --- a/FEATURES.txt +++ b/FEATURES.txt @@ -33,6 +33,7 @@ changed. - Sun Studio and lint build support - getpwent_r(3c), fgetpwent_r(3c), which are non-standard and were different from other OSes + - getpw(3c) - POSIX.1c Draft versions of several reentrant functions were removed. Applications using the draft versions have to be modified; users of the standard versions are unaffected. diff --git a/include/stdlib.h b/include/stdlib.h index b330087809..7b0df42bd0 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -264,7 +264,6 @@ extern char *optarg; extern int optind, opterr, optopt; extern char *getpass(const char *); extern char *getpassphrase(const char *); -extern int getpw(uid_t, char *); extern int isatty(int); extern void *memalign(size_t, size_t); extern char *ttyname(int); diff --git a/share/man/man3c/Makefile b/share/man/man3c/Makefile index 6e3aa1c9da..476c154e32 100644 --- a/share/man/man3c/Makefile +++ b/share/man/man3c/Makefile @@ -157,7 +157,6 @@ MAN = __fbufsize.3c \ getpeerucred.3c \ getpriority.3c \ getprogname.3c \ - getpw.3c \ getpwnam.3c \ getrusage.3c \ gets.3c \ diff --git a/share/man/man3c/getpw.3c b/share/man/man3c/getpw.3c deleted file mode 100644 index 44dd9cc3fc..0000000000 --- a/share/man/man3c/getpw.3c +++ /dev/null @@ -1,58 +0,0 @@ -'\" te -.\" Copyright 1989 AT&T Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved -.\" The contents of this file are subject to the terms of the 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. 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] -.TH GETPW 3C "Dec 29, 1996" -.SH NAME -getpw \- get passwd entry from UID -.SH SYNOPSIS -.LP -.nf -#include - -\fBint\fR \fBgetpw\fR(\fBuid_t\fR \fIuid\fR, \fBchar *\fR\fIbuf\fR); -.fi - -.SH DESCRIPTION -.sp -.LP -The \fBgetpw()\fR function searches the user data base for a user id number -that equals \fIuid\fR, copies the line of the password file in which \fIuid\fR -was found into the array pointed to by \fIbuf\fR, and returns 0. \fBgetpw()\fR -returns non-zero if \fIuid\fR cannot be found. -.SH USAGE -.sp -.LP -This function is included only for compatibility with prior systems and should -not be used; the functions described on the \fBgetpwnam\fR(3C) manual page -should be used instead. -.sp -.LP -If the \fB/etc/passwd\fR and the \fB/etc/group\fR files have a plus sign -(\fB+\fR) for the NIS entry, then \fBgetpwent()\fR and \fBgetgrent()\fR will -not return \fINULL\fR when the end of file is reached. See \fBgetpwnam\fR(3C). -.SH RETURN VALUES -.sp -.LP -The \fBgetpw()\fR function returns non-zero on error. -.SH ATTRIBUTES -.sp -.LP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp -.TS -box; -c | c -l | l . -ATTRIBUTE TYPE ATTRIBUTE VALUE -_ -MT-Level Safe -.TE - -.SH SEE ALSO -.sp -.LP -\fBgetpwnam\fR(3C), \fBpasswd\fR(4), \fBattributes\fR(5) diff --git a/usr/src/lib/c_synonyms/syn_common b/usr/src/lib/c_synonyms/syn_common index bd854ae19d..16b5625a0e 100644 --- a/usr/src/lib/c_synonyms/syn_common +++ b/usr/src/lib/c_synonyms/syn_common @@ -368,7 +368,6 @@ getppid getppriv getprivimplinfo getprojid -getpw getpwent getpwnam getpwnam_r diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile index 81237dc6f5..fb0b6307d2 100644 --- a/usr/src/lib/libc/amd64/Makefile +++ b/usr/src/lib/libc/amd64/Makefile @@ -424,7 +424,6 @@ PORTGEN= \ getopt.o \ getopt_long.o \ getpagesize.o \ - getpw.o \ getpwnam.o \ getpwnam_r.o \ getrusage.o \ diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com index 89163635f5..5e9cf8faa6 100644 --- a/usr/src/lib/libc/i386/Makefile.com +++ b/usr/src/lib/libc/i386/Makefile.com @@ -465,7 +465,6 @@ PORTGEN= \ getopt.o \ getopt_long.o \ getpagesize.o \ - getpw.o \ getpwnam.o \ getpwnam_r.o \ getrusage.o \ diff --git a/usr/src/lib/libc/port/gen/getpw.c b/usr/src/lib/libc/port/gen/getpw.c deleted file mode 100644 index 629312f91e..0000000000 --- a/usr/src/lib/libc/port/gen/getpw.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * 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. - * 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 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "lint.h" -#include "file64.h" -#include -#include -#include -#include -#include -#include -#include "stdiom.h" -#include "libc.h" - -static FILE *pwf; -static mutex_t _pwlock = DEFAULTMUTEX; -const char *PASSWD = "/etc/passwd"; - -int -getpw(uid_t uid, char buf[]) -{ - int n, c; - char *bp; - FILE *fp; - rmutex_t *lk; - - if (pwf == NULL) { - fp = fopen(PASSWD, "rF"); - lmutex_lock(&_pwlock); - if (pwf == NULL) { - if ((pwf = fp) == NULL) { - lmutex_unlock(&_pwlock); - return (1); - } - fp = NULL; - } - lmutex_unlock(&_pwlock); - if (fp != NULL) /* someone beat us to it */ - (void) fclose(fp); - } - - FLOCKFILE(lk, pwf); - _rewind_unlocked(pwf); - - for (;;) { - bp = buf; - while ((c = GETC(pwf)) != '\n') { - if (c == EOF) { - FUNLOCKFILE(lk); - return (1); - } - *bp++ = (char)c; - } - *bp = '\0'; - bp = buf; - n = 3; - while (--n) - while ((c = *bp++) != ':') - if (c == '\n') { - FUNLOCKFILE(lk); - return (1); - } - while ((c = *bp++) != ':') - if (isdigit(c)) - n = n*10+c-'0'; - else - continue; - if (n == uid) { - FUNLOCKFILE(lk); - return (0); - } - } -} diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers index 224911efd4..a8b790ac67 100644 --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -1824,7 +1824,6 @@ $endif getmntent; getnetgrent; getnetgrent_r; - getpw; getspent; getspent_r; getspnam; diff --git a/usr/src/pkg/manifests/system-library.man3c.inc b/usr/src/pkg/manifests/system-library.man3c.inc index 7446545333..16ecadeca6 100644 --- a/usr/src/pkg/manifests/system-library.man3c.inc +++ b/usr/src/pkg/manifests/system-library.man3c.inc @@ -175,7 +175,6 @@ file path=usr/share/man/man3c/getpass.3c file path=usr/share/man/man3c/getpeerucred.3c file path=usr/share/man/man3c/getpriority.3c file path=usr/share/man/man3c/getprogname.3c -file path=usr/share/man/man3c/getpw.3c file path=usr/share/man/man3c/getpwnam.3c file path=usr/share/man/man3c/getrusage.3c file path=usr/share/man/man3c/gets.3c -- 2.11.4.GIT