Getting X client information. (in the X server)
Hello,
I want to slightly modify X server to get the client list which is
currently
connected to X server. I want to save the list of client into a file.
(If possible, I want to get details of each client. For example, the
PID of
the client, request that is received from the client.)
Could you help to find out a starting point to do this?
Re: Getting X client information. (in the X server)
"Seongsu Lee" <senux@senux.com> writes:
[color=blue]
> Hello,
>
> I want to slightly modify X server to get the client list which is
> currently
> connected to X server. I want to save the list of client into a file.
> (If possible, I want to get details of each client. For example, the
> PID of
> the client, request that is received from the client.)
>
> Could you help to find out a starting point to do this?[/color]
Given the network transparent nature of X, getting
the PID is a problem. That is, some of the windows on your
DISPLAY may not have a PID on the local machine.
Otherwise, look at xlsclients.
Re: Getting X client information. (in the X server)
On Fri, 15 Dec 2006 08:37:55 -0500, Dan Espen
<daneNO@MORE.mk.SPAMtelcordia.com> wrote:
[color=blue]
>"Seongsu Lee" <senux@senux.com> writes:
>[color=green]
>> Hello,
>>
>> I want to slightly modify X server to get the client list which is
>> currently
>> connected to X server. I want to save the list of client into a file.
>> (If possible, I want to get details of each client. For example, the
>> PID of
>> the client, request that is received from the client.)
>>
>> Could you help to find out a starting point to do this?[/color]
>
>Given the network transparent nature of X, getting
>the PID is a problem. That is, some of the windows on your
>DISPLAY may not have a PID on the local machine.[/color]
Which might be solved by requiring that only TCPIP connections be
used, and that the client machine has identd running.
[color=blue]
>
>Otherwise, look at xlsclients.[/color]
Re: Getting X client information. (in the X server)
Michel Bardiaux <mbardiaux@mediaxim.be> writes:
[color=blue]
> On Fri, 15 Dec 2006 08:37:55 -0500, Dan Espen
> <daneNO@MORE.mk.SPAMtelcordia.com> wrote:
>[color=green]
>>"Seongsu Lee" <senux@senux.com> writes:
>>[color=darkred]
>>> Hello,
>>>
>>> I want to slightly modify X server to get the client list which is
>>> currently
>>> connected to X server. I want to save the list of client into a file.
>>> (If possible, I want to get details of each client. For example, the
>>> PID of
>>> the client, request that is received from the client.)
>>>
>>> Could you help to find out a starting point to do this?[/color]
>>
>>Given the network transparent nature of X, getting
>>the PID is a problem. That is, some of the windows on your
>>DISPLAY may not have a PID on the local machine.[/color]
>
> Which might be solved by requiring that only TCPIP connections be
> used, and that the client machine has identd running.[/color]
Hmm, never heard of identd before.
I just read the RFC.
You won't get the PID on the remote system and
you couldn't really distinguish one X windows connection
from the remote host from another.
Interesting though.
Re: Getting X client information. (in the X server)
On Wed, 20 Dec 2006 09:46:07 -0500, Dan Espen
<daneNO@MORE.mk.SPAMtelcordia.com> wrote:
[color=blue]
>Michel Bardiaux <mbardiaux@mediaxim.be> writes:
>[color=green]
>> On Fri, 15 Dec 2006 08:37:55 -0500, Dan Espen
>> <daneNO@MORE.mk.SPAMtelcordia.com> wrote:
>>[color=darkred]
>>>"Seongsu Lee" <senux@senux.com> writes:
>>>
>>>> Hello,
>>>>
>>>> I want to slightly modify X server to get the client list which is
>>>> currently
>>>> connected to X server. I want to save the list of client into a file.
>>>> (If possible, I want to get details of each client. For example, the
>>>> PID of
>>>> the client, request that is received from the client.)
>>>>
>>>> Could you help to find out a starting point to do this?
>>>
>>>Given the network transparent nature of X, getting
>>>the PID is a problem. That is, some of the windows on your
>>>DISPLAY may not have a PID on the local machine.[/color]
>>
>> Which might be solved by requiring that only TCPIP connections be
>> used, and that the client machine has identd running.[/color]
>
>Hmm, never heard of identd before.
>I just read the RFC.
>You won't get the PID on the remote system and[/color]
Mmm, yes, I must be confusing identd with some other daemon. I'm
pretty sure there *is* (or was!) one that gives the remote PID, but I
cant remember which.
[color=blue]
>you couldn't really distinguish one X windows connection
>from the remote host from another.[/color]
Let's be sure we're using the same terms: remote host = X client.
Right?
Now, reading /proc/<pid-of-X>/fd gives us the sockets.
Reading /proc/net/tcp gives us the remote address and port for each
client.
Identd (on the remote) then gives the corresponding username. It would
be relatively straightforward to extend the rcf1413 protocol to supply
more info about the connection.
But of course that assumes one has root privileges on both the local
and remote, and both the knowledge and authority to play around with
security-sensitive issues.
The last thing wished for by the OP, monitoring X requests on
per-client basis, would be much more difficult to do.
[color=blue]
>
>Interesting though.[/color]
Re: Getting X client information. (in the X server)
Michel Bardiaux <mbardiaux@mediaxim.be> writes:
[color=blue]
> On Wed, 20 Dec 2006 09:46:07 -0500, Dan Espen
> <daneNO@MORE.mk.SPAMtelcordia.com> wrote:
>[color=green]
>>Michel Bardiaux <mbardiaux@mediaxim.be> writes:
>>[color=darkred]
>>> On Fri, 15 Dec 2006 08:37:55 -0500, Dan Espen
>>> <daneNO@MORE.mk.SPAMtelcordia.com> wrote:
>>>
>>>>"Seongsu Lee" <senux@senux.com> writes:[/color][/color][/color]
Gee, a thread from last year.
[color=blue][color=green][color=darkred]
>>>>> Hello,
>>>>>
>>>>> I want to slightly modify X server to get the client list which is
>>>>> currently
>>>>> connected to X server. I want to save the list of client into a file.
>>>>> (If possible, I want to get details of each client. For example, the
>>>>> PID of
>>>>> the client, request that is received from the client.)
>>>>>
>>>>> Could you help to find out a starting point to do this?
>>>>
>>>>Given the network transparent nature of X, getting
>>>>the PID is a problem. That is, some of the windows on your
>>>>DISPLAY may not have a PID on the local machine.
>>>
>>> Which might be solved by requiring that only TCPIP connections be
>>> used, and that the client machine has identd running.[/color]
>>
>>Hmm, never heard of identd before.
>>I just read the RFC.
>>You won't get the PID on the remote system and[/color]
>
> Mmm, yes, I must be confusing identd with some other daemon. I'm
> pretty sure there *is* (or was!) one that gives the remote PID, but I
> cant remember which.
>[color=green]
>>you couldn't really distinguish one X windows connection
>>from the remote host from another.[/color]
>
> Let's be sure we're using the same terms: remote host = X client.
> Right?[/color]
Yep.
[color=blue]
> Now, reading /proc/<pid-of-X>/fd gives us the sockets.
>
> Reading /proc/net/tcp gives us the remote address and port for each
> client.
>
> Identd (on the remote) then gives the corresponding username. It would
> be relatively straightforward to extend the rcf1413 protocol to supply
> more info about the connection.
>
> But of course that assumes one has root privileges on both the local
> and remote, and both the knowledge and authority to play around with
> security-sensitive issues.
>
> The last thing wished for by the OP, monitoring X requests on
> per-client basis, would be much more difficult to do.
>[color=green]
>>Interesting though.[/color][/color]
I don't think you mentioned why you would want to do this.
The PID would allow you to kill a process, but X has protocols
for shutting down clients already.
You could design a new protocol that requires clients to present their
PIDs on connection but I don't think there is any requirement now that
a client has to have one PID.