1
0
Fork 0

changed password behavior

This commit is contained in:
Jan Steemann 2012-07-25 20:05:45 +02:00
parent 435a01b6b3
commit da55cda164
3 changed files with 21 additions and 13 deletions

View File

@ -1,5 +1,8 @@
v1.1.x (XXXX-XX-XX)
-------------------
* INCOMPATIBLE CHANGE: renamed parameters "connect-timeout" and "request-timeout"
for arangosh and arangoimp to "--server.connect-timeout" and "--server.request-timeout"
* INCOMPATIBLE CHANGE: authorization is now required when using the server
Clients sending requests without HTTP autorization will be rejected with HTTP 401

View File

@ -70,6 +70,12 @@ static int64_t DEFAULT_REQUEST_TIMEOUT = 300;
static size_t DEFAULT_RETRIES = 2;
static int64_t DEFAULT_CONNECTION_TIMEOUT = 3;
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not a password was specified
////////////////////////////////////////////////////////////////////////////////
static bool _hasPassword = false;
////////////////////////////////////////////////////////////////////////////////
/// @brief endpoint to connect to
////////////////////////////////////////////////////////////////////////////////
@ -175,6 +181,8 @@ static void ParseProgramOptions (int argc, char* argv[]) {
cerr << options.lastError() << "\n";
exit(EXIT_FAILURE);
}
_hasPassword = options.has("server.password");
if (FileName == "" && myargs.size() > 0) {
FileName = myargs[0];
@ -238,7 +246,7 @@ int main (int argc, char* argv[]) {
exit(EXIT_FAILURE);
}
if (_password.size() == 0) {
if (! _hasPassword) {
// no password given on command-line
cout << "Please specify a password:" << endl;
// now prompt for it
@ -252,11 +260,6 @@ int main (int argc, char* argv[]) {
#endif
}
if (_password.size() == 0) {
cerr << "no value specified for --server.password" << endl;
exit(EXIT_FAILURE);
}
_endpoint = Endpoint::clientFactory(_endpointString);
if (_endpoint == 0) {

View File

@ -121,6 +121,12 @@ static char const DEF_RESET[5] = "\x1b[0m";
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not a password was specified on the command line
////////////////////////////////////////////////////////////////////////////////
static bool _hasPassword = false;
////////////////////////////////////////////////////////////////////////////////
/// @brief endpoint
////////////////////////////////////////////////////////////////////////////////
@ -597,6 +603,8 @@ static void ParseProgramOptions (int argc, char* argv[]) {
TRI_SetLogLevelLogging(level.c_str());
TRI_CreateLogAppenderFile("-");
_hasPassword = options.has("server.password");
// set colors
if (options.has("colors")) {
NoColors = false;
@ -1234,7 +1242,7 @@ int main (int argc, char* argv[]) {
exit(EXIT_FAILURE);
}
if (_password.size() == 0) {
if (! _hasPassword) {
// no password given on command-line
cout << "Please specify a password:" << endl;
// now prompt for it
@ -1248,12 +1256,6 @@ int main (int argc, char* argv[]) {
#endif
}
if (_password.size() == 0) {
cerr << "no value specified for --server.password" << endl;
exit(EXIT_FAILURE);
}
// .............................................................................
// set-up client connection
// .............................................................................