summaryrefslogtreecommitdiff
path: root/usr.bin
AgeCommit message (Collapse)Author
2022-05-25revert previous; it was broken (spotted by Theo)Damien Miller
2022-05-25make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled viaDamien Miller
#define) dump to stderr rather than stdout
2022-05-24fix some dobeep_msgs callsop
dobeep_msgs isn't printf-like: it just prints the two arguments separated by a space. When it was introduced, some calls from ewprintf were incorrectly translated and the "%s" remained. ok florian@
2022-05-24automatically delete trailing whitespaces on RET in c-mode andop
auto-indent-mode (only after computing the auto indent.) tested also by Mikhail (thanks!). ok tb@
2022-05-20Re-classify the roff(7) \r (reverse line feed) escape sequenceIngo Schwarze
from "ignore" to "unsupported" because when an input file uses it, mandoc(1) is likely to significantly misformat the output, usually showing parts of the output in a different order than the author intended.
2022-05-19Make roff_expand() parse left-to-right rather than right-to-left.Ingo Schwarze
Some escape sequences have side effects on global state, implying that the order of evaluation matters. For example, this fixes the long-standing bug that "\n+x\n+x\n+x" after ".nr x 0 1" used to print "321"; now it correctly prints "123". Right-to-left parsing was convenient because it implicitly handled nested escape sequences. With correct left-to-right parsing, nesting now requires an explicit implementation, here solved as follows: 1. Handle nested expanding escape sequences iteratively. When finding one, expand it, then retry parsing the enclosing escape sequence from the beginning, which will ultimately succeed as soon as it no longer contains any nested expanding escape sequences. 2. Handle nested non-expanding escape sequences recursively. When finding one, the escape sequence parser calls itself to find the end of the inner sequence, then continues parsing the outer sequence after that point. This requires the mandoc_escape() function to operate in two different modes. The roff(7) parser uses it in a mode where it generates diagnostics and may return an expansion request instead of a parse result. All other callers, in particular the formatters, use it in a simpler mode that never generates diagnostics and always returns a definite parsing result, but that requires all expanding escape sequences to already have been expanded earlier. The bulk of the code is the same for both modes. Since this required a major rewrite of the function anyway, move it into its own new file roff_escape.c and out of the file mandoc.c, which was misnamed in the first place and lacks a clear focus. As a side benefit, this also fixes a number of assertion failures that tb@ found with afl(1), for example "\n\\\\*0", "\v\-\\*0", and "\w\-\\\\\$0*0". As another side benefit, it also resolves some code duplication between mandoc_escape() and roff_expand() and centralizes all handling of escape sequences (except for expansion) in roff_escape.c, hopefully easing maintenance and feature improvements in the future. While here, also move end-of-input handling out of the complicated function roff_expand() and into the simpler function roff_parse_comment(), making the logic easier to understand. Since this is a major reorganization of a central component of mandoc(1), stability of the program might slightly suffer for a few weeks, but i believe that's not a problem at this point of the release cycle. The new code already satisfies the regression suite, but more tweaking and regression testing to further improve the handling of various escape sequences will likely follow in the near future.
2022-05-19improve a comment explaining a particularly nasty hack; no code changeIngo Schwarze
2022-05-15fix in-place copies; r1.163 incorrectly skipped truncation in all cases,Damien Miller
not just at the start of a transfer. This could cause overwrites of larger files to leave junk at the end. Spotted by tb@
2022-05-13arrange for scp, when in sftp mode, to not ftruncate(3) files earlyDamien Miller
previous behavious of unconditionally truncating the destination file would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to delete all the contents of their destination. spotted by solene@ sthen@, also bz3431; ok dtucker@
2022-05-09Remove errant apostrophe. From haruyama at queen-ml org.Darren Tucker
2022-05-09Allow existing -U (use agent) flag to work with "-Y sign" operations,Damien Miller
where it will be interpreted to require that the private keys is hosted in an agent; bz3429, suggested by Adam Szkoda; ok dtucker@
2022-05-08improve error message when 'ssh-keygen -Y sign' is unable to load aDamien Miller
private key; bz3429, reported by Adam Szkoda ok dtucker@
2022-05-08When performing operations that glob(3) a remote path, ensure that theDamien Miller
implicit working directory used to construct that path escapes glob(3) characters. This prevents glob characters from being processed in places they shouldn't, e.g. "cd /tmp/a*/", "get *.txt" should have the get operation treat the path "/tmp/a*" literally and not attempt to expand it. Reported by Lusia Kundel; ok markus@
2022-05-05kstat(1): implement wait with setitimer(2) instead of nanosleep(2)Scott Soule Cheloha
kstat(1)'s wait period drifts because nanosleep(2) uses a relative timeout. If we use setitimer(2)/sigsuspend(2) the period does not drift. While here, bump the upper bound for wait up to UINT_MAX and switch to the normal strtonum(3) error message format. With input from kn@. Tweaked by bluhm@ to block SIGALRM with sigprocmask(2) while we're outside of sigsuspend(2). Thread: https://marc.info/?l=openbsd-tech&m=160038548111187&w=2 Earlier version ok millert@. ok bluhm@
2022-05-05Fix line wrapping in wall(1).Alexander Bluhm
from Anton Borowka; OK mbuhl@
2022-05-05sshkey_unshield_private() contains a exact duplicate of the code inDamien Miller
private2_check_padding(). Pull private2_check_padding() up so the code can be reused. From Martin Vahlensieck, ok deraadt@
2022-05-05channel_new no longer frees remote_name. So update the commentDamien Miller
accordingly. As remote_name is not modified, it can be const as well. From Martin Vahlensieck
2022-05-05mux.c: mark argument as const; from Martin VahlensieckDamien Miller
2022-05-04make sure stdout is non-blocking; ok djm@Markus Friedl
2022-05-03Add FIDO AUTHENTICATOR section and explain a bit how FIDO works. TheFlorian Obser
wording came mostly from the 8.2 OpenSSH release notes, addapted to fit the man page. Then move the -O bits into the new section as is already done for CERTIFICATES and MODULI GENERATION. Finally we can explain the trade-offs of resident keys. While here, consistently refer to the FIDO thingies as "FIDO authenticators", not "FIDO tokens". input & OK jmc, naddy
2022-05-02remove an obsolete rsa1 format example from an example;Jason McIntyre
from megan batty ok djm
2022-05-01fix some integer overflows in sieve_large() that show up when tryingDamien Miller
to generate modp groups > 16k bits. Reported via GHPR#306 by Bertram Felgenhauer, but fixed in a different way. feedback/ok tb@
2022-05-01Split a new function roff_parse_comment() out of roff_expand() because thisIngo Schwarze
functionality is not needed when called from roff_getarg(). This makes the long and complicated function roff_expand() significantly shorter, and also simpler in so far as it no longer needs to return ROFF_APPEND. No functional change intended.
2022-04-30Provide a new function roff_req_or_macro() to parse and handle a requestIngo Schwarze
or macro, including context-dependent error handling inside tbl(7) code and inside .ce/.rj blocks. Use it both in the top level roff(7) parser and inside conditional blocks. This fixes an assertion failure triggered by ".if 1 .ce" inside tbl(7) code, found by tb@ using afl(1). As a side benefit for readability, only one place remains in the code that calls the main handler functions for the various roff(7) requests. This patch also improves column numbers in some error messages and various comments.
2022-04-30Add comments to some of the enum roff_tok values;Ingo Schwarze
particularly useful for values that have non-obvious semantics like ROFF_MAX, ROFF_cblock, ROFF_RENAMED, and TOKEN_NONE; no code change.
2022-04-30Refactor the handler function roff_block_sub() for clarity and simplicity.Ingo Schwarze
1. Do not needlessly access the function pointer table roffs[]. Instead, simply call the block closing function directly. 2. Sort code: handle both cases of block closing at the beginning of the function rather than one at the beginning and one at the end. 3. Trim excessive, partially repetitive and obvious comments, also making the comments considerably more precise. No functional change.
2022-04-29Wait until the buffer is drained before closing the deviceAlexandre Ratchov
Fixes last few samples not being played when very large buffers are used.
2022-04-29Add sio_flush(3) function to stop playback immediatelyAlexandre Ratchov
The new sio_flush(3) functions works the same way as sio_stop(3), except that it doesn't wait for play buffer to be drained. Instead, it discards its contents and returns immediately.
2022-04-29be stricter in which characters will be accepted in specifying a maskDamien Miller
length; allow only 0-9. From khaleesicodes via GHPR#278; ok dtucker@
2022-04-29mention that the helpers are used by ssh(1), ssh-agent(1) andDamien Miller
ssh-keygen(1). Previously only ssh(1) was mentioned. From Pedro Martelletto
2022-04-29Don't leak SK device. Patch from Pedro Martelletto via github PR#316.Darren Tucker
ok djm@
2022-04-29fix memleak on session-bind path; from Pedro Martelletto, ok dtucker@Damien Miller
2022-04-28The syntax of the roff(7) .mc request is quite specialIngo Schwarze
and the roff_onearg() parsing function is too generic, so provide a dedicated parsing function instead. This fixes an assertion failure when an \o escape sequence is passed as the argument; the bug was found by tb@ using afl(1). It also makes mandoc output more similar to groff in various cases.
2022-04-28Fix comparison in openssl(1) pkcs12Kinichiro Inoguchi
comment from tb@
2022-04-28Compare pointer value with NULL in openssl(1) pkcs12Kinichiro Inoguchi
ok tb@
2022-04-28Element next-line scopes may nest, so man_breakscope() may have toIngo Schwarze
break multiple element next-line scopes at the same time, similar to what man_descope() already does for unconditional rewinding. This fixes an assertion failure that tb@ found with afl(1), caused by .SH .I .I .BI and similar sequences of macros without arguments.
2022-04-28avoid printing hash algorithm twice; from lucas AT sexy.isDamien Miller
2022-04-27The .AT, .DT, and .UC macros are allowed inside next-line scopeIngo Schwarze
and never produce output at the place of their invocation. Minibugs found while investigating unrelated afl(1) reports from tb@.
2022-04-27Fix three bugs regarding the interaction of \z and \h:Ingo Schwarze
1. The combination \z\h is a no-op whatever the argument may be. In the past, the \z only affected the first space character generated by the \h, which was wrong. 2. For the conbination \zX\h with a positive argument, the first space resulting from the \h is not printed but consumed by the \z. 3. For the combination \zX\h with a negative argument, application of the \z needs to be completed before the \h can be started. In the past, if this combination occurred at the beginning of an output line, the \h backed up to the beginning of the line and after that, the \z attempted to back up even further, triggering an assertion. Bugs found during an audit of assignments to termp->col that i started after the bugfix tbl_term.c rev. 1.65. The assertion triggered by bug 3 was *not* yet found by afl(1).
2022-04-27Add authfd path to debug output. ok markus@Darren Tucker
2022-04-26At the end of every tbl(7) cell, clear the \z state.Ingo Schwarze
This is needed because the TERMP_MULTICOL mode is designed such that term_tbl() buffers all the cells of the table row before the normal reset logic near the end of term_flushln() can be reached. This fixes an assertion failure triggered by \z near the end of a table cell, found by tb@ using afl(1).
2022-04-26If a node is tagged explicitly, skip implicit tagging for that node.Ingo Schwarze
Apart from making sense in the first place, this fixes an assertion failure that happened when the calculated implicit tag did not match the string value of the first child of the node, Bug found by tb@ using afl(1).
2022-04-26Check sshauthopt_new() for NULL. bz#3425, from tessgauthier atDarren Tucker
microsoft.com. ok djm@
2022-04-24When we open a new .while loop, let's not attempt to close outIngo Schwarze
another enclosing .while loop at the same time. Instead, postpone the closing until the next iteration of ROFF_RERUN. This prevents one-line constructions like ".while 0 .while 0 something" and ".while rx .while rx .rr x" (which admittedly aren't particularly useful) from dying of abort(3), which was a bug tb@ found with afl(1).
2022-04-24If a .shift request has a negative argument, do not use a negative arrayIngo Schwarze
index but use 0 instead of the argument, just like groff. Warn about the invalid argument. While here, fix the column number in another warning message. Segfault reported by tb@, found with afl(1).
2022-04-23If the last data row of a tbl(7) contains nothing but a horizontal line,Ingo Schwarze
do not skip closing the table and cleaning up memory at the end of the table in the HTML output module. This bug resulted in skipping the tblcalc() function and reusing the existing roffcol array for the next tbl(7) processed. If the next table had more columns than the one ending with a horizontal line in the last data row, uninitialized memory was read, potentially resulting in near-infinite output. The bug was introduced in rev. 1.24 (2018/11/26) but only fully exposed by rev. 1.33 (2021/09/09). Until rev. 1.32, it could only cause misformatting and invalid HTML output syntax but not huge output because up to that point, the function did not use the roffcol array. Nasty bug found the hard way by Michael Stapelberg on the production server manpages.debian.org. Michael also supplied example files and excellent instructions how to reproduce the bug, which was very difficult because no real-world manual page is known that triggers the bug by itself, so to reproduce the bug, mandoc(1) had to be invoked with at least two file name arguments.
2022-04-22escape the word "An" in an Rs/Re block, since it can beJason McIntyre
interpreted as a macro;
2022-04-22Check tkp->output != NULL before taking strlen for both command mappingsTheo Buehler
and input mappings. This adds a missing check for command mappings and simplifies the input mappings. ok millert
2022-04-22vi: apply expandtab to the output of a ! commandTodd C. Miller
This is consistent with vim's expandtab behavior. From nvi2 (Craig Leres). OK tb@
2022-04-22handle 16 bit kstat_kv typesDavid Gwynne