summaryrefslogtreecommitdiff
path: root/sys/src/cmd/auth
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-12-23 14:58:39 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-12-23 14:58:39 +0000
commit56768a36df13d7703c5fce283fff2dbb5c0094da (patch)
tree852cd80b271527a3d8b458abb3cb27d37067d6e3 /sys/src/cmd/auth
parent8dec598474aacb3e9016a79eea43796842ae4af5 (diff)
auth/factotum: access /proc instead of #p for private()
Diffstat (limited to 'sys/src/cmd/auth')
-rw-r--r--sys/src/cmd/auth/factotum/fs.c11
-rw-r--r--sys/src/cmd/auth/lib/private.c11
2 files changed, 10 insertions, 12 deletions
diff --git a/sys/src/cmd/auth/factotum/fs.c b/sys/src/cmd/auth/factotum/fs.c
index 3756f9a31..552b504de 100644
--- a/sys/src/cmd/auth/factotum/fs.c
+++ b/sys/src/cmd/auth/factotum/fs.c
@@ -179,18 +179,17 @@ main(int argc, char **argv)
exits(nil);
}
-char *pmsg = "Warning! %s can't protect itself from debugging: %r\n";
-char *smsg = "Warning! %s can't turn off swapping: %r\n";
-
/* don't allow other processes to debug us and steal keys */
static void
private(void)
{
int fd;
- char buf[64];
+ char buf[32];
+ static char pmsg[] = "Warning! %s can't protect itself from debugging: %r\n";
+ static char smsg[] = "Warning! %s can't turn off swapping: %r\n";
- snprint(buf, sizeof(buf), "#p/%d/ctl", getpid());
- fd = open(buf, OWRITE);
+ snprint(buf, sizeof(buf), "/proc/%d/ctl", getpid());
+ fd = open(buf, OWRITE|OCEXEC);
if(fd < 0){
fprint(2, pmsg, argv0);
return;
diff --git a/sys/src/cmd/auth/lib/private.c b/sys/src/cmd/auth/lib/private.c
index 392842c0d..43397ad69 100644
--- a/sys/src/cmd/auth/lib/private.c
+++ b/sys/src/cmd/auth/lib/private.c
@@ -4,18 +4,17 @@
#include <authsrv.h>
#include "authcmdlib.h"
-static char *pmsg = "Warning! %s can't protect itself from debugging: %r\n";
-static char *smsg = "Warning! %s can't turn off swapping: %r\n";
-
/* don't allow other processes to debug us and steal keys */
void
private(void)
{
int fd;
- char buf[64];
+ char buf[32];
+ static char pmsg[] = "Warning! %s can't protect itself from debugging: %r\n";
+ static char smsg[] = "Warning! %s can't turn off swapping: %r\n";
- snprint(buf, sizeof(buf), "#p/%d/ctl", getpid());
- fd = open(buf, OWRITE);
+ snprint(buf, sizeof(buf), "/proc/%d/ctl", getpid());
+ fd = open(buf, OWRITE|OCEXEC);
if(fd < 0){
fprint(2, pmsg, argv0);
return;