Improved logging

This commit is contained in:
norrarvid 2012-06-07 13:46:44 +02:00
parent a1274b0320
commit 42edcbb6c1
3 changed files with 33 additions and 17 deletions

View File

@ -283,7 +283,7 @@ scp_v0s_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s, int skipVchk)
session = scp_session_create();
if (0 == session)
{
/* until syslog merge log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);*/
/* until syslog merge log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);*/
return SCP_SERVER_STATE_INTERNAL_ERR;
}
@ -297,7 +297,7 @@ scp_v0s_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s, int skipVchk)
if (0 != scp_session_set_username(session, buf))
{
scp_session_destroy(session);
/* until syslog merge log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: error setting username", __LINE__);*/
/* until syslog merge log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: error setting username", __LINE__);*/
return SCP_SERVER_STATE_INTERNAL_ERR;
}

View File

@ -42,21 +42,32 @@ scp_v0_process(struct SCP_CONNECTION* c, struct SCP_SESSION* s)
{
/* this is just authentication in a gateway situation */
/* g_writeln("SCP_GW_AUTHENTICATION message received"); */
if(data){
if (1 == access_login_allowed(s->username))
{
if(data)
{
if (1 == access_login_allowed(s->username))
{
/* the user is member of the correct groups. */
scp_v0s_replyauthentication(c,0);
log_message( LOG_LEVEL_INFO,"Access permitted for user: %s",
s->username);
/* g_writeln("Connection allowed"); */
}else{
scp_v0s_replyauthentication(c,3);
}
else
{
scp_v0s_replyauthentication(c,3);
log_message( LOG_LEVEL_INFO,"Username okey but group problem for user: %s",
s->username);
/* g_writeln("user password ok, but group problem"); */
}
}else{
/* g_writeln("username or password error"); */
scp_v0s_replyauthentication(c,2);
}
auth_end(data);
}
}
else
{
/* g_writeln("username or password error"); */
log_message( LOG_LEVEL_INFO,"Username or password error for user: %s",
s->username);
scp_v0s_replyauthentication(c,2);
}
auth_end(data);
}
else if (data)
{
@ -66,11 +77,13 @@ scp_v0_process(struct SCP_CONNECTION* c, struct SCP_SESSION* s)
display = s_item->display;
if (0 != s->client_ip)
{
log_message( LOG_LEVEL_INFO, "++ reconnected session: username %s, display :%d.0, session_pid %d, ip %s", s->username, display, s_item->pid, s->client_ip);
log_message( LOG_LEVEL_INFO, "++ reconnected session: username %s, display :%d.0, "
"session_pid %d, ip %s", s->username, display, s_item->pid, s->client_ip);
}
else
{
log_message(LOG_LEVEL_INFO, "++ reconnected session: username %s, display :%d.0, session_pid %d", s->username, display, s_item->pid);
log_message(LOG_LEVEL_INFO, "++ reconnected session: username %s, display :%d.0, "
"session_pid %d", s->username, display, s_item->pid);
}
auth_end(data);
/* don't set data to null here */
@ -82,11 +95,13 @@ scp_v0_process(struct SCP_CONNECTION* c, struct SCP_SESSION* s)
{
if (0 != s->client_ip)
{
log_message(LOG_LEVEL_INFO, "++ created session (access granted): username %s, ip %s", s->username, s->client_ip);
log_message(LOG_LEVEL_INFO, "++ created session (access granted): "
"username %s, ip %s", s->username, s->client_ip);
}
else
{
log_message(LOG_LEVEL_INFO, "++ created session (access granted): username %s", s->username);
log_message(LOG_LEVEL_INFO, "++ created session (access granted): "
"username %s", s->username);
}
if (SCP_SESSION_TYPE_XVNC == s->type)

View File

@ -21,6 +21,7 @@
*/
#include "xrdp.h"
#include "log.h"
#define ACCESS
/*****************************************************************************/