1
0

some bugs

This commit is contained in:
Daniel Tartavel 2020-05-27 23:59:50 +02:00
parent 075404a48c
commit 6e57502a29

14
main.c
View File

@ -21,9 +21,9 @@
struct connexion struct connexion
{ {
int pid; int pid;
char cmd[24]; char cmd[128];
char cmdline[1000]; char cmdline[1000];
char user[24]; char user[128];
char hostname[128]; char hostname[128];
char host_ip[42]; char host_ip[42];
char host_ipv6[42]; char host_ipv6[42];
@ -429,7 +429,7 @@ int getpids(int pid, int exploded[])
int getprocinfo( struct connexion * conn ) int getprocinfo( struct connexion * conn )
{ {
FILE *fh1; FILE *fh1;
char child_path[128]; char child_path[1024];
char str[1024]; char str[1024];
int child_pid[10]; int child_pid[10];
int flag = 0; int flag = 0;
@ -476,7 +476,7 @@ int getprocinfo( struct connexion * conn )
printlog(conn->cmdline, DEBUG, 0); printlog(conn->cmdline, DEBUG, 0);
if ((strstr(conn->cmdline, "pam") || strstr(conn->cmdline, "net") ) != 0) if ((strstr(conn->cmdline, "pam") || strstr(conn->cmdline, "net") ) != 0)
{ {
printlog("comdline is pam or net or accepted", DEBUG, 0); printlog("comdline is pam or net", DEBUG, 0);
retval = -1; retval = -1;
} }
// get the command name // get the command name
@ -495,7 +495,7 @@ int getprocinfo( struct connexion * conn )
int main() int main()
{ {
FILE *fh = NULL; FILE *fh = NULL;
FILE *fh1; //FILE *fh1;
int n_ssh=10; int n_ssh=10;
int id; int id;
int pid; int pid;
@ -606,10 +606,10 @@ int main()
// date of connexion // date of connexion
if (conn.user[0] == '\0') if (conn.user[0] == '\0')
{ {
sprintf( str, "%s \"%s: tunnel ouvert depuis %s pid: %d avec la commande: %s %s\"", cfg.commande, cfg.hostname, ip, conn.pid, conn.cmd, conn.cmdline ); sprintf( str, "%s \"%s: tunnel ouvert depuis %s pid: %d\"", cfg.commande, cfg.hostname, ip, conn.pid );
}else }else
{ {
sprintf( str, "%s \"%s: %s s'est connecté depuis %s pid: %d avec la commande: %s %s\"", cfg.commande, cfg.hostname, conn.user, ip, conn.pid, conn.cmd, conn.cmdline ); sprintf( str, "%s \"%s: %s s'est connecté depuis %s pid: %d\"", cfg.commande, cfg.hostname, conn.user, ip, conn.pid);
} }
if ( start != 1 ) if ( start != 1 )
{ {