summaryrefslogtreecommitdiff
path: root/sysutils/coreutils/patches/patch-ad
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/coreutils/patches/patch-ad')
-rw-r--r--sysutils/coreutils/patches/patch-ad49
1 files changed, 49 insertions, 0 deletions
diff --git a/sysutils/coreutils/patches/patch-ad b/sysutils/coreutils/patches/patch-ad
new file mode 100644
index 00000000000..d4d811ef193
--- /dev/null
+++ b/sysutils/coreutils/patches/patch-ad
@@ -0,0 +1,49 @@
+$NetBSD: patch-ad,v 1.1 2005/03/21 14:44:08 tv Exp $
+
+--- src/su.c.orig Wed Jan 21 17:27:02 2004
++++ src/su.c
+@@ -141,6 +141,12 @@
+ /* The user to become if none is specified. */
+ #define DEFAULT_USER "root"
+
++#ifdef __INTERIX
++# include <interix/security.h>
++# undef DEFAULT_USER
++# define DEFAULT_USER (strdup(getpwuid(197108)->pw_name))
++#endif
++
+ char *crypt ();
+ char *getpass ();
+ char *getusershell ();
+@@ -291,9 +297,13 @@ correct_password (const struct passwd *p
+ error (0, 0, _("getpass: cannot open /dev/tty"));
+ return 0;
+ }
++#ifdef __INTERIX
++ return setuser (pw->pw_name, unencrypted, SU_CHECK) == 0;
++#else
+ encrypted = crypt (unencrypted, correct);
+ memset (unencrypted, 0, strlen (unencrypted));
+ return strcmp (encrypted, correct) == 0;
++#endif
+ }
+
+ /* Update `environ' for the new shell based on PW, with SHELL being
+@@ -343,6 +353,9 @@ modify_environment (const struct passwd
+ static void
+ change_identity (const struct passwd *pw)
+ {
++#ifdef __INTERIX
++ setuser (pw->pw_name, NULL, SU_COMPLETE);
++#else
+ #ifdef HAVE_INITGROUPS
+ errno = 0;
+ if (initgroups (pw->pw_name, pw->pw_gid) == -1)
+@@ -353,6 +366,7 @@ change_identity (const struct passwd *pw
+ error (EXIT_FAIL, errno, _("cannot set group id"));
+ if (setuid (pw->pw_uid))
+ error (EXIT_FAIL, errno, _("cannot set user id"));
++#endif
+ }
+
+ /* Run SHELL, or DEFAULT_SHELL if SHELL is empty.