]>
Commit | Line | Data |
---|---|---|
e2372302 | 1 | /* $Header$ |
2 | * | |
3 | * Reads a tar file from standard input, and extracts the contents as | |
4 | * the user specified by uid as an argument. | |
5 | * | |
6 | * (c) Copyright 1988 by the Massachusetts Institute of Technology. | |
7 | * For copying and distribution information, please see the file | |
8 | * <mit-copyright.h>. | |
9 | */ | |
10 | ||
11 | #include <mit-copyright.h> | |
12 | ||
13 | main(argc,argv) | |
14 | int argc; | |
15 | char **argv; | |
16 | { | |
17 | if (getuid() != 0) { | |
18 | write(2, "You must be root to run sms_untar\n", 34); | |
19 | exit(1); | |
20 | } | |
21 | ||
22 | if (argc != 2) { | |
23 | write(2, "Usage: sms_untar uid\n", 21); | |
24 | write(2, "sms_untar takes a tar file as standard input.\n", 46); | |
25 | exit(2); | |
26 | } | |
27 | ||
28 | setuid(atoi(argv[1])); | |
29 | execl("/bin/tar", "tar", "xfp", "-", 0); | |
30 | write(2, "sms_untar: unable to exec /bin/tar\n", 35); | |
31 | exit(3); | |
32 | } |