File: force-logout.c

package info (click to toggle)
ccstools 1.7.2-20100401-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 984 kB
  • ctags: 1,080
  • sloc: ansic: 20,286; sh: 890; makefile: 80
file content (29 lines) | stat: -rw-r--r-- 650 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * force-logout.c
 *
 * TOMOYO Linux's utilities.
 *
 * Copyright (C) 2005-2009  NTT DATA CORPORATION
 *
 * Version: 1.7.0   2009/09/03
 *
 */
/*
 * This utility forcibly chases away the user who logged in via network (e.g.
 * SSH).
 * This utility is designed for denied_execute_handler so that an intruder who
 * attempted to execute some programs which are not permitted by policy is
 * automatically chased away.
 * You need to set SUID bit to make vhangup() work.
 */
#include <unistd.h>
#include <sys/socket.h>

int main(int argc, char *argv[])
{
	vhangup();
	shutdown(0, SHUT_RD);
	shutdown(1, SHUT_WR);
	shutdown(2, SHUT_WR);
	return 0;
}