New upstream version 4.15.3

This commit is contained in:
Chris Hofstaedtler
2024-07-06 16:53:58 +02:00
parent e8b8d7a84b
commit 9f68246a01
10615 changed files with 2869 additions and 6456 deletions
+1
View File
@@ -489,6 +489,7 @@ EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
+1 -1
View File
@@ -44,6 +44,6 @@ int main(int argc, char *argv[])
printf("%d: %s %lu %lu\n", i, owner,
ranges[i].start, ranges[i].count);
}
subid_free(ranges);
free(ranges);
return 0;
}
+71 -12
View File
@@ -85,6 +85,11 @@ static struct lastlog ll;
static bool pflg = false;
static bool fflg = false;
#ifdef RLOGIN
static bool rflg = false;
#else /* RLOGIN */
#define rflg false
#endif /* !RLOGIN */
static bool hflg = false;
static bool preauth_flag = false;
@@ -129,6 +134,7 @@ static void exit_handler (int);
* usage - print login command usage and exit
*
* login [ name ]
* login -r hostname (for rlogind)
* login -h hostname (for telnetd, etc.)
* login -f name (for pre-authenticated login: datakit, xterm, etc.)
*/
@@ -139,6 +145,9 @@ static void usage (void)
exit (1);
}
fprintf (stderr, _(" %s [-p] [-h host] [-f name]\n"), Prog);
#ifdef RLOGIN
fprintf (stderr, _(" %s [-p] -r host\n"), Prog);
#endif /* RLOGIN */
exit (1);
}
@@ -262,7 +271,7 @@ static void process_flags (int argc, char *const *argv)
/*
* Check the flags for proper form. Every argument starting with
* "-" must be exactly two characters long. This closes all the
* clever telnet, and getty holes.
* clever rlogin, telnet, and getty holes.
*/
for (arg = 1; arg < argc; arg++) {
if (argv[arg][0] == '-' && strlen (argv[arg]) > 2) {
@@ -289,6 +298,13 @@ static void process_flags (int argc, char *const *argv)
hostname = optarg;
reason = PW_TELNET;
break;
#ifdef RLOGIN
case 'r':
rflg = true;
hostname = optarg;
reason = PW_RLOGIN;
break;
#endif /* RLOGIN */
case 'p':
pflg = true;
break;
@@ -297,11 +313,21 @@ static void process_flags (int argc, char *const *argv)
}
}
#ifdef RLOGIN
/*
* Neither -h nor -f should be combined with -r.
*/
if (rflg && (hflg || fflg)) {
usage ();
}
#endif /* RLOGIN */
/*
* Allow authentication bypass only if real UID is zero.
*/
if ((fflg || hflg) && !amroot) {
if ((rflg || fflg || hflg) && !amroot) {
fprintf (stderr, _("%s: Permission denied.\n"), Prog);
exit (1);
}
@@ -316,6 +342,11 @@ static void process_flags (int argc, char *const *argv)
++optind;
}
#ifdef RLOGIN
if (rflg && (NULL != username)) {
usage ();
}
#endif /* RLOGIN */
if (fflg && (NULL == username)) {
usage ();
}
@@ -443,6 +474,7 @@ static /*@observer@*/const char *get_failent_user (/*@returned@*/const char *use
* the flags which login supports are
*
* -p - preserve the environment
* -r - perform autologin protocol for rlogin
* -f - do not perform authentication, user is preauthenticated
* -h - the name of the remote host
*/
@@ -473,6 +505,9 @@ int main (int argc, char **argv)
# if defined(ENABLE_LASTLOG)
char ptime[80];
# endif
#endif
#if defined(RLOGIN)
char term[128] = "";
#endif
/*
@@ -524,7 +559,7 @@ int main (int argc, char **argv)
is_console = console (tty);
#endif
if (hflg) {
if (rflg || hflg) {
/*
* Add remote hostname to the environment. I think
* (not sure) I saw it once on Irix. --marekm
@@ -537,6 +572,23 @@ int main (int argc, char **argv)
if (hflg) {
reason = PW_RLOGIN;
}
#ifdef RLOGIN
if (rflg) {
size_t max_size;
max_size = login_name_max_size();
assert (NULL == username);
username = XMALLOC(max_size, char);
username[max_size - 1] = '\0';
if (do_rlogin(hostname, username, max_size, term, sizeof(term)))
{
preauth_flag = true;
} else {
free (username);
username = NULL;
}
}
#endif /* RLOGIN */
OPENLOG (Prog);
@@ -571,11 +623,18 @@ int main (int argc, char **argv)
}
}
/* preserve TERM from getty */
if (!pflg) {
tmp = getenv ("TERM");
if (NULL != tmp) {
addenv ("TERM", tmp);
#ifdef RLOGIN
if (term[0] != '\0') {
addenv ("TERM", term);
} else
#endif /* RLOGIN */
{
/* preserve TERM from getty */
if (!pflg) {
tmp = getenv ("TERM");
if (NULL != tmp) {
addenv ("TERM", tmp);
}
}
}
@@ -585,7 +644,7 @@ int main (int argc, char **argv)
set_env (argc - optind, &argv[optind]);
}
if (hflg) {
if (rflg || hflg) {
cp = hostname;
} else if ((host != NULL) && (host[0] != '\0')) {
cp = host;
@@ -895,7 +954,7 @@ int main (int argc, char **argv)
}
/*
* The -f flag provides a name which has already
* The -r and -f flags provide a name which has already
* been authenticated by some server.
*/
if (preauth_flag) {
@@ -984,8 +1043,8 @@ int main (int argc, char **argv)
(void) puts (_("Login incorrect"));
/* allow only one attempt with -f */
if (fflg || (retries <= 0)) {
/* allow only one attempt with -r or -f */
if (rflg || fflg || (retries <= 0)) {
closelog ();
exit (1);
}