diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-10-24 21:24:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-10-24 21:24:23 +0000 |
commit | acc343614063e6fcbfd2871022b325f7f58f01cf (patch) | |
tree | 116317e06df569f5951d37b46db5c27b2326b826 /lib/libkeynote | |
parent | 45b1bea4b11d2420bea5874f47944b05075dd1b0 (diff) |
For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef.
ok millert
Diffstat (limited to 'lib/libkeynote')
-rw-r--r-- | lib/libkeynote/keynote-sign.c | 6 | ||||
-rw-r--r-- | lib/libkeynote/keynote-sigver.c | 4 | ||||
-rw-r--r-- | lib/libkeynote/keynote-verify.c | 8 |
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/libkeynote/keynote-sign.c b/lib/libkeynote/keynote-sign.c index 29469215dcb..0d208452f74 100644 --- a/lib/libkeynote/keynote-sign.c +++ b/lib/libkeynote/keynote-sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keynote-sign.c,v 1.19 2019/06/28 13:32:42 deraadt Exp $ */ +/* $OpenBSD: keynote-sign.c,v 1.20 2021/10/24 21:24:20 deraadt Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) * @@ -103,7 +103,7 @@ keynote_sign(int argc, char *argv[]) algname = argv[1 + flg]; /* Read assertion */ - fd = open(argv[2 + flg], O_RDONLY, 0); + fd = open(argv[2 + flg], O_RDONLY); if (fd == -1) { perror(argv[2 + flg]); @@ -139,7 +139,7 @@ keynote_sign(int argc, char *argv[]) close(fd); /* Read private key file */ - fd = open(argv[3 + flg], O_RDONLY, 0); + fd = open(argv[3 + flg], O_RDONLY); if (fd == -1) { perror(argv[3 + flg]); diff --git a/lib/libkeynote/keynote-sigver.c b/lib/libkeynote/keynote-sigver.c index 6c87e386349..10b64a3c8ee 100644 --- a/lib/libkeynote/keynote-sigver.c +++ b/lib/libkeynote/keynote-sigver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keynote-sigver.c,v 1.17 2019/06/28 13:32:42 deraadt Exp $ */ +/* $OpenBSD: keynote-sigver.c,v 1.18 2021/10/24 21:24:20 deraadt Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) * @@ -56,7 +56,7 @@ keynote_sigver(int argc, char *argv[]) } /* Open and read assertion file */ - fd = open(argv[1], O_RDONLY, 0); + fd = open(argv[1], O_RDONLY); if (fd == -1) { perror(argv[1]); diff --git a/lib/libkeynote/keynote-verify.c b/lib/libkeynote/keynote-verify.c index 37cc2afbae7..288d738df7a 100644 --- a/lib/libkeynote/keynote-verify.c +++ b/lib/libkeynote/keynote-verify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keynote-verify.c,v 1.19 2021/01/18 00:53:20 mortimer Exp $ */ +/* $OpenBSD: keynote-verify.c,v 1.20 2021/10/24 21:24:20 deraadt Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) * @@ -104,7 +104,7 @@ keynote_verify(int argc, char *argv[]) case 'k': sk = 1; - if ((fd = open(optarg, O_RDONLY, 0)) == -1) + if ((fd = open(optarg, O_RDONLY)) == -1) { perror(optarg); exit(1); @@ -224,7 +224,7 @@ keynote_verify(int argc, char *argv[]) break; case 'l': - if ((fd = open(optarg, O_RDONLY, 0)) == -1) + if ((fd = open(optarg, O_RDONLY)) == -1) { perror(optarg); exit(1); @@ -308,7 +308,7 @@ keynote_verify(int argc, char *argv[]) while (argc--) { - if ((fd = open(argv[argc], O_RDONLY, 0)) == -1) + if ((fd = open(argv[argc], O_RDONLY)) == -1) { perror(argv[argc]); exit(1); |