Commit 530abb5c authored by unknown's avatar unknown

small corrections to the IM.


server-tools/instance-manager/IMService.cpp:
  removed \n from log_info calls as these will be added automatically
server-tools/instance-manager/user_map.cc:
  added back in support for password files using \r\n, this time
  without breaking the const contract.
parent 88c4ad24
...@@ -44,24 +44,24 @@ int HandleServiceOptions(Options options) ...@@ -44,24 +44,24 @@ int HandleServiceOptions(Options options)
if (options.install_as_service) if (options.install_as_service)
{ {
if (winService.IsInstalled()) if (winService.IsInstalled())
log_info("Service is already installed\n"); log_info("Service is already installed");
else if (winService.Install()) else if (winService.Install())
log_info("Service installed successfully\n"); log_info("Service installed successfully");
else else
{ {
log_info("Service failed to install\n"); log_info("Service failed to install");
ret_val= -1; ret_val= -1;
} }
} }
else if (options.remove_service) else if (options.remove_service)
{ {
if (! winService.IsInstalled()) if (! winService.IsInstalled())
log_info("Service is not installed\n"); log_info("Service is not installed");
else if (winService.Remove()) else if (winService.Remove())
log_info("Service removed successfully\n"); log_info("Service removed successfully");
else else
{ {
log_info("Service failed to remove\n"); log_info("Service failed to remove");
ret_val= -1; ret_val= -1;
} }
} }
......
...@@ -25,12 +25,6 @@ ...@@ -25,12 +25,6 @@
#include "log.h" #include "log.h"
#ifdef __WIN__
#define NEWLINE_LEN 2
#else
#define NEWLINE_LEN 1
#endif
struct User struct User
{ {
char user[USERNAME_LENGTH + 1]; char user[USERNAME_LENGTH + 1];
...@@ -43,6 +37,7 @@ struct User ...@@ -43,6 +37,7 @@ struct User
int User::init(const char *line) int User::init(const char *line)
{ {
const char *name_begin, *name_end, *password; const char *name_begin, *name_end, *password;
int line_ending_len= 1;
if (line[0] == '\'' || line[0] == '"') if (line[0] == '\'' || line[0] == '"')
{ {
...@@ -64,8 +59,14 @@ int User::init(const char *line) ...@@ -64,8 +59,14 @@ int User::init(const char *line)
if (user_length > USERNAME_LENGTH) if (user_length > USERNAME_LENGTH)
goto err; goto err;
/* assume that newline characater is present */ /*
if (strlen(password) != SCRAMBLED_PASSWORD_CHAR_LENGTH + NEWLINE_LEN) assume that newline characater is present
we support reading password files that end in \n or \r\n on
either platform.
*/
if (password[strlen(password)-2] == '\r')
line_ending_len= 2;
if (strlen(password) != SCRAMBLED_PASSWORD_CHAR_LENGTH + line_ending_len)
goto err; goto err;
memcpy(user, name_begin, user_length); memcpy(user, name_begin, user_length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment