]> andersk Git - moira.git/commitdiff
Initial revision
authormar <mar>
Tue, 22 Nov 1988 16:09:17 +0000 (16:09 +0000)
committermar <mar>
Tue, 22 Nov 1988 16:09:17 +0000 (16:09 +0000)
update/sms_untar.c [new file with mode: 0644]

diff --git a/update/sms_untar.c b/update/sms_untar.c
new file mode 100644 (file)
index 0000000..5e60474
--- /dev/null
@@ -0,0 +1,32 @@
+/* $Header$
+ *
+ * Reads a tar file from standard input, and extracts the contents as
+ * the user specified by uid as an argument.
+ *
+ *  (c) Copyright 1988 by the Massachusetts Institute of Technology.
+ *  For copying and distribution information, please see the file
+ *  <mit-copyright.h>.
+ */
+
+#include <mit-copyright.h>
+
+main(argc,argv)
+int argc;
+char **argv; 
+{
+    if (getuid() != 0) {
+       write(2, "You must be root to run sms_untar\n", 34);
+       exit(1);
+    }
+
+    if (argc != 2) {
+       write(2, "Usage: sms_untar uid\n", 21);
+       write(2, "sms_untar takes a tar file as standard input.\n", 46);
+       exit(2);
+    }
+
+    setuid(atoi(argv[1]));
+    execl("/bin/tar", "tar", "xfp", "-", 0);
+    write(2, "sms_untar: unable to exec /bin/tar\n", 35);
+    exit(3);
+}
This page took 0.155007 seconds and 5 git commands to generate.