1 /* Copyright (C) 2004-2006 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_USER_MAP_H
17 #define INCLUDES_MYSQL_INSTANCE_MANAGER_USER_MAP_H
19 #include <my_global.h>
21 #include <mysql_com.h>
25 #if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
34 User(const LEX_STRING
*user_name_arg
, const char *password
);
36 int init(const char *line
);
38 inline void set_password(const char *password
)
40 make_scrambled_password(scrambled_password
, password
);
43 char user
[USERNAME_LENGTH
+ 1];
44 char scrambled_password
[SCRAMBLED_PASSWORD_CHAR_LENGTH
+ 1];
46 uint8 salt
[SCRAMBLE_LENGTH
];
50 User_map -- all users and passwords
56 /* User_map iterator */
61 Iterator(User_map
*user_map_arg
) :
62 user_map(user_map_arg
), cur_idx(0)
80 int load(const char *password_file_name
, const char **err_msg
);
81 int save(const char *password_file_name
, const char **err_msg
);
82 int authenticate(const LEX_STRING
*user_name
,
83 const char *scrambled_password
,
84 const char *scramble
) const;
86 const User
*find_user(const LEX_STRING
*user_name
) const;
87 User
*find_user(const LEX_STRING
*user_name
);
89 bool add_user(User
*user
);
90 bool remove_user(User
*user
);
93 User_map(const User_map
&);
94 User_map
&operator =(const User_map
&);
100 friend class Iterator
;
103 #endif // INCLUDES_MYSQL_INSTANCE_MANAGER_USER_MAP_H