summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorjp161948 <none@none>2007-09-10 12:53:43 -0700
committerjp161948 <none@none>2007-09-10 12:53:43 -0700
commit37286d25632f789872ec9e6c8c659dd52a1f44e9 (patch)
treece26e80be3ad91f21c9794dd41ef0a6e7a6bfaf7 /usr/src
parent92ba710950bf6ee35de67e1e0b7f20ec9e528106 (diff)
downloadillumos-gate-37286d25632f789872ec9e6c8c659dd52a1f44e9.tar.gz
6598158 ssh compatibility flag SSH_BUG_DFLT_CLNT_EXIT_0 wasn't a good idea
6598255 sshd may print bogus error messages in lastlog_get_entry()
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/ssh/include/compat.h3
-rw-r--r--usr/src/cmd/ssh/libssh/common/compat.c4
-rw-r--r--usr/src/cmd/ssh/ssh/clientloop.c2
-rw-r--r--usr/src/cmd/ssh/sshd/loginrec.c36
4 files changed, 25 insertions, 20 deletions
diff --git a/usr/src/cmd/ssh/include/compat.h b/usr/src/cmd/ssh/include/compat.h
index e27b3b93fc..930bb08956 100644
--- a/usr/src/cmd/ssh/include/compat.h
+++ b/usr/src/cmd/ssh/include/compat.h
@@ -34,7 +34,7 @@ extern "C" {
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -71,7 +71,6 @@ extern "C" {
#define SSH_BUG_GSSAPI_BER 0x04000000
#define SSH_BUG_FIRSTKEX 0x08000000
-#define SSH_BUG_DFLT_CLNT_EXIT_0 0x10000000
#define SSH_BUG_GSSKEX_HOSTKEY 0x20000000
void enable_compat13(void);
diff --git a/usr/src/cmd/ssh/libssh/common/compat.c b/usr/src/cmd/ssh/libssh/common/compat.c
index a631b346ae..f63c6c0139 100644
--- a/usr/src/cmd/ssh/libssh/common/compat.c
+++ b/usr/src/cmd/ssh/libssh/common/compat.c
@@ -22,7 +22,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -101,10 +101,8 @@ compat_datafellows(const char *version)
"OpenSSH_3.8*", SSH_BUG_GSSKEX_HOSTKEY},
{ "OpenSSH*", 0 },
{ "Sun_SSH_1.0.*", SSH_BUG_NOREKEY|
- SSH_BUG_DFLT_CLNT_EXIT_0|
SSH_BUG_LOCALES_NOT_LANGTAGS},
{ "Sun_SSH_1.0*", SSH_BUG_NOREKEY|SSH_BUG_EXTEOF|
- SSH_BUG_DFLT_CLNT_EXIT_0|
SSH_BUG_LOCALES_NOT_LANGTAGS},
{ "*MindTerm*", 0 },
{ "2.1.0*", SSH_BUG_SIGBLOB|SSH_BUG_HMAC|
diff --git a/usr/src/cmd/ssh/ssh/clientloop.c b/usr/src/cmd/ssh/ssh/clientloop.c
index f112ac6d90..5979b6bac6 100644
--- a/usr/src/cmd/ssh/ssh/clientloop.c
+++ b/usr/src/cmd/ssh/ssh/clientloop.c
@@ -1029,8 +1029,6 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
escape_pending = 0;
last_was_cr = 1;
exit_status = -1;
- if (datafellows & SSH_BUG_DFLT_CLNT_EXIT_0)
- exit_status = 0;
stdin_eof = 0;
buffer_high = 64 * 1024;
connection_in = packet_get_connection_in();
diff --git a/usr/src/cmd/ssh/sshd/loginrec.c b/usr/src/cmd/ssh/sshd/loginrec.c
index aeee236659..66adaa3d65 100644
--- a/usr/src/cmd/ssh/sshd/loginrec.c
+++ b/usr/src/cmd/ssh/sshd/loginrec.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
@@ -1526,22 +1526,32 @@ int
lastlog_get_entry(struct logininfo *li)
{
struct lastlog last;
- int fd;
+ int fd, ret;
if (!lastlog_openseek(li, &fd, O_RDONLY))
- return 0;
-
- if (atomicio(read, fd, &last, sizeof(last)) != sizeof(last)) {
- (void) close(fd);
- log("lastlog_get_entry: Error reading from %s: %s",
+ return (0);
+
+ ret = atomicio(read, fd, &last, sizeof(last));
+ close(fd);
+
+ switch (ret) {
+ case 0:
+ memset(&last, '\0', sizeof(last));
+ /* FALLTHRU */
+ case sizeof(last):
+ lastlog_populate_entry(li, &last);
+ return (1);
+ case -1:
+ error("%s: Error reading from %s: %s", __func__,
LASTLOG_FILE, strerror(errno));
- return 0;
+ return (0);
+ default:
+ error("%s: Error reading from %s: Expecting %d, got %d",
+ __func__, LASTLOG_FILE, (int)sizeof(last), ret);
+ return (0);
}
- (void) close(fd);
-
- lastlog_populate_entry(li, &last);
-
- return 1;
+ /* NOTREACHED */
+ return (0);
}
#endif /* USE_LASTLOG */