Re: [patch] httpd: don't add date header if already set
OK florian@ p.s. whoever commits this please add extra ( ) around the && term, Apparently clang no longer supports operator precedence *sigh*. I'm wondering if it also warns for a * b + c /usr/src/usr.sbin/httpd/server_fcgi.c:665:56: warning: '&&' within '||' [-Wlogical-op-parentheses] if ((kv = kv_find(&resp->http_headers, &key)) == NULL && ~~^~ /usr/src/usr.sbin/httpd/server_fcgi.c:665:56: note: place parentheses around the '&&' expression to silence this warning if ((kv = kv_find(&resp->http_headers, &key)) == NULL && ^ 1 warning generated. On Sat, Jul 29, 2017 at 09:11:14PM -0700, Nick Owens wrote: > ping? > > On Jul 18, 2017 19:01, "Nick Owens" wrote: > > hello tech@, > > here is a diff that will cause httpd's fcgi code to not set the HTTP > date header if it has already been set. the code i am using for an fcgi > server > (https://github.com/golang/go/blob/master/src/net/http/fcgi/child.go#L102) > unconditionally sets the Date header, so with httpd there is a > duplicate "Date:" header in responses. > > quick glances at lighttpd and apache2 seem to agree with this behavior. > > Index: server_fcgi.c > === > RCS file: /cvs/src/usr.sbin/httpd/server_fcgi.c,v > retrieving revision 1.74 > diff -u -p -u -p -r1.74 server_fcgi.c > --- server_fcgi.c 21 Jan 2017 11:32:04 - 1.74 > +++ server_fcgi.c 18 Jul 2017 21:31:01 - > @@ -661,8 +661,10 @@ server_fcgi_header(struct client *clt, u > } > > /* Date header is mandatory and should be added as late as possible > */ > - if (server_http_time(time(NULL), tmbuf, sizeof(tmbuf)) <= 0 || > - kv_add(&resp->http_headers, "Date", tmbuf) == NULL) > + key.kv_key = "Date"; > + if ((kv = kv_find(&resp->http_headers, &key)) == NULL && > + (server_http_time(time(NULL), tmbuf, sizeof(tmbuf)) <= 0 || > + kv_add(&resp->http_headers, "Date", tmbuf) == NULL)) > return (-1); > > /* Write initial header (fcgi might append more) */ -- I'm not entirely sure you are real.
Re: [patch] httpd: don't add date header if already set
ping? On Jul 18, 2017 19:01, "Nick Owens" wrote: hello tech@, here is a diff that will cause httpd's fcgi code to not set the HTTP date header if it has already been set. the code i am using for an fcgi server (https://github.com/golang/go/blob/master/src/net/http/fcgi/child.go#L102) unconditionally sets the Date header, so with httpd there is a duplicate "Date:" header in responses. quick glances at lighttpd and apache2 seem to agree with this behavior. Index: server_fcgi.c === RCS file: /cvs/src/usr.sbin/httpd/server_fcgi.c,v retrieving revision 1.74 diff -u -p -u -p -r1.74 server_fcgi.c --- server_fcgi.c 21 Jan 2017 11:32:04 - 1.74 +++ server_fcgi.c 18 Jul 2017 21:31:01 - @@ -661,8 +661,10 @@ server_fcgi_header(struct client *clt, u } /* Date header is mandatory and should be added as late as possible */ - if (server_http_time(time(NULL), tmbuf, sizeof(tmbuf)) <= 0 || - kv_add(&resp->http_headers, "Date", tmbuf) == NULL) + key.kv_key = "Date"; + if ((kv = kv_find(&resp->http_headers, &key)) == NULL && + (server_http_time(time(NULL), tmbuf, sizeof(tmbuf)) <= 0 || + kv_add(&resp->http_headers, "Date", tmbuf) == NULL)) return (-1); /* Write initial header (fcgi might append more) */
Re: nm in free(): chunk canary corrupted 0x3e6e6845580 0x19@0x19
On Sat, Jul 29, 2017 at 10:43:23AM +0100, Stuart Henderson wrote: > I was just running nm over all of /usr/lib on a system with C in malloc > flags and ran into this. > > $ MALLOC_OPTIONS=C nm -s libc.so.89.3.a The bug seems to be in mmbr_name. First add one to len so there's space for the null with strlcpy. Second when advancing p to the end of the string, subtract one from len so that p points to the null not past the null. I believe the latter fixes the issue as the later *p = '\0'; wrote past the end of the allocation. Aside: I'm not sure p -= (long)*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 *namelen, FILE *fp) int len; i = atol(&arh->ar_name[1]); - len = strlen(&nametab[i]); + len = strlen(&nametab[i]) + 1; if (len > *namelen) { p -= (long)*name; if ((*name = realloc(*name, baselen+len)) == NULL) @@ -319,7 +319,7 @@ mmbr_name(struct ar_hdr *arh, char **name, int baselen, int *namelen, FILE *fp) p += (long)*name; } strlcpy(p, &nametab[i], len); - p += len; + p += len - 1; } else #ifdef AR_EFMT1 /*
Re: efiboot boot path matching
On Sat, Jul 29, 2017 at 09:01:35PM +0200, Patrick Wildt wrote: > On Sat, Jul 29, 2017 at 02:59:19PM +0200, Mark Kettenis wrote: > > This is apparently very hard. Caught this on arm64 where > > efi_device_path_depth() returned 0, which resulted in always selecting > > the first device. Clearly if the first path component (i = 0) matches > > the desired type, we should return 1, not 0. Here is the amd64 > > version of the diff which is easier to test for people. > > > > ok? > > God damn, this feels like the tenth time this thing has to be fixed up. > Fix looks good to me, please commit that on arm64 and armv7 as well. > > ok patrick@ The changes to arm64 broke boot on the overdrive 1000. Press ESCAPE for boot options .>> OpenBSD/arm64 BOOTAA64 0.5 boot> cannot open sd0a:/etc/random.seed: Device not configured booting sd0a:/bsd: open sd0a:/bsd: Device not configured failed(6). will try /bsd boot> cannot open sd0a:/etc/random.seed: Device not configured booting sd0a:/bsd: open sd0a:/bsd: Device not configured failed(6). will try /bsd Turning timeout off. Press ESCAPE for boot options .>> OpenBSD/arm64 BOOTAA64 0.4 boot> booting sd0a:/bsd: 3792240+572652+505240+673568 [86+446424+237176]=0x7c7060 type 0x0 pa 0x80 va 0x0 pages 0xe80 attr 0xe type 0x7 pa 0x8000e8 va 0x0 pages 0x180 attr 0xe type 0x2 pa 0x800100 va 0x0 pages 0x4000 attr 0xe type 0x7 pa 0x800500 va 0x0 pages 0x1adfd attr 0xe type 0x4 pa 0x801fdfd000 va 0x0 pages 0x203 attr 0xe type 0x7 pa 0x802000 va 0x0 pages 0x1d8086 attr 0xe type 0x2 pa 0x81f8086000 va 0x0 pages 0x67a attr 0xe type 0x9 pa 0x81f870 va 0x0 pages 0xa0 attr 0xe type 0x2 pa 0x81f87a va 0x0 pages 0xc attr 0xe type 0x7 pa 0x81f87ac000 va 0x0 pages 0x1 attr 0xe type 0x1 pa 0x81f87ad000 va 0x0 pages 0x13 attr 0xe type 0x7 pa 0x81f87c va 0x0 pages 0x196f attr 0xe type 0x4 pa 0x81fa12f000 va 0x0 pages 0x681 attr 0xe type 0x7 pa 0x81fa7b va 0x0 pages 0x16 attr 0xe type 0x4 pa 0x81fa7c6000 va 0x0 pages 0xeda attr 0xe type 0x7 pa 0x81fb6a va 0x0 pages 0x46 attr 0xe type 0x3 pa 0x81fb6e6000 va 0x0 pages 0x14a attr 0xe type 0x5 pa 0x81fb83 va 0x0 pages 0x3e0 attr 0x800e type 0x7 pa 0x81fbc1 va 0x0 pages 0x200 attr 0xe type 0x6 pa 0x81fbe1 va 0x0 pages 0x1f0 attr 0x800e type 0x7 pa 0x81fc00 va 0x0 pages 0x1f attr 0xe type 0x4 pa 0x81fc01f000 va 0x0 pages 0x1 attr 0xe type 0x7 pa 0x81fc02 va 0x0 pages 0x3732 attr 0xe type 0x4 pa 0x81ff752000 va 0x0 pages 0x87a attr 0xe type 0x7 pa 0x81fffcc000 va 0x0 pages 0x4 attr 0xe type 0x6 pa 0x81fffd va 0x0 pages 0x20 attr 0x800e type 0x7 pa 0x81 va 0x0 pages 0xc attr 0xe type 0x4 pa 0x81c000 va 0x0 pages 0x4 attr 0xe [ using 684968 bytes of bsd ELF symbol table ] Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. Copyright (c) 1995-2017 OpenBSD. All rights reserved. https://www.OpenBSD.org
[diff] typo in tls_load_file.3
Missing 'ocsp' in the function name. +--+ Carlos diff --git lib/libtls/man/tls_load_file.3 lib/libtls/man/tls_load_file.3 index fcaa5eef029..b83f55e0fe4 100644 --- lib/libtls/man/tls_load_file.3 +++ lib/libtls/man/tls_load_file.3 @@ -254,7 +254,7 @@ sets the files from which the public certificate, and private key will be read. .Fn tls_config_set_keypair_mem directly sets the public certificate, and private key from memory. .Pp -.Fn tls_config_set_keypair_file +.Fn tls_config_set_keypair_ocsp_file sets the files from which the public certificate, private key, and DER encoded OCSP staple will be read. .Pp
[PATCH] run security(8) on first boot
I did a couple of fresh installs the other day, which reminded me of a minor irritation and prompted me to think about a possible solution. The first run of security(8) on a fresh install is not terribly helpful. It produces a huge email report since it diffs all the /etc/changelist files against /dev/null. If you're already familiar with OpenBSD and understand this behavior, you probably disregard this email and drive on. If you're a new user, this is probably surprising and somewhat misleading. After all, you've just installed an operating system that takes justifiable pride in sane, secure defaults, and the next morning you receive a multi-thousand-line insecurity report that calls out every important configuration file on the system. I think the simplest way to prevent this would be for install.sub to add a line to /etc/rc.firsttime that runs security(8) and discards the output, or perhaps logs it to a file, rather than emailing it. This would "prime the pump" by populating /var/backups with as-installed copies of the changelist files, and then the first nightly run of security(8) would only show files that have actually been changed post-install. Of course, this also means you have virgin copies of your config files stashed away immediately, in case you need one before the nightly security(8) run can back them up for you. This will make the first boot take longer, perhaps by several minutes on slower platforms. Of course, the first boot is already slower due to key generation, etc. Diff below was tested in an amd64 bsd.rd and seems to behave as expected. I have *not* built a full release or tested every possible use case; I know there are sometimes issues with space on some install media, and hopefully this small addition would not cause an overflow. Does anyone see value in this? If not, I suppose it might end up living in my install.site. Index: install.sub === RCS file: /cvs/src/distrib/miniroot/install.sub,v retrieving revision 1.1031 diff -u -p -r1.1031 install.sub --- install.sub 28 Jul 2017 18:15:44 - 1.1031 +++ install.sub 29 Jul 2017 21:03:03 - @@ -2976,6 +2976,9 @@ do_install() { print -r -- "$_rootkey" >>/mnt/root/.ssh/authorized_keys ) + # Run security(8) on first boot to populate /var/backups + echo "/usr/libexec/security > /dev/null" >> /mnt/etc/rc.firsttime + # Perform final steps common to both an install and an upgrade. finish_up }
Re: less(1) - segmentation fault with '-g'
Theo Buehler wrote: > On Thu, Jul 27, 2017 at 10:31:51AM +0100, Larry Hynes wrote: > > Hi > > > > $ env | grep LESS > > LESSHISTFILE=- > > LESS="-i -M -R -g -c" > > LESSCHARSET=utf-8 > > > > $ unset LESS > > $ unset LESSCHARSET > > $ unset LESSHISTFILE > > > > $ LESS="-g" > > $ echo 'foo\nbar\nfoo\nbar\nfoo\nbar' | less > > > > While in less, '/' to search, then '^N', or '!', to search for lines > > which do NOT match the pattern, entering foo results in a seg > > fault. > > > > This is on amd64. > > Thanks for the report. Of course you want 'export LESS="-g"' here, > otherwise less(1) won't use the -g flag which is crucial for this crash. Ah. I've set 'allexport', so missed that; sorry. > I don't have a fix, but maybe this helps a bit: Anton's patches to pattern.c and search.c are working here so far.
mg: print default choice before colon in echo line prompts
Hi, GNU Emacs always, or very nearly always, prints the default choice before the colon in any given prompt. For example, you'll see "Kill buffer (default foo): " not "Kill buffer: (default foo) " This patch moves all default choices before the colon in all of mg's prompts. While here, add missing spaces in two prompts in tags.c and capitalize the tables prompt in tags.c. The first word of a minibuffer prompt is typically capitalized, and all others in mg(1) are currently capitalized except for "apropos", which is exempt because in that case it's meant to evoke the utility of the same name. Feedback? -- Scott Cheloha Index: usr.bin/mg/buffer.c === RCS file: /cvs/src/usr.bin/mg/buffer.c,v retrieving revision 1.103 diff -u -p -r1.103 buffer.c --- usr.bin/mg/buffer.c 13 Mar 2017 20:32:58 - 1.103 +++ usr.bin/mg/buffer.c 29 Jul 2017 20:55:54 - @@ -86,7 +86,7 @@ usebuffer(int f, int n) if (curbp->b_altb == NULL) bufp = eread("Switch to buffer: ", bufn, NBUFN, EFNEW | EFBUF); else - bufp = eread("Switch to buffer: (default %s) ", bufn, NBUFN, + bufp = eread("Switch to buffer (default %s): ", bufn, NBUFN, EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); if (bufp == NULL) @@ -112,7 +112,7 @@ poptobuffer(int f, int n) bufp = eread("Switch to buffer in other window: ", bufn, NBUFN, EFNEW | EFBUF); else - bufp = eread("Switch to buffer in other window: (default %s) ", + bufp = eread("Switch to buffer in other window (default %s): ", bufn, NBUFN, EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); if (bufp == NULL) return (ABORT); @@ -146,7 +146,7 @@ killbuffer_cmd(int f, int n) if (f & FFRAND) /* dired mode 'q' */ bp = curbp; - else if ((bufp = eread("Kill buffer: (default %s) ", bufn, NBUFN, + else if ((bufp = eread("Kill buffer (default %s): ", bufn, NBUFN, EFNUL | EFNEW | EFBUF, curbp->b_bname)) == NULL) return (ABORT); else if (bufp[0] == '\0') @@ -746,7 +746,7 @@ bufferinsert(int f, int n) /* Get buffer to use from user */ if (curbp->b_altb != NULL) - bufp = eread("Insert buffer: (default %s) ", bufn, NBUFN, + bufp = eread("Insert buffer (default %s): ", bufn, NBUFN, EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname); else bufp = eread("Insert buffer: ", bufn, NBUFN, EFNEW | EFBUF); Index: usr.bin/mg/re_search.c === RCS file: /cvs/src/usr.bin/mg/re_search.c,v retrieving revision 1.32 diff -u -p -r1.32 re_search.c --- usr.bin/mg/re_search.c 30 May 2017 07:05:22 - 1.32 +++ usr.bin/mg/re_search.c 29 Jul 2017 20:55:54 - @@ -429,7 +429,7 @@ re_readpattern(char *re_prompt) if (re_pat[0] == '\0') rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, re_prompt); else - rep = eread("%s: (default %s) ", tpat, NPAT, + rep = eread("%s (default %s): ", tpat, NPAT, EFNUL | EFNEW | EFCR, re_prompt, re_pat); if (rep == NULL) return (ABORT); Index: usr.bin/mg/search.c === RCS file: /cvs/src/usr.bin/mg/search.c,v retrieving revision 1.45 diff -u -p -r1.45 search.c --- usr.bin/mg/search.c 30 May 2017 07:05:22 - 1.45 +++ usr.bin/mg/search.c 29 Jul 2017 20:55:54 - @@ -838,7 +838,7 @@ readpattern(char *r_prompt) if (pat[0] == '\0') rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, r_prompt); else - rep = eread("%s: (default %s) ", tpat, NPAT, + rep = eread("%s (default %s): ", tpat, NPAT, EFNUL | EFNEW | EFCR, r_prompt, pat); /* specified */ Index: usr.bin/mg/tags.c === RCS file: /cvs/src/usr.bin/mg/tags.c,v retrieving revision 1.15 diff -u -p -r1.15 tags.c --- usr.bin/mg/tags.c 30 May 2017 07:05:22 - 1.15 +++ usr.bin/mg/tags.c 29 Jul 2017 20:55:54 - @@ -86,7 +86,7 @@ tagsvisit(int f, int n) return (FALSE); } - bufp = eread("visit tags table (default %s): ", fname, + bufp = eread("Visit tags table (default %s): ", fname, NFILEN, EFFILE | EFCR | EFNEW | EFDEF, DEFAULTFN); if (bufp == NULL) return (ABORT); @@ -150,9 +150,9 @@ findtag(int f, int n) if (curtoken(f, n, dtok) == FALSE) { dtok[0] = '\0'; - bufp = eread("Find tag:", utok, MAX_TOKEN, EFNUL | EFNEW); + bufp = eread("Find tag: ", utok, MAX_TOKEN, EFNUL | EFNEW); } else
Re: sysctl machdep.lidaction=suspend
On Sat, Jul 29, 2017 at 10:43:55PM +0200, Ingo Schwarze wrote: > > All the same, i'd like to point out that there is a minor documentation > issue. Some time ago, we decided that having duplicate descriptions > of each and every sysctl variable in sysctl(3) and sysctl(8) is bad > for maintainability, deleted them all from sysctl(8), and made sure > users of sysctl(8) can understand the full listing in sysctl(3) by > adding the full string-names used by sysctl(8) to the sysctl(3) > manual page. > > So after your patch, we would have to document in sysctl(3) that > CTL_MACHDEP.CPU_LIDACTION = machdep.lidaction takes int on the C > interface level and strings on the command line, and that > 0=none, 1=suspend, 2=hibernate. > that would be doable, but... > While i don't know whether documenting *all* machdep variables in > sysctl(3) would make sense, machdep.lidaction certainly seems > important enough to document it. Same for machdep.kbdreset. > ... at present sysctl(3) does not describe any machdep syscts at all. it never has (or we removed them long ago and i forget). the theory was that the machdep ctls were a moving target and, by definition, only relevant to specific platforms. so sysctl(3) didn;t even attempt to describe them, sysctl(8) listed some of them, and sysctl.conf described some of them. maybe there's a bigger discussion possible, but for now it would be simple, and not inconsistent, to just keep that in the example /etc file. no immediate doc change would be needed. jmc > Yours, > Ingo >
Re: sysctl machdep.lidaction=suspend
Hi Martin, Martin Natano wrote on Sat, Jul 29, 2017 at 08:45:05PM +0200: > On Sat, Jul 29, 2017 at 02:19:50PM +0200, Martin Natano wrote: >> On Sat, Jul 29, 2017 at 02:03:22PM +0200, Mark Kettenis wrote: >>> I don't think we want to add string parsing like this in the kernel. >>> Maybe the sysctl(8) frontend should do the mapping from strings to >>> numbers? >> Ok, I'll try to come up with an alternative diff that does the parsing >> in sysctl(8). Let me fetch my rubber gloves... > Here's the alternative diff. Ok? Here are my two cents: For users, "=hibernate" is easier to understand than "=2", so i sympathize with sysctl(8) taking the former. Users rarely have to use sysctl(3) directly, so i don't think it matters much whether the C interface takes a string or an int; do whatever is safer in the kernel. All the same, i'd like to point out that there is a minor documentation issue. Some time ago, we decided that having duplicate descriptions of each and every sysctl variable in sysctl(3) and sysctl(8) is bad for maintainability, deleted them all from sysctl(8), and made sure users of sysctl(8) can understand the full listing in sysctl(3) by adding the full string-names used by sysctl(8) to the sysctl(3) manual page. So after your patch, we would have to document in sysctl(3) that CTL_MACHDEP.CPU_LIDACTION = machdep.lidaction takes int on the C interface level and strings on the command line, and that 0=none, 1=suspend, 2=hibernate. While i don't know whether documenting *all* machdep variables in sysctl(3) would make sense, machdep.lidaction certainly seems important enough to document it. Same for machdep.kbdreset. Yours, Ingo
[PATCH] United sys/ntfs/ntfs.h and sys/ntfs/ntfsmount.h
file ntfsmount.h contains TWO defines! I moved this to ntfs.h file and remove ntfsmount.h for optinize headers. Amd64 build is ok. Index: ntfs/ntfs.h === RCS file: /cvs/src/sys/ntfs/ntfs.h,v retrieving revision 1.17 diff -u -p -u -p -r1.17 ntfs.h --- ntfs/ntfs.h 24 Nov 2013 16:02:30 - 1.17 +++ ntfs/ntfs.h 29 Jul 2017 19:16:15 - @@ -299,6 +299,10 @@ struct ntfsmount { #define ntfs_btocnoff(off) (off_t)((off) % ((ntmp)->ntm_spc * (ntmp)->ntm_bps)) #define ntfs_bntob(bn) (int32_t)((bn) * (ntmp)->ntm_bps) +/* mount flags */ +#define NTFS_MFLAG_CASEINS 0x0001 +#define NTFS_MFLAG_ALLNAMES 0x0002 + #ifdef _KERNEL #if defined(NTFS_DEBUG) extern int ntfs_debug; Index: ntfs/ntfs_subr.c === RCS file: /cvs/src/sys/ntfs/ntfs_subr.c,v retrieving revision 1.50 diff -u -p -u -p -r1.50 ntfs_subr.c --- ntfs/ntfs_subr.c 11 Apr 2017 14:43:49 - 1.50 +++ ntfs/ntfs_subr.c 29 Jul 2017 19:16:16 - @@ -43,7 +43,6 @@ /* #define NTFS_DEBUG 1 */ #include -#include #include #include #include Index: ntfs/ntfsmount.h === RCS file: ntfs/ntfsmount.h diff -N ntfs/ntfsmount.h --- ntfs/ntfsmount.h 29 May 2006 20:40:58 - 1.3 +++ /dev/null 1 Jan 1970 00:00:00 - @@ -1,33 +0,0 @@ -/* $OpenBSD: ntfsmount.h,v 1.3 2006/05/29 20:40:58 miod Exp $ */ -/* $NetBSD: ntfsmount.h,v 1.1 2002/12/23 17:38:34 jdolecek Exp $ */ - -/*- - * Copyright (c) 1998, 1999 Semen Ustimenko - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - *notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - *notice, this list of conditions and the following disclaimer in the - *documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Id: ntfsmount.h,v 1.4 1999/05/12 09:43:09 semenu Exp - */ - -#define NTFS_MFLAG_CASEINS 0x0001 -#define NTFS_MFLAG_ALLNAMES 0x0002
Re: Is someone interested in resuming support for socppc?
On Sat, Jul 29, 2017 at 01:33:03PM +0300, Андрей Болконский wrote: > https://www.openbsd.org/socppc.html > > > The OpenBSD/socppc port was discontinued after the 5.8 release. > Otherwise, will you approve removing support for socppc from src? I am still using a RB600A.
Re: efiboot boot path matching
On Sat, Jul 29, 2017 at 02:59:19PM +0200, Mark Kettenis wrote: > This is apparently very hard. Caught this on arm64 where > efi_device_path_depth() returned 0, which resulted in always selecting > the first device. Clearly if the first path component (i = 0) matches > the desired type, we should return 1, not 0. Here is the amd64 > version of the diff which is easier to test for people. > > ok? God damn, this feels like the tenth time this thing has to be fixed up. Fix looks good to me, please commit that on arm64 and armv7 as well. ok patrick@ > > > Index: arch/amd64/stand/efiboot/conf.c > === > RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/conf.c,v > retrieving revision 1.8 > diff -u -p -r1.8 conf.c > --- arch/amd64/stand/efiboot/conf.c 1 Jun 2017 11:32:15 - 1.8 > +++ arch/amd64/stand/efiboot/conf.c 29 Jul 2017 12:54:10 - > @@ -38,7 +38,7 @@ > #include "efiboot.h" > #include "efidev.h" > > -const char version[] = "3.33"; > +const char version[] = "3.34"; > > #ifdef EFI_DEBUG > int debug = 0; > Index: arch/amd64/stand/efiboot/efiboot.c > === > RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v > retrieving revision 1.20 > diff -u -p -r1.20 efiboot.c > --- arch/amd64/stand/efiboot/efiboot.c1 Jun 2017 11:32:15 - > 1.20 > +++ arch/amd64/stand/efiboot/efiboot.c29 Jul 2017 12:54:10 - > @@ -222,7 +222,7 @@ efi_device_path_depth(EFI_DEVICE_PATH *d > > for (i = 0; !IsDevicePathEnd(dp); dp = NextDevicePathNode(dp), i++) { > if (DevicePathType(dp) == dptype) > - return (i); > + return (i + 1); > } > > return (-1); >
Re: [diff] httpd: tls client cert & CRL checks
Hi Jack, On Fri, Jul 28, 2017 at 02:05:34AM +0930, Jack Burton wrote: > On Thu, 27 Jul 2017 13:10:14 +0200 > > > But, I found a bug in the part of the FastCGI variables. The > > following condition is always false. > > > > > Index: usr.sbin/httpd/server_fcgi.c > > > === > > > RCS file: /cvs/src/usr.sbin/httpd/server_fcgi.c,v > > > retrieving revision 1.74 > > > diff -u -p -r1.74 server_fcgi.c > > > --- usr.sbin/httpd/server_fcgi.c 21 Jan 2017 11:32:04 > > > - 1.74 +++ usr.sbin/httpd/server_fcgi.c 21 Jul > > > 2017 08:25:57 - @@ -282,11 +283,57 @@ server_fcgi(struct httpd > > > *env, struct cl > > ... > > > + if (srv_conf->tls_ca != NULL) { > > ... > > That's odd -- I'm not seeing that behaviour here -- in my tests > srv_conf->tls_ca always behaved just as expected (it's NULL iff the "tls > client ca" directive is not given for that server). In the End, I found and fixed the real bug here: @@ -430,7 +438,11 @@ config_getserver_config(struct httpd *en } f = SRVFLAG_TLS; - srv_conf->flags |= parent->flags & f; + if ((srv_conf->flags & f) == 0) { + srv_conf->flags |= parent->flags & f; + srv_conf->tls_ca = parent->tls_ca; + srv_conf->tls_crl = parent->tls_crl; + } f = SRVFLAG_ACCESS_LOG; if ((srv_conf->flags & f) == 0) { This additional copy fixes the bug I have seen by this config: server "default" { listen on 127.0.0.1 tls port 443 # TLS certificate and key files created with acme-client(1) tls certificate "/root/ca/server.crt" tls key "/root/ca/server.key" #tls client ca "/root/ca/ca.crt" crl "/root/ca/ca.crl" tls client ca "/root/ca/ca.crt" location "*.cgi" { fastcgi root "/var/www/cgi-bin/env.cgi" } root "/htdocs/" } You find the whole diff below. I tested: - TLS without client certs - TLS with client certs and without CRL - TLS with client certs and with CRL - as well as environment variables in CGI-Scripts Everything should work now. Bye, Jan Index: usr.sbin/httpd/config.c === RCS file: /mount/openbsd/cvs/src/usr.sbin/httpd/config.c,v retrieving revision 1.53 diff -u -p -r1.53 config.c --- usr.sbin/httpd/config.c 19 Jul 2017 17:36:25 - 1.53 +++ usr.sbin/httpd/config.c 29 Jul 2017 18:14:36 - @@ -304,10 +304,18 @@ config_setserver_tls(struct httpd *env, log_debug("%s: configuring tls for %s", __func__, srv_conf->name); + if (config_settls(env, srv, TLS_CFG_CA, "ca", srv_conf->tls_ca, + srv_conf->tls_ca_len) != 0) + return (-1); + if (config_settls(env, srv, TLS_CFG_CERT, "cert", srv_conf->tls_cert, srv_conf->tls_cert_len) != 0) return (-1); + if (config_settls(env, srv, TLS_CFG_CRL, "crl", srv_conf->tls_crl, + srv_conf->tls_crl_len) != 0) + return (-1); + if (config_settls(env, srv, TLS_CFG_KEY, "key", srv_conf->tls_key, srv_conf->tls_key_len) != 0) return (-1); @@ -430,7 +438,11 @@ config_getserver_config(struct httpd *en } f = SRVFLAG_TLS; - srv_conf->flags |= parent->flags & f; + if ((srv_conf->flags & f) == 0) { + srv_conf->flags |= parent->flags & f; + srv_conf->tls_ca = parent->tls_ca; + srv_conf->tls_crl = parent->tls_crl; + } f = SRVFLAG_ACCESS_LOG; if ((srv_conf->flags & f) == 0) { @@ -655,9 +667,21 @@ config_getserver_tls(struct httpd *env, } switch (tls_conf.tls_type) { + case TLS_CFG_CA: + if (config_gettls(env, srv_conf, &tls_conf, "ca", p, len, + &srv_conf->tls_ca, &srv_conf->tls_ca_len) != 0) + goto fail; + break; + case TLS_CFG_CERT: if (config_gettls(env, srv_conf, &tls_conf, "cert", p, len, &srv_conf->tls_cert, &srv_conf->tls_cert_len) != 0) + goto fail; + break; + + case TLS_CFG_CRL: + if (config_gettls(env, srv_conf, &tls_conf, "crl", p, len, + &srv_conf->tls_crl, &srv_conf->tls_crl_len) != 0) goto fail; break; Index: usr.sbin/httpd/httpd.conf.5 === RCS file: /mount/openbsd/cvs/src/usr.sbin/httpd/httpd.conf.5,v retrieving revision 1.82 diff -u -p -r1.82 httpd.conf.5 --- usr.sbin/httpd/httpd.conf.5 9 Apr 2017 09:13:28 - 1.82 +++ usr.sbin/httpd/httpd.conf.5 28 Jul 2017 11:28:25 - @
Re: sysctl machdep.lidaction=suspend
On Sat, Jul 29, 2017 at 02:19:50PM +0200, Martin Natano wrote: > On Sat, Jul 29, 2017 at 02:03:22PM +0200, Mark Kettenis wrote: > > > > I don't think we want to add string parsing like this in the kernel. > > Maybe the sysctl(8) frontend should do the mapping from strings to > > numbers? > > Ok, I'll try to come up with an alternative diff that does the parsing > in sysctl(8). Let me fetch my rubber gloves... Here's the alternative diff. Ok? Index: etc/etc.amd64/sysctl.conf === RCS file: /cvs/src/etc/etc.amd64/sysctl.conf,v retrieving revision 1.7 diff -u -p -r1.7 sysctl.conf --- etc/etc.amd64/sysctl.conf 2 Mar 2017 10:38:09 - 1.7 +++ etc/etc.amd64/sysctl.conf 25 Jul 2017 18:40:31 - @@ -1,3 +1,3 @@ #machdep.allowaperture=2 # See xf86(4) #machdep.kbdreset=1# permit console CTRL-ALT-DEL to do a nice halt -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon lid closing +#machdep.lidaction=none# action upon lid closing: none, suspend or hibernate Index: etc/etc.i386/sysctl.conf === RCS file: /cvs/src/etc/etc.i386/sysctl.conf,v retrieving revision 1.21 diff -u -p -r1.21 sysctl.conf --- etc/etc.i386/sysctl.conf2 Mar 2017 10:38:09 - 1.21 +++ etc/etc.i386/sysctl.conf25 Jul 2017 18:40:35 - @@ -1,4 +1,4 @@ #machdep.allowaperture=2 # See xf86(4) #machdep.apmhalt=1 # 1=powerdown hack, try if halt -p doesn't work #machdep.kbdreset=1# permit console CTRL-ALT-DEL to do a nice halt -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon lid closing +#machdep.lidaction=none# action upon lid closing: none, suspend or hibernate Index: etc/etc.loongson/sysctl.conf === RCS file: /cvs/src/etc/etc.loongson/sysctl.conf,v retrieving revision 1.4 diff -u -p -r1.4 sysctl.conf --- etc/etc.loongson/sysctl.conf2 Mar 2017 10:38:09 - 1.4 +++ etc/etc.loongson/sysctl.conf25 Jul 2017 18:40:40 - @@ -1 +1 @@ -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon lid closing +#machdep.lidaction=none# action upon lid closing: none, suspend or hibernate Index: sbin/sysctl/sysctl.c === RCS file: /cvs/src/sbin/sysctl/sysctl.c,v retrieving revision 1.228 diff -u -p -r1.228 sysctl.c --- sbin/sysctl/sysctl.c19 Jul 2017 06:30:54 - 1.228 +++ sbin/sysctl/sysctl.c29 Jul 2017 16:57:13 - @@ -158,6 +158,15 @@ struct list secondlevel[] = { { 0, 0 }, /* CTL_VFS */ }; +struct enum_vals { + int size; + const char **names; +}; +#ifdef CPU_LIDACTION +const char *cpu_lidaction_names[] = { "none", "suspend", "hibernate" }; +struct enum_vals cpu_lidaction_enum = { 3, cpu_lidaction_names }; +#endif + intAflag, aflag, nflag, qflag; /* @@ -167,10 +176,10 @@ int Aflag, aflag, nflag, qflag; #defineBOOTTIME0x0002 #defineCHRDEV 0x0004 #defineBLKDEV 0x0008 +#define ENUM 0x0010 #defineBADDYNAMIC 0x0020 #defineBIOSGEO 0x0040 #defineBIOSDEV 0x0080 -#defineMAJ2DEV 0x0100 #defineUNSIGNED0x0200 #defineKMEMBUCKETS 0x0400 #defineLONGARRAY 0x0800 @@ -211,6 +220,8 @@ void print_sensor(struct sensor *); int sysctl_chipset(char *, char **, int *, int, int *); #endif void vfsinit(void); +int strtoenum(const char *, struct enum_vals *, const char **); +const char *enumtostr(int, struct enum_vals *); char *equ = "="; @@ -297,6 +308,7 @@ parse(char *string, int flags) int indx, type, state, intval, len; size_t size, newsize = 0; int lal = 0, special = 0; + struct enum_vals *enump; void *newval = NULL; int64_t quadval; struct list *lp; @@ -615,6 +627,12 @@ parse(char *string, int flags) if (mib[1] == CPU_CPUFEATURE) special |= HEX; #endif +#ifdef CPU_LIDACTION + if (mib[1] == CPU_LIDACTION) { + special |= ENUM; + enump = &cpu_lidaction_enum; + } +#endif #ifdef CPU_BLK2CHR if (mib[1] == CPU_BLK2CHR) { if (bufp == NULL) @@ -700,6 +718,8 @@ parse(char *string, int flags) case CTLTYPE_INT: if (special & UNSIGNED) intval = strtonum(newval, 0, UINT_MAX, &errstr); + else if (special & ENUM) + intval = strtoenum(newval, enump, &errstr); else
make pkg_info -Q work with other flags
Hola, Currently "pkg_info -Q" doesn't respect other flags and the way pkg_info(1) reads, it implies that they will work with it. This diff makes pkg_info function as expected when other flags are passed when using -Q. Cheers, Aaron Index: OpenBSD/PkgInfo.pm === RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v retrieving revision 1.44 diff -u -p -r1.44 PkgInfo.pm --- OpenBSD/PkgInfo.pm 25 Jan 2017 14:10:46 - 1.44 +++ OpenBSD/PkgInfo.pm 29 Jul 2017 16:32:54 - @@ -406,13 +406,18 @@ sub print_info } $state->say("#1", $compose); } elsif ($state->opt('I')) { - if ($state->opt('q')) { - $state->say("#1", $pkg); + if ($state->opt('Q')) { + $state->say( + is_installed($pkg) ? "#1 (installed)" : "#1", $pkg); } else { - my $l = 20 - length($pkg); - $l = 1 if $l <= 0; - $state->say("#1#2#3", $pkg, " "x$l, - get_comment($handle->info)); + if ($state->opt('q')) { + $state->say("#1", $pkg); + } else { + my $l = 20 - length($pkg); + $l = 1 if $l <= 0; + $state->say("#1#2#3", $pkg, " "x$l, + get_comment($handle->info)); + } } } else { if ($state->opt('c')) { @@ -468,7 +473,7 @@ sub print_info OpenBSD::x509::print_certificate_info($plist); } elsif ($sig->{key} eq 'signify' || $sig->{key} eq 'signify2') { - $state->say("reportedly signed by #1", + $state->say("reportedly signed by #1", $plist->get('signer')->name); } } else { @@ -601,8 +606,10 @@ sub parse_and_run my $r = $state->repo->match_locations($partial); for my $p (sort map {$_->name} @$r) { - $state->say( - is_installed($p) ? "#1 (installed)" : "#1", $p); + $self->find_pkg($state, $p, + sub { + $self->print_info($state, @_); + }); } return 0; -- PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A 4AF0 1F81 112D 62A9 ADCE
Raspberry Pi Ethernet MAC address
Newer device trees for the Raspberry Pi have reorganized the usb part of the tree. This makes sure we can find the MAC address in those trees as well. Hopefully we can simplify this at some point when we have phased out old firmware. ok? Index: dev/usb/if_smsc.c === RCS file: /cvs/src/sys/dev/usb/if_smsc.c,v retrieving revision 1.30 diff -u -p -r1.30 if_smsc.c --- dev/usb/if_smsc.c 12 Feb 2017 04:29:57 - 1.30 +++ dev/usb/if_smsc.c 29 Jul 2017 16:11:02 - @@ -183,20 +183,36 @@ const struct cfattach smsc_ca = { void smsc_enaddr_OF(struct smsc_softc *sc) { + char *device = "/axi/usb/hub/ethernet"; + char prop[64]; int node; if (sc->sc_dev.dv_unit != 0) return; /* -* Get the Raspberry Pi MAC address from FDT -* also available via mailbox interface +* Get the Raspberry Pi MAC address from FDT. This is all +* much more complicated than strictly needed since the +* firmware device tree keeps changing as drivers get +* upstreamed. Sigh. +* +* Ultimately this should just use the "ethernet0" alias and +* the "local-mac-address" property. */ - if ((node = OF_finddevice("/axi/usb/hub/ethernet")) == -1) + + if ((node = OF_finddevice("/aliases")) == -1) return; + if (OF_getprop(node, "ethernet0", prop, sizeof(prop)) > 0 || + OF_getprop(node, "ethernet", prop, sizeof(prop)) > 0) + device = prop; - OF_getprop(node, "mac-address", sc->sc_ac.ac_enaddr, - sizeof(sc->sc_ac.ac_enaddr)); + if ((node = OF_finddevice(device)) == -1) + return; + if (OF_getprop(node, "local-mac-address", sc->sc_ac.ac_enaddr, + sizeof(sc->sc_ac.ac_enaddr)) != sizeof(sc->sc_ac.ac_enaddr)) { + OF_getprop(node, "mac-address", sc->sc_ac.ac_enaddr, + sizeof(sc->sc_ac.ac_enaddr)); + } } #else #define smsc_enaddr_OF(x) do {} while(0)
efiboot boot path matching
This is apparently very hard. Caught this on arm64 where efi_device_path_depth() returned 0, which resulted in always selecting the first device. Clearly if the first path component (i = 0) matches the desired type, we should return 1, not 0. Here is the amd64 version of the diff which is easier to test for people. ok? Index: arch/amd64/stand/efiboot/conf.c === RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/conf.c,v retrieving revision 1.8 diff -u -p -r1.8 conf.c --- arch/amd64/stand/efiboot/conf.c 1 Jun 2017 11:32:15 - 1.8 +++ arch/amd64/stand/efiboot/conf.c 29 Jul 2017 12:54:10 - @@ -38,7 +38,7 @@ #include "efiboot.h" #include "efidev.h" -const char version[] = "3.33"; +const char version[] = "3.34"; #ifdef EFI_DEBUG intdebug = 0; Index: arch/amd64/stand/efiboot/efiboot.c === RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v retrieving revision 1.20 diff -u -p -r1.20 efiboot.c --- arch/amd64/stand/efiboot/efiboot.c 1 Jun 2017 11:32:15 - 1.20 +++ arch/amd64/stand/efiboot/efiboot.c 29 Jul 2017 12:54:10 - @@ -222,7 +222,7 @@ efi_device_path_depth(EFI_DEVICE_PATH *d for (i = 0; !IsDevicePathEnd(dp); dp = NextDevicePathNode(dp), i++) { if (DevicePathType(dp) == dptype) - return (i); + return (i + 1); } return (-1);
Re: sysctl machdep.lidaction=suspend
On Sat, Jul 29, 2017 at 02:03:22PM +0200, Mark Kettenis wrote: > > I don't think we want to add string parsing like this in the kernel. > Maybe the sysctl(8) frontend should do the mapping from strings to > numbers? Ok, I'll try to come up with an alternative diff that does the parsing in sysctl(8). Let me fetch my rubber gloves... When the necessary mechanism is there we can also take advantage of it for setting hw.perfpolicy. That's where I copied the approach from. > > > Index: etc/etc.amd64/sysctl.conf > > === > > RCS file: /cvs/src/etc/etc.amd64/sysctl.conf,v > > retrieving revision 1.7 > > diff -u -p -r1.7 sysctl.conf > > --- etc/etc.amd64/sysctl.conf 2 Mar 2017 10:38:09 - 1.7 > > +++ etc/etc.amd64/sysctl.conf 25 Jul 2017 18:40:31 - > > @@ -1,3 +1,3 @@ > > #machdep.allowaperture=2 # See xf86(4) > > #machdep.kbdreset=1# permit console CTRL-ALT-DEL to do a > > nice halt > > -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon > > lid closing > > +#machdep.lidaction=none# action upon lid closing: none, > > suspend or hibernate > > Index: etc/etc.i386/sysctl.conf > > === > > RCS file: /cvs/src/etc/etc.i386/sysctl.conf,v > > retrieving revision 1.21 > > diff -u -p -r1.21 sysctl.conf > > --- etc/etc.i386/sysctl.conf2 Mar 2017 10:38:09 - 1.21 > > +++ etc/etc.i386/sysctl.conf25 Jul 2017 18:40:35 - > > @@ -1,4 +1,4 @@ > > #machdep.allowaperture=2 # See xf86(4) > > #machdep.apmhalt=1 # 1=powerdown hack, try if halt -p doesn't work > > #machdep.kbdreset=1# permit console CTRL-ALT-DEL to do a > > nice halt > > -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon > > lid closing > > +#machdep.lidaction=none# action upon lid closing: none, > > suspend or hibernate > > Index: etc/etc.loongson/sysctl.conf > > === > > RCS file: /cvs/src/etc/etc.loongson/sysctl.conf,v > > retrieving revision 1.4 > > diff -u -p -r1.4 sysctl.conf > > --- etc/etc.loongson/sysctl.conf2 Mar 2017 10:38:09 - 1.4 > > +++ etc/etc.loongson/sysctl.conf25 Jul 2017 18:40:40 - > > @@ -1 +1 @@ > > -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon > > lid closing > > +#machdep.lidaction=none# action upon lid closing: none, > > suspend or hibernate > > Index: sys/arch/amd64/amd64/machdep.c > > === > > RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v > > retrieving revision 1.231 > > diff -u -p -r1.231 machdep.c > > --- sys/arch/amd64/amd64/machdep.c 12 Jul 2017 06:26:32 - 1.231 > > +++ sys/arch/amd64/amd64/machdep.c 25 Jul 2017 19:37:22 - > > @@ -264,6 +264,8 @@ voidmap_tramps(void); > > void init_x86_64(paddr_t); > > void (*cpuresetfn)(void); > > > > +intsysctl_cpulidaction(void *, size_t *, void *, size_t); > > + > > #ifdef APERTURE > > int allowaperture = 0; > > #endif > > @@ -428,7 +430,7 @@ cpu_sysctl(int *name, u_int namelen, voi > > extern int amd64_has_xcrypt; > > dev_t consdev; > > dev_t dev; > > - int val, error; > > + int error; > > > > switch (name[0]) { > > case CPU_CONSDEV: > > @@ -477,15 +479,7 @@ cpu_sysctl(int *name, u_int namelen, voi > > case CPU_XCRYPT: > > return (sysctl_rdint(oldp, oldlenp, newp, amd64_has_xcrypt)); > > case CPU_LIDACTION: > > - val = lid_action; > > - error = sysctl_int(oldp, oldlenp, newp, newlen, &val); > > - if (!error) { > > - if (val < 0 || val > 2) > > - error = EINVAL; > > - else > > - lid_action = val; > > - } > > - return (error); > > + return (sysctl_cpulidaction(oldp, oldlenp, newp, newlen)); > > #if NPCKBC > 0 && NUKBD > 0 > > case CPU_FORCEUKBD: > > if (forceukbd) > > @@ -500,6 +494,47 @@ cpu_sysctl(int *name, u_int namelen, voi > > return (EOPNOTSUPP); > > } > > /* NOTREACHED */ > > +} > > + > > +int > > +sysctl_cpulidaction(void *oldp, size_t *oldlenp, void *newp, size_t newlen) > > +{ > > + char action[10]; > > + int error; > > + > > + switch (lid_action) { > > + case 0: > > + default: > > + strlcpy(action, "none", sizeof(action)); > > + break; > > + case 1: > > + strlcpy(action, "suspend", sizeof(action)); > > + break; > > +#ifdef HIBERNATE > > + case 2: > > + strlcpy(action, "hibernate", sizeof(action)); > > + break; > > +#endif > > + } > > + > > + error = sysctl_string(oldp, oldlenp, newp, newlen, action, > > sizeof(action)); > > + if (error) > > +
Re: sysctl machdep.lidaction=suspend
> Date: Sat, 29 Jul 2017 13:53:43 +0200 > From: Martin Natano > > Words are more descriptive than numbers. Let's use them! > > This diff removes > > sysctl machdep.lidaction=0 > sysctl machdep.lidaction=1 > sysctl machdep.lidaction=2 > > in favor of the more descriptive > > sysctl machdep.lidaction=none > sysctl machdep.lidaction=suspend > sysctl machdep.lidaction=hibernate > > as requested by deraadt. > > Given that there is a diff for poweroff (which I want to see go in) > floating around on tech@, it might be a good idea to switch now, so > the numbering doesn't get out of hand. > > Of course this means people will have to update their /etc/sysctl.conf > _again_. Sorry for that, I missed the opportunity to do both lidaction > changes in one big swoop. > > Do we want to go there? I don't think we want to add string parsing like this in the kernel. Maybe the sysctl(8) frontend should do the mapping from strings to numbers? > Index: etc/etc.amd64/sysctl.conf > === > RCS file: /cvs/src/etc/etc.amd64/sysctl.conf,v > retrieving revision 1.7 > diff -u -p -r1.7 sysctl.conf > --- etc/etc.amd64/sysctl.conf 2 Mar 2017 10:38:09 - 1.7 > +++ etc/etc.amd64/sysctl.conf 25 Jul 2017 18:40:31 - > @@ -1,3 +1,3 @@ > #machdep.allowaperture=2 # See xf86(4) > #machdep.kbdreset=1 # permit console CTRL-ALT-DEL to do a nice halt > -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon lid closing > +#machdep.lidaction=none # action upon lid closing: none, > suspend or hibernate > Index: etc/etc.i386/sysctl.conf > === > RCS file: /cvs/src/etc/etc.i386/sysctl.conf,v > retrieving revision 1.21 > diff -u -p -r1.21 sysctl.conf > --- etc/etc.i386/sysctl.conf 2 Mar 2017 10:38:09 - 1.21 > +++ etc/etc.i386/sysctl.conf 25 Jul 2017 18:40:35 - > @@ -1,4 +1,4 @@ > #machdep.allowaperture=2 # See xf86(4) > #machdep.apmhalt=1 # 1=powerdown hack, try if halt -p doesn't work > #machdep.kbdreset=1 # permit console CTRL-ALT-DEL to do a nice halt > -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon lid closing > +#machdep.lidaction=none # action upon lid closing: none, > suspend or hibernate > Index: etc/etc.loongson/sysctl.conf > === > RCS file: /cvs/src/etc/etc.loongson/sysctl.conf,v > retrieving revision 1.4 > diff -u -p -r1.4 sysctl.conf > --- etc/etc.loongson/sysctl.conf 2 Mar 2017 10:38:09 - 1.4 > +++ etc/etc.loongson/sysctl.conf 25 Jul 2017 18:40:40 - > @@ -1 +1 @@ > -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon lid closing > +#machdep.lidaction=none # action upon lid closing: none, > suspend or hibernate > Index: sys/arch/amd64/amd64/machdep.c > === > RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v > retrieving revision 1.231 > diff -u -p -r1.231 machdep.c > --- sys/arch/amd64/amd64/machdep.c12 Jul 2017 06:26:32 - 1.231 > +++ sys/arch/amd64/amd64/machdep.c25 Jul 2017 19:37:22 - > @@ -264,6 +264,8 @@ void map_tramps(void); > void init_x86_64(paddr_t); > void (*cpuresetfn)(void); > > +int sysctl_cpulidaction(void *, size_t *, void *, size_t); > + > #ifdef APERTURE > int allowaperture = 0; > #endif > @@ -428,7 +430,7 @@ cpu_sysctl(int *name, u_int namelen, voi > extern int amd64_has_xcrypt; > dev_t consdev; > dev_t dev; > - int val, error; > + int error; > > switch (name[0]) { > case CPU_CONSDEV: > @@ -477,15 +479,7 @@ cpu_sysctl(int *name, u_int namelen, voi > case CPU_XCRYPT: > return (sysctl_rdint(oldp, oldlenp, newp, amd64_has_xcrypt)); > case CPU_LIDACTION: > - val = lid_action; > - error = sysctl_int(oldp, oldlenp, newp, newlen, &val); > - if (!error) { > - if (val < 0 || val > 2) > - error = EINVAL; > - else > - lid_action = val; > - } > - return (error); > + return (sysctl_cpulidaction(oldp, oldlenp, newp, newlen)); > #if NPCKBC > 0 && NUKBD > 0 > case CPU_FORCEUKBD: > if (forceukbd) > @@ -500,6 +494,47 @@ cpu_sysctl(int *name, u_int namelen, voi > return (EOPNOTSUPP); > } > /* NOTREACHED */ > +} > + > +int > +sysctl_cpulidaction(void *oldp, size_t *oldlenp, void *newp, size_t newlen) > +{ > + char action[10]; > + int error; > + > + switch (lid_action) { > + case 0: > + default: > + strlcpy(action, "none", sizeof(action)); > + break; > + case 1: > + strlcpy(action, "suspend", sizeof(ac
sysctl machdep.lidaction=suspend
Words are more descriptive than numbers. Let's use them! This diff removes sysctl machdep.lidaction=0 sysctl machdep.lidaction=1 sysctl machdep.lidaction=2 in favor of the more descriptive sysctl machdep.lidaction=none sysctl machdep.lidaction=suspend sysctl machdep.lidaction=hibernate as requested by deraadt. Given that there is a diff for poweroff (which I want to see go in) floating around on tech@, it might be a good idea to switch now, so the numbering doesn't get out of hand. Of course this means people will have to update their /etc/sysctl.conf _again_. Sorry for that, I missed the opportunity to do both lidaction changes in one big swoop. Do we want to go there? natano Index: etc/etc.amd64/sysctl.conf === RCS file: /cvs/src/etc/etc.amd64/sysctl.conf,v retrieving revision 1.7 diff -u -p -r1.7 sysctl.conf --- etc/etc.amd64/sysctl.conf 2 Mar 2017 10:38:09 - 1.7 +++ etc/etc.amd64/sysctl.conf 25 Jul 2017 18:40:31 - @@ -1,3 +1,3 @@ #machdep.allowaperture=2 # See xf86(4) #machdep.kbdreset=1# permit console CTRL-ALT-DEL to do a nice halt -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon lid closing +#machdep.lidaction=none# action upon lid closing: none, suspend or hibernate Index: etc/etc.i386/sysctl.conf === RCS file: /cvs/src/etc/etc.i386/sysctl.conf,v retrieving revision 1.21 diff -u -p -r1.21 sysctl.conf --- etc/etc.i386/sysctl.conf2 Mar 2017 10:38:09 - 1.21 +++ etc/etc.i386/sysctl.conf25 Jul 2017 18:40:35 - @@ -1,4 +1,4 @@ #machdep.allowaperture=2 # See xf86(4) #machdep.apmhalt=1 # 1=powerdown hack, try if halt -p doesn't work #machdep.kbdreset=1# permit console CTRL-ALT-DEL to do a nice halt -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon lid closing +#machdep.lidaction=none# action upon lid closing: none, suspend or hibernate Index: etc/etc.loongson/sysctl.conf === RCS file: /cvs/src/etc/etc.loongson/sysctl.conf,v retrieving revision 1.4 diff -u -p -r1.4 sysctl.conf --- etc/etc.loongson/sysctl.conf2 Mar 2017 10:38:09 - 1.4 +++ etc/etc.loongson/sysctl.conf25 Jul 2017 18:40:40 - @@ -1 +1 @@ -#machdep.lidaction=0 # 1=suspend, 2=hibernate laptop upon lid closing +#machdep.lidaction=none# action upon lid closing: none, suspend or hibernate Index: sys/arch/amd64/amd64/machdep.c === RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v retrieving revision 1.231 diff -u -p -r1.231 machdep.c --- sys/arch/amd64/amd64/machdep.c 12 Jul 2017 06:26:32 - 1.231 +++ sys/arch/amd64/amd64/machdep.c 25 Jul 2017 19:37:22 - @@ -264,6 +264,8 @@ voidmap_tramps(void); void init_x86_64(paddr_t); void (*cpuresetfn)(void); +intsysctl_cpulidaction(void *, size_t *, void *, size_t); + #ifdef APERTURE int allowaperture = 0; #endif @@ -428,7 +430,7 @@ cpu_sysctl(int *name, u_int namelen, voi extern int amd64_has_xcrypt; dev_t consdev; dev_t dev; - int val, error; + int error; switch (name[0]) { case CPU_CONSDEV: @@ -477,15 +479,7 @@ cpu_sysctl(int *name, u_int namelen, voi case CPU_XCRYPT: return (sysctl_rdint(oldp, oldlenp, newp, amd64_has_xcrypt)); case CPU_LIDACTION: - val = lid_action; - error = sysctl_int(oldp, oldlenp, newp, newlen, &val); - if (!error) { - if (val < 0 || val > 2) - error = EINVAL; - else - lid_action = val; - } - return (error); + return (sysctl_cpulidaction(oldp, oldlenp, newp, newlen)); #if NPCKBC > 0 && NUKBD > 0 case CPU_FORCEUKBD: if (forceukbd) @@ -500,6 +494,47 @@ cpu_sysctl(int *name, u_int namelen, voi return (EOPNOTSUPP); } /* NOTREACHED */ +} + +int +sysctl_cpulidaction(void *oldp, size_t *oldlenp, void *newp, size_t newlen) +{ + char action[10]; + int error; + + switch (lid_action) { + case 0: + default: + strlcpy(action, "none", sizeof(action)); + break; + case 1: + strlcpy(action, "suspend", sizeof(action)); + break; +#ifdef HIBERNATE + case 2: + strlcpy(action, "hibernate", sizeof(action)); + break; +#endif + } + + error = sysctl_string(oldp, oldlenp, newp, newlen, action, sizeof(action)); + if (error) + return error; + + if (newp !=
Is someone interested in resuming support for socppc?
https://www.openbsd.org/socppc.html > The OpenBSD/socppc port was discontinued after the 5.8 release. Otherwise, will you approve removing support for socppc from src?
nm in free(): chunk canary corrupted 0x3e6e6845580 0x19@0x19
I was just running nm over all of /usr/lib on a system with C in malloc flags and ran into this. $ MALLOC_OPTIONS=C nm -s libc.so.89.3.a Archive index: _thread_sys___semctl in __semctl.so __semctl in __semctl.so ><...snip...> _libc_xdr_ypresp_master in xdr_ypresp_master.so _libc_xdr_ypresp_order in xdr_ypresp_order.so _libc_xdr_ypresp_val in xdr_ypresp_val.so _libc_xdr_ypstat in xdr_ypstat.so nm(98959) in free(): chunk canary corrupted 0x3e6e6845580 0x19@0x19 Abort trap (core dumped) gzipped file is at https://junkpile.org/libc.so.89.3.a.gz if anyone's interested.
Re: [PATCH] Remove useless sys/sys/dkbad.h
2017-07-29 2:15 GMT+03:00 Андрей Болконский : > sorry. correct patch: > > 2017-07-28 23:52 GMT+03:00 Андрей Болконский : > >> This header not used since retire sparc. >> build amd64 is ok Committed, thanks. -- WBR, Vadim Zhukov
fsdb(8): remove erroneous h length modifier
Hi tech@, Remove erroneous h length modifier, the argument has type 'int'. Comments? OK? Index: sbin/fsdb/fsdbutil.c === RCS file: /cvs/src/sbin/fsdb/fsdbutil.c,v retrieving revision 1.17 diff -u -p -r1.17 fsdbutil.c --- sbin/fsdb/fsdbutil.c20 Jan 2015 18:22:21 - 1.17 +++ sbin/fsdb/fsdbutil.c28 Jul 2017 17:34:32 - @@ -148,7 +148,7 @@ printstat(const char *cp, ino_t inum, un else printf("GID=%u ", DIP(dp, di_gid)); - printf("LINKCNT=%hd FLAGS=%#x BLKCNT=%x GEN=%x\n", DIP(dp, di_nlink), + printf("LINKCNT=%d FLAGS=%#x BLKCNT=%x GEN=%x\n", DIP(dp, di_nlink), DIP(dp, di_flags), (unsigned)DIP(dp, di_blocks), DIP(dp, di_gen)); }
Re: systat: return for non-void function
On Fri, Jul 28, 2017 at 02:31:02PM +, Florian Obser wrote: > > pointed out by clang > > OK? > comon, don't be shy, this is an easy one... maybe with a bit more context? This is an error return: diff --git usr.bin/systat/pool.c usr.bin/systat/pool.c index b6691ae0da6..3b289446522 100644 --- usr.bin/systat/pool.c +++ usr.bin/systat/pool.c @@ -492,14 +492,15 @@ pool_cache_read(void) return 0; unalloc: while (i > num_pool_caches) { pc = &pool_caches[--i]; free(pc->cache_cpus); } + return (-1); } -- I'm not entirely sure you are real.