diff options
author | unknown <petr@mysql.com> | 2005-08-05 17:02:06 +0400 |
---|---|---|
committer | unknown <petr@mysql.com> | 2005-08-05 17:02:06 +0400 |
commit | cd3fa684cec86172ee3905675886f4efb05e407a (patch) | |
tree | c17b432f59765ab0f44f3da33b763ee66db3f3b1 /server-tools/instance-manager/user_map.cc | |
parent | d976f87fb47310581a73903581a57e67a530009b (diff) | |
download | mariadb-git-cd3fa684cec86172ee3905675886f4efb05e407a.tar.gz |
IM port cleanup
server-tools/instance-manager/IMService.cpp:
coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/WindowsService.cpp:
coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/WindowsService.h:
coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/instance.cc:
cleanup & coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/listener.cc:
coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/manager.cc:
coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/options.cc:
coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/user_map.cc:
simplify password file processing
Diffstat (limited to 'server-tools/instance-manager/user_map.cc')
-rw-r--r-- | server-tools/instance-manager/user_map.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/server-tools/instance-manager/user_map.cc b/server-tools/instance-manager/user_map.cc index df86d6a6915..1498f2fa947 100644 --- a/server-tools/instance-manager/user_map.cc +++ b/server-tools/instance-manager/user_map.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef __GNUC__ -#pragma interface +#pragma interface #endif #include "user_map.h" @@ -25,6 +25,12 @@ #include "log.h" +#ifdef __WIN__ +#define NEWLINE_LEN 2 +#else +#define NEWLINE_LEN 1 +#endif + struct User { char user[USERNAME_LENGTH + 1]; @@ -36,8 +42,7 @@ struct User int User::init(const char *line) { - const char *name_begin, *name_end; - char *password; + const char *name_begin, *name_end, *password; if (line[0] == '\'' || line[0] == '"') { @@ -45,7 +50,7 @@ int User::init(const char *line) name_end= strchr(name_begin, line[0]); if (name_end == 0 || name_end[1] != ':') goto err; - password= (char*)(name_end + 2); + password= name_end + 2; } else { @@ -53,19 +58,14 @@ int User::init(const char *line) name_end= strchr(name_begin, ':'); if (name_end == 0) goto err; - password= (char*)(name_end + 1); + password= name_end + 1; } user_length= name_end - name_begin; if (user_length > USERNAME_LENGTH) goto err; /* assume that newline characater is present */ - if (password[strlen(password)-2] == '\r') - { - password[strlen(password)-2]= '\n'; - password[strlen(password)-1]= 0; - } - if (strlen(password) != SCRAMBLED_PASSWORD_CHAR_LENGTH + 1) + if (strlen(password) != SCRAMBLED_PASSWORD_CHAR_LENGTH + NEWLINE_LEN) goto err; memcpy(user, name_begin, user_length); @@ -101,7 +101,7 @@ C_MODE_END int User_map::init() { - enum { START_HASH_SIZE = 16 }; + enum { START_HASH_SIZE= 16 }; if (hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0, get_user_key, delete_user, 0)) return 1; |