summaryrefslogtreecommitdiffstats
path: root/sysif.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-05-02 21:09:19 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-05-02 21:09:19 -0700
commit94c4ac621f23e55b42f10d4cba920f2c7580005e (patch)
tree769051da2c54b0e9cca04b798b5129b4272bfaac /sysif.h
parent112aa0b16bcc53b06633dfb9878194f6d59ada4d (diff)
downloadtxr-94c4ac621f23e55b42f10d4cba920f2c7580005e.tar.gz
txr-94c4ac621f23e55b42f10d4cba920f2c7580005e.tar.bz2
txr-94c4ac621f23e55b42f10d4cba920f2c7580005e.zip
Implement setgid script support.
TXR now notices that it's running setgid, and implements setgid logic for scripts. * sysif.c (orig_egid, real_gid, is_setgid): New static variables. (repress_privilege): Treat real and effective group ID similarly to user ID. Save them in global variables, and set the is_setgid flag. (drop_privilege): Drop setgid privilege similarly to setuid. Operate selectively: if neither setuid nor setgid is in effect, do nothing, but if just one is in effect, don't do anything for the other. (simulate_setuid): Function renamed to simulate_setuid_setgid. A small change is made here: if the fstat fails, just drop privilege, don't abort. Implement setgid operation independently of setuid. The is_setgid and is_setuid flags are manipulated here now to get the drop_privileges function to selectively drop setuid if we are running a script which is only segid, or drop setgid if we are running a setuid only script. * sysif.h (simulate_setuid): Declaration name change to simulate_setuid_setgid. * txr.c (txr_main): Follow rename of simulate_setuid. * txr.1: SETUID OPERATION section changed to SETUID/SETGID operation, and setgid description worked into the text.
Diffstat (limited to 'sysif.h')
-rw-r--r--sysif.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysif.h b/sysif.h
index 99cb3ac0..093e4152 100644
--- a/sysif.h
+++ b/sysif.h
@@ -56,10 +56,10 @@ val stdio_fseek(FILE *, val, int whence);
#if HAVE_GETEUID
void repress_privilege(void);
void drop_privilege(void);
-void simulate_setuid(val open_script);
+void simulate_setuid_setgid(val open_script);
#else
INLINE void repress_privilege(void) { }
INLINE void drop_privilege(void) { }
-INLINE void simulate_setuid(val open_script) { }
+INLINE void simulate_setuid_setgid(val open_script) { }
#endif
void sysif_init(void);