Commit Graph

51 Commits

Author SHA1 Message Date
Warner Losh
b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
John Baldwin
8457b7f426 ypldap: Remove set but unused variables.
Some of these were reported by GCC, others reported by clang.
2023-06-20 09:29:00 -07:00
Simon J. Gerraty
d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
John Baldwin
c41b161812 ypldap: Fix mismatch in array bounds for ldapclient().
Reviewed by:	emaste
Reported by:	GCC -Warray-parameter
Differential Revision:	https://reviews.freebsd.org/D36807
2022-10-03 16:10:41 -07:00
Emmanuel Vadot
5abb10faa1 pkgbase: Put yellow pages programs to its own package
YP is less and less used, split them to users have the choice to not
install them.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33441
2021-12-21 10:17:22 +01:00
Kyle Evans
ecebb3cc1d Only set WARNS if not defined
This would allow interested parties to do experimental runs with an
environment set appropriately to raise all the warnings throughout the
build; e.g. env WARNS=6 NO_WERROR=yes buildworld.

Not currently touching the numerous instances in ^/tools.

MFC after:	1 week
2020-09-11 13:28:37 +00:00
Ed Maste
c5ea81f7a6 rename in-tree libevent v1 to libevent1
r316063 installed pf's embedded libevent as a private lib, with headers
in /usr/include/private/event.  Unfortunately we also have a copy of
libevent v2 included in ntp, which needed to be updated for compatibility
with OpenSSL 1.1.

As unadorned 'libevent' generally refers to libevent v2, be explicit that
this one is libevent v1.

Reviewed by:	vangyzen (earlier)
Differential Revision:	https://reviews.freebsd.org/D17275
2020-05-28 22:05:50 +00:00
Kyle Evans
3a166b3323 yp*: fix -fno-common build
This is mostly two problems spread out far and wide:
- ypldap_process should be declared properly
- debug is defined differently in many programs

For the latter, just extern it and define it everywhere that actually needs
it. This mostly works out nicely for ^/libexec/ypxfr, which can remove the
assignment at the beginning of main in favor of defining it properly.

-fno-common will become the default in GCC10/LLVM11.

MFC after:	3 days
2020-04-06 23:16:05 +00:00
Sergio Carlavilla Delgado
cdb51c125a Correct path in EXAMPLES ypldap.conf.5
PR:		244743
Submitted by:	alex@i.org.ua
Patch by:	alex@i.org.ua
Approved by:	bcr@(mentor), 0mp
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D24144
2020-03-24 19:12:28 +00:00
Conrad Meyer
446bb222fb ypldap(8): Fix absent va_end() in 'goto fail' path
In this path, we used va_start() without pairing it with va_end().  Add the
va_end().  (va_start() without paired va_end() is undefined behavior per the C
standard.)

"In many implementations, [va_end] is a do-nothing operation; but those
implementations that need it probably need it badly." - Rationale for the ANSI
C Programming Language, § 4.8.1.3.

Reported by:	Coverity
CID:		1340539
2020-01-29 05:59:22 +00:00
Konstantin Belousov
6b462d2762 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
2019-08-12 20:27:33 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Marcelo Araujo
4271417a84 Log when we have finished pushing users and groups.
Obtained from:	OpenBSD (rev 1.4)
MFC after:	3 weeks.
2017-08-01 05:26:20 +00:00
Marcelo Araujo
85a9cb4440 Simplify parseval() by allocating a buffer the size of the input string,
which will always be big enough to hold the output string.

Obtained from:	OpenBSD (revision 1.36)
2017-05-26 03:27:06 +00:00
Enji Cooper
5855f96f80 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This simplifies pathing in make/displayed output.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:18:28 +00:00
Marcelo Araujo
bbdfc8f1ea Use memset(3) instead of bzero(3).
Obtained from:	OpenBSD (r1.12, r1.20, r1.18 and r1.37)
2016-12-02 06:07:27 +00:00
Marcelo Araujo
5902259135 String terminators are called NUL, not NULL, also the variable
mentioned in the comment is p and not u.

Obtained from:	OpenBSD (r1.34)
2016-12-02 05:49:22 +00:00
Bryan Drewery
92e4e43ea8 DIRDEPS_BUILD: Update dependencies after a 'make bootstrap-tools'.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2016-09-02 20:41:43 +00:00
Bryan Drewery
1eb4ec9c62 DIRDEPS_BUILD: Add some missing dirctories to the build.
Sponsored by:	EMC / Isilon Storage Division
2016-08-31 19:30:59 +00:00
Marcelo Araujo
391adcc526 Do not allow whitespace in macro names.
Obtained from:	OpenBSD (r1.19).
2016-07-11 03:34:32 +00:00
Marcelo Araujo
1830617ec9 Bump date in both manpages.
Reported by:	rodrigc
2016-06-07 07:04:05 +00:00
Marcelo Araujo
3db8326de1 Add an entry on rc.conf(5) explaining the new options
nis_ypldap_enable and nis_ypldap_flags.

Also add an entry on ypldap(8) that it is a feature ready and
appears on FreeBSD 11.0.

Requested by:	rodrigc
Relnotes:	Yes
2016-06-07 01:00:08 +00:00
Don Lewis
9d80a8b09e Fix Coverity CIDs 1340544 Resource leak and 1340543 Use after free
At line 479 of ldapclient.c in client_build_req(), the error return
leaks ldap_attrs (CID 1340544).  It looks like this can happen if
the first utoa() call in aldap_get_stringset() fails.  It looks
like other leaks can happen if other utoa() calls fail since scanning
this array when it is freed stops when the first NULL is encountered.
Fix these problems by not storing NULL in the array when utoa()
fails, and by freeing ret and returning NULL if nothing is stored
in the array.  That way the caller will never see the
ldap_attrs[0] == NULL case, so delete that check.

The ber_printf_element() calls ber_free_elements() on its ber
argument and returns NULL on failure.  When each of its callers
detects failure, they do a goto fail, which then calls ber_free_elements()
with the same pointer (CID 1340543).  Fix is to delete the
ber_free_elements() from ber_printf_element()

Reported by:	Coverity
CID:		1340543, 1340544
Reviewed by:	araujo
Differential Revision:	https://reviews.freebsd.org/D6550
2016-05-25 01:37:25 +00:00
Marcelo Araujo
eed7cf8d2d Simplify overengineered and buggy code that looked like as if it did
some kind of UTF-8 validation, but actually didn't, but instead, for
malformed UTF-8 input, caused buffer overruns in some cases and caused
skipping of valid ASCII characters in other cases.

Obtained from:	OpenBSD (cvs 1.32)
2016-05-16 02:44:22 +00:00
Marcelo Araujo
152e878f4c When a group contains a non-existent user, make the warning
message more helpful by mentioning the group name.

Obtained from:	OpenBSD (cvs 1.19)
2016-05-16 02:35:23 +00:00
Don Lewis
a5f637460b Avoid indexing an array with a negative value.
Reported by:	Coverity
CID:		971121
2016-05-13 00:58:05 +00:00
Marcelo Araujo
6a35cae5ed Use nitems instead of 'sizeof(mapnames) / sizeof(mapnames[0]'. 2016-04-18 03:44:42 +00:00
Marcelo Araujo
eaf209de36 Convert ypldap_addr list to a tailq(queue(3)).
Obtained from:	OpenBSD r1.11, r1.17 and r1.36
2016-04-13 03:36:34 +00:00
Marcelo Araujo
0e3562425e Apply revisions 1.4 and 1.5 from ldapd's ber.c to ypldap's copy, so it can
deal with messages that haven't been fully read from the server yet.

Obtained from:	OpenBSD r1.11
2016-04-13 01:54:33 +00:00
Marcelo Araujo
5707468385 Set argument encode/result decode call backs for 'maplist' and 'all'.
Note: Listing a map is still not fully implemented.

Obtained from:	OpenBSD (r1.16, r1.17)
2016-03-04 03:10:08 +00:00
Marcelo Araujo
619d20a133 Implement the 'master' request.
Obtained from:	OpenBSD (r1.15)
2016-03-04 02:14:32 +00:00
Marcelo Araujo
db891e2149 Switch from FD_SETSIZE to getdtablesize(2) as it can make the FD to be
tunable. Also it gets more close with the original implementation from
OpenBSD.

Requested by:	rodrigc
Approved by:	rodrigc (mentor)
Differential Revision:	https://reviews.freebsd.org/D4970
2016-01-22 03:02:38 +00:00
Marcelo Araujo
3bf7d9a6eb ypldap(8) is a feature ready to be used to translate nis(8) database to ldap(3).
This commit, fix a core dump on ypldap(8) related with memory allocation.
Also an example of how to set the ypldap.conf(5) properly is added to
examples files.

A new user _ypldap is required to be able to run ypldap(8) as well as
in a chroot mode.

Reviewed by:	rodrigc (mentor), bjk
Approved by:	bapt (mentor)
Relnotes:	Yes
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D4744
2016-01-13 01:49:35 +00:00
Marcelo Araujo
6d652b139e Remove a garbage printf used for debug.
Approved by:	bapt (mentor implicit)
2015-12-15 15:46:14 +00:00
Marcelo Araujo
84e29f233a Remove the null checker before free.
Approved by:	bapt (mentor)
Obtained from:	OpenBSD
Differential Revision:	https://reviews.freebsd.org/D4549
2015-12-15 15:42:42 +00:00
Marcelo Araujo
474fa6a744 Remove wrong header and the NULL check before free().
Approved by:	bapt (mentor)
Obtained from:	OpenBSD
Differential Revision:	https://reviews.freebsd.org/D4548
2015-12-15 15:41:09 +00:00
Marcelo Araujo
7433efffe3 EAGAIN handling for imsg_read.
Approved by:	bapt (mentor)
Obtained from:	OpenBSD
Differential Revision:	https://reviews.freebsd.org/D4547
2015-12-15 15:37:58 +00:00
Craig Rodrigues
3634bb8e13 Add include of signal.h for signal() prototype. 2015-11-16 17:28:04 +00:00
Craig Rodrigues
67436074b5 Replace __svc_fdset with svc_fdset.
FreeBSD lacks __svc_fdset and __svc_fdsetsize.
2015-11-16 17:25:27 +00:00
Craig Rodrigues
4fa5f53548 Do not use SA_LEN() to dereference sa_len.
FreeBSD lacks the SA_LEN() macro.
2015-11-16 17:11:11 +00:00
Craig Rodrigues
21f6783298 Add include of time.h for tzset() prototype. 2015-11-16 17:08:51 +00:00
Craig Rodrigues
350ed59982 Replace __dead with __dead2.
FreeBSD lacks __dead.
2015-11-16 17:08:05 +00:00
Craig Rodrigues
66b5c05d95 Add include of sys/param.h for MAXHOSTNAMELEN 2015-11-16 17:06:33 +00:00
Craig Rodrigues
ab905b04a2 Replace __dead with __dead2.
FreeBSD lacks __dead.
2015-11-16 17:03:52 +00:00
Craig Rodrigues
cc7c29bf9a Replace HOST_NAME_MAX with MAXHOSTNAMELEN.
FreeBSD lacks HOST_NAME_MAX.
2015-11-16 17:02:34 +00:00
Craig Rodrigues
468878d99a Remove reference to EAI_NODATA.
It does not exist on FreeBSD.
2015-11-16 16:58:09 +00:00
Craig Rodrigues
28b524fb19 Add include of <string.h> for strlen() prototype. 2015-11-16 16:52:56 +00:00
Craig Rodrigues
f6fe55842b Convert Makefile to FreeBSD style.
Add libopenbsd to link line for imsg.
2015-11-16 16:51:18 +00:00