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)
if (options.install_as_service)
{
if (winService.IsInstalled())
log_info("Service is already installed\n");
log_info("Service is already installed");
else if (winService.Install())
log_info("Service installed successfully\n");
log_info("Service installed successfully");
else
{
log_info("Service failed to install\n");
log_info("Service failed to install");
ret_val= -1;
}
}
else if (options.remove_service)
{
if (! winService.IsInstalled())
log_info("Service is not installed\n");
log_info("Service is not installed");
else if (winService.Remove())
log_info("Service removed successfully\n");
log_info("Service removed successfully");
else
{
log_info("Service failed to remove\n");
log_info("Service failed to remove");
ret_val= -1;
}
}
......
......@@ -25,12 +25,6 @@
#include "log.h"
#ifdef __WIN__
#define NEWLINE_LEN 2
#else
#define NEWLINE_LEN 1
#endif
struct User
{
char user[USERNAME_LENGTH + 1];
......@@ -43,6 +37,7 @@ struct User
int User::init(const char *line)
{
const char *name_begin, *name_end, *password;
int line_ending_len= 1;
if (line[0] == '\'' || line[0] == '"')
{
......@@ -64,8 +59,14 @@ int User::init(const char *line)
if (user_length > USERNAME_LENGTH)
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;
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