diff options
Diffstat (limited to 'security/openssh/files/patch-an')
| -rw-r--r-- | security/openssh/files/patch-an | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/security/openssh/files/patch-an b/security/openssh/files/patch-an index 2c39339acaa0..9bbdf3348585 100644 --- a/security/openssh/files/patch-an +++ b/security/openssh/files/patch-an @@ -1,6 +1,6 @@ ---- sshd.c.orig Tue Dec 7 22:56:55 1999 -+++ sshd.c Tue Dec 7 22:58:36 1999 -@@ -24,6 +24,8 @@ +--- sshd.c.orig Fri Jan 7 01:32:03 2000 ++++ sshd.c Fri Jan 7 01:40:05 2000 +@@ -26,6 +26,8 @@ #include "servconf.h" #include "uidswap.h" #include "compat.h" @@ -9,7 +9,7 @@ #ifdef LIBWRAP #include <tcpd.h> -@@ -32,6 +34,16 @@ +@@ -34,6 +36,16 @@ int deny_severity = LOG_WARNING; #endif /* LIBWRAP */ @@ -26,7 +26,7 @@ #ifndef O_NOCTTY #define O_NOCTTY 0 #endif -@@ -118,6 +130,32 @@ +@@ -128,6 +140,32 @@ the private key. */ RSA *public_key; @@ -39,7 +39,7 @@ +const size_t MAGIC_CONNECTIONS_SIZE = 1; + +static __inline int -+magic_hash(struct sockaddr_in *sin) { ++magic_hash(struct sockaddr *sa) { + + return 0; +} @@ -59,17 +59,17 @@ /* Prototypes for various functions defined later in this file. */ void do_connection(); void do_authentication(char *user); -@@ -278,6 +316,7 @@ - extern char *optarg; +@@ -301,6 +339,7 @@ extern int optind; - int opt, aux, sock_in, sock_out, newsock, i, pid, on = 1; -+ int connections_per_period_exceeded = 0; + int opt, sock_in = 0, sock_out = 0, newsock, i, fdsetsz, pid, on = 1; + socklen_t fromlen; ++ int connections_per_period_exceeded = 0; int remote_major, remote_minor; int silentrsa = 0; - struct pollfd fds; -@@ -543,6 +582,12 @@ - /* Arrange SIGCHLD to be caught. */ - signal(SIGCHLD, main_sigchld_handler); + fd_set *fdset; +@@ -620,6 +659,12 @@ + fdsetsz = howmany(maxfd, NFDBITS) * sizeof(fd_mask); + fdset = (fd_set *)xmalloc(fdsetsz); + /* Initialize the magic_connections table. It's magical! */ + magic_connections = calloc(MAGIC_CONNECTIONS_SIZE, @@ -80,8 +80,8 @@ /* * Stay listening for connections until the system crashes or * the daemon is killed with a signal. -@@ -572,9 +617,31 @@ - error("accept: %.100s", strerror(errno)); +@@ -651,9 +696,31 @@ + error("newsock del O_NONBLOCK: %s", strerror(errno)); continue; } + if (options.connections_per_period != 0) { @@ -89,7 +89,7 @@ + struct magic_connection *mc; + + (void)gettimeofday(&connections_end, NULL); -+ mc = &magic_connections[magic_hash(&sin)]; ++ mc = &magic_connections[magic_hash(ai->ai_addr)]; + diff = timevaldiff(&mc->connections_begin, &connections_end); + if (diff.tv_sec >= options.connections_period) { + /* @@ -114,7 +114,7 @@ */ if (debug_flag) { /* -@@ -588,6 +655,12 @@ +@@ -667,6 +734,12 @@ sock_out = newsock; pid = getpid(); break; @@ -122,12 +122,12 @@ + log("Connection rate limit of %u/%us has been exceeded; " + "dropping connection from %s.", + options.connections_per_period, options.connections_period, -+ inet_ntoa(sin.sin_addr)); ++ ntop); + connections_per_period_exceeded = 0; } else { /* * Normal production daemon. Fork, and have -@@ -1065,6 +1138,14 @@ +@@ -1152,6 +1225,14 @@ return 0; } } @@ -142,7 +142,7 @@ /* We found no reason not to let this user try to log on... */ return 1; } -@@ -1100,6 +1181,9 @@ +@@ -1187,6 +1268,9 @@ pwcopy.pw_gid = pw->pw_gid; pwcopy.pw_dir = xstrdup(pw->pw_dir); pwcopy.pw_shell = xstrdup(pw->pw_shell); @@ -152,9 +152,9 @@ pw = &pwcopy; /* -@@ -1889,6 +1973,10 @@ - struct sockaddr_in from; - int fromlen; +@@ -1983,6 +2067,10 @@ + struct sockaddr_storage from; + socklen_t fromlen; struct pty_cleanup_context cleanup_context; +#ifdef LOGIN_CAP + login_cap_t *lc; @@ -163,7 +163,7 @@ /* Get remote host name. */ hostname = get_canonical_hostname(); -@@ -1953,6 +2041,12 @@ +@@ -2047,6 +2135,12 @@ /* Check if .hushlogin exists. */ snprintf(line, sizeof line, "%.200s/.hushlogin", pw->pw_dir); quiet_login = stat(line, &st) >= 0; @@ -176,7 +176,7 @@ /* * If the user has logged in before, display the time of last -@@ -1976,6 +2070,20 @@ +@@ -2070,6 +2164,20 @@ else printf("Last login: %s from %s\r\n", time_string, buf); } @@ -197,7 +197,7 @@ /* * Print /etc/motd unless a command was specified or printing * it was disabled in server options or login(1) will be -@@ -1984,14 +2092,22 @@ +@@ -2078,14 +2186,22 @@ */ if (command == NULL && options.print_motd && !quiet_login && !options.use_login) { @@ -221,7 +221,7 @@ /* Do common processing for the child, such as execing the command. */ do_child(command, pw, term, display, auth_proto, auth_data, ttyname); /* NOTREACHED */ -@@ -2127,7 +2243,8 @@ +@@ -2221,7 +2337,8 @@ const char *display, const char *auth_proto, const char *auth_data, const char *ttyname) { @@ -231,7 +231,7 @@ char buf[256]; FILE *f; unsigned int envsize, i; -@@ -2135,15 +2252,34 @@ +@@ -2229,15 +2346,34 @@ extern char **environ; struct stat st; char *argv[10]; @@ -271,7 +271,7 @@ } /* Set login name in the kernel. */ if (setlogin(pw->pw_name) < 0) -@@ -2153,6 +2289,13 @@ +@@ -2247,6 +2383,13 @@ /* Login(1) does this as well, and it needs uid 0 for the "-h" switch, so we let login(1) to this for us. */ if (!options.use_login) { @@ -285,7 +285,7 @@ if (getuid() == 0 || geteuid() == 0) { if (setgid(pw->pw_gid) < 0) { perror("setgid"); -@@ -2175,7 +2318,14 @@ +@@ -2269,7 +2412,14 @@ * Get the shell from the password data. An empty shell field is * legal, and means /bin/sh. */ @@ -300,7 +300,7 @@ #ifdef AFS /* Try to get AFS tokens for the local cell. */ -@@ -2199,7 +2349,12 @@ +@@ -2293,7 +2443,12 @@ child_set_env(&env, &envsize, "USER", pw->pw_name); child_set_env(&env, &envsize, "LOGNAME", pw->pw_name); child_set_env(&env, &envsize, "HOME", pw->pw_dir); @@ -313,17 +313,17 @@ snprintf(buf, sizeof buf, "%.200s/%.50s", _PATH_MAILDIR, pw->pw_name); -@@ -2289,6 +2444,9 @@ +@@ -2383,13 +2538,17 @@ */ endpwent(); - endhostent(); + +#ifdef LOGIN_CAP -+ login_close(lc); ++ login_close(lc); +#endif /* LOGIN_CAP */ - ++ /* * Close any extra open file descriptors so that we don\'t have them -@@ -2296,7 +2454,7 @@ + * hanging around in clients. Note that we want to do this after * initgroups, because at least on Solaris 2.3 it leaves file * descriptors open. */ @@ -332,7 +332,7 @@ close(i); /* Change current directory to the user\'s home directory. */ -@@ -2315,6 +2473,26 @@ +@@ -2408,6 +2567,26 @@ * in this order). */ if (!options.use_login) { |
