In OpenOnDemand 4.0 usernames consisting of only numbers can no longer login. (this worked in 3.x) due to a new /opt/ood/mod_ood_proxy/lib/ood/user_map.lua those numeric usernames are presumed to be uid’s and the script tries to convert then to usernames which fails.
Solution was to comment out the following in the lua script:
– if tonumber(sys_user) then
– local pwd = require “posix.pwd”
– sys_user = pwd.getpwuid(tonumber(sys_user)).pw_name
– end
I’m having trouble replicating this. Mostly due to Linux systems not liking numeric only user ids. How’d you get this to work? I assume they’re all in LDAP, but is there any other PAM/nssswitch/etc configurations you provide to get numeric only ids to work?
Can you run this program against a few of your users and see if the results are what you’d expect?
-- filename: delme.lua
-- to run issue 'lua delme.lua'
function actual_username(username)
local num = tonumber(username)
if num then
local pwd = require "posix.pwd"
local data = pwd.getpwnam(num)
-- it's a numeric username
if data then
return data.pw_name
-- not a numeric username, so must be a number
else
data = pwd.getpwuid(num)
return data.pw_name
end
else
return username
end
end
--- edit these function calls with your own numeric usernames/string usernames and so on.
print(actual_username('johrstrom'))
print(actual_username(30961))
print(actual_username('30961'))
@alainvanhoof Can you run the program above against a few of your users and see if the results are what you’d expect? I’m looking to patch 4.0.1 with the same logic.
No issues on the timing, infact thank you for getting back to me quickly. The only nil here I believe is from this invocation where I believe testacc is a nil variable (i.e., not a string and not a number).
Thanks again for the report and the fix feedback. I’ll get this patched in 4.0.1 so you don’t have to continue to patch it.