summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2021-06-02vi: make cursor positioning more vi compatibleRon Yorston
Commit 24effc7a3 (vi: cursor positioning after whole-line 'y') tried to save a few bytes by treating whole-line deletion the same as whole-line yank. If the deletion removed the last lines of the file the cursor was left beyond the end of the file. Revert the part of the commit related to whole-line deletion. Position the cursor on the first non-whitespace character of the line when whole lines are 'put'. function old new delta do_cmd 4759 4781 +22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 22/0) Total: 22 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-02tail: do not lose the tail of old file if new file (-F) is detectedDenys Vlasenko
function old new delta tail_main 1619 1645 +26 .rodata 103246 103250 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 30/0) Total: 30 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-02tail: fix typo in variable nameDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-02head,tail: trim --help textDenys Vlasenko
function old new delta packed_usage 33598 33560 -38 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-01udhcpc[6]: fix "untangle timeout and remaining lease" falloutDenys Vlasenko
As reported in bug 13776, before this fix the renew never times out. function old new delta udhcpc_main 2541 2585 +44 udhcpc6_main 2567 2558 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 44/-9) Total: 35 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-07login: permit change expired password wit PAMMario Abajo
Signed-off-by: Mario Abajo <marioabajo@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-05httpd: add comment about faster rejection of denied IPsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-05httpd: if no request was given at all, close the socket without generating ↵Denys Vlasenko
error page For one, an attacker can try to overload us by just opening and immediately closing tons of connections - reduce our work to the minimum for this case. function old new delta handle_incoming_and_exit 2172 2200 +28 .rodata 103225 103246 +21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 49/0) Total: 49 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-05httpd: no need to strcpy() when we only need to copy one byteDenys Vlasenko
function old new delta handle_incoming_and_exit 2161 2172 +11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-04httpd: avoid extra stat() calls for "GET /dirname/" caseDenys Vlasenko
function old new delta parse_conf 1325 1332 +7 handle_incoming_and_exit 2173 2161 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-12) Total: -5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-04httpd: avoid one stat() call for "GET /dirname" caseDenys Vlasenko
function old new delta handle_incoming_and_exit 2172 2173 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-04httpd: support HEAD requests even in !CGI configDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-04httpd: move proxy check before URL duplication and request type checkDenys Vlasenko
This makes proxy work for any type of requests. function old new delta handle_incoming_and_exit 2240 2172 -68 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-04httpd: cgi-bin support for DELETE, PUT, OPTIONS etc methodsAlexander Sack
function old new delta handle_incoming_and_exit 2217 2240 +23 static.request_POST - 5 +5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 28/0) Total: 28 bytes Signed-off-by: Alexander Sack <asac@pantacor.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-04vi: :wq/:x should warn if there are more files to editRon Yorston
':wq' or ':x' should issue a warning if there are more files to edit, unless they're followed by '!'. function old new delta colon 3911 3960 +49 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 49/0) Total: 49 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-04vi: cursor positioning after whole-line 'y'Ron Yorston
The 'y' command to yank text should leave the cursor at the start of the range. This mostly works correctly in BusyBox vi but not for whole-line yanks with backward motion, e.g. '2yk' to yank two lines backwards. In this case the cursor is left at the end of the range. Fix this by returning the actual range from find_range(). Cursor positioning following whole-line deletion is inconsistent between vim and traditional vi. For BusyBox vi chose the option that uses least code without being exactly compatible with either. Also, find_range() preserved the value of 'dot', the current cursor position. Since this isn't used by either caller of find_range() we can save a few bytes by not bothering. function old new delta do_cmd 4730 4759 +29 find_range 749 686 -63 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 29/-63) Total: -34 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-03decompress_gunzip: simplify ERR_RET bit clearingDenys Vlasenko
My gcc is in fact clever enough to do it itself, but let's be explicit Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-01vi: trivial code shrinkDenys Vlasenko
function old new delta get_input_line 178 176 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-01udhcpc[6]: fold perform_renew() into its only callerDenys Vlasenko
function old new delta udhcpc_main 2550 2541 -9 udhcpc6_main 2576 2567 -9 change_listen_mode 321 299 -22 .rodata 103294 103225 -69 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-109) Total: -109 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-05-01udhcpc[6]: untangle "timeout" and "remaining lease"; reduce min lease to 30 ↵Denys Vlasenko
seconds This allows to fix a problem that we wait for renew replies for up to half the lease (!!!) if they never come. Make it so that lease of 60 seconds is not "rounded up" to 120 seconds - set lower "sanity limit" to 30 seconds. After 3 failed renew attempts, switch to rebind. After this change, we can have more flexible choice of when to do the first renew - does not need to be equal to lease / 2. function old new delta udhcpc6_main 2568 2576 +8 .rodata 103339 103294 -45 udhcpc_main 2609 2550 -59 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 8/-104) Total: -96 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-30wget: allow HTTP 307/308 redirectsJeremy Lin
This resolves failures like wget: server returned error: HTTP/1.1 307 Temporary Redirect Signed-off-by: Jeremy Lin <jeremy.lin@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-30vi: fix empty line range regressionRon Yorston
Commit 7a8ceb4eb (vi: changes to line addresses for colon commands) was supposed to address the issue: When the last address is empty it should refer to the current line. This was intended to allow ranges of the form '1,' with an empty last address. It should have been expressed as: When the last address is empty *and the second last isn't* it should refer to the current line. Otherwise a command like ':w' only writes the current line resulting in serious loss of data. function old new delta colon 3906 3911 +5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 5/0) Total: 5 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-28tls: code shrink in curve 25519Denys Vlasenko
function old new delta curve25519 832 849 +17 curve_x25519_compute_pubkey_and_premaster 74 71 -3 static.basepoint9 32 - -32 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 17/-35) Total: -18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-28vi: expand '%' and '#' in colon commandsRon Yorston
Track the current and alternate filenames. The placeholders '%' and '#' can be used in arguments to colon commands to represent the current and alternate filenames respectively. Backslash can be used to allow literal '%' and '#' characters to be entered. This feature is controlled by the configuration option FEATURE_VI_COLON_EXPAND. function old new delta expand_args - 198 +198 colon 3751 3927 +176 update_filename - 70 +70 init_filename - 48 +48 .rodata 105218 105239 +21 get_one_char 115 124 +9 edit_file 835 838 +3 do_cmd 4724 4727 +3 init_text_buffer 190 172 -18 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 5/1 up/down: 528/-18) Total: 510 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-28vi: fix buffer overrun; code shrinkRon Yorston
It was possible for get_input_line() to store its NUL terminator one character beyond the end of its buffer. Code shrink in colon(): - Certain colon commands can be matched exactly, as any shorter string would be matched earlier, e.g. ':wq' versus ':write'. - Command matching is now case sensitive so there's no need to check for 'N' or 'Q' suffixes. - Rewrite how commands and arguments are split. function old new delta colon 3848 3751 -97 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-97) Total: -97 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-28vi: improvements to ':read' commandRon Yorston
Improvements to ':read': - When a file is read into the current buffer the cursor should be placed on the first line read. - If invoked without supplying a filename the current filename should be used. This is similar to how ':edit' works. - The code for ':edit' included an explicit check that the current filename was non-empty. Both vim and traditional vi accept non-empty filenames, only issuing an error message when an attempt to use such a name fails. - Allow undo of a file read. function old new delta file_insert 367 382 +15 colon 3841 3848 +7 .rodata 105236 105218 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 22/-18) Total: 4 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-28vi: preserve state when switching fileRon Yorston
When a new file is opened from an existing editing session the following details should be preserved: - the last command used; - the last character searched for on a line. function old new delta edit_file 849 835 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-14) Total: -14 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-28vi: 'ZZ' should warn if there are more files to editRon Yorston
When 'ZZ' was used to save the current file and more files were available to edit BusyBox vi immediately moved on to the next file. The correct behaviour is to issue a warning. function old new delta do_cmd 4673 4724 +51 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 51/0) Total: 51 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-28vi: saving unnamed file in readonly modeRon Yorston
Suppose vi is started with the command 'vi -R', that is, in readonly mode with no filename. Attempting to save the file with 'ZZ' or ':w' results in the message: '(null)' is read only Skip the code which prints this if no filename was provided, thus falling through to file_write() which gives the more helpful message 'No current filename'. function old new delta colon 3867 3874 +7 do_cmd 4668 4673 +5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 12/0) Total: 12 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-28vi: adjust conditional compilation of modifying_cmdsRon Yorston
Since commit 74d565ff1 (vi: make context marks more like vi) the list of commands that modify the text is no longer required when FEATURE_VI_YANKMARK is enabled, only FEATURE_VI_DOT_CMD. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-28vi: changes to line addresses for colon commandsRon Yorston
Make line addresses behave more like vi: - Vi allows the user to enter an arbitrary number of addresses, though only the last two are used. This simplifies get_address() by reducing the amount of state that needs to be carried. - When a command requires a single address the last one entered is used. - If addresses are separated by a ';' instead of a ',' the current line is updated to the left address. This may be useful when a search is used to specify a range, e.g. ':/first/;/last/d'. - When the last address is empty it should refer to the current line. function old new delta colon 3855 3834 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-21) Total: -21 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-27tls: tweak sp_256_ecc_gen_k_10 for smaller codeDenys Vlasenko
function old new delta curve_P256_compute_pubkey_and_premaster 194 191 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-27tls: shrink sp_256_mod_mul_norm_10 moreDenys Vlasenko
function old new delta sp_256_mod_mul_norm_10 1439 1305 -134 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-27tls: shrink sp_256_mod_mul_norm_10Denys Vlasenko
function old new delta sp_256_mod_mul_norm_10 1439 1405 -34 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-27tls: shrink p256_base moreDenys Vlasenko
function old new delta static.p256_base_bin - 64 +64 sp_256_point_from_bin2x32 - 62 +62 static.base_y 40 - -40 static.base_x 40 - -40 curve_P256_compute_pubkey_and_premaster 291 194 -97 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 0/1 up/down: 126/-177) Total: -51 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-27tls: shrink p256_baseDenys Vlasenko
function old new delta curve_P256_compute_pubkey_and_premaster 196 291 +95 static.base_y - 40 +40 static.base_x - 40 +40 p256_base 244 - -244 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 1/0 up/down: 175/-244) Total: -69 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-27tls: reorder P256 functions to make more senseDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-27tls: whitespace fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: add a patch with optimization which _should_ give better codeDenys Vlasenko
...but does not. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: get rid of constant-time add/sub operationsDenys Vlasenko
function old new delta sp_256_sub_10 - 22 +22 static.sp_256_mont_reduce_10 176 178 +2 sp_256_mod_mul_norm_10 1440 1439 -1 sp_256_proj_point_dbl_10 453 446 -7 sp_256_ecc_mulmod_10 1229 1216 -13 static.sp_256_mont_sub_10 52 30 -22 static.sp_256_cond_sub_10 32 - -32 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/4 up/down: 24/-75) Total: -51 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: fix whitespace in P256 codeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: shrink sp_256_mont_inv_10Denys Vlasenko
function old new delta sp_256_ecc_mulmod_10 1237 1251 +14 p256_mod_2 32 - -32 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 14/-32) Total: -18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: stop passing temporary buffer address in P256 codeDenys Vlasenko
function old new delta sp_256_proj_point_dbl_10 435 453 +18 sp_256_ecc_mulmod_10 1300 1237 -63 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 18/-63) Total: -45 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: shrink sp_256_proj_point_dbl_10Denys Vlasenko
function old new delta sp_256_ecc_mulmod_10 1329 1300 -29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: in P256 replace constant-time compares with usual onesDenys Vlasenko
function old new delta sp_256_cmp_10 - 24 +24 sp_256_ecc_mulmod_10 1332 1329 -3 sp_256_cmp_equal_10 30 - -30 static.sp_256_cmp_10 43 - -43 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 0/1 up/down: 24/-76) Total: -52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: simplify sp_256_proj_point_dbl_10Denys Vlasenko
function old new delta sp_256_proj_point_dbl_10 490 435 -55 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: simplify array manipulations in sp_256_ecc_mulmod_10Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: get rid of address obfuscation trick in P256Denys Vlasenko
function old new delta addr_mask 8 - -8 sp_256_ecc_mulmod_10 1363 1330 -33 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-41) Total: -41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: simplify sp_256_ecc_gen_k_10, cosmetic changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-26tls: make x25519 key generation code more similar to P256Denys Vlasenko
function old new delta curve_x25519_compute_pubkey_and_premaster - 74 +74 tls_handshake 2146 2072 -74 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 74/-74) Total: 0 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>