ref: 3a6f8996cd73836efd19e74415f6b55e06307311
parent: 283057285224bfc92f61b0af0cca177cf4a9ebc4
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Dec 25 13:02:18 EST 2022
auth: use caphash and capuse under /dev instead of #¤
--- a/sys/src/cmd/auth/as.c
+++ b/sys/src/cmd/auth/as.c
@@ -100,7 +100,7 @@
uchar hash[SHA1dlen];
int fd;
- fd = open("#¤/caphash", OCEXEC|OWRITE);+ fd = open("/dev/caphash", OCEXEC|OWRITE);if(fd < 0)
return nil;
@@ -135,7 +135,7 @@
{int fd, rv;
- fd = open("#¤/capuse", OWRITE);+ fd = open("/dev/capuse", OCEXEC|OWRITE);if(fd < 0)
return -1;
rv = write(fd, cap, strlen(cap));
--- a/sys/src/cmd/auth/cron.c
+++ b/sys/src/cmd/auth/cron.c
@@ -619,9 +619,9 @@
void
initcap(void)
{- caphashfd = open("#¤/caphash", OCEXEC|OWRITE);+ caphashfd = open("/dev/caphash", OCEXEC|OWRITE);if(caphashfd < 0)
- fprint(2, "%s: opening #¤/caphash: %r\n", argv0);
+ fprint(2, "%s: opening /dev/caphash: %r\n", argv0);
}
/*
@@ -667,7 +667,7 @@
{int fd, rv;
- fd = open("#¤/capuse", OWRITE);+ fd = open("/dev/capuse", OCEXEC|OWRITE);if(fd < 0)
return -1;
rv = write(fd, cap, strlen(cap));
--- a/sys/src/cmd/auth/factotum/util.c
+++ b/sys/src/cmd/auth/factotum/util.c
@@ -13,7 +13,7 @@
bind("#I", "/net", MBEFORE); if(access("/net/cs", AEXIST) < 0){- if((srvfd = open("#s/cs", ORDWR)) >= 0){+ if((srvfd = open("/srv/cs", ORDWR)) >= 0){if(mount(srvfd, -1, "/net", MBEFORE, "") != -1)
return 0;
close(srvfd);
@@ -619,9 +619,9 @@
void
initcap(void)
{- caphashfd = open("#¤/caphash", OWRITE);+ caphashfd = open("/dev/caphash", OCEXEC|OWRITE);// if(caphashfd < 0)
-// fprint(2, "%s: opening #¤/caphash: %r\n", argv0);
+// fprint(2, "%s: opening /dev/caphash: %r\n", argv0);
}
/*
@@ -888,10 +888,10 @@
if((s = strchr(owner,'@')) != nil)
*s = 0;
- fd = open("#c/hostowner", OWRITE);+ fd = open("/dev/hostowner", OWRITE|OCEXEC); if(fd >= 0){if(fprint(fd, "%s", owner) < 0)
- fprint(2, "factotum: setting #c/hostowner to %q: %r\n",
+ fprint(2, "factotum: setting /dev/hostowner to %q: %r\n",
owner);
close(fd);
}
--- a/sys/src/cmd/auth/login.c
+++ b/sys/src/cmd/auth/login.c
@@ -30,7 +30,7 @@
int rv, fd;
/* change uid */
- fd = open("#¤/capuse", OWRITE);+ fd = open("/dev/capuse", OCEXEC|OWRITE);if(fd < 0)
sysfatal("can't change uid: %r");rv = write(fd, ai->cap, strlen(ai->cap));
--- a/sys/src/libauth/auth_chuid.c
+++ b/sys/src/libauth/auth_chuid.c
@@ -16,15 +16,15 @@
}
/* change uid */
- fd = open("#¤/capuse", OWRITE|OCEXEC);+ fd = open("/dev/capuse", OCEXEC|OWRITE); if(fd < 0){- werrstr("opening #¤/capuse: %r");+ werrstr("opening /dev/capuse: %r");return -1;
}
rv = write(fd, ai->cap, strlen(ai->cap));
close(fd);
if(rv < 0){- werrstr("writing %s to #¤/capuse: %r", ai->cap);+ werrstr("writing %s to /dev/capuse: %r", ai->cap);return -1;
}
--
⑨