Skip to content

Commit 7e46a0b

Browse files
Use #nnn as default user name if no password entry for user ID which mod_wsgi-express is run as.
1 parent 8521cf3 commit 7e46a0b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/release-notes/version-4.4.17.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ Version 4.4.17 of mod_wsgi can be obtained from:
99
For details on the availability of Windows binaries see:
1010

1111
https://github.com/GrahamDumpleton/mod_wsgi/tree/master/win32
12+
13+
Bugs Fixed
14+
----------
15+
16+
1. If ``mod_wsgi-express`` was run under a user ID for which there was no
17+
password entry in the system password file, it would fail when looking up
18+
the user name. If this occurs now use ``#nnn`` as the default user name.

src/server/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ def where():
5050
return MOD_WSGI_SO
5151

5252
def default_run_user():
53-
return pwd.getpwuid(os.getuid()).pw_name
53+
try:
54+
return pwd.getpwuid(os.getuid()).pw_name
55+
except KeyError:
56+
return '#%d' % os.getuid()
5457

5558
def default_run_group():
5659
try:

0 commit comments

Comments
 (0)