You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by mx...@apache.org on 2010/07/18 18:27:55 UTC

svn commit: r965259 - in /tcl/rivet/trunk: ChangeLog VERSION configure.ac src/apache-2/mod_rivet.c

Author: mxmanghi
Date: Sun Jul 18 16:27:55 2010
New Revision: 965259

URL: http://svn.apache.org/viewvc?rev=965259&view=rev
Log:
    * src/apache-2/mod_rivet.c: static void ap_chdir_file renamed as static int Rivet_chdir_file. Rivet_chdir_file
    returns the value returned by chdir. This value is checked and in case of error the request
    aborts with an HTTP_INTERNAL_ERROR and a message is printed in the log file.
    * VERSION,configure.ac: version number changes as 2.0.1 (temporarily) 


Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/VERSION
    tcl/rivet/trunk/configure.ac
    tcl/rivet/trunk/src/apache-2/mod_rivet.c

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=965259&r1=965258&r2=965259&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Sun Jul 18 16:27:55 2010
@@ -1,3 +1,9 @@
+2010-07-18 Massimo Manghi <mx...@apache.org>
+    * src/apache-2/mod_rivet.c: static void ap_chdir_file renamed as static int Rivet_chdir_file. Rivet_chdir_file
+    returns the value returned by chdir. This value is checked and in case of error the request
+    aborts with an HTTP_INTERNAL_ERROR and a message is printed in the log file.
+    * VERSION,configure.ac: version number changes as 2.0.1 (temporarily) 
+    
 2010-07-12 Massimo Manghi <mx...@apache.org>
     * rivet/packages/calendar/calendar.tcl: new comments added. Fixed misspelled -errorinfo option
     in a return statement.

Modified: tcl/rivet/trunk/VERSION
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/VERSION?rev=965259&r1=965258&r2=965259&view=diff
==============================================================================
--- tcl/rivet/trunk/VERSION (original)
+++ tcl/rivet/trunk/VERSION Sun Jul 18 16:27:55 2010
@@ -1 +1 @@
-2.0.0
+2.0.1

Modified: tcl/rivet/trunk/configure.ac
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/configure.ac?rev=965259&r1=965258&r2=965259&view=diff
==============================================================================
--- tcl/rivet/trunk/configure.ac (original)
+++ tcl/rivet/trunk/configure.ac Sun Jul 18 16:27:55 2010
@@ -22,7 +22,7 @@ dnl
 # so you can encode the package version directly into the source files.
 #-----------------------------------------------------------------------
 
-AC_INIT([Rivet],[2.0.0])
+AC_INIT([Rivet],[2.0.1])
 TEA_INIT([3.7])
 
 AC_CONFIG_AUX_DIR(tclconfig)

Modified: tcl/rivet/trunk/src/apache-2/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/apache-2/mod_rivet.c?rev=965259&r1=965258&r2=965259&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/apache-2/mod_rivet.c Sun Jul 18 16:27:55 2010
@@ -68,35 +68,37 @@ static server_rec   *rivet_panic_server_
 
 /* rivet or tcl file */
 #define CTYPE_NOT_HANDLED   0
-#define RIVET_FILE	    1
-#define TCL_FILE	    2
+#define RIVET_FILE          1
+#define TCL_FILE            2
 
 /* rivet return codes */
 #define RIVET_OK 0
 #define RIVET_ERROR 1
-
+ 
 TCL_DECLARE_MUTEX(sendMutex);
 
 #define RIVET_FILE_CTYPE	"application/x-httpd-rivet"
 #define TCL_FILE_CTYPE		"application/x-rivet-tcl"
 
 /* This snippet of code came from the mod_ruby project, which is under a BSD license. */
-#ifdef RIVET_APACHE2 /* Apache 2.x */
 
-static void ap_chdir_file(const char *file)
+static int Rivet_chdir_file (const char *file)
 {
     const  char *x;
+    int    chdir_retval = 0;
+
     char chdir_buf[HUGE_STRING_LEN];
     x = strrchr(file, '/');
     if (x == NULL) {
-	chdir(file);
+        chdir_retval = chdir(file);
     } else if (x - file < sizeof(chdir_buf) - 1) {
-	memcpy(chdir_buf, file, x - file);
-	chdir_buf[x - file] = '\0';
-	chdir(chdir_buf);
+        memcpy(chdir_buf, file, x - file);
+        chdir_buf[x - file] = '\0';
+        chdir_retval = chdir(chdir_buf);
     }
+        
+    return chdir_retval;
 }
-#endif
 
 /* Function to be used should we desire to upload files to a variable */
 
@@ -1583,7 +1585,17 @@ Rivet_SendContent(request_rec *r)
 
     /* This one is the big catch when it comes to moving towards
        Apache 2.0, or one of them, at least. */
-    ap_chdir_file(r->filename);
+    if (Rivet_chdir_file(r->filename) < 0)
+    {
+        /* something went wrong doing chdir into r->filename, we are not specific
+        at this. We simply emit an internal server error and print a log message
+        */
+        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, APR_EGENERAL, r->server, 
+                    "Error accessing %s, could not chdir into directory", r->filename);
+
+        retval = HTTP_INTERNAL_SERVER_ERROR;
+        goto sendcleanup;
+    }
 
     //TODO: clarify whether rsc or rdc
     //Rivet_PropagatePerDirConfArrays( interp, rdc );



---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org