Hi everybody I made some minor changes to some files in Rivet. Here is a short description of my work
* The target 'uninstall-local' has been added to Makefile.am and removes althogheter the tcl code installed by Rivet. * In both mod_rivet.c the call to Tcl_EvalFile is now checked explicitly against the TCL_ERROR code. * dio_Mysql.tcl has been fixed in 2 methods: the switch '-host' was not handled in the 'open' method. The method 'exec' does determine now if the command is a 'select' by explicit comparison with a literal string. Though I can't recall exactly in what circumstances it happened to me the previous code failed because 'lindex $req 0' returned a string with spaces in it (probably builing queries using lists). I can't commit these changes immediately, but I'm confident I will able to it in a few days. More things to do: Do we intend to keep the server array? It is created in mod_rivet.c but it's not documented, and its variables have wrong definitions in them. If a purpose can be given to this array I can fix it and document it, otherwise the code can be removed (or compiled conditionally). I'm working to a small and simple implementation of the algorithm in rivetCrypt written in Javascript. My idea is to put it in the examples as a simple application to conceal from possible automatic scanning email addresses or other data that have to be shown on a web page. regards -- Massimo Index: Makefile.am =================================================================== --- Makefile.am (revision 604427) +++ Makefile.am (working copy) @@ -1,11 +1,11 @@ # -# top-level Makefile.am for Apache Rivet +# top-level Makefile.am for Apache Rivet: gets turned into a Makefile.in by automake # -# ...gets turned into a Makefile.in by automake -# # $Id$ # -#foreign -- need to set this somehow +# 2007/12/25: Added target uninistall-local that removes the tcl stuff (mxmanghi) +# +# EXTRA_DIST=LICENSE contrib debian doc rivet win/nmakehlp.c src/testing.c src/TclWebcgi.c SUBDIRS = src doc @@ -19,7 +19,7 @@ cp -r rivet/* $(RIVETLIB_DESTDIR) -( cd $(RIVETLIB_DESTDIR) ; echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join *[info sharedlibextension]]]' | @TCLSH_PROG@ ; ) -# $(mkinstalldirs) $(DESTDIR)@libdir@/[EMAIL PROTECTED]@ -# cp -r rivet/* $(DESTDIR)@libdir@/[EMAIL PROTECTED]@ -# This little bit of line noise generates the package index file (pkgIndex.tcl) -# -( cd $(DESTDIR)@libdir@/[EMAIL PROTECTED]@ ; echo 'eval pkg_mkIndex -verbose [pwd] init.tcl [glob [file join packages * *.tcl] [file join *[info sharedlibextension]]]' | @TCLSH_PROG@ ; ) +uninstall-local: + rm -fr $(RIVETLIB_DESTDIR) + +# Index: src/apache-2/mod_rivet.c =================================================================== --- src/apache-2/mod_rivet.c (revision 604427) +++ src/apache-2/mod_rivet.c (working copy) @@ -845,11 +845,11 @@ /* Eval Rivet's init.tcl file to load in the Tcl-level commands. */ - /* We want to run the init.tcl specific to the installation + /* We want to run the installation specific 'init.tcl' */ - if (Tcl_EvalFile(interp,RIVETLIB_DESTDIR"/init.tcl")) { // if (Tcl_PkgRequire(interp, "RivetTcl", "1.1", 1) == NULL) { + if (Tcl_EvalFile(interp,RIVETLIB_DESTDIR"/init.tcl") == TCL_ERROR) { ap_log_error( APLOG_MARK, APLOG_ERR, APR_EGENERAL, s, "init.tcl must be installed correctly for Apache Rivet to function: %s", Tcl_GetStringResult(interp) ); Index: src/apache-1/mod_rivet.c =================================================================== --- src/apache-1/mod_rivet.c (revision 604427) +++ src/apache-1/mod_rivet.c (working copy) @@ -200,8 +200,9 @@ delEntry = Tcl_FindHashEntry( rsc->objCache, rsc->objCacheList[ct]); - if (delEntry != NULL) + if (delEntry != NULL) { Tcl_DecrRefCount((Tcl_Obj *)Tcl_GetHashValue(delEntry)); + } Tcl_DeleteHashEntry(delEntry); free(rsc->objCacheList[ct]); @@ -705,14 +706,13 @@ /* Eval Rivet's init.tcl file to load in the Tcl-level commands. */ - /* We want to run the init.tcl specific to the installation - * that is being carried out + /* We want to run the installation specific 'init.tcl' */ Tcl_EvalFile(interp,RIVETLIB_DESTDIR"/init.tcl"); - if (Tcl_EvalFile(interp,RIVETLIB_DESTDIR"/init.tcl")) { // if (Tcl_PkgRequire(interp, "RivetTcl", "1.1", 1) == NULL) { + if (Tcl_EvalFile(interp,RIVETLIB_DESTDIR"/init.tcl") == TCL_ERROR) { ap_log_error( APLOG_MARK, APLOG_ERR, s, "init.tcl must be installed correctly for Apache Rivet to function: %s", Tcl_GetStringResult(interp) ); @@ -752,7 +752,7 @@ char *buf; char *format; - format = TCL_VARARGS_START(char *,arg1,argList); + format = (char *)TCL_VARARGS_START(char *,arg1,argList); buf = ap_pvsprintf(globalrr->pool, format, argList); ap_log_error(APLOG_MARK, APLOG_CRIT, globalrr->server, "Critical error in request: %s", globalrr->unparsed_uri); Index: rivet/packages/dio/dio_Mysql.tcl =================================================================== --- rivet/packages/dio/dio_Mysql.tcl (revision 604427) +++ rivet/packages/dio/dio_Mysql.tcl (working copy) @@ -16,7 +16,7 @@ # $Id$ -package provide dio_Mysql 0.1 +package provide dio_Mysql 0.2 namespace eval DIO { ::itcl::class Mysql { @@ -49,7 +49,7 @@ if {![lempty $user]} { lappend command -user $user } if {![lempty $pass]} { lappend command -password $pass } if {![lempty $port]} { lappend command -port $port } - if {![lempty $host]} { lappend command $host } + if {![lempty $host]} { lappend command -host $host } if {[catch $command error]} { return -code error $error } @@ -68,7 +68,14 @@ if {![info exists conn]} { open } set cmd mysqlexec - if {[::string tolower [lindex $req 0]] == "select"} { set cmd mysqlsel } +# +# if {[::string tolower [lindex $req 0]] == "select"} { set cmd mysqlsel } +# select is a 6 characters word, so let's see if the query is a select +# + set q [::string trim $req] + set q [::string tolower $q] + set q [::string range $q 0 5] + if {[::string match select $q]} { set cmd mysqlsel } set errorinfo "" if {[catch {$cmd $conn $req} error]} { -- Universita' degli Studi di Parma (http://www.unipr.it) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]