diff --git a/timeoutd.c b/timeoutd.c index 3bb60da..6f2ba4c 100644 --- a/timeoutd.c +++ b/timeoutd.c @@ -96,8 +96,6 @@ void logoff_msg(); void killit(); int chk_xsession(); /* seppy: is it a X-Session? */ void killit_xsession(); /* seppy: kill the X-Session */ -int chk_ssh(pid_t pid); /* seppy: check if user is logged in via ssh (we have to - handle that different... ;( */ char *getusr(pid_t pid); /*seppy: get the owner of a running process */ void segfault(); /* seppy: catch segfault and log them */ int chk_xterm(); /* seppy: is it a xterm? */ @@ -964,19 +962,10 @@ char *host; } - /* check if the pid is sshd. If so, get PID of the child process (another ssh, owned by the user). - Test reverse if this child process is also ssh and owned by the user we want to log out. - (because we don't want to slay another user ;) */ #ifdef DEBUG syslog(LOG_NOTICE, "I am at killit() pid=%d user=%s line %d", pid, user, __LINE__); #endif - if (chk_ssh(pid)) { -#ifdef DEBUG - syslog(LOG_NOTICE, "User %s (pid:%d) logged in via ssh from %s.", user, pid, host); -#endif - } - logoff_msg(tty); sleep(KWAIT); /*make sure msg does not get lost, again (esp. ssh) */ close(tty); @@ -1142,26 +1131,6 @@ char *host, *user; -int chk_ssh(pid) /* seppy; returns true if pid is sshd, otherwise it returns false */ -pid_t pid; -{ - sprintf(path, "/proc/%d/stat", pid); - proc_file = fopen(path, "r"); - if (!proc_file) { - syslog(LOG_WARNING, "chk_ssh(): PID %d does not exist. Something went wrong. Ignoring.", - pid); - return 0; - } - - fscanf(proc_file, "%*d (%[^)]", comm); - fclose(proc_file); - - if (!strcmp(comm, "sshd")) - return 1; - else - return 0; -} - char *getusr(pid) /*seppy; returns the name of the user owning process with the Process ID pid */ pid_t pid; {