Hello!
I maintain the FreeBSD port of mod_dtcl:
http://www.freebsd.org/cgi/ports.cgi?query=mod_dtcl
Here are the patches I plan to add to the port to use the 0.10.1.
Explanations preceed each patch (indented). Please, consider applying
the patches to the next release of the mod_dtcl. Thanks for the fine
software. Yours,
-mi
This is needed to compile properly without warnings.
The Tcl_MakeFileChannel's first argument must be ClientData,
NOT ClientData *. ClientData is void*, which is NOT neccessarily
the same size as int, returned by fileno(). Compiler complains.
--- mod_dtcl.c Tue May 1 11:56:01 2001
+++ mod_dtcl.c Fri Jun 1 20:29:10 2001
@@ -792 +792,6 @@
- chan = Tcl_MakeFileChannel((ClientData *)fileno(upload->fp),
TCL_READABLE);
+ union {
+ ClientData handle;
+ int fd;
+ } handle;
+ handle.fd = fileno(upload->fp);
+ chan = Tcl_MakeFileChannel(handle.handle, TCL_READABLE);
There is no index.ttml provided with this package. Make the
link point to the official site.
--- docs/examples.ttml Wed Nov 8 11:46:00 2000
+++ docs/examples.ttml Tue Feb 13 12:13:41 2001
@@ -238 +238 @@
-<a href="index.ttml">Return to the mod_dtcl homepage</a>
+<a href="http://tcl.apache.org/mod_dtcl/">Return to the mod_dtcl homepage</a>
In here I rewrite the implementation of ApacheRequest_tmpfile
to use the safe and secure mkstemp instead of tempnam.
Note, that I try to honour the tempnam's specification,
which, among other things, states, that the value of env(TMPDIR)
will be used for the directory name (if available) -- ignoring
the dirname specified. If this is not neccessary, the function can
be simplified to just construct the name once and call mkstemp.
--- apache_request.c Mon Mar 19 12:36:42 2001
+++ apache_request.c Fri Jun 1 20:36:57 2001
@@ -328,20 +328,34 @@
request_rec *r = req->r;
FILE *fp;
- char prefix[] = "apreq";
- char *name;
- int fd, tries = 100;
-
- while (--tries > 0) {
- if ( (name = tempnam(req->temp_dir, prefix)) == NULL ) continue;
- fd = ap_popenf(r->pool, name, O_CREAT|O_EXCL|O_RDWR, 0600);
- if ( fd >= 0 )
- break; /* success */
- else
+#define PREFIX "apreq"
+ char *name = NULL;
+ int fd = -1;
+ char *dirs[5], **dir;
+
+ dirs[0] = getenv("TMPDIR"); dirs[1] = req->temp_dir;
+ dirs[2] = P_tmpdir; dirs[3] = "/tmp"; dirs[4] = NULL;
+
+ /*
+ * Look for the non-NULL directory. The order
+ * above is dictated by the tempnam(3) spec
+ */
+ for (dir = dirs; *dir; dir++) /* Nothing */;
+
+ /* Now, try to create the temporary file in on of the directories: */
+ for (fd = -1; fd == -1 && *dir; dir++) {
+ name = malloc(strlen(*dir) + sizeof PREFIX + 8);
+ if (!name) {
+ ap_log_rerror(REQ_ERROR, "[libapreq] could not allocate memory");
+ return(NULL);
+ }
+ sprintf(name, "%s/%s.XXXXXX", *dir, PREFIX);
+ fd = mkstemp(name);
+ if (fd == -1)
free(name);
}
-
- if ( tries == 0 || (fp = ap_pfdopen(r->pool, fd, "w+") ) == NULL ) {
+
+ if ( fd == -1 || (fp = ap_pfdopen(r->pool, fd, "w+") ) == NULL ) {
ap_log_rerror(REQ_ERROR,
- "[libapreq] could not open temp file '%s'", name);
+ "[libapreq] could not open temp file '%s'", name);
if ( fd >= 0 ) { remove(name); free(name); }
return NULL;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]