Ted Unangst wrote:
> Without mucking about in the internals, here are some toplevel tame calls.
check return values. ok, ok.
in the fairly common verify case of piping msgfile to - (as in patching), we
can cut things down a bit more as well.
Index: signify.c
===================================================================
RCS file: /cvs/src/usr.bin/signify/signify.c,v
retrieving revision 1.100
diff -u -p -r1.100 signify.c
--- signify.c 16 Jan 2015 06:16:12 -0000 1.100
+++ signify.c 8 Oct 2015 15:29:35 -0000
@@ -663,6 +663,8 @@ main(int argc, char **argv)
VERIFY
} verb = NONE;
+ if (tame("stdio rpath wpath cpath tty", NULL) == -1)
+ err(1, "tame");
rounds = 42;
@@ -721,6 +723,30 @@ main(int argc, char **argv)
}
argc -= optind;
argv += optind;
+
+ switch (verb) {
+ case GENERATE:
+ case SIGN:
+ /* keep it all */
+ break;
+ case CHECK:
+ if (tame("stdio rpath", NULL) == -1)
+ err(1, "tame");
+ break;
+ case VERIFY:
+ if (embedded && (!msgfile || strcmp(msgfile, "-") != 0)) {
+ if (tame("stdio rpath wpath cpath", NULL) == -1)
+ err(1, "tame");
+ } else {
+ if (tame("stdio rpath", NULL) == -1)
+ err(1, "tame");
+ }
+ break;
+ default:
+ if (tame("stdio", NULL) == -1)
+ err(1, "tame");
+ break;
+ }
#ifndef VERIFYONLY
if (verb == CHECK) {