Cleanup credentials to string handling
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
This commit is contained in:
parent
77343d3c21
commit
7985d4fed0
|
@ -23,7 +23,7 @@
|
||||||
#define ACL_ADD_BOOL(S, L) do { ret = check_cmd_bool(S, L, line, line_count); if (ret != 0) return ret; } while(0)
|
#define ACL_ADD_BOOL(S, L) do { ret = check_cmd_bool(S, L, line, line_count); if (ret != 0) return ret; } while(0)
|
||||||
#define ACL_ADD_ADDR(S, L) do { ret = check_cmd_addr(S, L, line, line_count); if (ret != 0) return ret; } while(0)
|
#define ACL_ADD_ADDR(S, L) do { ret = check_cmd_addr(S, L, line, line_count); if (ret != 0) return ret; } while(0)
|
||||||
|
|
||||||
static const char* get_user_credential_string(enum user_credentials cred)
|
const char* get_user_credential_string(enum user_credentials cred)
|
||||||
{
|
{
|
||||||
switch (cred)
|
switch (cred)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,6 +48,8 @@ enum user_credentials
|
||||||
cred_link, /**<<< "User is a link (not used currently)" */
|
cred_link, /**<<< "User is a link (not used currently)" */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* get_user_credential_string(enum user_credentials cred);
|
||||||
|
|
||||||
struct user_access_info
|
struct user_access_info
|
||||||
{
|
{
|
||||||
char* username; /* name of user, cid or IP range */
|
char* username; /* name of user, cid or IP range */
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
static void log_user_login(struct user* u)
|
static void log_user_login(struct user* u)
|
||||||
{
|
{
|
||||||
const char* credentials_string[] = { "", "link", "guest", "user", "operator", "super", "admin" };
|
const char* cred = get_user_credential_string(u->credentials);
|
||||||
const char* addr = ip_convert_to_string(&u->ipaddr);
|
const char* addr = ip_convert_to_string(&u->ipaddr);
|
||||||
hub_log(log_user, "LoginOK %s/%s %s \"%s\" (%s) \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, credentials_string[u->credentials], u->user_agent);
|
hub_log(log_user, "LoginOK %s/%s %s \"%s\" (%s) \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, cred, u->user_agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_user_login_error(struct user* u, enum status_message msg)
|
static void log_user_login_error(struct user* u, enum status_message msg)
|
||||||
|
|
Loading…
Reference in New Issue