improved log messages and levels

This commit is contained in:
Nikos Mavrogiannopoulos
2015-04-25 10:10:22 +02:00
parent d35582ff7d
commit 35b9d4364d
4 changed files with 21 additions and 21 deletions

View File

@@ -547,11 +547,11 @@ char buf[128];
}
if (proc->ipv4)
mslog(s, proc, LOG_INFO, "assigned IPv4: %s",
mslog(s, proc, LOG_DEBUG, "assigned IPv4: %s",
human_addr((void*)&proc->ipv4->rip, proc->ipv4->rip_len, buf, sizeof(buf)));
if (proc->ipv6)
mslog(s, proc, LOG_INFO, "assigned IPv6: %s",
mslog(s, proc, LOG_DEBUG, "assigned IPv6: %s",
human_addr((void*)&proc->ipv6->rip, proc->ipv6->rip_len, buf, sizeof(buf)));
return 0;

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013, 2014 Nikos Mavrogiannopoulos
* Copyright (C) 2013, 2014, 2015 Nikos Mavrogiannopoulos
* Copyright (C) 2014, 2015 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -249,11 +250,11 @@ struct proc_st *old_proc;
/* check for a user with the same sid as in the cookie */
old_proc = proc_search_sid(s, cmsg->sid.data);
if (old_proc != NULL) {
mslog(s, old_proc, LOG_DEBUG, "disconnecting (%u) due to new cookie session",
mslog(s, old_proc, LOG_DEBUG, "disconnecting previous user session (%u) due to session re-use",
(unsigned)old_proc->pid);
if (strcmp(proc->username, old_proc->username) != 0) {
mslog(s, old_proc, LOG_ERR, "the user of the cookie doesn't match (new: %s)",
mslog(s, old_proc, LOG_ERR, "the user of the new session doesn't match the old (new: %s)",
proc->username);
return -1;
}
@@ -263,9 +264,9 @@ struct proc_st *old_proc;
if (old_proc->pid > 0)
kill(old_proc->pid, SIGTERM);
mslog(s, proc, LOG_INFO, "resumed cookie session for user '%s' (using %s)", proc->username, proc->tls_ciphersuite);
mslog(s, proc, LOG_INFO, "re-using session");
} else {
mslog(s, proc, LOG_INFO, "new cookie session for user '%s'", proc->username);
mslog(s, proc, LOG_INFO, "new user session");
}
if (cmsg->hostname)

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013, 2014 Nikos Mavrogiannopoulos
* Copyright (C) 2013, 2014, 2015 Nikos Mavrogiannopoulos
* Copyright (C) 2014, 2015 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -123,6 +124,7 @@ int handle_script_exit(main_server_st *s, struct proc_st *proc, int code)
goto fail;
}
}
mslog(s, proc, LOG_INFO, "user logged in");
ret = 0;
fail:
@@ -167,7 +169,7 @@ struct proc_st *ctmp;
*/
void remove_proc(main_server_st * s, struct proc_st *proc, unsigned k)
{
mslog(s, proc, LOG_INFO, "user '%s' disconnected", proc->username);
mslog(s, proc, LOG_INFO, "user disconnected");
list_del(&proc->list);
s->active_clients--;
@@ -208,14 +210,12 @@ static int accept_user(main_server_st * s, struct proc_st *proc, unsigned cmd)
int ret;
const char *group;
mslog(s, proc, LOG_DEBUG, "accepting user");
/* check for multiple connections */
ret = check_multiple_users(s, proc);
if (ret < 0) {
mslog(s, proc, LOG_INFO,
"user '%s' tried to connect more than %u times",
proc->username, s->config->max_same_clients);
"user tried to connect more than %u times",
s->config->max_same_clients);
return ret;
}
@@ -230,21 +230,20 @@ static int accept_user(main_server_st * s, struct proc_st *proc, unsigned cmd)
group = proc->groupname;
if (cmd == AUTH_COOKIE_REQ) {
mslog(s, proc, LOG_INFO,
"user '%s' of group '%s' authenticated (using cookie)",
proc->username, group);
mslog(s, proc, LOG_DEBUG,
"user of group '%s' authenticated (using cookie)",
group);
} else {
mslog(s, proc, LOG_INFO,
"user '%s' of group '%s' authenticated but from unknown state!",
proc->username, group);
"user of group '%s' authenticated but from unknown state! rejecting.",
group);
return ERR_BAD_COMMAND;
}
/* do scripts and utmp */
ret = user_connected(s, proc);
if (ret < 0 && ret != ERR_WAIT_FOR_SCRIPT) {
mslog(s, proc, LOG_INFO, "user '%s' disconnected due to script",
proc->username);
mslog(s, proc, LOG_INFO, "user disconnected due to script");
}
return ret;

View File

@@ -507,7 +507,7 @@ int open_tun(main_server_st * s, struct proc_st *proc)
goto fail;
}
memcpy(proc->tun_lease.name, ifr.ifr_name, IFNAMSIZ);
mslog(s, proc, LOG_INFO, "assigning tun device %s\n",
mslog(s, proc, LOG_DEBUG, "assigning tun device %s\n",
proc->tun_lease.name);
/* we no longer use persistent tun */