more work on logging
This commit is contained in:
parent
4c9d3862e5
commit
57484bd701
@ -21,7 +21,8 @@ DEFINES = -DSESMAN_CFG_FILE=\"$(CFGDIR)/sesman.ini\" \
|
|||||||
-DSESMAN_PID_FILE=\"$(PIDDIR)/sesman.pid\" \
|
-DSESMAN_PID_FILE=\"$(PIDDIR)/sesman.pid\" \
|
||||||
-DSESMAN_SESSVC_FILE=\"sessvc\"
|
-DSESMAN_SESSVC_FILE=\"sessvc\"
|
||||||
|
|
||||||
CFLAGS = -Wall -O2 -I../../common -I/usr/include/nptl -fPIC $(DEFINES)
|
#CFLAGS = -Wall -O2 -I../../common -I/usr/include/nptl -fPIC $(DEFINES)
|
||||||
|
CFLAGS = -Wall -g -I../../common -I/usr/include/nptl -fPIC $(DEFINES)
|
||||||
LDFLAGS = -shared -L/usr/gnu/lib -L/usr/lib/nptl -lpthread
|
LDFLAGS = -shared -L/usr/gnu/lib -L/usr/lib/nptl -lpthread
|
||||||
C_OS_FLAGS = $(CFLAGS) -c
|
C_OS_FLAGS = $(CFLAGS) -c
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
@ -27,32 +27,21 @@
|
|||||||
|
|
||||||
#include "libscp_init.h"
|
#include "libscp_init.h"
|
||||||
|
|
||||||
|
static struct log_config* s_log;
|
||||||
|
|
||||||
/* server API */
|
/* server API */
|
||||||
int DEFAULT_CC
|
int DEFAULT_CC
|
||||||
scp_init(void)
|
scp_init(struct log_config* log)
|
||||||
{
|
{
|
||||||
|
if (0 == log)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_log = log;
|
||||||
|
|
||||||
scp_lock_init();
|
scp_lock_init();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SCP_CONNECTION*
|
|
||||||
scp_make_connection(int sck)
|
|
||||||
{
|
|
||||||
struct SCP_CONNECTION* conn;
|
|
||||||
|
|
||||||
conn = g_malloc(sizeof(struct SCP_CONNECTION), 0);
|
|
||||||
|
|
||||||
if (0 == conn)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
conn->in_sck = sck;
|
|
||||||
make_stream(conn->in_s);
|
|
||||||
init_stream(conn->in_s, 8196);
|
|
||||||
make_stream(conn->out_s);
|
|
||||||
init_stream(conn->out_s, 8196);
|
|
||||||
|
|
||||||
return conn;
|
|
||||||
}
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#ifndef LIBSCP_INIT_H
|
#ifndef LIBSCP_INIT_H
|
||||||
#define LIBSCP_INIT_H
|
#define LIBSCP_INIT_H
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#include "libscp.h"
|
#include "libscp.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,16 +42,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int DEFAULT_CC
|
int DEFAULT_CC
|
||||||
scp_init(void);
|
scp_init(struct log_config* log);
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief mmm
|
|
||||||
* @param sck
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
struct SCP_CONNECTION*
|
|
||||||
scp_make_connection(int sck);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ scp_session_create()
|
|||||||
s->password=0;
|
s->password=0;
|
||||||
s->hostname=0;
|
s->hostname=0;
|
||||||
s->errstr=0;
|
s->errstr=0;
|
||||||
#warning usare scp_session_set* per inizializzare la sessione!!!!!!
|
#warning FIXME use scp_session_set* to init session
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -135,7 +135,10 @@ scp_session_set_rsr(struct SCP_SESSION* s, tui8 rsr)
|
|||||||
int
|
int
|
||||||
scp_session_set_locale(struct SCP_SESSION* s, char* str)
|
scp_session_set_locale(struct SCP_SESSION* s, char* str)
|
||||||
{
|
{
|
||||||
if (0 == str) return 1;
|
if (0 == str)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
g_strncpy(s->locale, str, 17);
|
g_strncpy(s->locale, str, 17);
|
||||||
s->locale[17]='\0';
|
s->locale[17]='\0';
|
||||||
return 0;
|
return 0;
|
||||||
@ -145,8 +148,14 @@ scp_session_set_locale(struct SCP_SESSION* s, char* str)
|
|||||||
int
|
int
|
||||||
scp_session_set_username(struct SCP_SESSION* s, char* str)
|
scp_session_set_username(struct SCP_SESSION* s, char* str)
|
||||||
{
|
{
|
||||||
if (0 == str) return 1;
|
if (0 == str)
|
||||||
if (0 != s->username) g_free(s->username);
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (0 != s->username)
|
||||||
|
{
|
||||||
|
g_free(s->username);
|
||||||
|
}
|
||||||
s->username = g_strdup(str);
|
s->username = g_strdup(str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -155,8 +164,14 @@ scp_session_set_username(struct SCP_SESSION* s, char* str)
|
|||||||
int
|
int
|
||||||
scp_session_set_password(struct SCP_SESSION* s, char* str)
|
scp_session_set_password(struct SCP_SESSION* s, char* str)
|
||||||
{
|
{
|
||||||
if (0 == str) return 1;
|
if (0 == str)
|
||||||
if (0 != s->password) g_free(s->password);
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (0 != s->password)
|
||||||
|
{
|
||||||
|
g_free(s->password);
|
||||||
|
}
|
||||||
s->password = g_strdup(str);
|
s->password = g_strdup(str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -165,8 +180,14 @@ scp_session_set_password(struct SCP_SESSION* s, char* str)
|
|||||||
int
|
int
|
||||||
scp_session_set_hostname(struct SCP_SESSION* s, char* str)
|
scp_session_set_hostname(struct SCP_SESSION* s, char* str)
|
||||||
{
|
{
|
||||||
if (0 == str) return 1;
|
if (0 == str)
|
||||||
if (0 != s->hostname) g_free(s->hostname);
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (0 != s->hostname)
|
||||||
|
{
|
||||||
|
g_free(s->hostname);
|
||||||
|
}
|
||||||
s->hostname = g_strdup(str);
|
s->hostname = g_strdup(str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -175,8 +196,14 @@ scp_session_set_hostname(struct SCP_SESSION* s, char* str)
|
|||||||
int
|
int
|
||||||
scp_session_set_errstr(struct SCP_SESSION* s, char* str)
|
scp_session_set_errstr(struct SCP_SESSION* s, char* str)
|
||||||
{
|
{
|
||||||
if (0 == str) return 1;
|
if (0 == str)
|
||||||
if (0 != s->errstr) g_free(s->errstr);
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (0 != s->errstr)
|
||||||
|
{
|
||||||
|
g_free(s->errstr);
|
||||||
|
}
|
||||||
s->errstr = g_strdup(str);
|
s->errstr = g_strdup(str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -193,7 +220,8 @@ scp_session_set_display(struct SCP_SESSION* s, SCP_DISPLAY display)
|
|||||||
int
|
int
|
||||||
scp_session_set_addr(struct SCP_SESSION* s, int type, char* addr)
|
scp_session_set_addr(struct SCP_SESSION* s, int type, char* addr)
|
||||||
{
|
{
|
||||||
|
#warning FIXME managing addresses
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
@ -213,7 +213,7 @@ main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* libscp initialization */
|
/* libscp initialization */
|
||||||
scp_init();
|
scp_init(&(g_cfg.log));
|
||||||
|
|
||||||
if (daemon)
|
if (daemon)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# sesman tools makefile
|
# sesman tools makefile
|
||||||
SESTESTOBJ = sestest.o \
|
SESTESTOBJ = sestest.o \
|
||||||
os_calls.o
|
os_calls.o log.o
|
||||||
# d3des.o list.o file.o \
|
# d3des.o list.o file.o \
|
||||||
# libscp_v1c.o tcp.o
|
# libscp_v1c.o tcp.o
|
||||||
|
|
||||||
@ -15,7 +15,8 @@ DOCDIR = /usr/doc/xrdp
|
|||||||
|
|
||||||
DEFINES = -DLIBSCP_CLIENT
|
DEFINES = -DLIBSCP_CLIENT
|
||||||
|
|
||||||
CFLAGS = -Wall -O2 -I../../common -I../ -I/usr/include/nptl -I../libscp $(DEFINES)
|
#CFLAGS = -Wall -O2 -I../../common -I../ -I/usr/include/nptl -I../libscp $(DEFINES)
|
||||||
|
CFLAGS = -Wall -g -I../../common -I../ -I/usr/include/nptl -I../libscp $(DEFINES)
|
||||||
LDFLAGS = -L /usr/gnu/lib -I/usr/include/nptl -L/usr/lib/nptl -L../libscp -lpthread -ldl -lscp -Wl,-rpath,../libscp $(DEFINES)
|
LDFLAGS = -L /usr/gnu/lib -I/usr/include/nptl -L/usr/lib/nptl -L../libscp -lpthread -ldl -lscp -Wl,-rpath,../libscp $(DEFINES)
|
||||||
#LDFLAGS = -L /usr/gnu/lib -ldl $(DEFINES)
|
#LDFLAGS = -L /usr/gnu/lib -ldl $(DEFINES)
|
||||||
C_OS_FLAGS = $(CFLAGS) -c -g
|
C_OS_FLAGS = $(CFLAGS) -c -g
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* sestest.c - an scp_v1 testing tool
|
||||||
|
* (c) 2008 Simone Fedele
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
#include "tcp.h"
|
#include "tcp.h"
|
||||||
#include "libscp.h"
|
#include "libscp.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -17,12 +22,21 @@ int main(int argc, char** argv)
|
|||||||
/*struct SCP_DISCONNECTED_SESSION ds;*/
|
/*struct SCP_DISCONNECTED_SESSION ds;*/
|
||||||
struct SCP_DISCONNECTED_SESSION* dsl;
|
struct SCP_DISCONNECTED_SESSION* dsl;
|
||||||
enum SCP_CLIENT_STATES_E e;
|
enum SCP_CLIENT_STATES_E e;
|
||||||
|
struct log_config log;
|
||||||
int end;
|
int end;
|
||||||
int scnt;
|
int scnt;
|
||||||
int idx;
|
int idx;
|
||||||
int sel;
|
int sel;
|
||||||
int sock;
|
int sock;
|
||||||
|
|
||||||
|
|
||||||
|
log.enable_syslog=0;
|
||||||
|
log.log_level=99;
|
||||||
|
log.program_name=g_strdup("sestest");
|
||||||
|
log.log_file=g_strdup("sestest.log");
|
||||||
|
log_start(&log);
|
||||||
|
scp_init(&log);
|
||||||
|
|
||||||
sock=g_tcp_socket();
|
sock=g_tcp_socket();
|
||||||
c=scp_connection_create(sock);
|
c=scp_connection_create(sock);
|
||||||
/*make_stream(c.in_s);
|
/*make_stream(c.in_s);
|
||||||
@ -69,7 +83,7 @@ int main(int argc, char** argv)
|
|||||||
s.errstr=0;
|
s.errstr=0;
|
||||||
|
|
||||||
end=0;
|
end=0;
|
||||||
e=scp_v1c_connect(&c,&s);
|
e=scp_v1c_connect(c,&s);
|
||||||
|
|
||||||
while (!end)
|
while (!end)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user