From owner-freebsd-questions Tue Nov 23 12:29:59 1999 Delivered-To: freebsd-questions@freebsd.org Received: from logatome.micronet.fr (logatome-2.francenet.fr [193.149.96.2]) by hub.freebsd.org (Postfix) with ESMTP id 568A014CB4 for ; Tue, 23 Nov 1999 12:29:55 -0800 (PST) (envelope-from e-masson@kisoft-services.com) Received: from kisoft-services.com (Brest1.francenet.net [193.149.110.241]) by logatome.micronet.fr (8.8.8/8.8.8) with ESMTP id VAA14005; Tue, 23 Nov 1999 21:28:28 +0100 (CET) Message-ID: <383AF86B.A0FA3CF3@kisoft-services.com> Date: Tue, 23 Nov 1999 21:26:19 +0100 From: Eric Masson Organization: Kisoft Services X-Mailer: Mozilla 4.6 [fr] (WinNT; I) X-Accept-Language: fr MIME-Version: 1.0 To: Giorgos Keramidas Cc: freebsd-questions@FreeBSD.ORG Subject: Re: ktrace/kdump output interpreting, help needed. References: <383967E9.E8A2936@kisoft-services.com> <86wvranegk.fsf@localhost.hell.gr> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Giorgos Keramidas a écrit : > > Eric Masson 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 ... > Right, I should have said that this code snippet was intented for test purposes only :), Thanks for improvements. > > : > > > > 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. Right, twice. I know rexec says connection is denied, I submitted this just because when i telnet the host on port 512, it doesn't deny connection. So I've done the test on my FBSD workstation after i have enabled rexecd in inetd.conf ( and of course sent a HUP to inetd). Same result, connection refused. That's why I posted ;). Regards Eric > > -- > Giorgos Keramidas, > "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 -- Any opinions expressed above | Murphy's Law Corollary : are my own, not Kisoft's | Murphy was an optimist. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message