aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 11839469a..454cd117a 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -188,37 +188,44 @@ RETURN VALUE: 0 on success, non-zero on error
}
}
+ if ( options->Role < 0 || options->Role > 15 )
+ {
+ log(LOG_ERR,"Role option must be an integer between 0 and 15 (inclusive).");
+ code = -1;
+ }
+
if ( options->RouterFile == NULL )
{
log(LOG_ERR,"RouterFile option required, but not found.");
code = -1;
}
- if ( options->PrivateKeyFile == NULL )
+ if ( ROLE_IS_OR(options->Role) && options->PrivateKeyFile == NULL )
{
- log(LOG_ERR,"PrivateKeyFile option required, but not found.");
+ log(LOG_ERR,"PrivateKeyFile option required for OR, but not found.");
code = -1;
}
- if ( options->ORPort < 1 )
+ if ( (options->Role & ROLE_OR_LISTEN) && options->ORPort < 1 )
{
log(LOG_ERR,"ORPort option required and must be a positive integer value.");
code = -1;
}
- if ( options->OPPort < 1 )
+ if ( (options->Role & ROLE_OP_LISTEN) && options->OPPort < 1 )
{
log(LOG_ERR,"OPPort option required and must be a positive integer value.");
code = -1;
}
- if ( options->APPort < 1 )
+ if ( (options->Role & ROLE_AP_LISTEN) && options->APPort < 1 )
{
log(LOG_ERR,"APPort option required and must be a positive integer value.");
code = -1;
}
- if ( options->CoinWeight < 0.0 || options->CoinWeight >= 1.0 )
+ if ( (options->Role & ROLE_AP_LISTEN) &&
+ (options->CoinWeight < 0.0 || options->CoinWeight >= 1.0) )
{
log(LOG_ERR,"CoinWeight option must be a value from 0.0 upto 1.0, but not including 1.0.");
code = -1;
@@ -248,12 +255,6 @@ RETURN VALUE: 0 on success, non-zero on error
code = -1;
}
- if ( options->Role < 0 || options->Role > 15 )
- {
- log(LOG_ERR,"Role option must be an integer between 0 and 15 (inclusive).");
- code = -1;
- }
-
return code;
}