Skip site navigation (1)Skip section navigation (2)
Date:      23 Nov 1999 04:12:27 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        freebsd-questions@freebsd.org
Subject:   Re: ktrace/kdump output interpreting, help needed.
Message-ID:  <86wvranegk.fsf@localhost.hell.gr>
In-Reply-To: Eric Masson's message of "Mon, 22 Nov 1999 16:57:29 %2B0100"
References:  <383967E9.E8A2936@kisoft-services.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Eric Masson <e-masson@kisoft-services.com> writes:

A few comments on the code before the real answer a few lines below ;)

>   sock_id=rexec(ahost,port,user,password,cmd,&fd2p);

From the manual page of rexec(3) we read:

    The port inport specifies which well-known DARPA Internet port to
    use for the connection; the call `getservbyname("exec", "tcp")' (see 
    getservent(3))  will return a pointer to a structure, which contains
    the necessary port.

In /etc/services we can read that 512 is indeed the rexec port.  So
you're right on using port 512, but to be as portable as one can be, try
to follow the manuals more closely.  Don't mind the few extra lines of
code that are destined to eventually prove very useful when a weird set
of circumstances comes forth.

>   buffer = (void *)malloc(BUF_SIZE);

What if this fails for some obscure reason?  I would really prefer it
written like:

    if ((buffer = malloc(BUF_SIZE*sizeof(char))) == NULL)
	err(0, "whoops! memory exchausted");

>   while(count = read(sock_id,buffer,BUF_SIZE)) {

The read() system call can return a negative number too, in case of
failure, which will pass your while() test, and have the for loop that
follows it barf on unread and probably broken data.  Try using:

    while ((count = read(sock_id, buffer, BUF_SIZE)) > 0)
	... blah ...

> :
> 
>    403 rexec    CALL  nanosleep(0xbfbfdb28,0xbfbfdb20)
>    403 rexec    RET   nanosleep 0
>    403 rexec    CALL  socket(0x2,0x1,0)
>    403 rexec    RET   socket 3
>    403 rexec    CALL  connect(0x3,0xbfbfdb94,0x10)
>    403 rexec    RET   connect -1 errno 61 Connection refused

"Connection refused"  this says a lot.  Probably rexec is not allowed
from your host to the one you're trying to connect to.

[large snip]

>    403 rexec    CALL  connect(0x3,0xbfbfdb94,0x10)
>    403 rexec    RET   connect -1 errno 61 Connection refused

Ditto.  You are refused the attempted connection.  A few lines below you 
can see your rexec retrying to establish the connection, but you're
always refused from the destination host.  Finally, the error message is 
very informative of why you failed to get any meaningful output:

>    403 rexec    CALL  writev(0x2,0xbfbfdb14,0x4)
>    403 rexec    GIO   fd 2 wrote 60 bytes
>        "srvas4nanssv.nantes.kisoft-services.com: Connection refused
>        "

Regards.

-- 
Giorgos Keramidas, <keramida@ceid.upatras.gr>
"What we have to learn to do, we learn by doing." [Aristotle]


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86wvranegk.fsf>