mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-26 04:45:20 +01:00
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>
This commit is contained in:
parent
2add9ce722
commit
0b48e65526
1 changed files with 1 additions and 1 deletions
|
@ -709,7 +709,7 @@ import os, sys, pwd, socket
|
||||||
pw = pwd.getpwuid(os.getuid())
|
pw = pwd.getpwuid(os.getuid())
|
||||||
user = pw.pw_name
|
user = pw.pw_name
|
||||||
name = pw.pw_gecos.partition(",")[0]
|
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:
|
for l in sys.stdin:
|
||||||
if user:
|
if user:
|
||||||
|
|
Loading…
Reference in a new issue