History log of /freebsd-current/lib/libc/net/getservent.c
Revision Date Author Comments
# 8d5353de 29-Jan-2024 Mark Johnston <markj@FreeBSD.org>

libc: Annotate a couple of local functions as such

No functional change intended.

MFC after: 1 week


# dc36d6f9 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42385


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 346eaa41 27-Nov-2021 Konstantin Belousov <kib@FreeBSD.org>

libc/net/getservent.c: Mark write-only variables as unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week


# 6671366a 15-Apr-2020 Brooks Davis <brooks@FreeBSD.org>

Fix -Wvoid-pointer-to-enum-cast warnings.

This pattern is used in callbacks with void * data arguments and seems
both relatively uncommon and relatively harmless. Silence the warning
by casting through uintptr_t.

This warning is on by default in Clang 11.

Reviewed by: arichardson
Obtained from: CheriBSD (partial)
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24425


# 6b462d27 12-Aug-2019 Konstantin Belousov <kib@FreeBSD.org>

Increase YPMAXRECORD to 16M to be compatible with Linux.

Since YP protocol definition uses the constant to declare
variable-size opaque byte strings, the change should be binary
compatible with existing installations which do not expose keys or
values larger than 1024 bytes.

All uses of local variables with YPMAXRECORD sizes were removed to
avoid insane stack use. On the other hand, variables with static
lifetime should be fine and only result in increased VA use.

Glibc made same change, increasing the allowed length for keys and
values in YP to 16M, in 2013.

Reviewed by: markj
Discussed with: ian
Sponsored by: Mellanox Technologies
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D20900


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 2cf5e936 18-Apr-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

libc: do not include <sys/types.h> where <sys/param.h> was already included

According to style(9):
> normally, include <sys/types.h> OR <sys/param.h>, but not both.
(<sys/param.h> already includes <sys/types.h> when LOCORE is not defined).


# 3fc873ff 11-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

libc: cleanup unnecessary semicolons.

Found with devel/coccinelle.


# 513004a2 10-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

libc: replace 0 with NULL for pointers.

While here also cleanup some surrounding code; particularly
drop some malloc() casts.

Found with devel/coccinelle.

Reviewed by: bde (previous version - all new bugs are mine)


# 626c9d74 20-Sep-2015 Craig Rodrigues <rodrigc@FreeBSD.org>

Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.


# a93705b0 23-Aug-2013 Jilles Tjoelker <jilles@FreeBSD.org>

libc: Make various internal file descriptors from fopen() close-on-exec.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 4deeadcb 17-Apr-2010 Hajimu UMEMOTO <ume@FreeBSD.org>

MFC r206155, r206267: Add capability to use a db version of
services. It is enabled by specifying `db' as source of
services in /etc/nsswitch.conf.


# b7a43116 17-Apr-2010 Hajimu UMEMOTO <ume@FreeBSD.org>

MFC ir206152, r206153, r206154:
- Stop adding trailing '\n'. The servent_unpack() doesn't expect
lines terminated with '\n'.
- Treat '+' as special only when in compat mode, and simplify
the logic bit.
- Reduce duplicate code.


# 79bbdc60 05-Apr-2010 Hajimu UMEMOTO <ume@FreeBSD.org>

Use the stored length value instead of calculating it by strlen().


# e622b479 04-Apr-2010 Hajimu UMEMOTO <ume@FreeBSD.org>

Add capability to use a db version of services. It is enabled by
specifying `db' as source of service in /etc/nsswitch.conf.

MFC after: 2 weeks


# dc6ab8dd 04-Apr-2010 Hajimu UMEMOTO <ume@FreeBSD.org>

Reduce duplicate code.

MFC after: 2 weeks


# aea86367 04-Apr-2010 Hajimu UMEMOTO <ume@FreeBSD.org>

Treat '+' as special only when in compat mode, and simplify
the logic bit.

MFC after: 2 weeks


# 8390eaed 04-Apr-2010 Hajimu UMEMOTO <ume@FreeBSD.org>

Stop adding trailing '\n'. The servent_unpack() doesn't expect
lines terminated with '\n'.

MFC after: 2 weeks


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# c879ae35 08-Jan-2007 Warner Losh <imp@FreeBSD.org>

Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.


# 06a99fe3 27-Apr-2006 Hajimu UMEMOTO <ume@FreeBSD.org>

- Extend the nsswitch to support Services, Protocols and Rpc
databases.
- Make nsswitch support caching.

Submitted by: Michael Bushkov <bushman__at__rsu.ru>
Sponsored by: Google Summer of Code 2005


# d3ac2b30 15-Apr-2006 Hajimu UMEMOTO <ume@FreeBSD.org>

- make reentrant version of netdb functions glibc style API, and
expose them to outside of libc.
- make netdb functions NSS friendly.

Reviewed by: arch@ and current@ (no objection)


# d8f77b45 20-Aug-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Include <sys/types.h> and <limits.h> ourselves, don't assume they are included
through <pthread.h>.

gen/sem.c: Prerequisite for <_semaphore.h>
net/getprotoent.c: USHRT_MAX
net/getservent.c: USHRT_MAX
stdio/ungetwc.c: MB_LEN_MAX
stdio/vfwscanf.c: MB_LEN_MAX


# a2a77501 28-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

make getnetby*() thread-safe.


# a87b3988 18-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

rename the NIS related fields to have yp_ prefix.

Suggested by: delphij


# ffe49790 17-Apr-2005 Xin LI <delphij@FreeBSD.org>

Do not check whether a pointer is NULL, since free(3) already takes care of
this case.

Reviewed by: ume


# 6d44c5c7 17-Apr-2005 Xin LI <delphij@FreeBSD.org>

Fix build for !YP case.

BTW. Shall we change these fields to have yp_ prefix? That will make the
code easier to read.


# 109e5709 17-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

libc-internal interfaces should have two underscores in front
of their names.

Pointed out by: das


# 96f79dca 15-Apr-2005 Hajimu UMEMOTO <ume@FreeBSD.org>

- add getserv{byname,byport,ent}_r for internal use within libc.
- make getserv{byname,byport,ent} thread-safe.

Reviewed by: gnn


# 7b6cc404 03-Jan-2005 Maxim Sobolev <sobomax@FreeBSD.org>

Don't ignore the last line of config file (/etc/hosts, /etc/services, etc)
which doesn't end in \n, since it may be very confusing. Also this should
increase consistency, since most other config files work just fine regardless
of the presence of traling \n in the last line.

MFC After: 2 weeks


# 2bbd7cf8 27-Feb-2003 Jacques Vidrine <nectar@FreeBSD.org>

Eliminate 19 warnings in libc (at level WARNS=2) of the
`implicit declaration of function' variety.


# c05ac53b 21-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove __P() usage.


# 8fb3f3f6 21-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove 'register' keyword.


# 68a6b5e1 15-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove trailing characters from #endif.
Actually this #endif is not needed, so remove leading characters also.


# fd8e4ebc 18-Feb-2002 Mike Barcroft <mike@FreeBSD.org>

o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
complexities associated with having MD (asm and inline) versions, and
having to prevent exposure of these functions in other headers that
happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on: alpha, i386
Reviewed by: bde, jake, tmm


# 3951b8e3 27-Dec-1996 Bill Paul <wpaul@FreeBSD.org>

Small yet significant tweaks/cleanups:

- getservent:
o put _yp_check() proto under #ifdef YP where it belongs
o local YP buffers should be YPMAXRECORD + 2 bytes long and should
be NUL terminated after copying

- gethostbynis:
o local YP buffer should be YPMAXRECORD + 2 bytes long

- getnetbynis:
o local YP buffer should be YPMAXRECORD + 2 bytes long and should
be NUL terminated after copying

- ether_addr:
o local YP buffers should be YPMAXRECORD + 2 bytes long and should
be NUL terminated after copying (in this case it's BUFSIZ + 2 bytes,
but it happens that BUFSIZ == YPMAXRECORD.

- gethostbydns:
o nuke stray 'return(NULL)' in __dns_getanswer() (harmless but looks silly)

These are 2.2 candidates. I will wait a few days to make sure these don't
break anything and then, if there are no objections, move them to the 2.2
branch.


# afb5b8ed 05-Dec-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

Eliminate 3 more examples of gratutiously passing arrays by address.

Everyone please call ParaSoft today and say "I will buy 57 copies of
Insure++ tomorrow, but first I want a FreeBSD version." :-)


# 51295a4d 12-Jul-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>


# 217ae632 31-May-1996 Bill Paul <wpaul@FreeBSD.org>

Improve NIS performace of getservbyname() and getservbyport(). Both these
functions are implimented as wrappers around getservent(), which means it's
up to getservent() to do all the work. The NIS support in getservent()
only allows it to scan through the services.byname map one entry at a
time until it finds the requested service name/port. This can be painfully
slow due to the overhead involved (lots and lots of successive RPCs).

To fix this, we allow getservbyname() and getservbyport() to signal
getservent() that if NIS is turned on (there's a '+' in /etc/services),
the usual yp_first()/yp_next() linear search should be abandoned and
yp_match() used instead. This causes getservent() to immediately
locate the requested entry instead of wasting time groping through the
whole map.

The downside is that this trick is accomplished by exporting a couple of
pointers from getservent.c which getservbyname.c and getservbyport.c can
preset in order to tell getservent() what to do. If all three functions
were in the same source module, then the extra cruft could be delcared
static to avoid poluting the global symbol space. Maybe they should be
combined anyway. For now I've settled on prepending lots of underscores.


# 70520b51 29-Jan-1996 Mike Pritchard <mpp@FreeBSD.org>

Getpwent() and getservent() can wind up calling free() with
an invalid pointer if a call to yp_first() fails. Closes PR # 964,
and possibly # 952.


# 215032be 04-Nov-1995 Bill Paul <wpaul@FreeBSD.org>

Add NIS support to getservent(3) functions (getservbyport() and getservbyname()
both call getservent() to do most of the work, so we only need to modify
this file to take care of everybody).

Note that there is only one NIS services map (services.byname) even
though there are getservbyname() and getservbyport() library functions.


# 58f0484f 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Lib Sources