crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs | LICENSE

commit 64cf18cd0dbbd2f1ad7c0126385c8b9e0d084696
parent 6cf4d65d53b384eff1b95e4010ebe650213e2560
Author: finwo <finwo@pm.me>
Date:   Sat,  3 Jan 2026 19:38:35 +0100

2.66

Diffstat:
MChangeLog | 6++++++
MMakefile | 2+-
Mtest/sampleconf.xml | 2+-
Mxrctl/xrctl | 22++++++++++++++++++++--
4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,7 +1,13 @@ +2.66 [KK 2010-06-09] +- Bugfix in xrctl, --host-match arguments are now shell-quoted (they + are regular expressions and can contain pipe characters etc). Thanks + Chewped for reporting. + 2.65 [KK 2010-04-26] - Bugfix in backend/connect.cc - if the determination whether a back end is available goes haywire, the client socket may stay open and not be consumed. Thanks Franz J. for reporting! +- Version stamped as STABLE. 2.64 [KK 2010-01-29] - Fixed signal handling for start/stop/restart. diff --git a/Makefile b/Makefile @@ -1,7 +1,7 @@ # Top-level Makefile for XR # ------------------------- -VER = 2.65 +VER = 2.66 PREFIX = $(DESTDIR)/usr BINDIR = $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man diff --git a/test/sampleconf.xml b/test/sampleconf.xml @@ -186,7 +186,7 @@ server. The back end is eligible for www.myothersite.org. --> <address>server3:80</address> <backendcheck>get:server3:80/healthcheck.cgi</backendcheck> - <hostmatch>www.myothersite.org</hostmatch> + <hostmatch>(www.myothersite.org)|(www.yetanothersite.org)</hostmatch> </backend> </service> diff --git a/xrctl/xrctl b/xrctl/xrctl @@ -599,9 +599,9 @@ sub xr_cmdarr { # Handle host match my $hm = $bp->data('hostmatch'); if ($hm and $hm ne $last_hostmatch) { - push (@cmd, '--host-match', $hm); + push (@cmd, '--host-match', shquote($hm)); } elsif ($hm eq '' and $last_hostmatch ne '') { - push (@cmd, '--host-match', $default_hostmatch); + push (@cmd, '--host-match', shquote($default_hostmatch)); } $last_hostmatch = $hm; @@ -650,6 +650,24 @@ sub xr_cmdarr { return (@ret); } +# Shell-quote a string +sub shquote($) { + my $s = shift; + + return $s unless ($s =~ /[\(\)\'\"\|]/); + + if ($s !~ /'/) { + $s = "'$s'"; + } elsif ($s !~ /"/) { + $s = "\"$s\""; + } else { + $s =~ s/"/\\"/g; + $s = "\"$s\""; + } + + return $s; +} + # Prepare a flag for the command line if it is defined and if it is # not equal to the default sub flag {