Skip to content

Commit

Permalink
random vhost
Browse files Browse the repository at this point in the history
  • Loading branch information
dgl committed Feb 19, 2008
1 parent 6114eb3 commit dc8c708
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nph-irc.cgi
Expand Up @@ -111,8 +111,9 @@ sub net_tcpconnect {
if($inet_addr !~ /:/) {
$saddr = sockaddr_in($port, inet_aton($inet_addr));
if(config_set('vhost')) {
(my $vhost) = $config->{vhost} =~ /([^ ]+)/;
bind($fh, pack_sockaddr_in(0, inet_aton($vhost)));
(my $vhost) = $config->{vhost} =~ /(.*)/; # untaint
my @vhosts = split /,\s*/, $vhost;
bind($fh, pack_sockaddr_in(0, inet_aton($vhosts[rand @vhosts])));
}else{
bind($fh, pack_sockaddr_in(0, inet_aton('0.0.0.0')));
}
Expand Down

0 comments on commit dc8c708

Please sign in to comment.