[patch] Fix vmd for user VMs

2022-09-17 Thread Matthew Martin
When vmd/vmctl switched to handling memory in bytes, seems a few places for user VMs were missed. Additionally the first hunk removes the quota hit if the VM will not be created. diff --git config.c config.c index 374d7de6629..425c901f36a 100644 --- config.c +++ config.c @@ -241,8 +241,10 @@ conf

Re: [patch] Fix vmd for user VMs

2022-10-03 Thread Matthew Martin
On Sat, Sep 24, 2022 at 08:32:55AM -0400, Dave Voutila wrote: > > Matthew Martin writes: > > > When vmd/vmctl switched to handling memory in bytes, seems a few places > > for user VMs were missed. Additionally the first hunk removes the quota > > hit if

Re: vmd: remove the user quota tracking

2022-10-05 Thread Matthew Martin
On Wed, Oct 05, 2022 at 05:03:16PM -0400, Dave Voutila wrote: > Matthew Martin recently presented a patch on tech@ [1] fixing some missed > scaling from when I converted vmd(8) to use bytes instead of megabytes > everywhere. I finally found time to wade through the code it touches

Re: vmd: remove the user quota tracking

2022-10-27 Thread Matthew Martin
On Wed, Oct 12, 2022 at 09:20:06AM -0400, Dave Voutila wrote: > > 1 week bump for the below. If you use this feature or currently hacking > on it, speak up by end of week. I'm sharpening my axes. Are the axes sharp? > > diff refs/heads/master refs/heads/vmd-user > > commit - bfe2092d87b190d9f89c

Add exit status to route.8

2023-08-02 Thread Matthew Martin
A user in IRC asked about route exec's exit status which seems a reasonable thing to document. The text is a combination of .Ex -std and env(1). Also route exec requires a command, so fix the .Op markup. diff --git route.8 route.8 index 887446c1420..ee5bd15fa1a 100644 --- route.8 +++ route.8 @@

Re: Add exit status to route.8

2023-08-02 Thread Matthew Martin
On Wed, Aug 02, 2023 at 06:36:26PM -0400, A Tammy wrote: > Not a huge fan of this complicated representation. > > +.Ar command > > +was invoked but failed with this exit status; > > +see its manual page for more information. > > +.It 126 > > +.Ar command > > +was found but could not be invoked, or

ifconfig.8 Ar/Cm typo

2020-06-27 Thread Matthew Martin
A rule on a bridge interface that uses arp or rarp may be followed with a literal "request" or "reply" (cf. sbin/ifconfig/brconfig.c L1041 and 1048), so the Ar macro is incorrect as it's argument is not a placeholder. Aside: Is there a rule for when to list alternatives with foo | bar or foo Ns |

[patch] tcpdump: Sync DNS types with IANA

2021-05-18 Thread Matthew Martin
Sync the DNS types with IANA[1] and upstream[2]. With this the Type65 queries show up as HTTPS. Removed the UNSPECA type parsing as IANA has that query type number assigned to NID now. Also added a const on ns_class2str. 1: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml 2:

Re: [patch] tcpdump: Sync DNS types with IANA

2021-05-19 Thread Matthew Martin
On Wed, May 19, 2021 at 08:01:00AM +0100, Stuart Henderson wrote: > For the love of $deity if we're updating this file can we please change > these T_XXX to the ns_t_xxx used by everything else so we don't have to > patch everything in ports using them? In that case judging from a quick look at th

Re: [patch] tcpdump: Sync DNS types with IANA

2021-09-23 Thread Matthew Martin
On Tue, May 18, 2021 at 10:24:00PM -0500, Matthew Martin wrote: > Sync the DNS types with IANA[1] and upstream[2]. With this the Type65 > queries show up as HTTPS. > > Removed the UNSPECA type parsing as IANA has that query type number > assigned to NID now. > >

Add rtable capability to login.conf

2022-01-29 Thread Matthew Martin
isting workflows and could be considered as in a separate thread if desired. - Matthew Martin diff --git include/login_cap.h include/login_cap.h index d9a4c2c349c..1e831b6471a 100644 --- include/login_cap.h +++ include/login_cap.h @@ -53,7 +53,8 @@ #defineLOGIN_SETUMASK 0x002

Re: Add rtable capability to login.conf

2022-01-29 Thread Matthew Martin
On Sat, Jan 29, 2022 at 07:10:00PM -0500, Ted Unangst wrote: > I believe it would be better to add setrtable to id pledge. Makes the diff quite a bit shorter too. diff --git include/login_cap.h include/login_cap.h index d9a4c2c349c..1e831b6471a 100644 --- include/login_cap.h +++ include/login_ca

if_wg: Missing DPRINTF newline

2022-02-02 Thread Matthew Martin
Two DPRINTFs in sys/net/if_wg.c are missing a newline. diff --git if_wg.c if_wg.c index 13c48f42c54..a3efd577dbc 100644 --- if_wg.c +++ if_wg.c @@ -2156,7 +2156,7 @@ wg_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa, } if (m->m_pkthdr.ph_loopcnt++ > M_MAXLOOP) {

[patch] const cclasses reference in ksh

2020-10-26 Thread Matthew Martin
Recently cclasses in lib/libc/gen/charclass.h was made const.[1] Mark the pointer used to walk the array in ksh const as well. 1: https://marc.info/?l=openbsd-cvs&m=160256416506433&w=2 diff --git misc.c misc.c index 9e6e9db5e76..7226f74eccf 100644 --- misc.c +++ misc.c @@ -713,7 +713,7 @@ do_gma

Re: Add rtable capability to login.conf

2022-02-05 Thread Matthew Martin
On Sat, Jan 29, 2022 at 06:25:32PM -0600, Matthew Martin wrote: > On Sat, Jan 29, 2022 at 07:10:00PM -0500, Ted Unangst wrote: > > I believe it would be better to add setrtable to id pledge. ping Also are there any opinions on adding LOGIN_SETRTABLE to doas? diff --git include/lo

Re: if_wg: Missing DPRINTF newline

2022-02-20 Thread Matthew Martin
On Thu, Feb 03, 2022 at 07:53:43AM +, Jason McIntyre wrote: > On Wed, Feb 02, 2022 at 07:46:39PM -0600, Matthew Martin wrote: > > Two DPRINTFs in sys/net/if_wg.c are missing a newline. > > > > if this is committed, the committer may also want to question the dodgy

Re: Add rtable capability to login.conf

2022-02-24 Thread Matthew Martin
On Fri, Feb 18, 2022 at 03:25:51PM -0500, Ted Unangst wrote: > On 2022-02-06, Ted Unangst wrote: > > On 2022-02-05, Matthew Martin wrote: > > > On Sat, Jan 29, 2022 at 06:25:32PM -0600, Matthew Martin wrote: > > > > On Sat, Jan 29, 2022 at 07:10:00PM -0500, Ted Unan

[patch] LOGIN_SETENV fails when login.conf is missing

2022-02-26 Thread Matthew Martin
Anton spotted a doas regression failure in t-run-keepenv-path after the change to doas for LOGIN_SETALL. Since that test runs doas in a chroot and the setup does not create a login.conf, login_getclass in login_cap.c will return a login_cap_t with a NULL lc_cap (and errno set to ENOENT) on L133. se

Re: issue with login.conf(5) rtable and su -l user

2022-03-13 Thread Matthew Martin
On Sun, Mar 13, 2022 at 02:30:23PM +0100, Solene Rapenne wrote: > Hi, I'm playing with the new rtable feature in login.conf(5) but it > seems one use case doesn't trigger the rtable change. > > I have an user called alice, if I ssh locally from my user to alice > with ssh alice@localhost, alice ha

rcctl.8: Add missing variable

2022-03-31 Thread Matthew Martin
diff --git rcctl.8 rcctl.8 index 6c3048b834c..93a76a937c1 100644 --- rcctl.8 +++ rcctl.8 @@ -64,6 +64,7 @@ can be one of .Cm class , .Cm flags , .Cm logger , +.Cm rtable , .Cm status , .Cm timeout or

const openpty et al.

2022-04-07 Thread Matthew Martin
const the termp and winp arguments for openpty and related. This matches the prototypes for openpty and forkpty in glibc and musl libc. diff --git openpty.3 openpty.3 index e0c82e00c53..080d92d8ced 100644 --- openpty.3 +++ openpty.3 @@ -47,15 +47,15 @@ .Ft int .Fn getptmfd "void" .Ft int -.Fn o

Re: const openpty et al.

2022-04-19 Thread Matthew Martin
On Thu, Apr 07, 2022 at 06:11:45PM -0500, Matthew Martin wrote: > const the termp and winp arguments for openpty and related. This matches > the prototypes for openpty and forkpty in glibc and musl libc. ping; has an ok from tb@ [1] 1: https://marc.info/?l=openbsd-tech&m=164986161

Mark pw_error __dead in util.h

2022-05-03 Thread Matthew Martin
The function is already marked __dead in passwd.c, so appears to just be an oversight. diff --git util.h util.h index dd64f478e23..752f8bb9fc5 100644 --- util.h +++ util.h @@ -97,7 +97,7 @@ void pw_edit(int, const char *); void pw_prompt(void); void pw_copy(int, int, const struct passwd *,

Re: Mark pw_error __dead in util.h

2022-05-10 Thread Matthew Martin
On Tue, May 03, 2022 at 10:37:36PM -0500, Matthew Martin wrote: > The function is already marked __dead in passwd.c, so appears to just be > an oversight. ping diff --git util.h util.h index dd64f478e23..752f8bb9fc5 100644 --- util.h +++ util.h @@ -97,7 +97,7 @@ void pw_edit(int, cons

Re: Picky, but much more efficient arc4random_uniform!

2022-05-14 Thread Matthew Martin
int main() { int results[3] = { 0, 0, 0 }; for (int i = 0; i < 10; i++) { results[arc4random_uniform_fast_simple(3)]++; } for (int i = 0; i < 3; i++) printf("%d: %d\n", i, results[i]); return 0; } % ./a.out 0: 24809 1: 50

Avoid system(3) in ikectl

2019-03-06 Thread Matthew Martin
I had sent a similar patch a while back. There seemed to me some interest, but it was never comitted. Updated to apply to -current. Apologies for the attachment; gmail still isn't sending emails sent via mutt, but I suspect the patch in the body will be mangled. - Matthew Martin"

Re: Avoid system(3) in ikectl

2019-03-07 Thread Matthew Martin
On Thu, Mar 7, 2019 at 4:53 AM Stuart Henderson wrote: > > On 2019/03/06 22:20, Theo de Raadt wrote: > > I'm not sure why this matters. > > > > Fundamentally system is fork+exec via a shell. So you write it as > > minimal fork+exec. > > > > What is the particular benefit you see here, is it secur

Re: Avoid system(3) in ikectl

2019-03-08 Thread Matthew Martin
On Fri, Mar 8, 2019 at 3:39 AM Reyk Floeter wrote: > > On Wed, Mar 06, 2019 at 10:42:15PM -0600, Matthew Martin wrote: > > I had sent a similar patch a while back. There seemed to me some > > interest, but it was never comitted. Updated to apply to -current. > > > >

Re: Avoid system(3) in ikectl

2019-03-16 Thread Matthew Martin
ping On Fri, Mar 8, 2019 at 8:52 PM Matthew Martin wrote: > > On Fri, Mar 8, 2019 at 3:39 AM Reyk Floeter wrote: > > > > On Wed, Mar 06, 2019 at 10:42:15PM -0600, Matthew Martin wrote: > > > I had sent a similar patch a while back. There seemed to me some >

Re: Avoid system(3) in ikectl

2019-04-25 Thread Matthew Martin
ping after unlock diff --git usr.sbin/ikectl/ikeca.c usr.sbin/ikectl/ikeca.c index bac76ab9c2f..09df5066820 100644 --- usr.sbin/ikectl/ikeca.c +++ usr.sbin/ikectl/ikeca.c @@ -18,11 +18,13 @@ #include #include +#include #include #include #include #include #include +#include #incl

Re: Avoid system(3) in ikectl

2019-04-25 Thread Matthew Martin
On Thu, Apr 25, 2019 at 08:59:56PM -0600, Theo de Raadt wrote: > > + argv = alloca((n + 1) * sizeof(*argv)); > > Our source tree is exceedingly sparing in the use of alloca(). > This will not do. Was staying as close as possible to exec.c, but avoiding alloca is preferable; replaced with re

Re: Avoid system(3) in ikectl

2019-05-08 Thread Matthew Martin
ping On Thu, Apr 25, 2019 at 11:21:00PM -0500, Matthew Martin wrote: > On Thu, Apr 25, 2019 at 08:59:56PM -0600, Theo de Raadt wrote: > > > + argv = alloca((n + 1) * sizeof(*argv)); > > > > Our source tree is exceedingly sparing in the use of alloca(). > &

Re: Avoid system(3) in ikectl

2019-05-08 Thread Matthew Martin
On Wed, May 08, 2019 at 04:22:16PM -0600, Theo de Raadt wrote: > Isn't something like better -- to avoid marshalling code to convert > arguments -> array? > > char *pkcs_args[] = > PATH_OPENSSL, > "pkcs12", > "-export", > "-caname", > ca->caname, > "-name", >

Re: ldomctl: init-system: Add -n (noaction) switch for validation only

2020-01-04 Thread Matthew Martin
On Sat, Jan 04, 2020 at 04:08:47PM +0100, Mark Kettenis wrote: > I don't think this should print "configuartion OK" when there are no > errors. The UNIX way is to just return 0 and be done. For what it's worth most daemons currently print "configuration OK": bgpd dvmrpd eigrpd httpd ifstated iked

Re: acme-client calloc fix

2020-01-22 Thread Matthew Martin
On Wed, Jan 22, 2020 at 12:44:18AM -0500, Ted Unangst wrote: > should not size the size until the allocation succeeds, or the free path will > try to deref the null array. > > > Index: json.c > === > RCS file: /home/cvs/src/usr.sbin/

Add readonly flag to tftpd

2016-01-24 Thread Matthew Martin
Add a -R flag to tftpd for a read only mode. This allows for a tighter pledge than currently possible because by default existing files can be overwritten (but no new files created). Perhaps read only should be the default since it is surprising that tftp can overwrite by default. - Matthew

Re: Add readonly flag to tftpd

2016-01-24 Thread Matthew Martin
On Sun, Jan 24, 2016 at 03:05:28AM -0600, Matthew Martin wrote: > Add a -R flag to tftpd for a read only mode. This allows for a tighter > pledge than currently possible because by default existing files can be > overwritten (but no new files created). Perhaps read only should be the

Re: Add readonly flag to tftpd

2016-01-26 Thread Matthew Martin
On Mon, Jan 25, 2016 at 07:32:52AM +, Stuart Henderson wrote: > On 2016/01/25 04:32, Jérémie Courrèges-Anglas wrote: > > > > Hi Matthew, > > > > Matthew Martin writes: > > > > > On Sun, Jan 24, 2016 at 03:05:28AM -0600, Matthew Martin wrote: >

Re: [patch] Avoid system(3) in ikectl

2017-06-12 Thread Matthew Martin
correct or if it's ok to rely on calloc'ing a struct setting pointers to NULL. I ran out of entropy for picking names, so I've added some braces (but really initialization syntax is nicer). - Matthew Martin diff --git ikeca.c ikeca.c index 3dacac9e83e..c04d0b7229c 100644 ---

Re: [patch] Use readpassphrase in ikectl

2017-06-12 Thread Matthew Martin
On Thu, Jun 08, 2017 at 10:33:07PM +1000, Jonathan Gray wrote: > On Fri, May 19, 2017 at 12:35:44AM -0500, Matthew Martin wrote: > > While making the last patch, I noticed ikectl uses getpass. Use > > readpassphrase instead and explicit_bzero the buffers. > > > > - Matt

[patch] Remove duplicate include in file.c

2017-06-26 Thread Matthew Martin
Remove duplicate include in file.c. - Matthew Martin diff --git file.c file.c index 6304a38c18f..f7a2f56cb64 100644 --- file.c +++ file.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include

Remove getopt from vipw

2017-07-08 Thread Matthew Martin
== 1 || (argc == 2 && strcmp(argv[1], "--") == 0))) Also kill a needless include. - Matthew Martin diff --git vipw.c vipw.c index e9595b02198..88a741f1c15 100644 --- vipw.c +++ vipw.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -49,18

Remove games/fortune/tools

2017-07-08 Thread Matthew Martin
As far as I can tell, it's never been linked into the build even looking in the NetBSD history. unstr is also not linked, but as it's the reverse of strfile (which is built and used but not installed) unstr seems less useless. - Matthew Martin diff --git tools/Do_spell tools/Do_spe

Use getprogname(3) in style(9)

2017-07-10 Thread Matthew Martin
hould also be const. Instead of fixing all the declarations throughout the tree, use getprogname(3) which is the documented API anyway. - Matthew Martin diff --git style.9 style.9 index 6e662f3a4f6..c849dd172ed 100644 --- style.9 +++ style.9 @@ -589,10 +589,10 @@ Uppercase letters take precedence

fsck_ext2fs: Remove always false comparison

2017-07-13 Thread Matthew Martin
src/sbin/fsck_ext2fs/dir.c: In function 'dircheck': src/sbin/fsck_ext2fs/dir.c:241: warning: comparison is always false due to limited range of data type And indeed in /usr/include/ufs/ext2fs/ext2fs_dir.h e2d_namelen is a u_int8_t and a few lines above #define EXT2FS_MAXNAMLEN255 diff --

caesar(6) documents incorrect frequencies

2017-07-26 Thread Matthew Martin
The man page documents frequencies that are different than the code uses e.g. C (3.61 vs 2.7) and D (4.78 vs 3.8). This seems a bit much for a man page. If anyone prefers the letter ordering be kept, the correct order is ETSAORINDHLCPMUYFWGBVKXQZJ . - Matthew Martin diff --git caesar.6 caesar.6

Re: nm in free(): chunk canary corrupted 0x3e6e6845580 0x19@0x19

2017-07-29 Thread Matthew Martin
name; is valid C. Shouldn't that be something like off_t offset = p - *name; ... p = name + offset; ? - Matthew Martin diff --git nm.c nm.c index 5d2a1bfeb61..085c4152fc6 100644 --- nm.c +++ nm.c @@ -310,7 +310,7 @@ mmbr_name(struct ar_hdr *arh, char **name, int baselen, int *namel

Re: caesar(6) documents incorrect frequencies

2017-08-01 Thread Matthew Martin
On Tue, Aug 01, 2017 at 09:36:13AM +0100, Jason McIntyre wrote: > On Thu, Jul 27, 2017 at 01:36:15AM -0500, Matthew Martin wrote: > > The man page documents frequencies that are different than the code > > uses e.g. C (3.61 vs 2.7) and D (4.78 vs 3.8). This seems a bit much for >

Re: caesar(6) documents incorrect frequencies

2017-08-01 Thread Matthew Martin
.c which claims to get it's numbers from "some unix(tm) documentation". - Matthew Martin > > On Tue, Aug 01, 2017 at 09:36:13AM +0100, Jason McIntyre wrote: > > > On Thu, Jul 27, 2017 at 01:36:15AM -0500, Matthew Martin wrote: > > > > The man page documents

Re: caesar(6) documents incorrect frequencies

2017-08-01 Thread Matthew Martin
AONRISHetc is > from some well-known research, but ETSAOR* is brand new and even google > cannot find a reference to that ordering. It seems there is a bug here, > but is it perhaps the other frequency table? I certainly don't claim to know which frequencies are more accurate. Does anyone have a preferred source for which percentages to use? - Matthew Martin

Re: caesar(6) documents incorrect frequencies

2017-08-09 Thread Matthew Martin
On Tue, Aug 01, 2017 at 08:41:32AM -0500, Matthew Martin wrote: > On Tue, Aug 01, 2017 at 07:38:28AM -0600, Theo de Raadt wrote: > > > On Tue, Aug 01, 2017 at 07:28:39AM -0600, Theo de Raadt wrote: > > > > I've known about ETAONRISHetc basically forever. Wh

user(8): Don't create default config file

2016-10-06 Thread Matthew Martin
There doesn't seem to be any reason for user to write out a config file with the defaults if none exists. I've never seen anything else in base do this, so kill it. - Matthew Martin Index: user.c === RCS file: /cvs/sr

Re: user(8): Don't create default config file

2016-10-13 Thread Matthew Martin
On Thu, Oct 06, 2016 at 10:36:48PM -0500, Matthew Martin wrote: > There doesn't seem to be any reason for user to write out a config file > with the defaults if none exists. I've never seen anything else in base > do this, so kill it. Ping. With man pages fixes this time

[patch] Skip DHCP responsefile if no interface is given

2016-11-26 Thread Matthew Martin
Don't force the user to pick an interface if the responsefile is on a disk. - Matthew Martin Index: install.sub === RCS file: /cvs/src/distrib/miniroot/install.sub,v retrieving revision 1.932 diff -u -p -r1.932 instal

Re: [patch] Skip DHCP responsefile if no interface is given

2016-12-07 Thread Matthew Martin
ping On Sat, Nov 26, 2016 at 11:28:55PM -0600, Matthew Martin wrote: > Don't force the user to pick an interface if the responsefile is on > a disk. > > - Matthew Martin > > > Index: install.sub > ===

Add support for SGR parameters 39 and 49

2015-07-12 Thread Matthew Martin
Currently on the console echo '\033[34mblue\033[39m white' will echo both words with a blue foreground. Add support for SGR 39 and 49 that reset the fg and bg color respectively back to default. - Matthew Martin Index: wsemul_vt

Re: Add support for SGR parameters 39 and 49

2015-07-29 Thread Matthew Martin
On Sun, Jul 12 2015 at 12:23:48 -0500, Matthew Martin wrote: > Currently on the console > echo '\033[34mblue\033[39m white' > will echo both words with a blue foreground. Add support for SGR 39 and > 49 that reset the fg and bg color respectively back to default. > >

Re: Add support for SGR parameters 39 and 49

2015-08-13 Thread Matthew Martin
On Wed, Jul 29, 2015 at 05:42:10PM -0500, Matthew Martin wrote: > On Sun, Jul 12 2015 at 12:23:48 -0500, Matthew Martin wrote: > > Currently on the console > > echo '\033[34mblue\033[39m white' > > will echo both words with a blue foreground. Add support for SGR 39 a

xargs -0 -I

2015-09-27 Thread Matthew Martin
The following outputs only $ with a newline. { i=0; while [ $i -lt 89 ]; do printf $i\\0; : $(( i++ )); done; } | xargs -0 -I $ printf '%s\n' $ The problem is two fold. The first is that strnsubst gives up on substituting since replstr is greater than maxsize. This should likely cause an

Re: xargs -0 -I

2015-10-12 Thread Matthew Martin
ping On Sun, Sep 27, 2015 at 09:52:16AM -0500, Matthew Martin wrote: > The following outputs only $ with a newline. > > { i=0; while [ $i -lt 89 ]; do printf $i\\0; : $(( i++ )); done; } | > xargs -0 -I $ printf '%s\n' $ > > The problem is two fold. The firs

tcpdump: checksums are 4 hexits

2015-11-10 Thread Matthew Martin
Dropping leading zeros doesn't make sense for checksums. Only odd case is print-mobile.c which previously printed checksums as decimal. print-gre.c also sticks out as the only one that prepends "0x". - Matthew Martin Index: usr.sbin/tcpdu

[patch] Convert modulus to arc4random_uniform

2015-12-06 Thread Matthew Martin
sd/util.c usr.sbin/nsd/xfrd.c as they seem to have upstreams. The only other case is games/wump/wump.c which has if (arc4random() % 2 == 1) This is safe and seems obvious enough to me. - Matthew Martin Index: games/atc/update.c ===

Re: [patch] Convert modulus to arc4random_uniform

2015-12-07 Thread Matthew Martin
On Mon, Dec 07, 2015 at 09:33:47AM +0100, Theo Buehler wrote: > I think some of these are ok, but I'm unsure about some of the others. > Here are some of my concerns: > > - since arc4random_uniform can potentially loop indefinitely, it > might interfere with predictable timing of some routines.

Re: usermod.8 patch

2017-03-31 Thread Matthew Martin
On Fri, Mar 31, 2017 at 08:03:44AM -0500, Edgar Pettijohn wrote: > usermod(8) doesn't have an option for setting defaults. Here is a patch to > correct the manual. I believe it's referring to user.c read_defaults which calls setdefaults before reading the defaults.

snprintf(3) example warns under -Wextra

2017-04-22 Thread Matthew Martin
The example proper usage of snprintf(3) (under Caveats) evokes a warning when compiled with -Wextra. I presume casting ret to unsigned int would be safe, but I'll defer to those who know the nuances. #include int foo(char* string) { char buffer[128]; int ret = snprintf(buffer, si

[patch] ND_COMPUTER_RTIME is not uniformly distributed

2017-05-07 Thread Matthew Martin
RFC 4861 specifies ReachableTime "should be a uniformly distributed random value between MIN_RANDOM_FACTOR and MAX_RANDOM_FACTOR times BaseReachableTime milliseconds." I think the author intended to do the multiplication by (x>>10) outside the mask, but it's still missing a

[patch] Fail execve on environment duplicates

2017-05-08 Thread Matthew Martin
ge except for a purposefully misbehaving program to test that execve will fail. EINVAL gives a somewhat confusing error message, but nothing in intro(2) looked like a better choice. Idea from Martin Brandenburg. - Matthew Martin diff --git kern_exec.c kern_exec.c index 7784d5f4165..3c3

Re: [patch] ND_COMPUTER_RTIME is not uniformly distributed

2017-05-15 Thread Matthew Martin
ping On Sun, May 07, 2017 at 06:59:12PM -0500, Matthew Martin wrote: > RFC 4861 specifies ReachableTime "should be a uniformly distributed > random value between MIN_RANDOM_FACTOR and MAX_RANDOM_FACTOR times > BaseReachableTime milliseconds." I think the author intended to do t

Re: [patch] ND_COMPUTER_RTIME is not uniformly distributed

2017-05-15 Thread Matthew Martin
On Mon, May 15, 2017 at 03:49:55PM +0200, Mike Belopuhov wrote: > On Sun, May 07, 2017 at 18:59 -0500, Matthew Martin wrote: > > RFC 4861 specifies ReachableTime "should be a uniformly distributed > > random value between MIN_RANDOM_FACTOR and MAX_RANDOM_FACTOR times &

[patch] Avoid system(3) in ikectl

2017-05-18 Thread Matthew Martin
cause it uses system(3) in various places to run openssl, tar, and zip. Take the hint from the system(3) man page, and write a small function that does the fork and exec bypassing sh. Keep in mind while reviewing ca->batch was either "" or "-batch " and is now either "

[patch] Use readpassphrase in ikectl

2017-05-18 Thread Matthew Martin
While making the last patch, I noticed ikectl uses getpass. Use readpassphrase instead and explicit_bzero the buffers. - Matthew Martin diff --git ikeca.c ikeca.c index 69ca076407b..2ec010a5831 100644 --- ikeca.c +++ ikeca.c @@ -22,6 +22,7 @@ #include #include #include +#include