Well, the subject.
I have searched a lot, but unfortunately, found nothing. Is there some document describing this format? Or the structure need to be extracted out from the xauth source files?
Advertisement
Answer
Probably not exactly what you are looking for but putting in an answer just for the formatting.
The .Xauthority is an array of structures:
typedef struct xauth { unsigned short family; unsigned short address_length; char *address; unsigned short number_length; char *number; unsigned short name_length; char *name; unsigned short data_length; char *data; } Xauth;
You would probably still need to be able to decode each entry — if nothing else by slogging through the source:Xauth.h
For example:
$ od -xc --endian=big .Xauthority | more 0000000 0100 0007 6d61 7869 6d75 7300 0130 0012 001 a m a x i m u s 001 0 022 0000020 4d49 542d 4d41 4749 432d 434f 4f4b 4945 M I T - M A G I C - C O O K I E 0000040 2d31 0010 c0ac 9e9c ee82 ef59 f406 b7f9 - 1 020 300 254 236 234 356 202 357 Y 364 006 267 371 0000060 b745 254e 0100 0007 6d61 7869 6d75 7300 267 E % N 001 a m a x i m u s
The first short is 0x100 indicating the family
The next short is 0x0007 indicating the length of the address
The next 7 bytes are the address: maximus
The next short is 0001, the length of the seat number
The next byte is 30, ascii 0, the seat number
The next short is 0x0012, decimal 18, the length of the name
The next 18 bytes are the name: MIT-MAGIC-COOKIE-1
The next short is 0x0010, decimal 16, the length of the data
And the next 16 bytes are the data: 0xc0ac thru 0x254e.
Then it starts over.