1
0

corrected the code for session connecting

This commit is contained in:
Daniel Tartavel 2020-05-17 23:33:40 +02:00
parent 32920d49cc
commit 2f03f2fcdd

11
main.c
View File

@ -387,11 +387,7 @@ int getprocinfo( struct connexion * conn )
while ( flag == 0) while ( flag == 0)
{ {
r = getpids( conn->pid, child_pid ); r = getpids( conn->pid, child_pid );
if( level == 0 && r == 2 ) if ( r != -1 )
{
flag = 1;
retval = -1;
}else if ( r != -1 )
{ {
level++; level++;
strcat(tab," "); strcat(tab," ");
@ -413,6 +409,10 @@ int getprocinfo( struct connexion * conn )
null2space( str ); null2space( str );
sprintf(conn->cmdline, "%s", str); sprintf(conn->cmdline, "%s", str);
fclose(fh1); fclose(fh1);
if ((strstr(conn->cmdline, "pam") || strstr(conn->cmdline, "net")) != 0)
{
retval = -1;
}
// get the command name // get the command name
sprintf( child_path, "/proc/%d/comm", conn->pid ); sprintf( child_path, "/proc/%d/comm", conn->pid );
if ( (fh1= fopen(child_path, "r" )) == NULL) if ( (fh1= fopen(child_path, "r" )) == NULL)
@ -422,6 +422,7 @@ int getprocinfo( struct connexion * conn )
} }
fscanf( fh1, "%s", conn->cmd ); fscanf( fh1, "%s", conn->cmd );
fclose(fh1); fclose(fh1);
return retval; return retval;
} }