amindexd java - unexpected EOF/unprocessed input

2001-02-15 Thread Sebastian Frankfurt

Hello ;-)

I tried to connect to the amindexd service via Java. It is possible
to read what the Server first barfs out... but if I try to send
some commands (SECURITY root, HOST localhost, etc.) nothing happens
and the debug output of amindexd says, that there is an unexpected EOF
and some unprocessed input (the mentioned commands I sent before).

=
This is what the /tmp/amanda/amindexd.debug says:

 220 kant AMANDA index server (2.4.1p1) ready.
? unexpected EOF
? unprocessed input:
-
? SECURITY root

-
amindexd: pid 5867 finish time Thu Feb 15 17:27:19 2001

=

I also tried to get a connection via Telnet, but the socket-port
of the telnet process is always to high, to be taken as a secure port
by the amindexd. Do you know a possibility of setting a portrange
to a telnet process?


Well, please have a look at the following (attached) tiny java program
and give me some hints, how to get a connection to the amindexd.



I want to write some interface from Java to amindexd for providing
a possibility for writing native java programs to take use of
the Amanda Backup Service ;-)


Please sent me a copy (CC:) to my private account ( mailto:[EMAIL PROTECTED])

thanx in advance,

Sebastian



import java.net.InetAddress;
import java.net.Socket;
import java.io.InputStream;
import java.io.PrintWriter;

public class testsock {

  public static String read(InputStream in) throws Exception {
StringBuffer sb = new StringBuffer();

while (true) {
  String str = "";
  while (in.available()  0) {
byte b[] = new byte[in.available()];
in.read(b);
str = new String(b);
sb.append(str);
  }
  if (str.indexOf("AMANDA")  -1)
break;
  else if (str.indexOf("5")  -1)
break;
  else if (str.indexOf("2")  -1)
break;
}
return sb.toString();
  }

  public static void main(String args[]) throws Exception {
Socket s = new Socket("localhost", 10082, InetAddress.getLocalHost(), 1028);
System.out.println("localport: "+s.getLocalPort());
InputStream in  = s.getInputStream();

System.out.println("got: "+read(in));

PrintWriter out = new PrintWriter(s.getOutputStream(), true);
System.out.println("send: SECURITY root");
out.println("SECURITY root");

System.out.println("got: "+read(in));
  }

}

 testsock.class

#!/usr/bin/perl

use Net::Telnet();

$hostname = "localhost";

$port = 10082;

$t = new Net::Telnet ( Host = $hostname, Port = $port);
$t-open("$hostname");

do
{
  $data = $t-getline(Timeout = 40);
  print "got: $data";
  $t-print("SECURITY root\n");
} while (true);




Re: amrecover: cannot connect to host (connection refused)

2001-01-30 Thread Sebastian Frankfurt

Gerhard den Hollander wrote:

 * Sebastian Frankfurt [EMAIL PROTECTED] (Tue, Jan 30, 2001 at 10:27:41AM +0100)
 
 Mack Earnhardt wrote:
 
 
 I was getting connection refused on amrecover for a while.  The 
 ..amandahosts file allowed access to root@localhost, but amrecover would 
 use root@servername and fail.  My solution was to use the server name 
 explicitly in both .amandahosts and disklist.
 
 Hope this help one of your problems. :)
 
 Well thanx for the tip, but it doesn't matter, what I put into
 the .amandahosts because the error I get is:
 
AMRECOVER Version 2.4.1p1. Contacting server on localhost ...
amrecover: Unexpected server end of file
 
 
 Did you check the files in /tmp/amanda 
 (on server and client) ?

I have had a look at them don't see anything wrong :-(


amrecover:

   amrecover: debug 1 pid 1554 ruid 0 euid 0 start time Tue Jan 30 
10:28:33 2001
   Error connecting to server
   amrecover: pid 1554 finish time Tue Jan 30 10:28:33 2001




I will attach all /tmp/amanda files.

thanx,

Sebastian

PS: rsh commands works properly for root and operator



amandad: debug 1 pid 1495 ruid 11 euid 11 start time Tue Jan 30 10:25:31 2001
amandad: version 2.4.1p1
amandad: build: VERSION="Amanda-2.4.1p1"
amandad:BUILT_DATE="Mon Aug 21 16:31:37 EDT 2000"
amandad:BUILT_MACH="Linux porky.devel.redhat.com 2.2.5-22smp #1 SMP Wed Jun 2 
09:11:51 EDT 1999 i686 unknown"
amandad:CC="gcc"
amandad: paths: bindir="/usr/bin" sbindir="/usr/sbin"
amandad:libexecdir="/usr/lib/amanda" mandir="/usr/share/man"
amandad:CONFIG_DIR="/etc/amanda" DEV_PREFIX="/dev/"
amandad:RDEV_PREFIX="/dev/r" DUMP="/sbin/dump"
amandad:RESTORE="/sbin/restore" SAMBA_CLIENT="/usr/bin/smbclient"
amandad:GNUTAR="/bin/tar" COMPRESS_PATH="/usr/bin/gzip"
amandad:UNCOMPRESS_PATH="/usr/bin/gzip" MAILER="/usr/bin/Mail"
amandad:listed_incr_dir="/var/lib/amanda/gnutar-lists"
amandad: defs:  DEFAULT_SERVER="localhost" DEFAULT_CONFIG="DailySet1"
amandad:DEFAULT_TAPE_SERVER="localhost"
amandad:DEFAULT_TAPE_DEVICE="/dev/null" HAVE_MMAP HAVE_SYSVSHM
amandad:LOCKING=POSIX_FCNTL SETPGRP_VOID DEBUG_CODE BSD_SECURITY
amandad:USE_AMANDAHOSTS CLIENT_LOGIN="operator" FORCE_USERID
amandad:HAVE_GZIP COMPRESS_SUFFIX=".gz" COMPRESS_FAST_OPT="--fast"
amandad:COMPRESS_BEST_OPT="--best" UNCOMPRESS_OPT="-dc"
got packet:

Amanda 2.4 REQ HANDLE 000-90D50508 SEQ 980846701
SECURITY USER operator
SERVICE sendbackup
OPTIONS hostname=localhost;
GNUTAR /etc 1 2001:1:27:2:25:7 OPTIONS 
|;bsd-auth;compress-fast;index;exclude-list=/usr/local/lib/amanda/exclude.gtar;


sending ack:

Amanda 2.4 ACK HANDLE 000-90D50508 SEQ 980846701


bsd security: remote host localhost user operator local user operator
amandahosts security check passed
amandad: running service "/usr/lib/amanda/sendbackup"
amandad: sending REP packet:

Amanda 2.4 REP HANDLE 000-90D50508 SEQ 980846701
CONNECT DATA 1297 MESG 1298 INDEX 1299
OPTIONS ;compress-fast;bsd-auth;index;exclude-list=/usr/local/lib/amanda/exclude.gtar;


amandad: got ack:

Amanda 2.4 ACK HANDLE 000-90D50508 SEQ 980846701


amandad: pid 1495 finish time Tue Jan 30 10:25:31 2001


amrecover: debug 1 pid 1639 ruid 0 euid 0 start time Tue Jan 30 10:59:36 2001
Error connecting to server
amrecover: pid 1639 finish time Tue Jan 30 10:59:36 2001


amtrmidx: debug 1 pid 1541 ruid 11 euid 11 start time Tue Jan 30 10:25:32 2001
/usr/lib/amanda/amtrmidx: version 2.4.1p1
Keeping 26 index files
localhost /etc
amtrmidx: pid 1541 finish time Tue Jan 30 10:25:40 2001


killpgrp: debug 1 pid 2007 ruid 11 euid 0 start time Sat Jan 27 03:16:49 2001
/usr/lib/amanda/killpgrp: version 2.4.1p1
sending SIGTERM to process group 2007
child process exited with status 3


runtar: debug 1 pid 1500 ruid 11 euid 0 start time Tue Jan 30 10:25:31 2001
gtar: version 2.4.1p1
running: /bin/tar: gtar --create --directory /etc --listed-incremental 
/var/lib/amanda/gnutar-lists/localhost_etc_1.new --sparse --one-file-system 
--ignore-failed-read --totals --file - . 


selfcheck: debug 1 pid 1453 ruid 11 euid 11 start time Tue Jan 30 10:20:01 2001
/usr/lib/amanda/selfcheck: version 2.4.1p1
checking disk /etc: device /etc: OK
selfcheck: pid 1453 finish time Tue Jan 30 10:20:01 2001


sendbackup: debug 1 pid 1496 ruid 11 euid 11 start time Tue Jan 30 10:25:31 2001
/usr/lib/amanda/sendbackup: got input request: GNUTAR /etc 1 2001:1:27:2:25:7 OPTIONS 
|;bsd-auth;compress-fast;index;exclude-list=/usr/local/lib/amanda/exclude.gtar;
  parsed request as: program `GNUTAR' disk `/etc' lev 1 since 2001:1:27:2:25:7 opt 
`|;bsd-