Skip Menu |

This queue is for tickets about the Sys-Hostname-Long CPAN distribution.

Report information
The Basics
Id: 25977
Status: open
Priority: 0/
Queue: Sys-Hostname-Long

People
Owner: Nobody in particular
Requestors: sam [...] cpanel.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: sam [...] cpanel.net
Subject: "su nobody -c" is a problem where nobody's shell is /bin/nologin
Date: Fri, 30 Mar 2007 15:37:33 -0500
To: bug-Sys-Hostname-Long [...] rt.cpan.org
From: Sam Foster <sam [...] cpanel.net>
Hello, I am submitting this via e-mail as I am having trouble logging in to http://rt.cpan.org. Thank you for producing this module. We are experiencing an issue where Sys::Hostname::Long::hostname_long(); returns "This account is currently not available" when the system's hostname does not comtaiin a period (.), and when the user "nobody" exists with the shell of / bin/nologin. Our configuration is Fedora Core 5 Linux x86_64 with Perl 5.8.8. Following the code, it appears that the line: $hostlong = dispatcher('uname') is in fact pulling the proper hostname for our system. However, if the hostname does not contain a period (eg: is not a FQDN), the module determines that this may not be the correct hostname and looks to alternative methods. When the OS checking "if" statements fail to find Linux, it falls back on: } else { $hostlong = dispatcher('exec_hostname_fqdn'); } However, exec_hostname_fqdn (if ran as root) attempts to execute $tmp = `su nobody -c "hostname --fqdn"`; In our system (and many others), the user nobody is set in /etc/ passwd to use the shell /bin/nologin. This is where the "This account is currently not available" message comes from. So, the script is first finding the correct hostname, erroneously determining that it might not be correct, and then trying an alternative method which fails to produce the hostname, and then returns the value of the failed method, assuming that it's the best possible guess. One of our engineers J.D. Lightsey has suggested, as a fix, changing the line $tmp = `su nobody -c "hostname --fqdn"`; to specify a shell, like so: $tmp = `su nobody -s /bin/bash -c "hostname --fqdn"`; or: $tmp = `su nobody -s /bin/sh -c "hostname --fqdn"`;
I've the same problem on a RHEL 6.3 box.
Subject: Re: [rt.cpan.org #25977] "su nobody -c" is a problem where nobody's shell is /bin/nologin
Date: Fri, 07 Sep 2012 07:52:51 -0500
To: bug-Sys-Hostname-Long [...] rt.cpan.org
From: "sales [...] cpanel.net" <sam [...] cpanel.net>
Hello, Sam is no longer at cPanel. If you need to get ahold of us, please send an email to sales@cpanel.net and we will make sure it gets directed to the correct person. Thank you.
This is now also a problem in ubuntu Xenial (16.04) because in Xenial, "nobody"'s shell is now /usr/sbin/nologin vs /bin/sh in Precise, and Sys::Hostname::Long if run as root attempts to su to nobody before running "hostname --fqdn", but because of described bug, that fails. It is being patched around in the debian package: https://www.mail-archive.com/debian-bugs-closed@lists.debian.org/msg427344.html -- would it be possible to have this patch shipped in a new release to cpan? I can assist with the packaging details, if you like -- my PAUSE id is ETHER. thank you!