Comparison

mod_net_dovecotauth/mod_net_dovecotauth.lua @ 2011:1831c7b23286

mod_net_dovecotauth: Improve variable names for clarity
author Kim Alvefur <zash@zash.se>
date Fri, 15 Jan 2016 17:19:34 +0100
parent 1491:e7294423512f
child 2456:f3fc2b672df3
comparison
equal deleted inserted replaced
2010:891a5e925ae5 2011:1831c7b23286
16 local base64 = require"util.encodings".base64; 16 local base64 = require"util.encodings".base64;
17 local new_buffer = module:require"buffer".new; 17 local new_buffer = module:require"buffer".new;
18 local dump = require"util.serialization".serialize; 18 local dump = require"util.serialization".serialize;
19 19
20 -- Config 20 -- Config
21 local vhost = module:get_option_string("dovecotauth_host", (next(hosts))); -- TODO Is there a better solution? 21 local default_vhost = module:get_option_string("dovecotauth_host", (next(hosts))); -- TODO Is there a better solution?
22 local allow_master = module:get_option_boolean("dovecotauth_allow_master", false); 22 local allow_master = module:get_option_boolean("dovecotauth_allow_master", false);
23 23
24 -- Active sessions 24 -- Active sessions
25 local sessions = {}; 25 local sessions = {};
26 26
126 end 126 end
127 elseif command == "USER" and self.type == "M" then 127 elseif command == "USER" and self.type == "M" then
128 -- FIXME Should this be on a separate listener? 128 -- FIXME Should this be on a separate listener?
129 local id = part(); 129 local id = part();
130 local user = part(); 130 local user = part();
131 if user and user_exists(user, vhost) then 131 if user and user_exists(user, default_vhost) then
132 self:send("USER", id); 132 self:send("USER", id);
133 else 133 else
134 self:send("NOTFOUND", id); 134 self:send("NOTFOUND", id);
135 end 135 end
136 else 136 else
147 local listener = {} 147 local listener = {}
148 148
149 function listener.onconnect(conn) 149 function listener.onconnect(conn)
150 s = new_session(conn); 150 s = new_session(conn);
151 sessions[conn] = s; 151 sessions[conn] = s;
152 local g_sasl = new_sasl(vhost, s); 152 local g_sasl = new_sasl(default_vhost, s);
153 s.g_sasl = g_sasl; 153 s.g_sasl = g_sasl;
154 s:handshake(); 154 s:handshake();
155 end 155 end
156 156
157 function listener.onincoming(conn, data) 157 function listener.onincoming(conn, data)