sudo_logsrvd creates directory instead of pid_file

Patrik Peng <[email protected]> Tue, 4 Oct 2022 14:49:34 +0200
Newsgroups gmane.comp.tools.sudo.user
Message-ID <[email protected]>
Hi,

I'm not sure, but I think I stumbled upon a bug in sudo_logsrvd.

We have been running sudo_logsrvd on FreeBSD for a few months without 
any issues.
Today I noticed, that instead of creating a file containing the PID, a 
directory is created at the path configured by pid_file.

[root@logging01:~] # service sudo_logsrvd start
Starting sudo_logsrvd.
sudo_logsrvd: /var/run/sudo/sudo_logsrvd.pid: Is a directory

[root@logging01:~] # ls -alh /var/run/sudo/
drwx--x--x   4 root  wheel     4B Oct  4 14:32 .
drwxr-xr-x  19 root  wheel    59B Oct  4 03:53 ..
drwx--x--x   2 root  wheel     2B Oct  4 14:32 sudo_logsrvd.pid


Starting the server with truss attached shows the according `mkdirat`:

--8<--
  6714: openat(7,"sudo_logsrvd.pid",O_RDONLY|O_NONBLOCK,00) ERR#2 'No such file or directory'
  6714: mkdirat(7,"sudo_logsrvd.pid",0711)     = 0 (0x0)
  6714: openat(7,"sudo_logsrvd.pid",O_RDONLY|O_NONBLOCK|O_NOFOLLOW,00) = 6 (0x6)
  6714: fstat(6,{ mode=drwx--x--x ,inode=1924,size=2,blksize=131072 }) = 0 (0x0)
  6714: fchown(6,0,0)                 = 0 (0x0)
  6714: close(7)                     = 0 (0x0)
  6714: close(6)                     = 0 (0x0)
  6714: openat(AT_FDCWD,"/var/run/sudo/sudo_logsrvd.pid",O_WRONLY|O_NOFOLLOW|O_CREAT,0644) ERR#21 'Is a directory'
sudo_logsrvd 6714: write(2,"sudo_logsrvd",12)         = 12 (0xc)
:  6714: write(2,": ",2)                 = 2 (0x2)
/var/run/sudo/sudo_logsrvd.pid 6714: write(2,"/var/run/sudo/sudo_logsrvd.pid",30) = 30 (0x1e)
--8<--


The configuration hasn't been changed but sudo has been updated. Current 
version is 1.9.11p3

Regards,
Patrik

____________________________________________________________
sudo-users mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
https://www.sudo.ws/mailman/listinfo/sudo-users
OpenPGP_signature (application/pgp-signature, 840 B) - not displayed