[p4] password encyrption

Sweeney, Tony sweeney at ea.com
Fri Oct 6 08:53:14 PDT 2006


Perforce will only bind on all interfaces it P4PORT doesn't specify an
interface.  I have a secondary Perforce instance on this box with P4PORT
set to localhost:1667.  It can't be seen on the physical IP network
interface, only from localhost:

[sweeney at ukstudhp01 ~]$ p4 -p ukstudhp01:1667 info
Perforce client error:
        Connect to server failed; check $P4PORT.
        TCP connect to ukstudhp01:1667 failed.
        connect: ukstudhp01:1667: Connection refused
[sweeney at ukstudhp01 ~]$ p4 -p localhost:1667 info
User name: sweeney
Client name: ukstudhp01
Client host: ukstudhp01.eu.ad.ea.com
Client unknown.
Current directory: /home/sweeney
Client address: 127.0.0.1:38971
Server address: localhost.localdomain:1667
Server root: /p4rcs/tmp/Perforce
Server date: 2006/10/06 16:41:50 +0100 BST
Server version: P4D/LINUX26AMD64/2005.1/91257 (2005/12/28)
Server license: Electronic Arts (fka Criterion Software Ltd) 4024 users
(expires 2006/10/31)
[sweeney at ukstudhp01 ~]$

Compare my main server, with P4PORT=1666

[sweeney at ukstudhp01 ~]$ p4 -p ukstudhp01:1666 info
User name: sweeney
Client name: ukstudhp01
Client host: ukstudhp01.eu.ad.ea.com
Client unknown.
Current directory: /home/sweeney
Client address: 10.21.160.225:39014
Server address: ukstudhp01.eu.ad.ea.com:1666
Server root: /p4db
Server date: 2006/10/06 16:51:25 +0100 BST
Server version: P4D/LINUX26AMD64/2005.1/91257 (2005/12/28)
Server license: Electronic Arts (fka Criterion Software Ltd) 4024 users
(expires 2006/10/31)
[sweeney at ukstudhp01 ~]$ p4 -p localhost:1666 info
User name: sweeney
Client name: ukstudhp01
Client host: ukstudhp01.eu.ad.ea.com
Client unknown.
Current directory: /home/sweeney
Client address: 127.0.0.1:39015
Server address: localhost.localdomain:1666
Server root: /p4db
Server date: 2006/10/06 16:51:35 +0100 BST
Server version: P4D/LINUX26AMD64/2005.1/91257 (2005/12/28)
Server license: Electronic Arts (fka Criterion Software Ltd) 4024 users
(expires 2006/10/31)
[sweeney at ukstudhp01 ~]$

If you had a box with (say) four network interfaces with separate IP
addresses, you should be able to run separate Perforce instances on the
same socket on each one, just by setting P4PORT appropriately in your
startup scripts.  Disclaimer: I haven't actually tried this as I don't
have such a machine handy. :-/

Tony.

quis custodiet ipsos custodes -- Juvenal VI, 347-8  

> -----Original Message-----
> From: perforce-user-bounces at perforce.com 
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Jeff Grills
> Sent: 06 October 2006 15:50
> To: 'David Jones'
> Cc: 'Perforce Users'
> Subject: Re: [p4] password encyrption
> 
> 
> 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
> 
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
> 



More information about the perforce-user mailing list