diff --git a/addon/etc/rmupdate-addon.cfg b/addon/etc/rmupdate-addon.cfg index cde4aa0..f456c31 100644 --- a/addon/etc/rmupdate-addon.cfg +++ b/addon/etc/rmupdate-addon.cfg @@ -1,5 +1,5 @@ { - CONFIG_URL /addons/rmupdate + CONFIG_URL /addons/rmupdate/index.cgi CONFIG_DESCRIPTION { de {
  • System-Update
  • } en {
  • System-update
  • } diff --git a/addon/lib/querystring.tcl b/addon/lib/querystring.tcl new file mode 100644 index 0000000..bd1f01f --- /dev/null +++ b/addon/lib/querystring.tcl @@ -0,0 +1,9 @@ +catch { + set input $env(QUERY_STRING) + set pairs [split $input &] + foreach pair $pairs { + if {0 != [regexp "^(\[^=]*)=(.*)$" $pair dummy varname val]} { + set $varname $val + } + } +} diff --git a/addon/lib/session.tcl b/addon/lib/session.tcl new file mode 100644 index 0000000..eb183a6 --- /dev/null +++ b/addon/lib/session.tcl @@ -0,0 +1,13 @@ +#!/bin/tclsh + +load tclrega.so + +proc check_session sid { + if {[regexp {@([0-9a-zA-Z]{10})@} $sid all sidnr]} { + set res [lindex [rega_script "Write(system.GetSessionVarStr('$sidnr'));"] 1] + if {$res != ""} { + return 1 + } + } + return 0 +} diff --git a/addon/www/index.cgi b/addon/www/index.cgi new file mode 100644 index 0000000..92bdf32 --- /dev/null +++ b/addon/www/index.cgi @@ -0,0 +1,12 @@ +#!/bin/tclsh + +source /usr/local/addons/rmupdate/lib/querystring.tcl +source /usr/local/addons/rmupdate/lib/session.tcl + +if {[info exists sid] && [check_session $sid]} { + set fp [open "/usr/local/addons/rmupdate/www/rmupdate.html" r] + puts -nonewline [read $fp] + close $fp +} else { + puts {error: invalid session} +} diff --git a/addon/www/index.html b/addon/www/rmupdate.html similarity index 100% rename from addon/www/index.html rename to addon/www/rmupdate.html