variable options
upvar #0 $Channel channel
switch -exact -- $command {
+ login { return [lindex $args 0] }
+ username { return [lindex $args 0] }
password {
- #Log debug "SASL retrieve password for authid [lindex $args 0] '$args'"
+ Log debug "SASL retrieve password for authid [lindex $args 0] '$args'"
set channel(jid) [lindex $args 0]@[cget -domain]
return [eval [linsert $args 0 [cget -s2c:authenticate]]]
}
Close $Channel
}
+proc ::xmppd::s2c::OnTlsImport {cmd args} {
+ switch -exact -- $cmd {
+ info {
+ lassign $args chan major minor msg
+ Log debug "tls import $chan $major $minor \"$msg\""
+ }
+ verify {
+ lassign $args chan depth cert status err
+ Log debug "tls import verify: $chan $depth $cert $status $err"
+ return 1; # cert is valid
+ }
+ }
+}
+
proc ::xmppd::s2c::OnInput {Channel xmllist} {
variable options
upvar #0 $Channel channel
WriteTo $Channel $xml
flush $channel(sock)
wrapper::reset $channel(parser)
- tls::import $channel(sock) -server 1 -tls1 1 -ssl3 1 -ssl2 0 \
- -keyfile [cget -keyfile] -certfile [cget -certfile]
+ tls::import $channel(sock) \
+ -server 1 \
+ -command [list [namespace current]::OnTlsImport] \
+ -cadir [cget -cadir] \
+ -cafile "" \
+ -keyfile [cget -keyfile] \
+ -certfile [cget -certfile]
}
}
Log debug "Routing calling local handler"
CallHandler $Channel $xmllist
} else {
- Log debug "Routing route $from $to"
+ Log debug "Routing route '$from' '$to'"
xmppd::route $from $to [wrapper::createxml $xmllist]
}
}