Bug 202819 - Fix a bug in net/openldap24-server affecting UDP packets
Summary: Fix a bug in net/openldap24-server affecting UDP packets
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Xin LI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-01 23:27 UTC by Brad Davis
Modified: 2015-09-02 01:47 UTC (History)
0 users

See Also:
delphij: maintainer-feedback+


Attachments
patch (1.16 KB, patch)
2015-09-01 23:27 UTC, Brad Davis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Davis freebsd_committer freebsd_triage 2015-09-01 23:27:14 UTC
Created attachment 160609 [details]
patch

Recent update of openladap-sasl-client changed the sendto(2) "tolen" argument from:
sendto(..., dst, sizeof(sruct sockaddr));
to:
sendto(..., dst, sizeof(struct sockaddr_storage)); 

On FreeBSD with UDP sockets this change is invalid.

FreeBSD's getsockaddr() will copyin((dst, sa, len); and then set sa->sa_len = len. With the above change sa_len will be 128.

Later in in_pcbconnect_setup() this socket address will be rejected with EINVAL because sa_len != sizeof(struct sockaddr_in)

Patch openldap's liblber to always issue a the sendto(2) as follows:
sendto(..., dst, dst->sa_len);

This fixes both IPv4 and IPv6 sockaddrs in a manner compatible with the kernel's getsockaddr() semantics.
Comment 1 Xin LI freebsd_committer freebsd_triage 2015-09-02 00:32:02 UTC
Looks good to me.  I'll commit this one with a PORTREVISION bump.
Comment 2 Xin LI freebsd_committer freebsd_triage 2015-09-02 01:46:32 UTC
Committed, thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-09-02 01:47:10 UTC
A commit references this bug:

Author: delphij
Date: Wed Sep  2 01:46:16 UTC 2015
New revision: 395815
URL: https://svnweb.freebsd.org/changeset/ports/395815

Log:
  Use sa_len instead of sizeof(struct sockaddr_storage) to work around a
  FreeBSD kernel check, which would return EINVAL when the passed length
  is larger than desired.

  PR:		ports/202819
  Submitted by:	brd

Changes:
  head/net/openldap24-server/Makefile
  head/net/openldap24-server/files/patch-libraries__liblber__sockbuf.c