aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib.sh
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2021-05-01 06:54:13 -0500
committerDavid Bremner <david@tethera.net>2021-05-01 21:14:37 -0300
commit0b48e65526fc1850949b5068a2536a4f46886197 (patch)
tree3e16e89ac705fa926ca5d282b711a132966390c7 /test/test-lib.sh
parent2add9ce7229abbc2b07417a4c97d2eccee40d731 (diff)
test: use correct fqdn in passwd_sanitize()
My fqdn is 'natae.localdomain', however, socket.getfqdn() returns 'localhost'. To fetch the true fqdn we need socket.getaddrinfo(). For more information see: https://stackoverflow.com/a/11580042/10474 Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Diffstat (limited to 'test/test-lib.sh')
-rw-r--r--test/test-lib.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index ae653363..21dda265 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -709,7 +709,7 @@ import os, sys, pwd, socket
pw = pwd.getpwuid(os.getuid())
user = pw.pw_name
name = pw.pw_gecos.partition(",")[0]
-fqdn = socket.getfqdn()
+fqdn = socket.getaddrinfo(socket.gethostname(), 0, 0, socket.SOCK_STREAM, 0, socket.AI_CANONNAME)[0][3]
for l in sys.stdin:
if user: