Page MenuHomeFreeBSD

Sync the ypwhich code with OpenBSD.
ClosedPublic

Authored by araujo on Jul 30 2015, 12:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Feb 16, 5:30 AM
Unknown Object (File)
Thu, Feb 5, 9:29 PM
Unknown Object (File)
Jan 4 2026, 5:51 PM
Unknown Object (File)
Dec 27 2025, 6:43 AM
Unknown Object (File)
Dec 4 2025, 8:40 AM
Unknown Object (File)
Dec 1 2025, 5:35 AM
Unknown Object (File)
Nov 29 2025, 6:01 PM
Unknown Object (File)
Nov 26 2025, 8:48 AM
Subscribers

Details

Summary
  • Update the BSD LICENSE and remove the 3rd clause.
  • Sync the code with the OpenBSD version that is more modern.
  • Code clean up.
Test Plan

The test for ypwhich was connect to the server:
root@srcCODE:/usr/src/usr.bin/ypmatch # ypwhich
10.0.1.11
root@srcCODE:/usr/src/usr.bin/ypmatch # ypwhich -d freebsd -x
Use "passwd" for "passwd.byname"
Use "master.passwd" for "master.passwd.byname"
Use "shadow" for "shadow.byname"
Use "group" for "group.byname"
Use "networks" for "networks.byaddr"
Use "hosts" for "hosts.byaddr"
Use "protocols" for "protocols.bynumber"
Use "services" for "services.byname"
Use "aliases" for "mail.aliases"
Use "ethers" for "ethers.byname"

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

araujo retitled this revision from to Sync the ypwhich code with OpenBSD..
araujo updated this object.
araujo edited the test plan for this revision. (Show Details)
rodrigc edited edge metadata.

In OpenBSD, yplib_host.c is in a directory:

http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr.sbin/ypserv/common/

If you are going to bring our yp code closer to OpenBSD, it would probably be a good idea to mirror
the same directory structure. That will make it easier to take fixes from OpenBSD in future.

This revision now requires changes to proceed.Jul 31 2015, 5:08 PM
bapt requested changes to this revision.Aug 1 2015, 9:34 AM
bapt added a reviewer: bapt.
bapt added a subscriber: bapt.

I agree with @rodrigc

araujo edited edge metadata.
araujo edited the test plan for this revision. (Show Details)

Address @rodrigc and @bapt suggestion. Thanks to
point it out, probably I will bring more files
from OpenBSD to the same place.

araujo edited edge metadata.

I just realized that my last update here wasn't fully complete.
So here is the full patch.

usr.bin/ypwhich/ypwhich.c
53 ↗(On Diff #7592)

Shouldn't just #include "yplib_host.h" work, due to the -I compiler flag ?

195 ↗(On Diff #7592)

It is strange to see both err(3) use and conversion from the err() to fprintf()/exit(). IMO err*() is preferrable.

219 ↗(On Diff #7592)

you do not need braces around !notrans, sizeof/sizeof is better written as nitems(ypaliases)

Address @kib comments with exception of nitems.
I have another patch for nitems as I need to change it
in most of the yp(8) tools.

Forgotten to remove the braces around !notrans.

Sorry for the noise.

usr.bin/ypwhich/ypwhich.c
103 ↗(On Diff #7594)

Why do you remove () around return values ? You explicitely violate the style(9).

usr.sbin/ypserv/common/yplib_host.c
77 ↗(On Diff #7594)

err() ? There and in lot of places below.

163 ↗(On Diff #7594)

According to style, there should be spaces around binary operations.

usr.bin/ypwhich/ypwhich.c
103 ↗(On Diff #7594)

Agree with you, it was removed because these patches are from OpenBSD, they use this style for return.

I will added it back to follow the style(9).

usr.sbin/ypserv/common/yplib_host.c
77 ↗(On Diff #7594)

They are OpenBSD files, and need to send a patch to upstream first to check if they(OpenBSD) will accept the changes and will be easier in the future sync the code. If they doesn't accept, I will change it. (my current plan).

163 ↗(On Diff #7594)

These two files weren't changed because I need to send a patch to OpenBSD, or otherwise in the future would be a bit hard to sync the code with them.

However, if it is a must, I have no problem to make the change to follow the style(9).

usr.sbin/ypserv/common/yplib_host.c
163 ↗(On Diff #7594)

No, it is not a must.

bapt edited edge metadata.