Age | Commit message (Collapse) | Author |
|
The intent here seems to have been to ignore lines with too few
arguments to be valid, but since strtok() returns NULL at the end of the
string, if you only have "verb noun", you'd be falsely rejected.
Since we've kept a count anyway, just check the count.
|
|
|
|
|
|
|
|
|
|
|
|
I don't _think_ that can happen with the .dep files since they're
machine-generated, but the config files can and do contain empty lines
to aid readability.
(Not found on Android, so I haven't tested this, but the code already
even contained a special case for empty lines. I haven't touched the
/proc/modules loop because the kernel definitely isn't going to insert
empty lines, and that code _would_ need to be modified to cope with
empty lines, and since I can't test this, that would be not just
pointless but also irresponsible!)
|
|
The maximum unicode code point is 0x10ffff which is 21 bits.
|
|
|
|
|
|
|
|
|
|
I don't see the need for the separate buffer, and just using dprintf()
directly is less code. The only downside really is having to get the
right number of `%c`s in your format string.
|
|
|
|
|
|
|
|
|
|
mostly only safe to use behind a firewall or through a VPN these days.
|
|
Of course "x() { echo hello; } | tr e f; x" allows the pipe but not the call.
Ok, take out the union so you can && after a function declaration.
|
|
|
|
This got a bit out of hand. All I wanted to fix was the CR conversion to
get this part of https://tools.ietf.org/html/rfc854 right:
Therefore, the sequence "CR LF" must be treated as a single "new
line" character and used whenever their combined action is
intended; the sequence "CR NUL" must be used where a carriage
return alone is actually desired; and the CR character must be
avoided in other contexts. This rule gives assurance to systems
which must decide whether to perform a "new line" function or a
multiple-backspace that the TELNET stream contains a character
following a CR that will allow a rational decision.
But to understand the code well enough to do that, and to fix it so that
it works when IAC or CR sequences are split across multiple reads, I
ended up rewriting a lot:
* Add punctuation in help.
* Remove duplicated #include.
* Remove some unnecessary globals, enlarge the global buffers, and keep
state for correct IAC sequence processing across reads.
* Reduce code duplication and rewrite bits that made no sense.
* Handle entering/exiting raw mode more uniformly.
* Fix the prompt (the character count was wrong).
* Allow ^]^D (like BSD telnet) as well as ^]e to exit, and look less
like we crashed when doing so.
* Simplify the IAC sequence handling, but more importantly work
correctly when a sequence is split across multiple reads.
* Use more of the existing "x" functions from lib. (And remove code that
was duplicating what the "x" functions they'd just called had already
done.)
* Show "Connected to".
* Better signal handling.
I'm still not happy with TELOPT_ECHO and TELOPT_SGA in handle_wwdd(),
but don't (yet) understand them well enough to simplify them further. On
the bright side, I think TELOPT_NAWS is a lot clearer now.
It also occurs to me now I'm looking at the diff that although the IAC
output code is now better than it was, it probably still isn't pulling
its weight and might better be replaced by printf().
...but this patch has already gotten way out of hand!
|
|
After a network outage, a long-running telnetd was spinning trying to
read from a socket that was in TIME_WAIT. It's easy to reproduce this by
using the regular telnet client and typing ^]^D to exit abruptly.
I don't think these sockets should ever have been non-blocking, and we
want to give up on the client if we hit EOF. All of this needs
rewriting to be less complicated (and not use select(2)), but this seems
to be a minimal fix for the spin without harming normal usage (where by
"usage" I mean "testing the telnet client").
|
|
Handling utmp is login's job: telnetd should just pass the appropriate
option to login.
(I was investigating a different bug that caused telnetd to take 100%
CPU after a network outage and noticed an unexpected utmp fd. It turned
out to not be relevant to my actual problem, but it did remind me that
this utmp code isn't right in small details like that, but also in the
bigger picture: it's writing the wrong information, and only on logout,
not login. But rather than try to fix it, let's just let login do its
job.)
|
|
|
|
|
|
|
|
|
|
Cached $IFS value has to be per function context because local vars.
|
|
|
|
|
|
Remove cached blk/pout/urd and make TT.ff->blk always be populated instead
(like TT.ff, list is never empty), have current pipe (and block trailing)
redirections live in current TT.ff->blk.
Left in a bunch of commented debug printfs and a filehandle dump function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Noticed while using telnetd to manually test some telnet fixes: telnetd
would sometimes exit when I'd disconnect because it couldn't find pid 0
on its list of sessions.
I've not seen obscure exits because select() times out, but I've also
changed that `return` to an error_exit() so we'll at least know what's
happened if that ever occurs.
Also use <arpa/telnet.h> rather than manually #define'ing its constants,
use the FLAG() macro throughout, and xsetsockopt(). Don't pointlessly
set errno to 0 at the start of main and then never look at it again.
|
|
The kill(2) should be checking whether `pid` still exists, not the
process that wait(2) just told us has exited.
|
|
(fixes up some test suite tests).
|
|
I've been using toybox vi as a makeshift "less" lately. This patch
contains all the fixes I've made...
$ should go to the last character before the newline, not the newline.
Fix ^b and ^f, and ^e and ^y (which was mistakenly ^u before, which is
also a movement key, but half of ^d/^u, neither of which we actually
implement, and neither of which I've ever used myself --- I might have
large hands, but they're not _that_ large).
Fix the display of lines longer than 1024 characters.
Fix the display of the "~"s after the end of the file, and use VT100 dim
to make it a bit more obvious that they're not actually part of the
file. Also be a bit more consistent about \033 which is the most common
way to write \x1b in toybox.
Don't show the status while in ex mode.
Make what the status is showing a little less unclear by adding a "C"
for the byte offset and file size, and add a percentage (albeit one
based on bytes rather than lines).
Fix the flickering seen on updates with the usual stupid trick of
setting a large buffer.
Handle SIGWINCH.
Add support for Home/End/PageUp/PageDown.
Remove a bit of duplication around calls to draw_page().
|
|
Not fully wired up yet, probably a bunch of regressions.
|
|
Other dd implementations always show the status on exit, whether success
or failure. Fix that by using xsigatexit() (and clarify the comment for
that function a little, since it didn't previously address the "at exit"
part of its behavior at all).
This also fixes SIGUSR1 behavior so that we show the status immediately
rather than on the next trip round the read/write loop.
Tested with `dd of=/dev/full`, sending SIGUSR1 twice from another shell
(to see the status immediately each time, without exiting), then hitting
^C (to see the status and then exiting), then restarting dd and hitting
enter (to see a write error followed by the status before exiting).
Bug: https://issuetracker.google.com/177017283
|
|
I need to set up a test environment for this...
|
|
|
|
|
|
|
|
|
|
Remove STDIN_FILENO and use FLAG().
Use xsetspeed() rather than have a duplicate table.
Inline getty's print_prompt().
There's still a lot of cleanup needed here, in particular use of toybuf
and removal of the inappropriately-named HOSTNAME_SIZE (and ideally
sharing that logic with login(1) which already contains a better
implementation of it).
|