[or-cvs] As far as I can tell, CONFIG_LEGAL_FILENAME_CHARACTERS is b...

Nick Mathewson nickm at seul.org
Tue Aug 24 20:48:25 UTC 2004


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv5084/src/common

Modified Files:
	crypto.c util.c util.h 
Log Message:
As far as I can tell, CONFIG_LEGAL_FILENAME_CHARACTERS is both pointless and broken.  #if it out, pending agreement from arma.  This fixes a bug on win32 that rejected paths with a : in them.

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- crypto.c	22 Jul 2004 21:41:50 -0000	1.100
+++ crypto.c	24 Aug 2004 20:48:22 -0000	1.101
@@ -344,10 +344,12 @@
 
   tor_assert(env && keyfile);
 
+#if 0
   if(strspn(keyfile,CONFIG_LEGAL_FILENAME_CHARACTERS) != strlen(keyfile)) {
     /* filename contains nonlegal characters */
     return -1;
   }
+#endif
 
   /* open the keyfile */
   f_pr=fopen(keyfile,"rb");

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- util.c	17 Aug 2004 21:06:36 -0000	1.126
+++ util.c	24 Aug 2004 20:48:22 -0000	1.127
@@ -1507,10 +1507,12 @@
 
   tor_assert(filename);
 
+#if 0
   if(strcspn(filename,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0) {
     log_fn(LOG_WARN,"Filename %s contains illegal characters.",filename);
     return NULL;
   }
+#endif
 
   if(stat(filename, &statbuf) < 0) {
     log_fn(LOG_INFO,"Could not stat %s.",filename);

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/src/common/util.h,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- util.h	19 Aug 2004 17:21:17 -0000	1.85
+++ util.h	24 Aug 2004 20:48:22 -0000	1.86
@@ -74,12 +74,16 @@
 #define tor_close_socket(s) close(s)
 #endif
 
+#if 0
+/* XXXX Remove this -- These lists are incomplete, and detecting bad filenames
+ * is the OS's job. -NM */
 /** Legal characters in a filename */
 #ifdef MS_WINDOWS
 #define CONFIG_LEGAL_FILENAME_CHARACTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_/\\ "
 #else
 #define CONFIG_LEGAL_FILENAME_CHARACTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_/ "
 #endif
+#endif
 
 #define HEX_CHARACTERS "0123456789ABCDEFabcdef"
 



More information about the tor-commits mailing list