mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
change WARNING to WARN
svn:r570
This commit is contained in:
parent
ecfb36823e
commit
36fb8e839d
@ -211,17 +211,17 @@ crypto_create_init_cipher(int cipher_type, char *key, char *iv, int encrypt_mode
|
||||
crypto_cipher_env_t *crypto = NULL;
|
||||
|
||||
if (! (crypto = crypto_new_cipher_env(cipher_type))) {
|
||||
log_fn(LOG_WARNING, "Unable to allocate crypto object");
|
||||
log_fn(LOG_WARN, "Unable to allocate crypto object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (crypto_cipher_set_key(crypto, key)) {
|
||||
log_fn(LOG_WARNING, "Unable to set key: %s", crypto_perror());
|
||||
log_fn(LOG_WARN, "Unable to set key: %s", crypto_perror());
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (crypto_cipher_set_iv(crypto, iv)) {
|
||||
log_fn(LOG_WARNING, "Unable to set iv: %s", crypto_perror());
|
||||
log_fn(LOG_WARN, "Unable to set iv: %s", crypto_perror());
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ crypto_create_init_cipher(int cipher_type, char *key, char *iv, int encrypt_mode
|
||||
r = crypto_cipher_decrypt_init_cipher(crypto);
|
||||
|
||||
if (r) {
|
||||
log_fn(LOG_WARNING, "Unable to initialize cipher: %s", crypto_perror());
|
||||
log_fn(LOG_WARN, "Unable to initialize cipher: %s", crypto_perror());
|
||||
goto error;
|
||||
}
|
||||
return crypto;
|
||||
@ -367,7 +367,7 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *k
|
||||
|
||||
/* read the private key */
|
||||
if(crypto_pk_read_private_key_from_file(env, f_pr) < 0) {
|
||||
log_fn(LOG_WARNING,"Error reading private key : %s",crypto_perror());
|
||||
log_fn(LOG_WARN,"Error reading private key : %s",crypto_perror());
|
||||
fclose(f_pr);
|
||||
return -1;
|
||||
}
|
||||
@ -376,10 +376,10 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *k
|
||||
/* check the private key */
|
||||
switch(crypto_pk_check_key(env)) {
|
||||
case 0:
|
||||
log_fn(LOG_WARNING,"Private key read but is invalid : %s.", crypto_perror());
|
||||
log_fn(LOG_WARN,"Private key read but is invalid : %s.", crypto_perror());
|
||||
return -1;
|
||||
case -1:
|
||||
log_fn(LOG_WARNING,"Private key read but validity checking failed : %s",crypto_perror());
|
||||
log_fn(LOG_WARN,"Private key read but validity checking failed : %s",crypto_perror());
|
||||
return -1;
|
||||
/* case 1: fall through */
|
||||
}
|
||||
@ -982,14 +982,14 @@ int crypto_seed_rng()
|
||||
n = fread(buf, 1, 20, f);
|
||||
fclose(f);
|
||||
if (n != 20) {
|
||||
log_fn(LOG_WARNING, "Error reading from entropy source");
|
||||
log_fn(LOG_WARN, "Error reading from entropy source");
|
||||
return -1;
|
||||
}
|
||||
RAND_seed(buf, 20);
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_fn(LOG_WARNING, "Cannot seed RNG -- no entropy source found.");
|
||||
log_fn(LOG_WARN, "Cannot seed RNG -- no entropy source found.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ static INLINE const char *sev_to_string(int severity) {
|
||||
switch(severity) {
|
||||
case LOG_DEBUG: return "debug";
|
||||
case LOG_INFO: return "info";
|
||||
case LOG_WARNING: return "warn";
|
||||
case LOG_WARN: return "warn";
|
||||
case LOG_ERR: return "err";
|
||||
default: assert(0); return "UNKNOWN";
|
||||
}
|
||||
|
@ -9,15 +9,12 @@
|
||||
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
#include <syslog.h>
|
||||
#define LOG_WARN LOG_WARNING
|
||||
#else
|
||||
#define LOG_DEBUG 0
|
||||
#define LOG_INFO 1
|
||||
#define LOG_NOTICE 2
|
||||
#define LOG_WARNING 3
|
||||
#define LOG_WARN 3
|
||||
#define LOG_ERR 4
|
||||
#define LOG_CRIT 5
|
||||
#define LOG_ALERT 6
|
||||
#define LOG_EMERG 7
|
||||
#endif
|
||||
|
||||
/* magic to make GCC check for proper format strings. */
|
||||
|
@ -215,7 +215,7 @@ tor_tls_context_new(crypto_pk_env_t *rsa,
|
||||
if (rsa) {
|
||||
cert = tor_tls_create_certificate(rsa, nickname);
|
||||
if (!cert) {
|
||||
log(LOG_WARNING, "Error creating certificate");
|
||||
log(LOG_WARN, "Error creating certificate");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -415,7 +415,7 @@ tor_tls_shutdown(tor_tls *tls)
|
||||
*/
|
||||
if (tls->state == TOR_TLS_ST_GOTCLOSE ||
|
||||
tls->state == TOR_TLS_ST_SENTCLOSE) {
|
||||
log(LOG_WARNING,
|
||||
log(LOG_WARN,
|
||||
"TLS returned \"half-closed\" value while already half-closed");
|
||||
return TOR_TLS_ERROR;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ tv_udiff(struct timeval *start, struct timeval *end)
|
||||
long secdiff = end->tv_sec - start->tv_sec;
|
||||
|
||||
if (secdiff+1 > LONG_MAX/1000000) {
|
||||
log_fn(LOG_WARNING, "comparing times too far apart.");
|
||||
log_fn(LOG_WARN, "comparing times too far apart.");
|
||||
return LONG_MAX;
|
||||
}
|
||||
|
||||
@ -335,17 +335,17 @@ int check_private_dir(const char *dirname, int create)
|
||||
struct stat st;
|
||||
if (stat(dirname, &st)) {
|
||||
if (errno != ENOENT) {
|
||||
log(LOG_WARNING, "Directory %s cannot be read: %s", dirname,
|
||||
log(LOG_WARN, "Directory %s cannot be read: %s", dirname,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (!create) {
|
||||
log(LOG_WARNING, "Directory %s does not exist.", dirname);
|
||||
log(LOG_WARN, "Directory %s does not exist.", dirname);
|
||||
return -1;
|
||||
}
|
||||
log(LOG_INFO, "Creating directory %s", dirname);
|
||||
if (mkdir(dirname, 0700)) {
|
||||
log(LOG_WARNING, "Error creating directory %s: %s", dirname,
|
||||
log(LOG_WARN, "Error creating directory %s: %s", dirname,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
} else {
|
||||
@ -353,17 +353,17 @@ int check_private_dir(const char *dirname, int create)
|
||||
}
|
||||
}
|
||||
if (!(st.st_mode & S_IFDIR)) {
|
||||
log(LOG_WARNING, "%s is not a directory", dirname);
|
||||
log(LOG_WARN, "%s is not a directory", dirname);
|
||||
return -1;
|
||||
}
|
||||
if (st.st_uid != getuid()) {
|
||||
log(LOG_WARNING, "%s is not owned by this UID (%d)", dirname, getuid());
|
||||
log(LOG_WARN, "%s is not owned by this UID (%d)", dirname, getuid());
|
||||
return -1;
|
||||
}
|
||||
if (st.st_mode & 0077) {
|
||||
log(LOG_WARNING, "Fixing permissions on directory %s", dirname);
|
||||
log(LOG_WARN, "Fixing permissions on directory %s", dirname);
|
||||
if (chmod(dirname, 0700)) {
|
||||
log(LOG_WARNING, "Could not chmod directory %s: %s", dirname,
|
||||
log(LOG_WARN, "Could not chmod directory %s: %s", dirname,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
} else {
|
||||
@ -380,28 +380,28 @@ write_str_to_file(const char *fname, const char *str)
|
||||
int fd;
|
||||
FILE *file;
|
||||
if (strlen(fname) > 1000) {
|
||||
log(LOG_WARNING, "Filename %s is too long.", fname);
|
||||
log(LOG_WARN, "Filename %s is too long.", fname);
|
||||
return -1;
|
||||
}
|
||||
strcpy(tempname,fname);
|
||||
strcat(tempname,".tmp");
|
||||
if ((fd = open(tempname, O_WRONLY|O_CREAT|O_TRUNC, 0600)) < 0) {
|
||||
log(LOG_WARNING, "Couldn't open %s for writing: %s", tempname,
|
||||
log(LOG_WARN, "Couldn't open %s for writing: %s", tempname,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (!(file = fdopen(fd, "w"))) {
|
||||
log(LOG_WARNING, "Couldn't fdopen %s for writing: %s", tempname,
|
||||
log(LOG_WARN, "Couldn't fdopen %s for writing: %s", tempname,
|
||||
strerror(errno));
|
||||
close(fd); return -1;
|
||||
}
|
||||
if (fputs(str,file) == EOF) {
|
||||
log(LOG_WARNING, "Error writing to %s: %s", tempname, strerror(errno));
|
||||
log(LOG_WARN, "Error writing to %s: %s", tempname, strerror(errno));
|
||||
fclose(file); return -1;
|
||||
}
|
||||
fclose(file);
|
||||
if (rename(tempname, fname)) {
|
||||
log(LOG_WARNING, "Error replacing %s: %s", fname, strerror(errno));
|
||||
log(LOG_WARN, "Error replacing %s: %s", fname, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -415,7 +415,7 @@ char *read_file_to_str(const char *filename) {
|
||||
assert(filename);
|
||||
|
||||
if(strcspn(filename,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0) {
|
||||
log_fn(LOG_WARNING,"Filename %s contains illegal characters.",filename);
|
||||
log_fn(LOG_WARN,"Filename %s contains illegal characters.",filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -426,14 +426,14 @@ char *read_file_to_str(const char *filename) {
|
||||
|
||||
fd = open(filename,O_RDONLY,0);
|
||||
if (fd<0) {
|
||||
log_fn(LOG_WARNING,"Could not open %s.",filename);
|
||||
log_fn(LOG_WARN,"Could not open %s.",filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string = tor_malloc(statbuf.st_size+1);
|
||||
|
||||
if(read_all(fd,string,statbuf.st_size) != statbuf.st_size) {
|
||||
log_fn(LOG_WARNING,"Couldn't read all %ld bytes of file '%s'.",
|
||||
log_fn(LOG_WARN,"Couldn't read all %ld bytes of file '%s'.",
|
||||
(long)statbuf.st_size,filename);
|
||||
free(string);
|
||||
close(fd);
|
||||
@ -485,7 +485,7 @@ try_next_line:
|
||||
value++;
|
||||
|
||||
if(!*end || !*value) { /* only a key on this line. no value. */
|
||||
log_fn(LOG_WARNING,"Line has keyword '%s' but no value. Skipping.",s);
|
||||
log_fn(LOG_WARN,"Line has keyword '%s' but no value. Skipping.",s);
|
||||
goto try_next_line;
|
||||
}
|
||||
*end = 0; /* null it out */
|
||||
|
Loading…
Reference in New Issue
Block a user