Commit Graph
41 Commits
Author SHA1 Message Date
Andrew Tridgell bca78c12f8 access: fail closed when a hosts-deny token can't be resolved
match_hostname() did a forward-DNS lookup of a config-specified hostname
token and, on gethostbyname() failure, returned "no match" -- which
allow_access() cannot distinguish from a real non-match, so a daemon with
"hosts deny = <hostname>" silently admitted the host whenever the token
could not resolve (a resolver-less chroot, or a transient DNS failure).
No attacker DNS control required.

Thread a deny flag through access_match()/match_hostname() and, on a
forward-DNS failure, treat an unresolvable DENY-list token as a match so
the connection is refused (fail closed); allow-list tokens still fail as a
non-match. Sibling of CVE-2026-43617, which fixed only the reverse path.

Reported-by: Leonid Bugaev <leonsbox@gmail.com>
(cherry picked from commit 84e469ea03a98ef31326d3d861336d7e7d582ce1)
2026-06-27 18:14:25 +10:00
Andrew Tridgell 6e00a3b867 daemon: bound argument lists + proxy-protocol peer/length hardening
- io: bound daemon argument lists so a malicious daemon client cannot grow
   argv without limit (DoS);
 - socket: bound the PROXY CONNECT request and proxy response header lines;
 - daemon: require a trusted-proxy host list for "proxy protocol = true"
   (reject untrusted proxy peers, fail-closed), and warn at startup when the
   trusted-proxy list is unset so the fail-closed behaviour is not silent.

Tests: daemon-argv-limit, proxy-connect-request-too-long,
proxy-response-header-too-long, proxy-protocol-trusted-peer.
2026-06-15 15:24:42 +10:00
Holger Hoffstätte 6994fdf50e Fix glibc-2.43 constness warnings
Glibc 2.43 added C23 const-preserving overloads to various string functions,
which change the return type depending on the constness of the argument(s).
Currently this leads to warnings from calls to strtok() or strchr().
Fix this by properly declaring the respective variable types.

Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
2026-05-07 06:35:39 +10:00
Wayne Davison c3b553a93f Preparing for release of 3.2.4pre2 2022-01-15 17:21:01 -08:00
Wayne Davison 3e44bbd313 Preparing for release of 3.2.4pre1 2022-01-02 15:13:19 -08:00
Wayne Davison ec3833c96e Add optional netgroup.h include for NetBSD hosts. 2021-02-01 16:31:28 -08:00
Wayne Davison 2f13049600 Add "@netgroup" names to host matching. 2020-07-12 19:16:57 -07:00
Wayne Davison 11eb67eec9 Some memory allocation improvements
- All the memory-allocation macros now auto-check for failure and exit
   with a failure message that incudes the caller's file and lineno
   info.  This includes strdup().

 - Added the `--max-alloc=SIZE` option to be able to override the memory
   allocator's sanity-check limit.  It defaults to 1G (as before).
   Fixes bugzilla bug 12769.
2020-06-25 20:54:21 -07:00
Wayne Davison e63ff70eae Some indentation fixes. 2020-06-13 19:15:02 -07:00
Wayne Davison 3e2e4b5a33 Tweak the copyright year. 2019-03-16 09:15:49 -07:00
Wayne Davison 473108ae6e Tweak copyright date. 2018-01-14 19:55:07 -08:00
Wayne Davison 453914e35b Update the copyright year. 2015-08-08 12:47:03 -07:00
Wayne Davison dfa5b49110 Bump the year to 2014. 2014-01-26 09:29:15 -08:00
Wayne Davison 7e1a9c4d79 Update copyright year. 2013-01-19 11:05:53 -08:00
Wayne Davison bf4170ade8 Daemon supports forward-DNS lookups for simple hostnames
in hosts deny/allow config settings.
2011-01-03 19:04:06 -08:00
Wayne Davison df694f72ed Change some args from "char *" to "const char *" in order to get rid of
a compiler warning that was just introduced.  Also avoids changing the
host string to lower-case in access.c (by using iwildmatch()).
2009-01-15 00:23:07 -08:00
Wayne Davison b3bf9b9df9 Update the copyright year. 2009-01-03 10:57:14 -08:00
Wayne Davison d3d07a5e86 Include 2008 in the copyright years. 2008-03-01 12:01:41 -08:00
Wayne Davison 8e41b68e8f Tweaking the license text a bit more. 2007-07-10 13:55:49 +00:00
Wayne Davison 4fd842f98d Switching to GPL 3. 2007-07-07 05:33:14 +00:00
Wayne Davison ba2133d6ad Further modifications to the copyright comment section. 2007-02-04 14:54:58 +00:00
Wayne Davison e7c67065c0 Updated the FSF's address to an even newer one. 2006-04-25 23:51:12 +00:00
Wayne Davison 0f78b81511 - Updated the address for the FSF in the opening comment.
- Standardized the format of the opening comment, including adding a
  brief description of what's in the file for those that lacked it.
- Added some missing copyright lines.
- Some minor whitespace tweaks (in a few of the files).
2006-04-25 20:23:34 +00:00
Wayne Davison 2997e9f769 Indent the "oom:" label away from column 0. 2005-11-10 16:42:46 +00:00
Wayne Davison 4f5b0756df John E. Malmberg convinced me to standardize on #ifs for defined
values instead of non-zero.
2005-02-14 00:53:43 +00:00
Wayne Davison 25ff04417e Use "#if" (not "#ifdef") for configure-defined macros. 2005-01-28 18:50:49 +00:00
Wayne Davison 361428213b Simplified the logic in allow_access() and tweaked some whitespace. 2005-01-15 20:06:48 +00:00
Wayne Davison be7cf82299 - Make sure that match_address() always restores the "tok" string,
even on error.
- Turned the various FERROR messages into (the more proper) FLOG.
2004-09-24 16:50:07 +00:00
Wayne Davison fe332038c6 Call wildmatch(), not fnmatch(). 2003-07-30 06:12:27 +00:00
Wayne Davison b49d381d05 Changed "./0123456789" to just ".0123456789". 2003-07-07 19:37:58 +00:00
Wayne Davison 7da9a16d10 I decided to go with the slightly simpler logic Thorild Selen suggested
in a subsequent email.
2003-07-07 18:37:38 +00:00
Wayne Davison 32f60a6e7b Improved deficiencies in the hostname-vs-address check (reintroduced in the
last revision) based on the suggestions of Thorild Selen.
2003-07-07 18:25:01 +00:00
Wayne Davison 70a6051cf1 Restored an isdigit() check in the match_address() function, but check
the last character in the hostname, not the first.
2003-07-05 07:39:57 +00:00
David Dykstra 7bc8218d81 Fix bug that causes messages like
rsync: stack overflow in function match_address
on openbsd.  Patch from Brian Poole <raj@cerias.purdue.edu>.
2003-01-20 13:46:28 +00:00
David Dykstra 8d2aad49e3 AI_NUMERICHOST is not defined on AIX. 2003-01-09 21:30:24 +00:00
David Dykstra bc2b4963a0 Support IPv6 addresses with "hosts allow" and "hosts deny". Patch from
Hideaki Yoshifuji.
2003-01-09 21:14:10 +00:00
Martin Pool 32f761755e Try to fix ctype issues by always calling these functions as
if (!isdigit(* (unsigned char *) p)) {

so that the argument is always in the range of unsigned char when
coerced to an int.

(See digit 1.)
2002-04-11 02:25:53 +00:00
Andrew Tridgell 43e46b4cf6 allow 0.0.0.0/0 syntax in hosts allow/deny
patch from Charles Levert <charles@comm.polymtl.ca>
2000-08-19 13:04:29 +00:00
Andrew Tridgell 505c7ea2bc add a cast to initialisation of mask 1998-05-22 13:27:55 +00:00
Andrew Tridgell 5a96ee0599 make host access controls case insensitive 1998-05-14 04:31:03 +00:00
Andrew Tridgell 56c473b795 added hosts allow and hosts deny support. I ended up writing my own as
the tcpd code is not quite what I wanted.
1998-05-13 08:03:47 +00:00