mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-21 13:34:59 +02:00
agree with nick: this legal-chars-in-filename stuff gets us nothing
svn:r2310
This commit is contained in:
parent
015232bd39
commit
d91cacb839
@ -344,13 +344,6 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *k
|
|||||||
|
|
||||||
tor_assert(env && keyfile);
|
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 */
|
/* open the keyfile */
|
||||||
f_pr=fopen(keyfile,"rb");
|
f_pr=fopen(keyfile,"rb");
|
||||||
if (!f_pr)
|
if (!f_pr)
|
||||||
|
@ -1507,13 +1507,6 @@ char *read_file_to_str(const char *filename) {
|
|||||||
|
|
||||||
tor_assert(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) {
|
if(stat(filename, &statbuf) < 0) {
|
||||||
log_fn(LOG_INFO,"Could not stat %s.",filename);
|
log_fn(LOG_INFO,"Could not stat %s.",filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1624,7 +1617,7 @@ int replace_file(const char *from, const char *to)
|
|||||||
#ifndef MS_WINDOWS
|
#ifndef MS_WINDOWS
|
||||||
return rename(from,to);
|
return rename(from,to);
|
||||||
#else
|
#else
|
||||||
switch(file_status(to))
|
switch(file_status(to))
|
||||||
{
|
{
|
||||||
case FN_NOENT:
|
case FN_NOENT:
|
||||||
break;
|
break;
|
||||||
|
@ -74,17 +74,6 @@ struct timeval {
|
|||||||
#define tor_close_socket(s) close(s)
|
#define tor_close_socket(s) close(s)
|
||||||
#endif
|
#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"
|
#define HEX_CHARACTERS "0123456789ABCDEFabcdef"
|
||||||
|
|
||||||
size_t strlcat(char *dst, const char *src, size_t siz);
|
size_t strlcat(char *dst, const char *src, size_t siz);
|
||||||
|
@ -28,34 +28,12 @@ typedef enum config_type_t {
|
|||||||
/** Largest allowed config line */
|
/** Largest allowed config line */
|
||||||
#define CONFIG_LINE_T_MAXLEN 4096
|
#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_commandlines(int argc, char **argv);
|
||||||
static struct config_line_t *config_get_lines(FILE *f);
|
static struct config_line_t *config_get_lines(FILE *f);
|
||||||
static void config_free_lines(struct config_line_t *front);
|
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_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);
|
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);
|
|
||||||
if (strspn(filename,CONFIG_LEGAL_FILENAME_CHARACTERS) != strlen(filename)) {
|
|
||||||
/* filename has illegal letters */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return fopen(filename, "r");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Close the configuration file */
|
|
||||||
static int config_close(FILE *f) {
|
|
||||||
tor_assert(f);
|
|
||||||
return fclose(f);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Helper: Read a list of configuration options from the command line. */
|
/** Helper: Read a list of configuration options from the command line. */
|
||||||
static struct config_line_t *config_get_commandlines(int argc, char **argv) {
|
static struct config_line_t *config_get_commandlines(int argc, char **argv) {
|
||||||
struct config_line_t *new;
|
struct config_line_t *new;
|
||||||
|
Loading…
Reference in New Issue
Block a user