Re: [AOLSERVER] Fix for ns_tmpnam under Windows
fixed. -gustaf neumann Titi Alailima schrieb: There is a missing variable declaration in this patch for i, the for-loop index. Anyone want to make this fix and commit it? -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Fix for ns_tmpnam under Windows
There is a missing variable declaration in this patch for i, the for-loop index. Anyone want to make this fix and commit it? Titi Ala'ilima Lead Architect MedTouch LLC 1100 Massachusetts Avenue Cambridge, MA 02138 617.621.8670 x309 -Original Message- From: AOLserver Discussion [mailto:[EMAIL PROTECTED] On Behalf Of Gustaf Neumann Sent: Thursday, April 24, 2008 3:33 AM To: AOLSERVER@LISTSERV.AOL.COM Subject: [AOLSERVER] Fix for ns_tmpnam under Windows Dear AOLserver community There was a problem with ns_tmpnam, when the aolserver was compiled under windows (esp. Vista). The Tcl commandns_tmpnam is implemented in C using tmpnam(), which exists under WIN32, but behaves differently as on unix counterparts and is practically unusable. The problem is that tmnam() under Windows generates a filename for the root directory of the actual drive (at least under Vista, no permissions under normal conditions) and ignores the TMP environment variable. See some background info form Microsoft: http://msdn2.microsoft.com/en-us/library/hs3e7355(VS.80).aspx I have commited a patch to CVS head to address this problem. http://aolserver.cvs.sourceforge.net/aolserver/aolserver/nsd/tclfile.c? r1=1.25r2=1.26 The patch is local and documents the intended behavior and background in detail. Please crosscheck. best regards -gustaf neumann -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Fix for ns_tmpnam under Windows
Dear Titi, The proper version of the file, properly compiled and tested is the one attached to this email message. Hope it helps, Maurizio -Original Message- From: AOLserver Discussion [mailto:[EMAIL PROTECTED] On Behalf Of Titi Alailima Sent: 05 May 2008 19:03 To: AOLSERVER@LISTSERV.AOL.COM Subject: Re: [AOLSERVER] Fix for ns_tmpnam under Windows There is a missing variable declaration in this patch for i, the for-loop index. Anyone want to make this fix and commit it? Titi Ala'ilima Lead Architect MedTouch LLC 1100 Massachusetts Avenue Cambridge, MA 02138 617.621.8670 x309 -Original Message- From: AOLserver Discussion [mailto:[EMAIL PROTECTED] On Behalf Of Gustaf Neumann Sent: Thursday, April 24, 2008 3:33 AM To: AOLSERVER@LISTSERV.AOL.COM Subject: [AOLSERVER] Fix for ns_tmpnam under Windows Dear AOLserver community There was a problem with ns_tmpnam, when the aolserver was compiled under windows (esp. Vista). The Tcl commandns_tmpnam is implemented in C using tmpnam(), which exists under WIN32, but behaves differently as on unix counterparts and is practically unusable. The problem is that tmnam() under Windows generates a filename for the root directory of the actual drive (at least under Vista, no permissions under normal conditions) and ignores the TMP environment variable. See some background info form Microsoft: http://msdn2.microsoft.com/en-us/library/hs3e7355(VS.80).aspx I have commited a patch to CVS head to address this problem. http://aolserver.cvs.sourceforge.net/aolserver/aolserver/nsd/tclfile.c? r1=1.25r2=1.26 The patch is local and documents the intended behavior and background in detail. Please crosscheck. best regards -gustaf neumann -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. /* * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the License); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://aolserver.com/. * * Software distributed under the License is distributed on an AS IS * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is AOLserver Code and related documentation * distributed by AOL. * * The Initial Developer of the Original Code is America Online, * Inc. Portions created by AOL are Copyright (C) 1999 America Online, * Inc. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms * of the GNU General Public License (the GPL), in which case the * provisions of GPL are applicable instead of those above. If you wish * to allow use of your version of this file only under the terms of the * GPL and not to allow others to use your version of this file under the * License, indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the GPL. * If you do not delete the provisions above, a recipient may use your * version of this file under either the License or the GPL. */ /* * tclfile.c -- * * Tcl commands that do stuff to the filesystem. */ static const char *RCSID = @(#) $Header: /cvsroot/aolserver/aolserver/nsd/tclfile.c,v 1.24 2005/08/23 21:41:31 jgdavidson Exp $, compiled: __DATE__ __TIME__; #include nsd.h #ifdef _WIN32 #include sys/utime.h #else #include utime.h #endif /* * Structure handling one registered channel for the [ns_chan] command */ typedef struct _NsRegChan { char *name; Tcl_Channel chan; } NsRegChan; static void SpliceChannel(Tcl_Interp *interp, Tcl_Channel chan); static void UnspliceChannel(Tcl_Interp *interp, Tcl_Channel chan); /* *-- * * Ns_TclGetOpenChannel -- * * Return an open channel with an interface similar to the * pre-Tcl7.5 Tcl_GetOpenFile, used throughout AOLserver. * * Results: * TCL_OK or TCL_ERROR. * * Side effects: * The value at chanPtr is updated with a valid open Tcl_Channel. * *-- */ static int GetOpenChannel(Tcl_Interp *interp, Tcl_Obj *obj, int write, int check
Re: [AOLSERVER] Fix for ns_tmpnam under Windows
After Gustaf updated this for WIN32, I started looking at some old problems with temp files. I noticed that Tcl core has some internal API for this (temporary files are used for buffering pipe I/O), which might be able to be used. The core code also handles file systems which have wide char (I think for the filenames), and I think it handles end of line conversions, etc. Not sure how important this is. Another issue is that [ns_form] and [ns_conn form] have some security issues related to temporary files. These can't be fixed without changing the API, but it might be worth keeping in mind. Any security fix will probably have to use new api such as: ns_mkstemp templateVar Example: set template /path/to/secure/dir/myfileXX set fp [ns_mkstemp template] ;# template var is updated file delete $template ;#(same as ns_unlink $template) # Use fp to write/read, fp is opened exclusively. # When $fp is closed file will go away. # If nsd crashes, the file also goes away. The file is actually 'unlinked' prior to use, so there is no way to access it, or even list it from the filesystem. tom jackson On Monday 05 May 2008 10:02, Titi Alailima wrote: There is a missing variable declaration in this patch for i, the for-loop index. Anyone want to make this fix and commit it? Titi Ala'ilima Lead Architect MedTouch LLC 1100 Massachusetts Avenue Cambridge, MA 02138 617.621.8670 x309 -Original Message- From: AOLserver Discussion [mailto:[EMAIL PROTECTED] On Behalf Of Gustaf Neumann Sent: Thursday, April 24, 2008 3:33 AM To: AOLSERVER@LISTSERV.AOL.COM Subject: [AOLSERVER] Fix for ns_tmpnam under Windows Dear AOLserver community There was a problem with ns_tmpnam, when the aolserver was compiled under windows (esp. Vista). The Tcl commandns_tmpnam is implemented in C using tmpnam(), which exists under WIN32, but behaves differently as on unix counterparts and is practically unusable. The problem is that tmnam() under Windows generates a filename for the root directory of the actual drive (at least under Vista, no permissions under normal conditions) and ignores the TMP environment variable. See some background info form Microsoft: http://msdn2.microsoft.com/en-us/library/hs3e7355(VS.80).aspx I have commited a patch to CVS head to address this problem. http://aolserver.cvs.sourceforge.net/aolserver/aolserver/nsd/tclfile.c? r1=1.25r2=1.26 The patch is local and documents the intended behavior and background in detail. Please crosscheck. best regards -gustaf neumann -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Fix for ns_tmpnam under Windows
On 2008.04.24, Gustaf Neumann [EMAIL PROTECTED] wrote: I have commited a patch to CVS head to address this problem. http://aolserver.cvs.sourceforge.net/aolserver/aolserver/nsd/tclfile.c?r1=1.25r2=1.26 The patch is local and documents the intended behavior and background in detail. Please crosscheck. Looks good, Gustaf. Thanks for the fix! -- Dossy Shiobara | [EMAIL PROTECTED] | http://dossy.org/ Panoptic Computer Network | http://panoptic.com/ He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on. (p. 70) -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.
Re: [AOLSERVER] Fix for ns_tmpnam under Windows
Isn't there a new safe version of these functions? The link to msdn also suggests that the replacements are depricated. In general, I think that the directory where the temp file is created should not be world writable. Some while back there was a suggestion to replace the C function with a safe version. I'll try to find this old info. tom jackson On Thursday 24 April 2008 00:32, Gustaf Neumann wrote: Dear AOLserver community There was a problem with ns_tmpnam, when the aolserver was compiled under windows (esp. Vista). The Tcl commandns_tmpnam is implemented in C using tmpnam(), which exists under WIN32, but behaves differently as on unix counterparts and is practically unusable. The problem is that tmnam() under Windows generates a filename for the root directory of the actual drive (at least under Vista, no permissions under normal conditions) and ignores the TMP environment variable. See some background info form Microsoft: http://msdn2.microsoft.com/en-us/library/hs3e7355(VS.80).aspx I have commited a patch to CVS head to address this problem. http://aolserver.cvs.sourceforge.net/aolserver/aolserver/nsd/tclfile.c?r1=1 .25r2=1.26 The patch is local and documents the intended behavior and background in detail. Please crosscheck. best regards -gustaf neumann -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] with the body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: field of your email blank.