tclserv

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ec638374e2da2afbadc50198e3fbb986bde948b7
parent 39f660a699c05e2510d424921b2695183efe8e5b
Author: Ellenor Bjornsdottir <ellenor@umbrellix.net>
Date:   Sun, 11 Dec 2022 15:21:27 +0000

so I figured out why quoteserv broke. legacy interface was being used that had been deprecated.

Diffstat:
Mcore/0000-callbacks.tcl | 7+++++--
Mcore/0004-hashing.tcl | 7++-----
Mcore/0999-conn.tcl | 1+
Mcore/2003-ts6.tcl | 4++--
Mmain.tcl | 11+++++++----
Mmodules/gateway.disabled | 2+-
Mmodules/quoteserv.tcl | 1+
Mnda.tcl | 1+
8 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/core/0000-callbacks.tcl b/core/0000-callbacks.tcl @@ -20,6 +20,7 @@ proc llbind {sock type client comd script} { if {[tnda get "llbinds/$::netname($sock)/$type/$client/[ndcenc $comd]/$llbindnum"]!=""} {} {set moretodo 0} } tnda set "llbinds/$::netname($sock)/$type/$client/[ndcenc $comd]/$llbindnum" $script + puts stdout "llbind $sock $type $client $comd $script" return $llbindnum } @@ -32,13 +33,15 @@ proc unllbindall {sock type client comd} { tnda unset "llbinds/$::netname($sock)/$type/$client/[ndcenc $comd]" } proc firellbind {sock type client comd args} { +# Warn: will be noisy +# puts stdout [cdbase get llbinds] # puts stdout "$sock $type $client $comd $args" global globuctx globctx if {$sock == "-"} {} {set globctx $::netname($sock)} set oldglobuctx $globuctx if {$client == "-"} {set globuctx ""} {set globuctx $client} - if {""!=[tnda get "llbinds/$::netname($sock)/$type/$client/[ndcenc $comd]"]} { - foreach {id script} [tnda get "llbinds/$::netname($sock)/$type/$client/[ndcenc $comd]"] { + if {""!=[cdbase get llbinds $::netname($sock) $type $client [ndcenc $comd]]} { + foreach {id script} [cdbase get llbinds $::netname($sock) $type $client [ndcenc $comd]] { if {$script != ""} { set scr [string range $script 0 120] # lappend $scr $sock diff --git a/core/0004-hashing.tcl b/core/0004-hashing.tcl @@ -1,11 +1,8 @@ #! /usr/bin/env tclsh -# Yea, another password manager. "Password--" it's called, because it's entirely stateless. -# Just takes a master password, a protocol, and a site, and spits out a password. - # # This file is part of the password-- distribution (https://github.com/xxxx or http://xxx.github.io). -# Copyright (c) 2016 Ellenor Malik, legal name "Jack Dennis Johnson". All rights reserved. +# Copyright (c) 2016 Ellenor Bjornsdottir # # This file is free software - you may distribute it under the M.I.T. license. # If included with GPL'd software, this file is instead available under the terms of @@ -28,7 +25,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -package require Expect +#package require Expect package require base64 package require aes package require sha256 diff --git a/core/0999-conn.tcl b/core/0999-conn.tcl @@ -52,6 +52,7 @@ proc mknetwork {headlines block} { tnda set "netinfo/$netname/pfxchar" $pfx } { # safe defaults, will cover charybdis and chatircd + # hey, me from the past - wouldn't this just overwrite? tnda set "netinfo/$netname/prefix" [list @ o % h + v] tnda set "netinfo/$netname/prefix" [list o @ h % v +] } diff --git a/core/2003-ts6.tcl b/core/2003-ts6.tcl @@ -450,7 +450,7 @@ proc ::ts6::irc-main {sck} { #firellbind $sck notc "-" [string tolower [lindex [split $payload " "] 0]] [lindex $comd 2] [lindex $comd 0] [join [lrange [split $payload " "] 1 end] " "] #firellmbind $sck pnotcm $client [string tolower [lindex [split $payload " "] 0]] [lindex $comd 0] [join [lrange [split $payload " "] 1 end] " "] # firellbind $sck pubnotc-m "-" [string tolower [lindex [split $payload " "] 0]] [lindex $comd 2] [lindex $comd 0] [join [lrange [split $payload " "] 1 end] " "] - #firellbind $sck "evnt" "-" "channotc" [lindex $comd 0] [lindex $comd 2] $payload + firellbind $sck "evnt" "-" "chanmsg" [lindex $comd 0] [lindex $comd 2] $payload } { set client [tnda get "intclient/$::netname($sck)/[lindex $comd 2]"] set words [split $payload " "] @@ -468,7 +468,7 @@ proc ::ts6::irc-main {sck} { } #firellbind $sck notc $client [string tolower [lindex [split $payload " "] 0]] [lindex $comd 0] [join [lrange [split $payload " "] 1 end] " "] #firellmbind $sck notcm $client [string tolower [lindex [split $payload " "] 0]] [lindex $comd 0] [join [lrange [split $payload " "] 1 end] " "] - #firellbind $sck "evnt" "-" "privnotc" [lindex $comd 0] [lindex $comd 2] $payload + firellbind $sck "evnt" "-" "privmsg" [lindex $comd 0] [lindex $comd 2] $payload } } diff --git a/main.tcl b/main.tcl @@ -7,6 +7,7 @@ package require sha1 #set b64 [split "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]" {}] source b64.tcl +set alwayssave 0 proc pwhash.SHA1 {pass {salt "a"}} { global b64 @@ -69,13 +70,15 @@ proc loadmodule {script} { proc save.db {name var no oper {apres 1}} { upvar $var db - global lastsave - if {$apres != 1 && ($lastsave + 40 > [set now [clock seconds]])} {return} ;#save CPU time by not always saving DB. integrity problems may result - # but do not save CPU time if we are apres=0 + global lastsave alwayssave + if {$alwayssave != 1 && $apres != 1 && ($lastsave + 40 > [set now [clock seconds]])} {return} ;#save IO time by not always saving DB. integrity problems may result + # but do not save CPU time if we are apres=0 or alwayssave=1 # ensure DB save is atomic, so if tclserv is killed during or under 12.5 seconds after save catch [list file rename $name [format "%s.bk%s" $name $now]] set there [open $name [list WRONLY CREAT TRUNC]] - chan configure $there -encoding utf-8 -blocking 0 -buffering full -buffersize 8192 + # I've learned from my time in qmail land - blocking I/O is probably better. + # might be even better if we can fire off a thread to do this for us. + chan configure $there -encoding utf-8 -blocking 1 -buffering full -buffersize 8192 # should not block for long puts -nonewline $there $db flush $there diff --git a/modules/gateway.disabled b/modules/gateway.disabled @@ -62,7 +62,7 @@ proc doinsecurehost {unick} { set reho [string trim $reho] if {[lindex [split $reho " "] 0] == $unick} {set result [lindex [split $reho " "] 1]} {puts stdout "gave up $rhostname $unick results /$reho/";return} # If we returned then we gave up. - if {$result!="" && $result != 0 && $result != 1} {$::maintype kill $::sock($::cs(netname)) 1444 $unick "(DNSBL::$::dname($dnsbl) match - if this is in error contact j4jackj)"} + if {$result!="" && $result != 0 && $result != 1} {$::maintype kill $::sock($::cs(netname)) 1444 $unick "(DNSBL::$::dname($dnsbl) match - if this is in error contact the opers)"} } } diff --git a/modules/quoteserv.tcl b/modules/quoteserv.tcl @@ -73,6 +73,7 @@ proc quoteserv.oneintro {headline block} { proc qs.pmdo {n i t m} { set whoarewe [tnda get "intclient/$n/$t"] + puts stdout "whoarewe $t on [curctx]" if {$whoarewe != [tnda get "quoteserv/[curctx net]/ourid"]} {return} quoteservdo $n $i 0 $m } diff --git a/nda.tcl b/nda.tcl @@ -156,6 +156,7 @@ namespace eval tnda { namespace ensemble create } +# cdbase is for interacting with the temporary DB. namespace eval cdbase { proc ::cdbase::get {args} { global tnd