Commit Graph

34 Commits

Author SHA1 Message Date
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
Craig Rodrigues
9e7c127f8d Import ypldap from OpenBSD.
ypldap -- Intended to be a drop-in replacement for ypserv, gluing in a
LDAP directory and thus providing support for users and groups stored in
LDAP for the get{pw,gr}ent family of functions.
2015-11-16 16:48:43 +00:00