bugzilla-daemon at bugzilla.mindrot.org
2009-May-13 19:58 UTC
[Bug 1597] New: During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597
Summary: During ssh login, the motd may not appear
Product: Portable OpenSSH
Version: 5.2p1
Platform: ix86
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: sshd
AssignedTo: unassigned-bugs at mindrot.org
ReportedBy: john.ata at baesystems.com
Created an attachment (id=1637)
--> (http://bugzilla.mindrot.org/attachment.cgi?id=1637)
Flushed pending output such as motd before execv of shell
In do_login (session.c), the routine do_motd() is called that writes to
the stdout stream. Apparently, it may have been assumed that stdout
was line buffered because it was a pseudo terminal. Even though stdio
is indeed a terminal, this may not be the correct assumption. The
following sequence of events can occur:
1) Forked child "rexecs" sshd in main() with stdout pointing to a
non-tty device (accepted socket).
2) Because the stdout stream is not a terminal, the libc startup code
run immediately in the execed process will cause the stdout stream to
be fully buffered.
3) After some processing, do_exec_pty (session.c) is called which dup2
the the psedudo tty to fd 1. The stdio buffering mode for the stdout
stream is not affected and is still fully buffered even though it is
now a terminal.
4) Process calls do_motd and calls fputs to the stdout stream for the
motd. The data is now buffered but is not displayed even though it is
a terminal.
5) Process execs the shell. Since the stdout stream is now a terminal,
the startup code in libc will cause the stdout stream to be line
buffered. From this point forward, everything is ok. However, the
buffered data from the motd will will lost.
Suggest a fflush(NULL) be called before the execv of the shell or
alternatively after do_motd writes to stdout. Attached patch does the
former.
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-May-13 20:02 UTC
[Bug 1597] During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597
John Ata <john.ata at baesystems.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |john.ata at baesystems.com
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-May-15 01:03 UTC
[Bug 1597] During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597 --- Comment #1 from John Ata <john.ata at baesystems.com> 2009-05-15 11:03:58 --- Additional info: I am using uClibc rather than glibc. Apparently glibc forces the stream to line buffer mode on the first I/O if it is a terminal so when the loginmsg or motd is printed in step 4, even though it is fully buffered before the I/O, it is switched over during the stdio call such as printf or fputs causing the output to be flushed. However, uClibc does not do this which explains the problem reported. -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-May-15 23:12 UTC
[Bug 1597] During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597
John Ata <john.ata at baesystems.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #1637|0 |1
is obsolete| |
--- Comment #2 from John Ata <john.ata at baesystems.com> 2009-05-16
09:12:38 ---
Created an attachment (id=1638)
--> (http://bugzilla.mindrot.org/attachment.cgi?id=1638)
Flushed pending output so motd is not lost
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-May-15 23:16 UTC
[Bug 1597] During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597
John Ata <john.ata at baesystems.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #1638|0 |1
is obsolete| |
--- Comment #3 from John Ata <john.ata at baesystems.com> 2009-05-16
09:16:09 ---
Created an attachment (id=1639)
--> (http://bugzilla.mindrot.org/attachment.cgi?id=1639)
Flushed pending output so motd is not lost
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-Sep-09 00:54 UTC
[Bug 1597] During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #1639|0 |1
is obsolete| |
--- Comment #4 from Damien Miller <djm at mindrot.org> 2009-09-09 10:54:40
EST ---
Created an attachment (id=1694)
flush just before exec()
Does this work? It delays the flush until just before we perform an
exec
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-Sep-09 00:55 UTC
[Bug 1597] During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597
Darren Tucker <dtucker at zip.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #1694| |ok+
Flag| |
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-Sep-09 15:52 UTC
[Bug 1597] During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597 --- Comment #5 from John Ata <john.ata at baesystems.com> 2009-09-10 01:52:36 EST --- (In reply to comment #4)> Does this work? It delays the flush until just before we perform an > execWorks fine, thanks! -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-Oct-06 04:47 UTC
[Bug 1597] During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |djm at mindrot.org
Blocks| |1626
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #6 from Damien Miller <djm at mindrot.org> 2009-10-06 15:47:10
EST ---
fix committed, will be in openssh-5.4
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2010-Mar-25 23:51 UTC
[Bug 1597] During ssh login, the motd may not appear
https://bugzilla.mindrot.org/show_bug.cgi?id=1597
Darren Tucker <dtucker at zip.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--- Comment #7 from Darren Tucker <dtucker at zip.com.au> 2010-03-26
10:51:51 EST ---
With the release of 5.4p1, this bug is now considered closed.
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.