Re: How to determine whether client and server are on the same host

2013-11-27 Thread Malte Forkel
Am 27.11.2013 00:15, schrieb Chris Angelico: > Since the server runs Linux, inability to run /sbin/ifconfig could > safely be interpreted as "we're not running on the server". But I > think this actually gains little over "is there a file called > /tmp/_this_is_malte_forkel_on_his_server_9515343_",

Re: How to determine whether client and server are on the same host

2013-11-27 Thread Malte Forkel
Am 27.11.2013 01:14, schrieb Michael Torrie: > > I believe socket.getsockname() can return the IP address of the > connecting client if you're using standard tcp/ip sockets. > The way you describe it, it sounds like it would require a change to the server. I can only modify the client. I'll try t

Re: How to determine whether client and server are on the same host

2013-11-27 Thread Malte Forkel
Am 27.11.2013 00:37, schrieb Gregory Ewing: > > What would happen if you tried the file-based method when > it wasn't a local connection? Is there a danger of it > "succeeding" on the wrong machine and damaging something? > I have been thinking about that. There is a slight risk that the client m

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Michael Torrie
On 11/25/2013 12:35 PM, Malte Forkel wrote: > I have a Python application that communicates with a server via telnet. > Host and port of the server are supplied by the user when the > application is started. > > How can I determine from within the application whether the server's > host actually i

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Gregory Ewing
Malte Forkel wrote: One special operation is not available in the protocol, but can be implemented by a direct file-based operation if the application is run on the server itself. What would happen if you tried the file-based method when it wasn't a local connection? Is there a danger of it "su

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Chris Angelico
On Wed, Nov 27, 2013 at 10:08 AM, Walter Hurry wrote: > Easy enough with ifconfig and grep. I presume that there is also a way on > Windows, but others will have to contribute that. Since the server runs Linux, inability to run /sbin/ifconfig could safely be interpreted as "we're not running on t

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Walter Hurry
On Wed, 27 Nov 2013 09:56:13 +1100, Chris Angelico wrote: > On Wed, Nov 27, 2013 at 4:26 AM, Malte Forkel > wrote: >> Thanks for the explanation. I guess I was hoping that I could use some >> property of a connection created with telnetlib or its socket to find >> out whether it was actually a ho

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Chris Angelico
On Wed, Nov 27, 2013 at 4:26 AM, Malte Forkel wrote: > Thanks for the explanation. I guess I was hoping that I could use some > property of a connection created with telnetlib or its socket to find > out whether it was actually a host-local connection (i.e. a connection > to 'localhost', '127.xx.x

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Malte Forkel
Am 26.11.2013 13:26, schrieb Chris Angelico: > If you deliberately create a file with a random name, the chances of > one existing with the same name on the client are infinitesimal unless > someone's deliberately trying to confuse things... in which case I > wouldn't worry about it. > I wouldn't,

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Chris Angelico
On Tue, Nov 26, 2013 at 11:13 PM, Malte Forkel wrote: > That is a clever idea. While I can't modify the server, I could look at > the files on the host running the application and try to determine if > they fit to information from the server about its files. If both match, > I could then conclude

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Malte Forkel
Am 26.11.2013 12:38, schrieb Chris Angelico: > There is another way you might be able to do this. The server could > simply create a cookie in the file system - say, a file in /tmp with a > randomly-generated name - and it can announce that to the client. If > the client sees the same file in what

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Chris Angelico
On Tue, Nov 26, 2013 at 10:26 PM, Malte Forkel wrote: > Most of the application's functionality uses the telnet connection to > communicate with the server. One special operation is not available in > the protocol, but can be implemented by a direct file-based operation if > the application is run

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Malte Forkel
Am 26.11.2013 00:41, schrieb Ben Finney: > > On Unix, this is up to the person invoking the program: the “sockets > facility allows for a host-local connection to appear as though it's > going over a network. > > https://en.wikipedia.org/wiki/Localhost> > https://en.wikipedia.org/wiki/Un

Re: How to determine whether client and server are on the same host

2013-11-26 Thread Malte Forkel
Am 26.11.2013 00:07, schrieb Chris Angelico: > > Two easy ways you could do this. I would be inclined to do what > PostgreSQL and others do, and have an explicit indication that you > want to use a local method: for instance, the name "localhost". Use of > anything else (including "127.0.0.1") mea

Re: How to determine whether client and server are on the same host

2013-11-25 Thread Ben Finney
Malte Forkel writes: > I have a Python application that communicates with a server via > telnet. Host and port of the server are supplied by the user when the > application is started. > > How can I determine from within the application whether the server's > host actually is the local host? (In

Re: How to determine whether client and server are on the same host

2013-11-25 Thread Chris Angelico
On Tue, Nov 26, 2013 at 6:35 AM, Malte Forkel wrote: > I have a Python application that communicates with a server via telnet. > Host and port of the server are supplied by the user when the > application is started. > > How can I determine from within the application whether the server's > host a

How to determine whether client and server are on the same host

2013-11-25 Thread Malte Forkel
Hi, I have a Python application that communicates with a server via telnet. Host and port of the server are supplied by the user when the application is started. How can I determine from within the application whether the server's host actually is the local host? (In that case I could implement a