directory permissions [was: 'syslogd -u' and pidfile creation]

2024-11-08 Thread Jan Schaumann
Robert Elz wrote: > I agree this is mostly harmless (though annoying) - but leads me to > ponder whether or not we should have a directory permission setting > which would allow anyone to remove their own files from a directory, > but not create any (assuming they don't also have write permission

Re: 'syslogd -u' and pidfile creation

2024-11-08 Thread Robert Elz
Date:Sat, 09 Nov 2024 02:00:54 +0700 From:Robert Elz Message-ID: <284.1731092...@jacaranda.noi.kre.to> | Even though it is not at all meaningful in any naming sense, perhaps | we could reuse the sticky bit on directories (which was once used for | what is now t

Re: 'syslogd -u' and pidfile creation

2024-11-08 Thread Jan Schaumann
Mouse wrote: > > [I]f you use 'syslogd -u user', then syslogd can't create a pidfile > > because that is done post-setuid. > > What is the intended use case for -u? To run syslogd as an unprivileged user rather than as root. It starts up as root to open the log sockets, then changes euid to the

Re: 'syslogd -u' and pidfile creation

2024-11-08 Thread Robert Elz
Date:Fri, 8 Nov 2024 12:02:38 -0500 (EST) From:Mouse Message-ID: <202411081702.maa21...@stone.rodents-montreal.org> | What is the intended use case for -u? My guess would be so that the syslogd process isn't running as root, and so can do less harm if some bug is u

Re: 'syslogd -u' and pidfile creation

2024-11-08 Thread Mouse
> [I]f you use 'syslogd -u user', then syslogd can't create a pidfile > because that is done post-setuid. What is the intended use case for -u? Or, to put it another way, why is this something that needs fixing? My own reaction is that if you're using -u, it's not appropriate to write the usual

Re: Use of feature test macros

2024-11-08 Thread David Holland
On Sat, Nov 02, 2024 at 10:36:10PM +0100, Roland Illig wrote: > In the system headers, we use this pattern a lot: > > #if (_POSIX_C_SOURCE - 0 >= 200809L) || defined(_NETBSD_SOURCE) > > Are the parentheses around the first condition really necessary? If so, > for which cases? > > Is the "-

'syslogd -u' and pidfile creation

2024-11-08 Thread Jan Schaumann
Hello, 20 years ago, I filed bin/27309. In short, if you use 'syslogd -u user', then syslogd can't create a pidfile because that is done post-setuid. My suggested fix (diff attached) is to create the pidfile and chown it before changing UIDs. The subsequent pidfile(3) call will happily take ove