[sudo-users] sudo_logsrvd creates directory instead of pid_file

Patrik Peng patrik.peng at hostpoint.ch
Tue Oct 4 06:49:34 MDT 2022


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 at logging01:~] # service sudo_logsrvd start
Starting sudo_logsrvd.
sudo_logsrvd: /var/run/sudo/sudo_logsrvd.pid: Is a directory

[root at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://www.sudo.ws/pipermail/sudo-users/attachments/20221004/cf1056ef/attachment.bin>


More information about the sudo-users mailing list