From owner-freebsd-questions Mon Nov 22 19: 4:16 1999 Delivered-To: freebsd-questions@freebsd.org Received: from athserv.otenet.gr (athserv.otenet.gr [195.170.0.1]) by hub.freebsd.org (Postfix) with ESMTP id AD16E14C23 for ; Mon, 22 Nov 1999 19:04:11 -0800 (PST) (envelope-from keramida@diogenis.ceid.upatras.gr) Received: from localhost.hell.gr (patr530-a012.otenet.gr [195.167.115.12]) by athserv.otenet.gr (8.9.3/8.9.3) with SMTP id FAA11691 for ; Tue, 23 Nov 1999 05:03:37 +0200 (EET) Received: (qmail 494 invoked by uid 1001); 23 Nov 1999 02:12:28 -0000 To: freebsd-questions@freebsd.org Subject: Re: ktrace/kdump output interpreting, help needed. References: <383967E9.E8A2936@kisoft-services.com> From: Giorgos Keramidas Date: 23 Nov 1999 04:12:27 +0200 In-Reply-To: Eric Masson's message of "Mon, 22 Nov 1999 16:57:29 +0100" Message-ID: <86wvranegk.fsf@localhost.hell.gr> Lines: 68 X-Mailer: Gnus v5.6.45/XEmacs 21.1 - "20 Minutes to Nikko" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 ... > : > > 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, "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