- my $sun = sockaddr_un($parm_clamsocket) or die "** Failed packing '$parm_clamsocket'\n";
- socket(SOCK, AF_UNIX, SOCK_STREAM, 0) or die "** Unable to open socket '$parm_clamsocket'\n";
-
+ my $socket;
+ if ($socket_domain == AF_UNIX)
+ {
+ $socket = sockaddr_un($parm_clamsocket) or die "** Failed packing '$parm_clamsocket'\n";
+ }
+ elsif ($socket_domain == AF_INET)
+ {
+ my ($ca_host, $ca_port) = split(/\s+/,$parm_clamsocket);
+ my $ca_hostent = gethostbyname($ca_host) or die "** Failed to get raw address for host '$ca_host'\n";
+ $socket = sockaddr_in($ca_port, $ca_hostent) or die "** Failed packing '$parm_clamsocket'\n";
+ }
+ else
+ {
+ die "** Unknown socket domain '$socket_domain' (should not happen)\n";
+ }
+ socket(SOCK, $socket_domain, SOCK_STREAM, 0) or die "** Unable to open socket '$parm_clamsocket'\n";