What mode should `whois' be?

Jordan Hayes jordan at ucbarpa.Berkeley.EDU
Sun Dec 7 17:36:06 AEST 1986


Steve D. Miller <steve at mimsy.UUCP> writes:

	struct sockaddr sin;

	sin.sin_family = AF_INET;
	if (bind(&sin, sizeof(sin)) < 0) ...

[ I assume you mean bind(s, &sin, sizeof(sin)) since bind() takes 3
arguments ]

	It's not trying to bind to any particular port on the local
	machine; it just wants the kernel to pick one for it.
	Unfortunately, the kernel does so only if no address is
	specified (all-zeroes), and this is specifying a garbage
	address.

That's weird ... the 4.3 source says

	struct sockaddr_in	sin;

	sin.sin_family = hp->h_addrtype;
	if (bind(s,&sin, sizeof(sin)) < 0) ...

More portable, but still far from the point -- clients that talk to
Internet Services (I.e., those with RFC's) shouldn't bind the socket
locally -- the server should do that for you. You can't enforce the
protected ports across non-BSD systems. You certainly shouldn't try to
with whois ...

/jordan



More information about the Comp.bugs.4bsd.ucb-fixes mailing list