* Add fix for Debian bug #536574 -- Can be enabled by -DACCTON_OFF
* Add helper program fstab-decode to make it easier to handle /etc/mtab content. Patch by Miloslav Trmac and Fedora. * Add fix for Debian bug #335023 - Make sure TERM is set on FreeBSD. * Add fix for Debian bug #374038 - Make it clear that shutdown -c can only cancel a waiting shutdown, not an active one. * Add not to pidof manual page about the use of readlink(2). Patch by Bill Nottingham and Fedora. * Add changes for Debian bug #68621 - Add PAM support for programs spawned by init on the console like sulogin. Based on patch by Topi Miettinen.
This commit is contained in:
42
src/init.c
42
src/init.c
@@ -53,11 +53,10 @@
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
#include <selinux/selinux.h>
|
||||
#include <sys/mount.h>
|
||||
# include <selinux/selinux.h>
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __i386__
|
||||
# ifdef __GLIBC__
|
||||
/* GNU libc 2.x */
|
||||
@@ -71,6 +70,11 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_PAM
|
||||
# include <security/pam_appl.h>
|
||||
# include <security/pam_misc.h>
|
||||
#endif
|
||||
|
||||
#include "init.h"
|
||||
#include "initreq.h"
|
||||
#include "paths.h"
|
||||
@@ -746,6 +750,16 @@ void console_stty(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD_kernel__
|
||||
/*
|
||||
* The kernel of FreeBSD expects userland to set TERM. Usually, we want
|
||||
* "cons25". Later, gettys might disagree on this (i.e. we're not using
|
||||
* syscons) but some boot scripts, like /etc/init.d/xserver-xorg, still
|
||||
* need a non-dumb terminal.
|
||||
*/
|
||||
putenv ("TERM=cons25");
|
||||
#endif
|
||||
|
||||
(void) tcgetattr(fd, &tty);
|
||||
|
||||
tty.c_cflag &= CBAUD|CBAUDEX|CSIZE|CSTOPB|PARENB|PARODD;
|
||||
@@ -902,6 +916,20 @@ void init_freeenv(char **e)
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_PAM
|
||||
static pam_handle_t *pamh = NULL;
|
||||
static const struct pam_conv conv = { misc_conv, NULL };
|
||||
# define PAM_FAIL_CHECK(func, args...) \
|
||||
{ \
|
||||
const int __ret = (func)(args); \
|
||||
if (__ret != PAM_SUCCESS) { \
|
||||
initlog(L_VB, "%s", pam_strerror(pamh, __ret)); \
|
||||
pam_end(pamh, __ret); \
|
||||
exit(1); \
|
||||
} \
|
||||
}
|
||||
#endif /* USE_PAM */
|
||||
|
||||
/*
|
||||
* Fork and execute.
|
||||
*
|
||||
@@ -1031,6 +1059,14 @@ int spawn(CHILD *ch, int *res)
|
||||
|
||||
sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||
|
||||
#ifdef USE_PAM
|
||||
PAM_FAIL_CHECK(pam_start, "init", "root" , &conv, &pamh);
|
||||
PAM_FAIL_CHECK(pam_set_item, pamh, PAM_TTY, console_dev);
|
||||
PAM_FAIL_CHECK(pam_acct_mgmt, pamh, PAM_SILENT);
|
||||
PAM_FAIL_CHECK(pam_open_session, pamh, PAM_SILENT);
|
||||
PAM_FAIL_CHECK(pam_setcred, pamh, PAM_ESTABLISH_CRED|PAM_SILENT);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Update utmp/wtmp file prior to starting
|
||||
* any child. This MUST be done right here in
|
||||
|
||||
Reference in New Issue
Block a user