_ katsuya
2021-Jul-25 13:38 UTC
[LightDM] About xauthority file in lightdm. It seems to me that xauthority file will be broken.
Hi all, I'm katsuya. In my environment using XDMCP, the xauthority file (/var/run/lightdm/ligtdm/xauthority) is corrupetd. The xauthority file is opend as follows: In src/x-authority.c at line 323, ? ? int output_fd = g_open (filename, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); The second argv isn't set O_TRANC, the xauthority file is opend as it is if it exists. At line 352, the file is synced and closed. The xauthority file includes? the back part of the original file. I thinks there are two ways to avoid this. 1: open the xauthority file with O_TRANC. ? ? int output_fd = g_open (filename, O_WRONLY | O_CREAT | O_TRANC, S_IRUSR | S_IWUSR); 2: write EOF before syncing & closing the file ? ? g_list_free_full?(records, g_object_unref); // add from here ? char eof_buf[1]; ? eof_buf[0]=EOF; ? write (output_fd, &eof_buf[0], 1); // add to here ? ? fsync (output_fd); ? ? close (output_fd); best regards, katsuya