On Sat, Aug 19, 2000 at 02:23:10PM +0200, Abhishek Rungta wrote:
> Hello Gaurav,
> 
> Yeah. This is a common problem.
> I am sure you must be using a system with multiple domains on the same 
> server. i.e. multiple virtual domains.
> 
> I faced the same problem and it can be fixed by sending OpenSRS your machine 
> IP as well. You must have only send the IP of the domain name on which you 
> wish to install OpenSRS. By machine name i mean the IP of the physical 
> machine.

Or apply this patch and set LOCAL_HOST in your OpenSRS.conf.
-- 
Christopher Masto         Senior Network Monkey      NetMonger Communications
[EMAIL PROTECTED]        [EMAIL PROTECTED]        http://www.netmonger.net

Free yourself, free your machine, free the daemon -- http://www.freebsd.org/
Index: cgi/verify_install.cgi
===================================================================
RCS file: /usr/local/cvsroot/opensrs/client/cgi/verify_install.cgi,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- verify_install.cgi  2000/07/18 18:07:01     1.1.1.1
+++ verify_install.cgi  2000/07/18 18:41:45     1.3
@@ -183,16 +183,24 @@
 
 sub init_socket {
     
-    my ($REMOTE_HOST,$REMOTE_PORT,$fh,$connect_type);
+    my ($REMOTE_HOST,$REMOTE_PORT,$LOCAL_HOST,$fh,$connect_type);
 
     $fh = 'opensrs';
 
     $REMOTE_HOST = $OPENSRS{REMOTE_HOST};
     $REMOTE_PORT = $OPENSRS{REMOTE_PORT};
+    $LOCAL_HOST  = $OPENSRS{LOCAL_HOST};
 
     # create a socket
     socket($fh, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
     
+    # bind to local address
+    my $local_addr = inet_aton($LOCAL_HOST)
+      or die "Couldn't lookup local address: $!";
+    my $laddr = sockaddr_in(0, $local_addr);
+    bind($fh, $laddr)
+      or die "Couldn't bind local address: $!";
+
     # build the address of the remote machine
     my $internet_addr = inet_aton($REMOTE_HOST)
 #      Couldn't convert $REMOTE_HOST into an Internet address
Index: lib/OpenSRS/Client.pm
===================================================================
RCS file: /usr/local/cvsroot/opensrs/client/lib/OpenSRS/Client.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- Client.pm   2000/07/18 18:07:01     1.1.1.1
+++ Client.pm   2000/07/18 18:46:32     1.3
@@ -111,7 +111,8 @@
 
 # global variables
 my ($cipher,$username,$private_key,$lookup_all_tlds,$crypt_type);
-my ($REMOTE_PORT,$REMOTE_HOST,$LOOKUP_REMOTE_PORT,$LOOKUP_REMOTE_HOST);
+my ($REMOTE_PORT,$REMOTE_HOST,$LOOKUP_REMOTE_PORT,$LOOKUP_REMOTE_HOST,
+    $LOCAL_HOST);
 
 # start random generator for Crypt::CBC
 srand( time() ^ ($$ + ($$ << 15)) );
@@ -203,6 +204,7 @@
     $REMOTE_HOST = $self->{REMOTE_HOST};
     $LOOKUP_REMOTE_PORT = $self->{LOOKUP_REMOTE_PORT};
     $LOOKUP_REMOTE_HOST = $self->{LOOKUP_REMOTE_HOST};
+    $LOCAL_HOST  = $self->{LOCAL_HOST};
 
 }
 
@@ -443,6 +445,13 @@
     # create a socket
     socket($fh, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
     
+    # bind to local address
+    my $local_addr = inet_aton($LOCAL_HOST)
+      or die "Couldn't lookup local address: $!";
+    my $laddr = sockaddr_in(0, $local_addr);
+    bind($fh, $laddr)
+      or die "Couldn't bind local address: $!";
+
     # build the address of the remote machine
     my $internet_addr = inet_aton($remote_host)
 #      Couldn't convert $remote_host into an Internet address
@@ -533,6 +542,7 @@
     my $domain = lc $args->{domain};
     my $username = $args->{username};
     my $affiliate_id = $args->{affiliate_id};
+    $affiliate_id = "" unless defined $affiliate_id;
 
     my $CRLF = "\r\n";
 
@@ -610,7 +620,7 @@
        $self->{_lookup_fh} = undef;
     } else {
        $fh = $self->{_fh};
-       close($fh);
+       close($fh) if defined $fh;
        $cipher = undef;
        $self->{_authenticated} = 0;
        $self->{_fh} = undef;
@@ -666,7 +676,7 @@
     my @array = split '&', $data;
 
     foreach my $item (@array) {
-       my ($key,$value) = split /=/, $item;
+       next unless my ($key,$value) = split /=/, $item;
        $value = unencode($value);
 
        if (exists $hash{$key}) {
@@ -684,6 +694,8 @@
 sub unencode {
     
     my $text = shift;
+    return "" unless defined $text;
+
     $text =~ tr/+/ /;
     $text =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge;
     return $text;
@@ -692,6 +704,8 @@
 sub encode {
     
     my $text = shift;
+    return "" unless defined $text;
+
     $text =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
     
     return $text;

Reply via email to