jail.c (46155) | jail.c (46432) |
---|---|
1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * 9 * $Id$ 10 * 11 */ 12 |
|
1#include <stdio.h> 2#include <err.h> 3#include <sys/types.h> 4#include <sys/jail.h> 5#include <netinet/in.h> 6 7int 8main(int argc, char **argv) --- 7 unchanged lines hidden (view full) --- 16 i = chdir(argv[1]); 17 if (i) 18 err(1, "chdir %s", argv[1]); 19 j.path = argv[1]; 20 j.hostname = argv[2]; 21 i = inet_aton(argv[3], &in); 22 if (!i) 23 errx(1, "Couldn't make sense if ip number\n"); | 13#include <stdio.h> 14#include <err.h> 15#include <sys/types.h> 16#include <sys/jail.h> 17#include <netinet/in.h> 18 19int 20main(int argc, char **argv) --- 7 unchanged lines hidden (view full) --- 28 i = chdir(argv[1]); 29 if (i) 30 err(1, "chdir %s", argv[1]); 31 j.path = argv[1]; 32 j.hostname = argv[2]; 33 i = inet_aton(argv[3], &in); 34 if (!i) 35 errx(1, "Couldn't make sense if ip number\n"); |
24 j.ip_number = in.s_addr; | 36 j.ip_number = ntohl(in.s_addr); |
25 i = jail(&j); 26 if (i) 27 err(1, "Imprisonment failed"); 28 i = execv(argv[4], argv + 4); 29 if (i) 30 err(1, "execv(%s)", argv[4]); 31 exit (0); 32} | 37 i = jail(&j); 38 if (i) 39 err(1, "Imprisonment failed"); 40 i = execv(argv[4], argv + 4); 41 if (i) 42 err(1, "execv(%s)", argv[4]); 43 exit (0); 44} |