sh-utils i su
Arkadiusz Miśkiewicz
misiek w zsz2.starachowice.pl
Czw, 17 Gru 1998, 08:24:16 CET
Jak to w końcu będzie z su (z sh-utils) i /etc/security/limits.conf ?
Wymyślił ktoś patcha ?
--
+- Arkadiusz Miśkiewicz - Cron w irc.pl on #plug - misiek w misiek.eu.org -+
+ http://www.misiek.eu.org --- Poland --- SysAdm: zsz2.starachowice.pl +
+ Polish Linux Distribution Team Member - http://www.shadow.eu.org/PLD +
-------------- następna część ---------
diff -urN sh-utils-1.16.orig/src/su.c sh-utils-1.16/src/su.c
--- sh-utils-1.16.orig/src/su.c Tue Dec 15 19:35:19 1998
+++ sh-utils-1.16/src/su.c Tue Dec 15 19:37:25 1998
@@ -502,7 +502,7 @@
arguments. */
static void
-run_shell (const char *shell, const char *command, char **additional_args)
+run_shell (struct passwd *pw, const char *shell, const char *command, char **additional_args)
{
const char **args;
int argno = 1;
@@ -510,14 +510,19 @@
int child;
sigset_t ourset;
int status;
+ uid_t old_pw_uid;
+ old_pw_uid=geteuid();
+ seteuid(pw->pw_uid);
retval = pam_open_session(pamh,0);
+ seteuid(old_pw_uid);
if (retval != PAM_SUCCESS) {
fprintf (stderr, "could not open session\n");
exit (1);
}
child = fork();
if (child == 0) { /* child shell */
+ change_identity(pw);
pam_end(pamh, 0);
#endif
if (additional_args)
@@ -664,6 +669,7 @@
char *shell = 0;
struct passwd *pw;
struct passwd pw_copy;
+ uid_t old_pw_uid;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -774,9 +780,11 @@
}
modify_environment (pw, shell);
- change_identity (pw);
+ old_pw_uid=geteuid();
+ seteuid(pw->pw_uid);
if (simulate_login && chdir (pw->pw_dir))
error (0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
+ seteuid(old_pw_uid);
- run_shell (shell, command, additional_args);
+ run_shell (pw, shell, command, additional_args);
}
Więcej informacji o liście dyskusyjnej pld-devel-pl