Software /
code /
prosody
Comparison
util/prosodyctl.lua @ 10367:649acbfbf7fe
util.prosodyctl: Enforce strict JID validation on user creation
This is where 64ddcbc9a328 should have started. By preventing creation
of users with invalid JIDs, it will slowly become safer to enforce
strict validation on everything.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 Nov 2019 22:53:14 +0100 (2019-11-01) |
parent | 10209:e6ba8bb91905 |
child | 10536:a469d2bcea96 |
comparison
equal
deleted
inserted
replaced
10366:5611c939743a | 10367:649acbfbf7fe |
---|---|
132 return (line and #line > 0) and line or nil; | 132 return (line and #line > 0) and line or nil; |
133 end | 133 end |
134 | 134 |
135 -- Server control | 135 -- Server control |
136 local function adduser(params) | 136 local function adduser(params) |
137 local user, host, password = nodeprep(params.user), nameprep(params.host), params.password; | 137 local user, host, password = nodeprep(params.user, true), nameprep(params.host), params.password; |
138 if not user then | 138 if not user then |
139 return false, "invalid-username"; | 139 return false, "invalid-username"; |
140 elseif not host then | 140 elseif not host then |
141 return false, "invalid-hostname"; | 141 return false, "invalid-hostname"; |
142 end | 142 end |