Commit Graph

10 Commits

Author SHA1 Message Date
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
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
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
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
6d652b139e Remove a garbage printf used for debug.
Approved by:	bapt (mentor implicit)
2015-12-15 15:46:14 +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
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
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