[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch for seteuid/setegid
Hello!
Here is a patch that implements Pseteuid()/Psetegid(), which are needed
for an nfs daemon to do access checking (and probably for a lot of other
things). So I would like this patch making its way into the next release
of mint.
diff -ur old/dos.c ./dos.c
--- old/dos.c Fri May 6 23:46:04 1994
+++ ./dos.c Sat May 7 00:02:34 1994
@@ -208,6 +208,31 @@
return EACCDN;
}
+
+/* uk: set effective uid/gid but leave the real uid/gid unchanged. */
+long ARGS_ON_STACK
+p_seteuid(id)
+ int id;
+{
+ if (curproc->euid == 0 || curproc->ruid == id) {
+ curproc->euid = id;
+ return id;
+ }
+ return EACCDN;
+}
+
+long ARGS_ON_STACK
+p_setegid(id)
+ int id;
+{
+ if (curproc->euid == 0 || curproc->egid == 0 || curproc->rgid == id) {
+ curproc->egid = id;
+ return id;
+ }
+ return EACCDN;
+}
+
+
/*
* a way to get/set process-specific user information. the user information
* longword is set to "arg", unless arg is -1. In any case, the old
@@ -623,4 +648,6 @@
dos_tab[0x13e] = p_sigintr;
dos_tab[0x13f] = s_uptime;
dos_tab[0x142] = d_xreaddir;
+ dos_tab[0x143] = p_seteuid;
+ dos_tab[0x144] = p_setegid;
}
diff -ur old/proto.h ./proto.h
--- old/proto.h Fri May 6 23:55:06 1994
+++ ./proto.h Fri May 6 23:56:02 1994
@@ -78,6 +78,8 @@
long ARGS_ON_STACK p_getegid P_((void));
long ARGS_ON_STACK p_setuid P_((int id));
long ARGS_ON_STACK p_setgid P_((int id));
+long ARGS_ON_STACK p_seteuid P_((int id));
+long ARGS_ON_STACK p_setegid P_((int id));
long ARGS_ON_STACK p_usrval P_((long arg));
long ARGS_ON_STACK p_umask P_((unsigned mode));
long ARGS_ON_STACK p_domain P_((int arg));
Regards,
Ulrich
p.s.: Thorsten, sorry, but I think You have to choose some other function
numbers for Your patch :)
--
+---------------+----------------------------+-----------------------+
| Ulrich Kuehn | Internet: | Life is uncertain -- |
| Cand.Math.Inf | kuehn@math.uni-muenster.de | eat the dessert first |
+---------------+----------------------------+-----------------------+