Re: Wondering if this is a security issue?
"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]> Tue, 5 May 2026 04:58:34 -0700
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Holy smokes !! Layer upon layer of cruft which has become mainstream in our lives… I am not a networking expert, and I have been wrestling with how to allocate (claim) a socket port number, and get that information made available to remote clients. Turns out, after more than 50 years, there are no standard mechanisms for doing this. It is every man for himself. Now we have vibe coded enshitification on top of all that too... > On May 5, 2026, at 03:10, Tim Bradshaw (as tfb at cley dot com) <[email protected]> wrote: > > On 4 May 2026, at 23:11, David McClain <[email protected]> wrote: >> >> I don’t understand, from your explanations, why it would report “root”. > > The problem is that logname is one of those utilities which digs into the layers of emulation which allow the OS running, for instance, on a Mac to think it's actually running on a PDP-11. > > I am pretty sure logname just calls getlogin(3) which > returns a pointer to a string containing the name of the user logged in on the controlling terminal of the process, or a null pointer if this information cannot be determined. > That depends on at least two things which can be confusing > > What is the controlling terminal of a process which may well be runnng in a GUI? > Is the user logged in on that terminal, whatever it is, in any way related to the user who owns the current process? > I have no idea how that Mac GUI gets started but I would not be at all surprised if the 'controlling terminal' is not whatever the OS thinks is its console, in other words whatever is on the end of the topmost RS232 port on the CPU VME card ... no, wait, the whole concept of 'the console' hasn't made sense for forty years now. > > But if we go back forty years to a machine where there really is a physical terminal on which a user is logged in, then the second question still applies: what, for instance does 'logname; sudo su - otheruser logname' print? The answer should be 'the same string twice', even though the users running the command were different. > > --tim > >