Page MenuHomeFreeBSD

D61513.1794693951.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D61513.1794693951.diff

Index: libexec/nuageinit/nuage.lua
===================================================================
--- libexec/nuageinit/nuage.lua
+++ libexec/nuageinit/nuage.lua
@@ -326,7 +326,7 @@
local pwdstr = f:read("*a")
f:close()
if pwdstr:len() ~= 0 then
- return pwdstr:match("%a+:.+:%d+:%d+:.*:(.*):.*")
+ return pwdstr:match("[^:]*:[^:]*:%d+:%d+:[^:]*:([^:]*):")
end
if not pwd.gecos then
pwd.gecos = pwd.name .. " User"
Index: libexec/nuageinit/tests/adduser.lua
===================================================================
--- libexec/nuageinit/tests/adduser.lua
+++ libexec/nuageinit/tests/adduser.lua
@@ -6,7 +6,7 @@
n.err("adduser should not accept empty value")
end
if n.adduser("plop") then
- n.err("adduser should not accept empty value")
+ n.err("adduser accepted a string (not table)")
end
local pw = {}
pw.name = "impossible_username"
@@ -14,3 +14,12 @@
if not res then
n.err("valid adduser should return a path")
end
+
+pw.name = "underscore_"
+-- Call adduser twice to test both addding and looking up an existing user.
+for i = 1, 2 do
+ local res = n.adduser(pw)
+ if not res then
+ n.err("no path returned for username ending with _")
+ end
+end

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 14, 10:05 PM (6 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41731356
Default Alt Text
D61513.1794693951.diff (1 KB)

Event Timeline