vzfirewall icon indicating copy to clipboard operation
vzfirewall copied to clipboard

remove host command

Open jnorell opened this issue 11 years ago • 1 comments

Some systems don't have "host" and it's called "hostx" on others .. probably should just rewrite resolve() to use Net::DNS.

jnorell avatar Jan 20 '14 19:01 jnorell

Net::DNS is a non-standard module:

# perl -e "use Net::DNS;"
Can't locate Net/DNS.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

So we cannot use it. Maybe add an "if" which checks whether host or hostx is available and use it? But before this check, get a configuration option like

RESOLVER_CMD = host %s
RESOLVER_CMD = super_duper_host_Z %s | grep "la-la" | sed -e s/foo/bar/ 

where %s is processed with the following function before:

sub escape_shell_arg {
    my ($arg) = @_;
    my $q = qq{\x27};
    my $qq = qq{\x22};
    return $arg if $arg !~ m/[\s$q$qq\\]/s && length($arg);
    # aaa'bbb  =>  'aaa'\'bbb'
    $arg =~ s/$q/$q\\$q$q/sg;
    return $q . $arg . $q;
}

dimikot avatar Jan 22 '14 22:01 dimikot