diff options
Diffstat (limited to 'login/programs')
-rw-r--r-- | login/programs/request.c | 20 | ||||
-rw-r--r-- | login/programs/utmpd.c | 10 | ||||
-rw-r--r-- | login/programs/utmpd.h | 7 |
3 files changed, 18 insertions, 19 deletions
diff --git a/login/programs/request.c b/login/programs/request.c index d2c12e68cf..5e6bfa19cf 100644 --- a/login/programs/request.c +++ b/login/programs/request.c @@ -182,12 +182,8 @@ do_setutent (client_connection *connection) setutent_request *request; setutent_reply reply; + /* The request size varies, so don't check it. */ request = (setutent_request *)connection->read_base; - if (request->header.size != sizeof (setutent_request)) - { - warning (EINVAL, "invalid request size"); - return -1; - } /* Initialize reply. */ reply.header.version = UTMPD_VERSION; @@ -195,7 +191,8 @@ do_setutent (client_connection *connection) reply.header.type = UTMPD_REQ_SETUTENT; /* Select database. */ - if (!strncmp (request->file, _PATH_UTMP, sizeof request->file)) + if (!strncmp (request->file, _PATH_UTMP, + request->header.size - sizeof (setutent_request))) connection->database = utmp_db; else { @@ -450,7 +447,7 @@ do_pututline (client_connection *connection) goto return_error; } - if (connection->database == NULL || connection->position == -1) + if (connection->database == NULL) { errno = ESRCH; goto return_error; @@ -520,12 +517,8 @@ do_updwtmp (client_connection *connection) updwtmp_reply reply; utmp_database *database; + /* The request size varies, so don't check it. */ request = (updwtmp_request *)connection->read_base; - if (request->header.size != sizeof (updwtmp_request)) - { - warning (EINVAL, "invalid request size"); - return -1; - } /* Initialize reply. */ reply.header.version = UTMPD_VERSION; @@ -539,7 +532,8 @@ do_updwtmp (client_connection *connection) } /* Select database. */ - if (!strncmp (request->file, _PATH_UTMP, sizeof request->file)) + if (!strncmp (request->file, _PATH_UTMP, + request->header.size - sizeof (updwtmp_request))) database = utmp_db; else { diff --git a/login/programs/utmpd.c b/login/programs/utmpd.c index ca310a21de..3c8d626a84 100644 --- a/login/programs/utmpd.c +++ b/login/programs/utmpd.c @@ -134,8 +134,9 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ usage (EXIT_SUCCESS); signal (SIGINT, termination_handler); + signal (SIGQUIT, termination_handler); signal (SIGTERM, termination_handler); - + /* Check if we are already running. */ if (check_pid (_PATH_UTMPDPID)) error (EXIT_FAILURE, 0, "already running"); @@ -168,8 +169,13 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ if (write_pid (_PATH_UTMPDPID) < 0) warning (errno, "%s", _PATH_UTMPDPID); - } + /* Ignore job control signals. */ + signal (SIGTTOU, SIG_IGN); + signal (SIGTTIN, SIG_IGN); + signal (SIGTSTP, SIG_IGN); + } + /* Drop priviliges. */ drop_priviliges (); diff --git a/login/programs/utmpd.h b/login/programs/utmpd.h index 8fbc33c923..ef92a1490b 100644 --- a/login/programs/utmpd.h +++ b/login/programs/utmpd.h @@ -22,7 +22,6 @@ /* This is an *internal* header. */ -#include <limits.h> #include <stddef.h> #include <utmp.h> @@ -68,7 +67,7 @@ typedef struct { request_header header; /* File to use. */ - char file[_POSIX_PATH_MAX + 1]; + char file[0]; } setutent_request; typedef struct @@ -100,10 +99,10 @@ typedef struct typedef struct { request_header header; - /* File to use. */ - char file[_POSIX_PATH_MAX + 1]; /* Entry to write. */ struct utmp utmp; + /* File to use. */ + char file[0]; } updwtmp_request; |