diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-08-24 20:48:22 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-08-24 20:48:22 +0000 |
commit | 015232bd394367b8422b69222847e622a45b3714 (patch) | |
tree | 0c464d0e902cef4e7bab58556b86a2f0c32f3399 /src | |
parent | 4b4bfd500a1b4919f385314172ae71e0acfa79e2 (diff) | |
download | tor-015232bd394367b8422b69222847e622a45b3714.tar tor-015232bd394367b8422b69222847e622a45b3714.tar.gz |
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.
svn:r2309
Diffstat (limited to 'src')
-rw-r--r-- | src/common/crypto.c | 2 | ||||
-rw-r--r-- | src/common/util.c | 2 | ||||
-rw-r--r-- | src/common/util.h | 4 | ||||
-rw-r--r-- | src/or/config.c | 9 |
4 files changed, 15 insertions, 2 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 6a9dc348e..4339e8c75 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -344,10 +344,12 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *k 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"); diff --git a/src/common/util.c b/src/common/util.c index 43d6d41ab..e3a918c05 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1507,10 +1507,12 @@ char *read_file_to_str(const char *filename) { 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); diff --git a/src/common/util.h b/src/common/util.h index ba5319e56..f7e4cc7fa 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -74,12 +74,16 @@ struct timeval { #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" diff --git a/src/or/config.c b/src/or/config.c index 153385861..520725497 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -28,14 +28,17 @@ typedef enum config_type_t { /** Largest allowed config line */ #define CONFIG_LINE_T_MAXLEN 4096 +#if 0 static FILE *config_open(const unsigned char *filename); static int config_close(FILE *f); +#endif static struct config_line_t *config_get_commandlines(int argc, char **argv); static struct config_line_t *config_get_lines(FILE *f); static void config_free_lines(struct config_line_t *front); static int config_compare(struct config_line_t *c, const char *key, config_type_t type, void *arg); static int config_assign(or_options_t *options, struct config_line_t *list); +#if 0 /** Open a configuration file for reading */ static FILE *config_open(const unsigned char *filename) { tor_assert(filename); @@ -51,6 +54,7 @@ static int config_close(FILE *f) { tor_assert(f); return fclose(f); } +#endif /** Helper: Read a list of configuration options from the command line. */ static struct config_line_t *config_get_commandlines(int argc, char **argv) { @@ -670,9 +674,10 @@ int getconfig(int argc, char **argv, or_options_t *options) { } } } + tor_assert(fname); log(LOG_DEBUG,"Opening config file '%s'",fname); - cf = config_open(fname); + cf = fopen(fname, "r"); if(!cf) { if(using_default_torrc == 1) { log(LOG_NOTICE, "Configuration file '%s' not present, using reasonable defaults.",fname); @@ -692,7 +697,7 @@ int getconfig(int argc, char **argv, or_options_t *options) { if(config_assign(options,cl) < 0) return -1; config_free_lines(cl); - config_close(cf); + fclose(cf); } /* go through command-line variables too */ |