Commit Graph

2505 Commits

Author SHA1 Message Date
tg c1c0b997fe make the code to exec simple commands also available for mksh_small 2014-01-11 16:26:28 +00:00
tg c8188de88b add BAFH: Better Avalanche for the Jenkins hash
This uses NZAAT Init and Update, and AES MixColumns for Finish.
For hashtables this will need XOR with uint32_t then rotation
with uint5_t (so a total of 37 bit of entropy) for mitigation.
For entropy avalanche this needs mixing, and better handling
of the IV and/or the first four bytes, see BAFHHost* macros.

Thanks to Bob Jenkins for the one-at-a-time hash, Bret Mulvey for
the Hash.cs AvalancheTest, Jonathan “ciruZ” Schleifer and Dominik
“Natureshadow” George for discussion, Theodore “Ted” Ts'o for valuable
input on arc4random_roundhash, “poncho” for suggesting and Orson
“nightcracker” Peters for implementing MixColumns, tarent GmbH for
letting me test this empirically on a 64 GiB RAM machine.
2014-01-11 15:59:41 +00:00
tg 95a19997b8 avoid NZATMix returning false on its identity mapping (00000000h) 2014-01-05 22:17:57 +00:00
tg 89e774fd7e • fix ${12345678901234567890} segfault (OOB access / integer overflow)
‣ not like oksh did, but using mksh’s built-in features
• handle suggested __pure additions
• revert cid 1004F7F096867C83CF0
  ‣ always use our wcwidth code
  ‣ only use our strlcpy code if none found
• fix a couple of gcc-snapshot and clang/scan-build warnings
• mksh R49~rc1
2014-01-05 21:57:29 +00:00
tg 2f6fa6fb3d revert unfinished change (listed in mksh.hts) 2014-01-05 19:20:31 +00:00
tg d8b65ff642 oksh bumped array indicēs again, INT_MAX this time, still less than mksh… 2014-01-05 19:14:18 +00:00
tg 2f7eec765d merge oksh’s “ctype cleanups” commit
(not much of it applies since we don’t use the OS’ table-based lookup)
2014-01-05 19:11:46 +00:00
tg 0545eb1c45 • use Rijndæl MixColumn for arc4random_roundhash avalanching;
suggested in http://crypto.stackexchange.com/questions/12145
• add pure mksh™ implementation, too, while here (since it can
  replace NZAATFinish even though NZATMix is slower, both are
  bijective)
2014-01-02 22:51:01 +00:00
tg d22296d595 make octal in arithmetics better greppable (cf. Debian #732509)
XXX maybe make an entire .Ss or .Sh out of delta against posix? other sh?
2013-12-18 16:54:20 +00:00
tg 70233e4cd4 play catchup with weird obsd reorg (in which they lost a few tests, even…) 2013-12-15 15:45:31 +00:00
tg d49d03a095 read’s -r option is not portable; discovered by RT 2013-12-02 19:47:33 +00:00
tg 328cbf510c Unicode 6.3.0 2013-11-30 23:20:04 +00:00
tg 0dfbf3d314 note that even set -o noclobber can be coërced into dropping O_EXCL by a TOCTOU 2013-11-30 18:16:54 +00:00
tg 6217904193 detect getsid(2), also spotted by RT, this on MSYS 2013-11-30 17:41:35 +00:00
tg c4c4fd7365 RCSID-only oksh sync (their whitespace changes don’t apply to us)
note that emacs.c partial peereboom rewrite is *not* merged, and kept that way
2013-11-30 17:33:51 +00:00
tg 6e1ab32be6 don’t use File::Temp because it’s Perl >= 5.6.1 only
spotted by RT
2013-11-30 17:11:06 +00:00
tg 7cae22ef5c zsh on BeOS calls sigsuspend() on “dot”, which fails; work around it
tested by RT
2013-11-30 15:42:19 +00:00
tg fc4f36e75b revert commit 1005289433447F6CA90 as it makes the system unbootable 2013-11-30 00:20:48 +00:00
tg 73106b6e75 make this actually call getopt.sh, correctly, and Heirloom sh compatible 2013-11-20 21:14:50 +00:00
tg 47ba4d13b4 make jsh compatible (Heirloom sh) 2013-11-20 20:55:01 +00:00
tg 973c7a55c2 fix initial IFSWS not ignored when expanding, noticed by Seb <sbb@tuxfamily.org> 2013-11-17 22:28:51 +00:00
tg 2008bab5a0 mention negative history numbers (thanks odc:#!/bin/mksh for noticing) 2013-11-17 22:24:06 +00:00
tg 73c5ad3e3f apply patch by Steffen Daode Nurpmeso to drop ISTRIP termios mode 2013-11-17 22:23:29 +00:00
tg be9bd4c543 static option creating for cmdline and set, too
(in preparation of doing something real with set ±p)
2013-11-17 22:22:56 +00:00
tg d1245ee13a more clueful (automatic) getopt string generation 2013-11-17 22:21:18 +00:00
tg 44a58fb3e9 drop RLIMIT_LOCKS completely, it was for early Linux 2.4 versions only 2013-11-17 22:20:21 +00:00
tg 61886de5ee oksh sync (RCSID only) 2013-11-17 22:19:42 +00:00
tg b71c3e1583 some bad OSes use _FORTIFY_LEVEL and break this
problem noticed by jonthn
2013-11-05 22:10:15 +00:00
tg cf40c01b45 adapt most __attribute__((…)) occurrences to new KNF style(9) 2013-10-31 20:05:39 +00:00
tg f920d94785 add O_BINARY to all open() calls except tty_fd
cf. http://svn.netlabs.org/libc/wiki/Faq#Whydoesntreadfdbufsize_of_filereturnsize_of_file
2013-10-09 11:59:30 +00:00
tg 7f16464902 slightly optimised and, more importantly, much more consistent (use only
one set of CTRL, UNCTRL, and new ISCTRL macros) C0 and DEL handling; the
optimisation only works for 7-bit ASCII, so those places 8-bit must pass
intact have an added check

also, while here, remove an editor oops (‘;’), oksh rcsid sync (they did
accept I was right wrt. set -e), int → bool, and code merge/cleanup
2013-09-24 20:19:45 +00:00
tg 2e7509548a integrate latest changes from oksh: Wed Sep 4 15:49:19 2013 UTC by millert
Add a proper suspend builtin that saves/restores the tty and pgrp
as needed instead of an alias that just sends SIGSTOP.  Login shells
may be suspended if they are not running in an orphan process group.
2013-09-10 17:33:04 +00:00
tg 8352fc78d3 apply patch from Steffen Daode Nurpmeso to use WCONTINUED waitpid(2) 2013-09-10 16:51:17 +00:00
tg 14667a9838 int → bool; commit as a TODO comment a begun change attempt 2013-09-10 16:30:50 +00:00
tg fda010d8de SECURITY: Unbreak “set +p”, broken by OpenBSD ksh change.
TODO: I am seriously considering following Chet and changing
the way this works, by explicitly dropping privs unless the
shell is run with -p. Every other shell does it like mksh,
except Heirloom sh, which on the other hand doesn’t know any
explicit set -p or set +p (though it doesn’t know set +foo
for any foo either).

┌──┤ QUESTION: Do we need the ability to do this:
│ tg@blau:~ $ ./suidmksh -p -c 'whoami; set +p; whoami'
│ root
│ tg

If not, I’m seriously considering to drop set ±p as well,
only parse -p on the command line, with +p being the default,
and dropping FPRIVILEGED.

Thanks to RT for noticing and jilles for initial follow-up
discussion, as well as Chet Ramey for doing the sane/secure
thing instead of following Debian.
2013-08-23 14:07:39 +00:00
tg 75c00ebaae • don’t eat builtin cd errorlevel in function cd
• fix extglob in function cd_csh to match current error strings
2013-08-22 13:46:46 +00:00
tg 5eb6995d75 Ypnose discovered a problem with multi-line prompts and SIGWINCH
related to caching some values (downside, pprompt gets back doprint option)
2013-08-16 10:59:03 +00:00
tg bf94b7e2ec fun: when writing this code I feared an off-by-one;
Steffen Daode Nurpmeso stumbled upon it and gave very detailed
instructions on how to reproduce it (thanks!); fix that

also only call x_bs0 if xcp < xep because *xep is undefined
2013-08-14 20:26:19 +00:00
tg bb0b409a9d improve density of .rodata (with net win on .text size(1)) via better struct packing 2013-08-11 14:57:11 +00:00
tg 64d828ac07 try to be even more clear 2013-08-10 14:11:39 +00:00
tg a799f5928b improve documentation and comments 2013-08-10 13:47:18 +00:00
tg c10e5bd237 reduce amount of .bss memory needed; initialise via AEDIT at x_init
or even first run of x_vi
2013-08-10 13:44:33 +00:00
tg 1d487d9163 by request of gecko2@ make “doch” keep stdin at slight lack of privacy 2013-08-10 13:43:50 +00:00
tg 247e20c524 • Completely overhaul prompt length calculation and
prompt display routines; make Emacs and Vi share
  code, permitting reducing of duplication and code
  removal as well as more consistent behaviour; put
  some common code into shared helper functions, too
• New x_adjust() logic (Emacs mode): when determining
  what portion of a line to render use a much more
  sophisticated algorithm and try to fill up ⅔ of the
  total screen width (with line and prompt both) also
  as wished from Steffen Daode Nurpmeso
2013-07-26 20:33:39 +00:00
tg 472bc350b5 TGIF, drinking-beer, Sysadmin Appreciation Day commit:
• As requested by Steffen Daode Nurpmeso, enlarge the
  amount of command characters shown in job handling
2013-07-26 20:33:24 +00:00
tg 3876b38220 Steffen Daode Nurpmeso found an actual bug:
Whenever the SIGEXIT trap was set (to anything, really)
syntax errors and interruptions were not ignored any more
in an interactive shell (where they should be, unless
set -e is used); fix that.

tbd: traps should probably only be marked as pending
and run for LLEAVE/E_NONE
2013-07-25 18:07:47 +00:00
tg c7f483c16f also protect the icon file from accidental deletion, and merge the cases 2013-07-25 17:01:03 +00:00
tg 5b35b869f1 Apply patch from: Steffen "Daode" Nurpmeso for testing -i vs. EXIT trap 2013-07-25 16:41:30 +00:00
tg 861890f7fa add the desktop shortcut / icon from mksh/Win32 so it may be used by everyone for mksh/Unix too 2013-07-25 16:18:25 +00:00
tg fb1c2ee862 more checks for special char handling 2013-07-25 16:06:43 +00:00