diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 21 | ||||
-rw-r--r-- | src/TARGETS | 2 | ||||
-rw-r--r-- | src/chkshsgr.c | 13 | ||||
-rw-r--r-- | src/chpst.c | 3 | ||||
-rw-r--r-- | src/prot.c | 23 | ||||
-rw-r--r-- | src/prot.h | 9 | ||||
-rw-r--r-- | src/tryshsgr.c | 19 |
7 files changed, 4 insertions, 86 deletions
diff --git a/src/Makefile b/src/Makefile index d9624de..129f216 100644 --- a/src/Makefile +++ b/src/Makefile @@ -170,12 +170,6 @@ byte_diff.o: byte.h byte_diff.c compile byte_rchr.o: byte.h byte_rchr.c compile ./compile byte_rchr.c -chkshsgr: chkshsgr.o load - ./load chkshsgr - -chkshsgr.o: chkshsgr.c compile - ./compile chkshsgr.c - choose: choose.sh warn-auto.sh rm -f choose cat warn-auto.sh choose.sh \ @@ -232,11 +226,6 @@ hassgact.h: choose compile hassgact.h1 hassgact.h2 load trysgact.c hassgprm.h: choose compile hassgprm.h1 hassgprm.h2 load trysgprm.c ./choose cl trysgprm hassgprm.h1 hassgprm.h2 > hassgprm.h -hasshsgr.h: chkshsgr choose compile hasshsgr.h1 hasshsgr.h2 load \ -tryshsgr.c warn-shsgr - ./chkshsgr || ( cat warn-shsgr; exit 1 ) - ./choose clr tryshsgr hasshsgr.h1 hasshsgr.h2 > hasshsgr.h - haswaitp.h: choose compile haswaitp.h1 haswaitp.h2 load trywaitp.c ./choose cl trywaitp haswaitp.h1 haswaitp.h2 > haswaitp.h @@ -292,9 +281,6 @@ pathexec_run.o: compile env.h error.h gen_alloc.h pathexec.h \ pathexec_run.c str.h stralloc.h ./compile pathexec_run.c -prot.o: compile hasshsgr.h prot.c prot.h - ./compile prot.c - readclose.o: compile error.h gen_alloc.h readclose.c readclose.h \ stralloc.h ./compile readclose.c @@ -372,7 +358,7 @@ subgetopt.o: compile subgetopt.c subgetopt.h ./compile subgetopt.c sysdeps: compile direntry.h hasflock.h hasmkffo.h hassgact.h \ -hassgprm.h hasshsgr.h haswaitp.h iopause.h load select.h systype \ +hassgprm.h haswaitp.h iopause.h load select.h systype \ uint64.h reboot_system.h uw_tmp.h socket.lib rm -f sysdeps cat systype compile load socket.lib >>sysdeps @@ -385,7 +371,6 @@ uint64.h reboot_system.h uw_tmp.h socket.lib grep sysdep iopause.h >>sysdeps grep sysdep hasmkffo.h >>sysdeps grep sysdep hasflock.h >>sysdeps - grep sysdep hasshsgr.h >>sysdeps grep sysdep reboot_system.h >>sysdeps grep sysdep uw_tmp.h >>sysdeps cat sysdeps @@ -444,7 +429,7 @@ buffer_get.o buffer_put.o buffer_read.o buffer_write.o coe.o env.o \ error.o error_str.o fd_copy.o fd_move.o fifo.o lock_ex.o lock_exnb.o \ makelib ndelay_off.o ndelay_on.o open_append.o open_read.o \ open_trunc.o open_write.o openreadclose.o pathexec_env.o \ -pathexec_run.o prot.o readclose.o seek_set.o sgetopt.o sig.o \ +pathexec_run.o readclose.o seek_set.o sgetopt.o sig.o \ sig_block.o sig_catch.o sig_pause.o stralloc_cat.o stralloc_catb.o \ stralloc_cats.o stralloc_eady.o stralloc_opyb.o stralloc_opys.o \ stralloc_pend.o strerr_die.o strerr_sys.o subgetopt.o wait_nohang.o \ @@ -454,7 +439,7 @@ wait_pid.o coe.o env.o error.o error_str.o fd_copy.o fd_move.o fifo.o lock_ex.o \ lock_exnb.o ndelay_off.o ndelay_on.o open_append.o open_read.o \ open_trunc.o open_write.o openreadclose.o pathexec_env.o \ - pathexec_run.o prot.o readclose.o seek_set.o sgetopt.o sig.o \ + pathexec_run.o readclose.o seek_set.o sgetopt.o sig.o \ sig_block.o sig_catch.o sig_pause.o stralloc_cat.o stralloc_catb.o \ stralloc_cats.o stralloc_eady.o stralloc_opyb.o stralloc_opys.o \ stralloc_pend.o strerr_die.o strerr_sys.o subgetopt.o wait_nohang.o \ diff --git a/src/TARGETS b/src/TARGETS index 46981ce..d284854 100644 --- a/src/TARGETS +++ b/src/TARGETS @@ -49,8 +49,6 @@ byte_copy.o byte_cr.o byte_diff.o byte_rchr.o -chkshsgr -chkshsgr.o choose coe.o compile diff --git a/src/chkshsgr.c b/src/chkshsgr.c deleted file mode 100644 index a33403b..0000000 --- a/src/chkshsgr.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Public domain. */ - -#include <unistd.h> -#include <grp.h> - -int main() -{ - short x[4]; - - x[0] = x[1] = 0; - if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1); - _exit(0); -} diff --git a/src/chpst.c b/src/chpst.c index 2e62285..cb4e7a9 100644 --- a/src/chpst.c +++ b/src/chpst.c @@ -9,7 +9,6 @@ #include "strerr.h" #include "str.h" #include "uidgid.h" -#include "prot.h" #include "strerr.h" #include "scan.h" #include "fmt.h" @@ -80,7 +79,7 @@ void suidgid(char *user, unsigned int ext) { } if (setgroups(ugid.gids, ugid.gid) == -1) fatal("unable to setgroups"); if (setgid(*ugid.gid) == -1) fatal("unable to setgid"); - if (prot_uid(ugid.uid) == -1) fatal("unable to setuid"); + if (setuid(ugid.uid) == -1) fatal("unable to setuid"); } void euidgid(char *user, unsigned int ext) { diff --git a/src/prot.c b/src/prot.c deleted file mode 100644 index a617a53..0000000 --- a/src/prot.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Public domain. */ - -#include <unistd.h> -#include <grp.h> -#include "hasshsgr.h" -#include "prot.h" - -int prot_gid(int gid) -{ -#ifdef HASSHORTSETGROUPS - short x[2]; - x[0] = gid; x[1] = 73; /* catch errors */ - if (setgroups(1,x) == -1) return -1; -#else - if (setgroups(1,&gid) == -1) return -1; -#endif - return setgid(gid); /* _should_ be redundant, but on some systems it isn't */ -} - -int prot_uid(int uid) -{ - return setuid(uid); -} diff --git a/src/prot.h b/src/prot.h deleted file mode 100644 index 2e5cb81..0000000 --- a/src/prot.h +++ /dev/null @@ -1,9 +0,0 @@ -/* Public domain. */ - -#ifndef PROT_H -#define PROT_H - -extern int prot_gid(int); -extern int prot_uid(int); - -#endif diff --git a/src/tryshsgr.c b/src/tryshsgr.c deleted file mode 100644 index 1bb5f61..0000000 --- a/src/tryshsgr.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Public domain. */ - -#include <unistd.h> -#include <grp.h> - -int main() -{ - short x[4]; - - x[0] = x[1] = 1; - if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1); - - if (getgroups(1,x) == -1) _exit(1); - if (x[1] != 1) _exit(1); - x[1] = 2; - if (getgroups(1,x) == -1) _exit(1); - if (x[1] != 2) _exit(1); - _exit(0); -} |