]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Add a hostname function for systems that don't have it.
authorDarren Tucker <dtucker@dtucker.net>
Fri, 5 Feb 2021 22:37:01 +0000 (09:37 +1100)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 5 Feb 2021 22:37:01 +0000 (09:37 +1100)
Some systems don't have a hostname command (it's not required by POSIX).
The do have uname -n (which is), but as found by tim@ some others (eg
UnixWare) do not report the FQDN from uname -n.

regress/test-exec.sh

index ee47f572c464d58cd66c8c7b18592f477272cb03..db5d2f9c90c61389b4128e2583f643e8c0616d24 100644 (file)
@@ -323,6 +323,15 @@ md5 () {
                wc -c
        fi
 }
+
+# Some platforms don't have hostname at all, but on others uname -n doesn't
+# provide the fully qualified name we need, so in the former case we create
+# our own hostname function.
+if ! have_prog hostname; then
+       hostname() {
+               uname -n
+       }
+fi
 # End of portable specific functions
 
 stop_sshd ()