[p4] password encyrption
Jeff Grills
jgrills at drivensnow.org
Fri Oct 6 07:50:11 PDT 2006
I'm not sure how Unix could possibly support this from the shell. It would
require semantic knowledge of the command line arguments and somehow getting
that information from the command line into the bind() call. I just don't
see that happening.
P4d, by default, will bind the port on all interfaces, and then wait in an
accept() or a select() call (I could probably figure out which, but it
doesn't matter for this discussion) for an incoming connection. It will
then fork() a new process to handle the incoming connection and the main
process will go back to waiting on incoming connections. You mention
running p4d from inetd, which most people probably do not do; to support
that, p4d has the "-i" command line option which basically just causes p4d
to not bind any sockets and use stdin/stdout in place of the socket for a
single connection. There's no reason that you have to use inetd - one could
easily write a small little application that works similar to inetd in that
it binds a specific port on a specific interface, and when an incoming
connection is made, it would fork() a new process, dup2() the socket to
stdin/stdout, and then exec p4d with the -i option. It could easily be made
generic enough to bind whatever ports you wanted on whatever interface, and
exec any program with any set of arguments. For a competent unix network
programmer, it's an easy task. In fact, I'd be relatively surprised if such
an application wasn't already generally available. The tcpserver
application is almost exactly that, but significantly more powerful, but it
could probably do the job. One downside is that by exec()ing the p4d
process for each connection, you have some extra overhead compared to just
fork()ing.
j
-----Original Message-----
From: David Jones [mailto:drj at ravenbrook.com]
Sent: Friday, October 06, 2006 3:21 AM
To: Jeff Grills
Cc: Perforce Users
Subject: Re: [p4] password encyrption
Every socket server should have an option to bind to a particular
interface or interfaces and it's a small bug that p4d does not. Of
course with this being such a useful feature it would be better if
Unix could somehow support this in the shell. inetd allows you to
specify that a server runs only on 127.0.0.1 (for example) but no-
ones runs their p4d in inetd mode do they?
drj
More information about the perforce-user
mailing list