bsd.port.mk.5: Ev for NO_ARCH

2023-09-06 Thread Caspar Schutijser
Hi,

The patch below marks up "NO_ARCH" consistently with the other
variables. I noticed because on man.openbsd.org, NO_ARCH looks off
compared to the others:
https://man.openbsd.org/bsd.port.mk.5#MULTI_PACKAGES

Comments or OKs?

Caspar

Index: bsd.port.mk.5
===
RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
retrieving revision 1.604
diff -u -p -r1.604 bsd.port.mk.5
--- bsd.port.mk.5   5 Sep 2023 23:45:53 -   1.604
+++ bsd.port.mk.5   6 Sep 2023 11:44:22 -
@@ -2447,7 +2447,7 @@ below.
 Especially read the part about
 .Ev ONLY_FOR_ARCHS
 when some of the packages only exist for some architectures.
-.It NO_ARCH
+.It Ev NO_ARCH
 Location for arch-independent packages.
 Defaults to
 .Sq no-arch .



Re: pax(1) and tar(1): fix misleading -DSMALL

2023-09-04 Thread Caspar Schutijser
On Mon, Sep 04, 2023 at 01:54:18PM +0100, Jeremie Courreges-Anglas wrote:
> 
> Two code sets are currently guarded with #ifdef SMALL in pax(1) and
> tar(1): reading 'pax' format extended headers, and identifying various
> compressed formats for user-friendliness.  As noted by Caspar, the SMALL
> path isn't currently used on the install media.  I've been confused by
> this twice already...
> 
> Here's a proposal:
> 
> 1. always compile in read support for the 'pax' format extended headers.
>   The ustar format is limited and being able to restore archives using
>   the pax format in any situation would be nice.  Especially if we
>   switch to writing out pax format archives by default one day.
>   We're definitely not there yet.
> 
> 2. actually use -DSMALL to save a bit of storage on the install media.
>   The behavior is still sane, tar(1) warns that it doesn't recognize
>   a compressed archive, seeks through it trying to look a tar header,
>   and eventually gives up.  Here's the tiny size change on amd64:
>   shannon /usr/src/distrib/special/pax$ size  tar.o options.o pax  obj/tar.o 
> obj/options.o obj/pax
>   textdatabss dec hex
>   68210   40  68611acdtar.o
>   7195108432  83112077options.o
>   390495  19024   85392   494911  78d3f   pax
>   68210   40  68611acdobj/tar.o
>   6878108432  79941f3aobj/options.o
>   390175  19024   85392   494591  78bff   obj/pax
> 
> I don't expect any regression on the ramdisks but a make release is
> running just in case.
> 
> ok?

Thanks a lot.

OK caspar@ provided that Todd and Philip don't object.

Caspar

> 
> 
> Index: bin/pax/tar.c
> ===
> RCS file: /home/cvs/src/bin/pax/tar.c,v
> retrieving revision 1.72
> diff -u -p -r1.72 tar.c
> --- bin/pax/tar.c 19 Aug 2023 04:21:05 -  1.72
> +++ bin/pax/tar.c 4 Sep 2023 12:19:39 -
> @@ -59,9 +59,7 @@ static u_long tar_chksm(char *, int);
>  static char *name_split(char *, int);
>  static int ul_oct(u_long, char *, int, int);
>  static int ull_oct(unsigned long long, char *, int, int);
> -#ifndef SMALL
>  static int rd_xheader(ARCHD *arcn, int, off_t);
> -#endif
>  
>  static uid_t uid_nobody;
>  static uid_t uid_warn;
> @@ -721,14 +719,11 @@ ustar_rd(ARCHD *arcn, char *buf)
>   if (ustar_id(buf, BLKMULT) < 0)
>   return(-1);
>  
> -#ifndef SMALL
>  reset:
> -#endif
>   memset(arcn, 0, sizeof(*arcn));
>   arcn->org_name = arcn->name;
>   arcn->sb.st_nlink = 1;
>  
> -#ifndef SMALL
>   /* Process Extended headers. */
>   if (hd->typeflag == XHDRTYPE || hd->typeflag == GHDRTYPE) {
>   if (rd_xheader(arcn, hd->typeflag == GHDRTYPE,
> @@ -745,7 +740,6 @@ reset:
>   if (hd->typeflag == XHDRTYPE || hd->typeflag == GHDRTYPE)
>   goto reset;
>   }
> -#endif
>  
>   if (!arcn->nlen) {
>   /*
> @@ -1190,8 +1184,6 @@ expandname(char *buf, size_t len, char *
>   return(nlen);
>  }
>  
> -#ifndef SMALL
> -
>  /* shortest possible extended record: "5 a=\n" */
>  #define MINXHDRSZ5
>  
> @@ -1331,4 +1323,3 @@ rd_xheader(ARCHD *arcn, int global, off_
>   return (-1);
>   return (ret);
>  }
> -#endif
> Index: distrib/special/pax/Makefile
> ===
> RCS file: /home/cvs/src/distrib/special/pax/Makefile,v
> retrieving revision 1.2
> diff -u -p -r1.2 Makefile
> --- distrib/special/pax/Makefile  13 Sep 2018 16:34:33 -  1.2
> +++ distrib/special/pax/Makefile  3 Sep 2023 10:38:17 -
> @@ -1,7 +1,7 @@
>  #$OpenBSD: Makefile,v 1.2 2018/09/13 16:34:33 sthen Exp $
>  
>  .PATH:  ${.CURDIR}/../../../bin/pax
> -CFLAGS+=-DNOCPIO -I${.CURDIR}/../../../bin/pax
> +CFLAGS+=-DNOCPIO -DSMALL -I${.CURDIR}/../../../bin/pax
>  
>  PROG=   pax
>  SRCS=ar_io.c ar_subs.c buf_subs.c file_subs.c ftree.c\
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



arm64 install.md: fix softraid crypto installation on Mac

2023-04-27 Thread Caspar Schutijser
I was trying to install OpenBSD on the arm64 MacBook Air with
softraid crypto (that's the "Encrypt the root disk?" question in the
installer). Right now that does not work out of the box.

In a regular install, md_prep_fdisk is careful and leaves the EFI Sys
partition alone with the "if disk_has $_disk gpt apfsisc" check.

However, in the "encrypt the root disk" case, the installer goes through
md_prep_fdisk twice. The second time, it's called on the softraid crypto
disk, which does not have the special EFI Sys partition. So there we
don't hit the special "if disk_has $_disk gpt apfsisc" case. Instead,
we go to a more regular case where we end up running "installboot -p".

Because it's a softraid disk, installboot also looks at the "chunks"
that the softraid volume resides on. I.e., it also looks at sd0 and
there "installboot -p" will newfs the EFI Sys partition, which is
something we don't want on the Mac.

This diff addresses this problem. The first time we go through
md_prep_fdisk, we keep track of whether we're in this special Mac
case by setting KEEP_EFI_SYS. Then when we go through md_prep_fdisk
for the second time to prepare the softraid disk, we can check this
variable to see if we should avoid running "installboot -p".

Debugged with help from and came up with a fix with kn@, thanks!

Comments or OKs?

Caspar

---

arm64 install.md: fix softraid crypto installation on Mac

Make sure we don't newfs the EFI Sys partition on systems that have an
"apfsisc" partition in the case we're installing with softraid crypto.

Debugged with help from and came up with a fix with kn@


Index: install.md
===
RCS file: /cvs/src/distrib/arm64/ramdisk/install.md,v
retrieving revision 1.46
diff -u -p -r1.46 install.md
--- install.md  27 Apr 2023 10:03:49 -  1.46
+++ install.md  27 Apr 2023 11:26:56 -
@@ -36,6 +36,7 @@ MDBOOTSR=y
 NCPU=$(sysctl -n hw.ncpufound)
 COMPATIBLE=$(sysctl -n machdep.compatible)
 MOUNT_ARGS_msdos="-o-l"
+KEEP_EFI_SYS=false
 
 md_installboot() {
local _disk=$1 _chunks _bootdisk _mdec _plat
@@ -109,6 +110,11 @@ md_prep_fdisk() {
[wW]*)
echo -n "Creating a ${bootfstype} partition and an 
OpenBSD partition for rest of $_disk..."
if disk_has $_disk gpt apfsisc; then
+   # On Apple hardware, the existing EFI Sys
+   # partition contains boot firmware and MUST NOT
+   # be recreated.
+   KEEP_EFI_SYS=true
+
# Is this a boot disk?
if [[ $_disk == @($ROOTDISK|$CRYPTOCHUNK) ]]; 
then
fdisk -Ay -b "${bootsectorsize}" 
${_disk} >/dev/null
@@ -119,13 +125,20 @@ md_prep_fdisk() {
# Is this a boot disk?
if [[ $_disk == @($ROOTDISK|$CRYPTOCHUNK) ]]; 
then
fdisk -gy -b "${bootsectorsize}" 
${_disk} >/dev/null
-   installboot -p $_disk
+
+   # With root on softraid,
+   # 'installboot -p' on the root disk
+   # nukes EFI Sys on the chunks.
+   $KEEP_EFI_SYS || installboot -p $_disk
else
fdisk -gy ${_disk} >/dev/null
fi
else
fdisk -iy -b 
"${bootsectorsize}@${bootsectorstart}:${bootparttype}" ${_disk} >/dev/null
-   installboot -p $_disk
+
+   # With root on softraid, 'installboot -p' on
+   # the root disk nukes EFI Sys on the chunks.
+   $KEEP_EFI_SYS || installboot -p $_disk
fi
echo "done."
return ;;



Re: Support Wacom One S (CTL-472)

2022-09-03 Thread Caspar Schutijser
Hi,

On Sat, Sep 03, 2022 at 05:00:00PM +0200, Stefan Hagen wrote:
> This is a better version of an earlier attempt to make my wacom tablet
> work. I have the tablet here in Bad Liebenzell if you want to give it a
> spin (on my or on your machine).
> 
> Comments? OK?

I don't feel entirely qualified to give OKs in this area so I won't do
that. But I tested it on my machine with sdk@'s tablet and it works well
here. Nice!

Is there any chance it breaks other supported tablets? Should it be
tested there as well?

One whitespace nit below.

Caspar

> 
> Best Regards,
> Stefan
> 
> Index: share/man/man4/uwacom.4
> ===
> RCS file: /cvs/src/share/man/man4/uwacom.4,v
> retrieving revision 1.2
> diff -u -p -u -p -r1.2 uwacom.4
> --- share/man/man4/uwacom.4   12 Sep 2016 10:39:06 -  1.2
> +++ share/man/man4/uwacom.4   1 Sep 2022 19:57:37 -
> @@ -42,6 +42,7 @@ driver supports the following Wacom tabl
>  .Bl -column "Intuos Draw" "Model Number" -offset 6n
>  .It Em Name Ta Em Model Number
>  .It Li Intuos Draw Ta CTL-490
> +.It Li One Ta CTL-472
>  .El
>  .Sh SEE ALSO
>  .Xr uhidev 4 ,
> Index: sys/dev/usb/usbdevs
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs,v
> retrieving revision 1.748
> diff -u -p -u -p -r1.748 usbdevs
> --- sys/dev/usb/usbdevs   23 Aug 2022 08:10:35 -  1.748
> +++ sys/dev/usb/usbdevs   1 Sep 2022 19:57:38 -
> @@ -4613,6 +4613,7 @@ product WACOM GRAPHIRE3_4X5 0x0013  Graph
>  product WACOM GRAPHIRE4_4X5  0x0015  Graphire4 Classic A6
>  product WACOM INTUOSA5   0x0021  Intuos A5
>  product WACOM INTUOS_DRAW0x033b  Intuos Draw (CTL-490)
> +product WACOM ONE_S  0x037a  One S (CTL-472)
>  product WACOM INTUOS_PRO_S   0x0392  Intuos Pro S
>  
>  /* WAGO Kontakttechnik products */
> Index: sys/dev/usb/usbdevs.h
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs.h,v
> retrieving revision 1.760
> diff -u -p -u -p -r1.760 usbdevs.h
> --- sys/dev/usb/usbdevs.h 23 Aug 2022 08:11:01 -  1.760
> +++ sys/dev/usb/usbdevs.h 1 Sep 2022 19:57:38 -
> @@ -1,4 +1,4 @@
> -/*   $OpenBSD: usbdevs.h,v 1.760 2022/08/23 08:11:01 jsg Exp $   */
> +/*   $OpenBSD$   */
>  
>  /*
>   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
> @@ -4620,6 +4620,7 @@
>  #define  USB_PRODUCT_WACOM_GRAPHIRE4_4X5 0x0015  /* Graphire4 
> Classic A6 */
>  #define  USB_PRODUCT_WACOM_INTUOSA5  0x0021  /* Intuos A5 */
>  #define  USB_PRODUCT_WACOM_INTUOS_DRAW   0x033b  /* Intuos Draw 
> (CTL-490) */
> +#define  USB_PRODUCT_WACOM_ONE_S 0x037a  /* One S (CTL-472) */
>  #define  USB_PRODUCT_WACOM_INTUOS_PRO_S  0x0392  /* Intuos Pro S 
> */
>  
>  /* WAGO Kontakttechnik products */
> Index: sys/dev/usb/usbdevs_data.h
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs_data.h,v
> retrieving revision 1.754
> diff -u -p -u -p -r1.754 usbdevs_data.h
> --- sys/dev/usb/usbdevs_data.h23 Aug 2022 08:11:01 -  1.754
> +++ sys/dev/usb/usbdevs_data.h1 Sep 2022 19:57:39 -
> @@ -1,4 +1,4 @@
> -/*   $OpenBSD: usbdevs_data.h,v 1.754 2022/08/23 08:11:01 jsg Exp $  */
> +/*   $OpenBSD$   */
>  
>  /*
>   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
> @@ -11824,6 +11824,10 @@ const struct usb_known_product usb_known
>   {
>   USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_DRAW,
>   "Intuos Draw (CTL-490)",
> + },
> + {
> + USB_VENDOR_WACOM, USB_PRODUCT_WACOM_ONE_S,
> + "One S (CTL-472)",
>   },
>   {
>   USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_PRO_S,
> Index: sys/dev/usb/uwacom.c
> ===
> RCS file: /cvs/src/sys/dev/usb/uwacom.c,v
> retrieving revision 1.5
> diff -u -p -u -p -r1.5 uwacom.c
> --- sys/dev/usb/uwacom.c  22 Nov 2021 11:29:18 -  1.5
> +++ sys/dev/usb/uwacom.c  1 Sep 2022 19:57:39 -
> @@ -35,10 +35,14 @@
>  
>  #include 
>  
> +#define  UWACOM_USE_PRESSURE 0x0001 /* button 0 is flaky, use tip 
> pressure */
> +#define  UWACOM_BIG_ENDIAN   0x0002 /* XY reporting byte order */
> +
>  struct uwacom_softc {
>   struct uhidev   sc_hdev;
>   struct hidmssc_ms;
>   struct hid_location sc_loc_tip_press;
> + int sc_flags;
>  };
>  
>  struct cfdriver uwacom_cd = {
> @@ -47,7 +51,8 @@ struct cfdriver uwacom_cd = {
>  
>  
>  const struct usb_devno uwacom_devs[] = {
> - { USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_DRAW }
> + { USB_VENDOR_WACOM, USB_PRODUCT_WACOM_INTUOS_DRAW },
> + { USB_VENDOR_WACOM, USB_PRODUCT_WACOM_ONE_S }
>  };
>  
>  int  uwacom_match(struct device *, void *, void *);
> @@ -110,6 

Re: ssh.1: refer to ssh_config(5) in description of -C, -m

2022-05-27 Thread Caspar Schutijser
On Fri, May 27, 2022 at 08:06:55PM +0200, Caspar Schutijser wrote:
> Hi,
> 
> In almost all cases where ssh.1 refers to an option described in
> ssh_config(5), it makes this reference explicit. See for example in the
> description of -c:
> "See the Ciphers keyword **in ssh_config(5)**".
> Would it make sense to add "in ssh_config(5)" for the description of
> -C and -m too? Patch below.
> 
> I looked for similar cases in other man pages by searching for "see"
> but I didn't find any.
> 
> I sent this earlier to openssh-unix-...@mindrot.org but I didn't get a
> response so I figured I'd try again.

With the diff this time.


Index: ssh.1
===
RCS file: /cvs/src/usr.bin/ssh/ssh.1,v
retrieving revision 1.430
diff -u -p -r1.430 ssh.1
--- ssh.1   31 Mar 2022 17:27:27 -  1.430
+++ ssh.1   27 May 2022 19:19:35 -
@@ -159,7 +159,8 @@ slow connections, but will only slow dow
 The default value can be set on a host-by-host basis in the
 configuration files; see the
 .Cm Compression
-option.
+option in
+.Xr ssh_config 5 .
 .Pp
 .It Fl c Ar cipher_spec
 Selects the cipher specification for encrypting the session.
@@ -434,7 +435,9 @@ A comma-separated list of MAC (message a
 specified in order of preference.
 See the
 .Cm MACs
-keyword for more information.
+keyword in
+.Xr ssh_config 5
+for more information.
 .Pp
 .It Fl N
 Do not execute a remote command.



ssh.1: refer to ssh_config(5) in description of -C, -m

2022-05-27 Thread Caspar Schutijser
Hi,

In almost all cases where ssh.1 refers to an option described in
ssh_config(5), it makes this reference explicit. See for example in the
description of -c:
"See the Ciphers keyword **in ssh_config(5)**".
Would it make sense to add "in ssh_config(5)" for the description of
-C and -m too? Patch below.

I looked for similar cases in other man pages by searching for "see"
but I didn't find any.

I sent this earlier to openssh-unix-...@mindrot.org but I didn't get a
response so I figured I'd try again.

Caspar



Re: sndio: add sio_flush() function

2022-04-27 Thread Caspar Schutijser
Hi,

On Thu, Mar 24, 2022 at 07:11:42AM +0100, Alexandre Ratchov wrote:
> Most audio/video players do a stop/start cycle whenever the play
> position is changed, track is changed, etc. Currently, stopping drains
> the play buffer, which by default is very large (to workaround very
> long kernel non-preemptive code-paths). This makes player controls
> sluggish.
> 
> This diff adds a new sio_flush() function to workaround the jumbo
> buffer sizes: it stops playback immediately, discarding buffered
> data. Basically it's the same as sio_stop() but doesn't wait. The plan
> is to make players use it.
> 
> In the network protocol, sio_flush() is implemented by adding a flag
> to the message corresponding to sio_stop(). Old sndiod servers ignore
> it and just work with new libraries. New sndiod servers see that the
> flag is not set by old libraries and properly drain the play buffer.
> 
> Tested with mplayer, mpv and audacious, if we go this way other ports
> will follow.

I tested this with Audacious and I like the new behavior a lot! When I
change the play position, stop playback or change the track it indeed
responds much faster.

When pausing playback however, the buffer is still being drained which
suprised me a little bit. However, after some printf-debugging I
confirmed my suspicion that Audacious does not call SndioPlugin::flush()
in that case, so this patch (or sndio in general) doesn't have anything
to do with that.

I can't really comment on the diff itself, although that makes sense
to me.

Caspar



ifconfig.8: fix for minor typo

2021-12-29 Thread Caspar Schutijser
Hi,

The diff below fixes a minor typo in ifconfig.8. In the initial
short description, the "protected" option is said to have a
"child-iface" argument. In the text, this argument was referred to as
"interface". This diff makes it consistent.

Caspar

Index: ifconfig.8
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v
retrieving revision 1.380
diff -u -p -r1.380 ifconfig.8
--- ifconfig.8  14 Nov 2021 03:02:06 -  1.380
+++ ifconfig.8  29 Dec 2021 20:37:30 -
@@ -2070,7 +2070,7 @@ Disable the filtering of IPv4 and IPv6 p
 This is the default.
 .It Cm protected Ar child-iface ids
 Put
-.Ar interface
+.Ar child-iface
 in protected domains.
 .Ar ids
 is a comma delimited list of domain IDs, between 1 and 31, to put the



mpe.4: properly refer to ioctl(2)

2021-05-14 Thread Caspar Schutijser
Index: mpe.4
===
RCS file: /cvs/src/share/man/man4/mpe.4,v
retrieving revision 1.11
diff -u -p -r1.11 mpe.4
--- mpe.4   18 Mar 2021 14:22:04 -  1.11
+++ mpe.4   14 May 2021 10:01:58 -
@@ -41,7 +41,7 @@ The interface itself can be configured w
 see its manual page for more information.
 .Sh IOCTLS
 The following
-.Nm ioctl 2
+.Xr ioctl 2
 calls are specific to
 .Nm ,
 .Xr mpip 4



libpcap: allow breaking out of loop when using savefile

2020-05-15 Thread Caspar Schutijser
Hi,

Below is a patch that makes breaking out of the loop work when using
a savefile.

The pcap_breakloop() function was backported from tcpdump.org libpcap
to OpenBSD libpcap by djm@ on Nov 18, 2005. The bits to make
pcap_breakloop() work were backported to pcap-bpf.c [1] but not to
savefile.c even though tcpdump.org implemented support there too [2].

The diff below backports this piece of code to savefile.c after all.

Thanks,
Caspar Schutijser

[1] 
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libpcap/pcap-bpf.c.diff?r1=1.16=1.17
[2] 
https://github.com/the-tcpdump-group/libpcap/commit/991d444f7116bef16893826b46f3950f62281507#diff-95d4d29d0f11145ff40b850860667a97R745


Index: savefile.c
===
RCS file: /cvs/src/lib/libpcap/savefile.c,v
retrieving revision 1.16
diff -u -p -r1.16 savefile.c
--- savefile.c  22 Dec 2015 19:51:04 -  1.16
+++ savefile.c  15 May 2020 19:03:44 -
@@ -307,6 +307,23 @@ pcap_offline_read(pcap_t *p, int cnt, pc
while (status == 0) {
struct pcap_pkthdr h;
 
+   /*
+* Has "pcap_breakloop()" been called?
+* If so, return immediately - if we haven't read any
+* packets, clear the flag and return -2 to indicate
+* that we were told to break out of the loop, otherwise
+* leave the flag set, so that the *next* call will break
+* out of the loop without having read any packets, and
+* return the number of packets we've processed so far.
+*/
+   if (p->break_loop) {
+   if (n == 0) {
+   p->break_loop = 0;
+   return (PCAP_ERROR_BREAK);
+   } else
+   return (n);
+   }
+
status = sf_next_packet(p, , p->buffer, p->bufsize);
if (status) {
if (status == 1)



PATCH: smtpd: don't strcmp() NULL in mta_relay_cmp()

2019-09-13 Thread Caspar Schutijser
Hi,

smtpd crashed on one of my machines. I attempted to start it again but
it crashed again after a few seconds.

After doing
  # sysctl kern.nosuidcoredump=3
  # mkdir -m 700 /var/crash/smtpd
and rebuilding smtpd with DEBUG=-g I obtained the following information:


# egdb /usr/src/usr.sbin/smtpd/smtpd/smtpd 4142.core  
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-openbsd6.6".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/src/usr.sbin/smtpd/smtpd/smtpd...done.
Illegal process-id: 4142.core.
[New process 382296]
Core was generated by `smtpd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  strcmp () at /usr/src/lib/libc/arch/amd64/string/strcmp.S:47
47  movq8(%rsi),%rdx
(gdb) frame 1
#1  0x06b086ba3478 in mta_relay_cmp (a=0x7f7c5e90, b=0x6b34ad15200) at 
../mta.c:2077
2077if (a->backupname && ((r = strcmp(a->backupname, 
b->backupname
(gdb) print a->backupname
$1 = 0x6b2c800f9a0 "tank.msrv.nl"
(gdb) print b->backupname
$2 = 0x0


So I think the problem is that b->backupname is passed to strcmp()
without checking whether b->backupname != NULL. The diff below adds
such a check, in line with other string comparisons that are performed
in mta_relay_cmp(). In the same function, I think the same problem
exists while comparing a->authlabel and b->authlabel so I added a
similar check there.

I'd like you to double-check whether the fix is indeed correct.

Thanks,
Caspar Schutijser


Index: mta.c
===
RCS file: /cvs/src/usr.sbin/smtpd/mta.c,v
retrieving revision 1.228
diff -u -p -r1.228 mta.c
--- mta.c   14 Jun 2019 19:55:25 -  1.228
+++ mta.c   13 Sep 2019 19:28:02 -
@@ -2036,6 +2036,10 @@ mta_relay_cmp(const struct mta_relay *a,
return (1);
if (a->authtable && ((r = strcmp(a->authtable, b->authtable
return (r);
+   if (a->authlabel == NULL && b->authlabel)
+   return (-1);
+   if (a->authlabel && b->authlabel == NULL)
+   return (1);
if (a->authlabel && ((r = strcmp(a->authlabel, b->authlabel
return (r);
if (a->sourcetable == NULL && b->sourcetable)
@@ -2071,6 +2075,10 @@ mta_relay_cmp(const struct mta_relay *a,
if (a->ca_name && ((r = strcmp(a->ca_name, b->ca_name
return (r);
 
+   if (a->backupname == NULL && b->backupname)
+   return (-1);
+   if (a->backupname && b->backupname == NULL)
+   return (1);
if (a->backupname && ((r = strcmp(a->backupname, b->backupname
return (r);
 



PATCH: show usage when calling "vmctl stop"

2019-08-21 Thread Caspar Schutijser
Hi,

Output of "vmctl stop" without patch:

$ vmctl stop
vmctl: invalid id: _=/usr/sbin/vmctl

With patch:

$ ./vmctl stop
usage:  vmctl [-v] stop [-fw] [id | -a]

Best regards,
Caspar Schutijser

Index: main.c
===
RCS file: /cvs/src/usr.sbin/vmctl/main.c,v
retrieving revision 1.57
diff -u -p -r1.57 main.c
--- main.c  5 Jul 2019 22:22:40 -   1.57
+++ main.c  21 Aug 2019 19:18:18 -
@@ -945,7 +945,10 @@ ctl_stop(struct parse_result *res, int a
argc -= optind;
argv += optind;
 
-   if (argc > 1)
+   if (argc == 0) {
+   if (res->action != CMD_STOPALL)
+   ctl_usage(res->ctl);
+   } else if (argc > 1)
ctl_usage(res->ctl);
else if (argc == 1)
ret = parse_vmid(res, argv[0], 0);



unwind: clean up list of includes

2019-01-26 Thread Caspar Schutijser
Below is a diff that (attempts to) clean up the list of includes in
unwind. I added some missing includes, too. The hashes of the relevant
object files (control.o, frontend.o, printconf.o, resolver.o and
unwind.o) did not change. I'm not sure if I'm supposed to touch
control.c but I did it anyway.

I did not look at (uw_)log.c since it is shared with many other deamons.

Thanks,
Caspar Schutijser


Index: control.c
===
RCS file: /cvs/src/sbin/unwind/control.c,v
retrieving revision 1.1
diff -u -p -r1.1 control.c
--- control.c   23 Jan 2019 13:11:00 -  1.1
+++ control.c   26 Jan 2019 20:30:02 -
@@ -19,16 +19,12 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
-#include 
-#include 
-
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
Index: frontend.c
===
RCS file: /cvs/src/sbin/unwind/frontend.c,v
retrieving revision 1.3
diff -u -p -r1.3 frontend.c
--- frontend.c  24 Jan 2019 17:39:43 -  1.3
+++ frontend.c  26 Jan 2019 20:30:02 -
@@ -20,38 +20,29 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 
+#include 
 #include 
-#include 
-#include 
 #include 
 
-#include 
-#include 
-
-#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
-#include 
 #include "libunbound/config.h"
-#include "libunbound/libunbound/unbound.h"
-#include "libunbound/unbound-event.h"
-#include "libunbound/sldns/rrdef.h"
 #include "libunbound/sldns/pkthdr.h"
 #include "libunbound/sldns/sbuffer.h"
 #include "libunbound/sldns/wire2str.h"
Index: printconf.c
===
RCS file: /cvs/src/sbin/unwind/printconf.c,v
retrieving revision 1.1
diff -u -p -r1.1 printconf.c
--- printconf.c 23 Jan 2019 13:11:00 -  1.1
+++ printconf.c 26 Jan 2019 20:30:02 -
@@ -17,15 +17,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include 
 #include 
-#include 
-#include 
-
-#include 
-#include 
-
-#include 
 
 #include 
 #include 
Index: resolver.c
===
RCS file: /cvs/src/sbin/unwind/resolver.c,v
retrieving revision 1.9
diff -u -p -r1.9 resolver.c
--- resolver.c  25 Jan 2019 17:20:45 -  1.9
+++ resolver.c  26 Jan 2019 20:30:02 -
@@ -23,16 +23,12 @@
 #include 
 #include 
 #include 
-#include 
-
-#include 
-#include 
-#include 
+#include 
 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -42,13 +38,11 @@
 #include 
 #include 
 
-#include 
 #include "libunbound/config.h"
 #include "libunbound/libunbound/unbound.h"
 #include "libunbound/unbound-event.h"
 #include "libunbound/sldns/rrdef.h"
 #include "libunbound/sldns/pkthdr.h"
-#include "libunbound/sldns/sbuffer.h"
 #include "libunbound/sldns/wire2str.h"
 
 #include 
Index: unwind.c
===
RCS file: /cvs/src/sbin/unwind/unwind.c,v
retrieving revision 1.3
diff -u -p -r1.3 unwind.c
--- unwind.c25 Jan 2019 08:06:15 -  1.3
+++ unwind.c26 Jan 2019 20:30:02 -
@@ -22,16 +22,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
-#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 
 #include 
 #include 



unwind: trust anchor path in unwind.8

2019-01-26 Thread Caspar Schutijser
The diff below fixes the path of the trust anchor in unwind.8.

Thanks,
Caspar Schutijser


Index: unwind.8
===
RCS file: /cvs/src/sbin/unwind/unwind.8,v
retrieving revision 1.2
diff -u -p -r1.2 unwind.8
--- unwind.825 Jan 2019 09:12:02 -  1.2
+++ unwind.826 Jan 2019 13:57:39 -
@@ -90,17 +90,17 @@ Multiple
 options increase the verbosity.
 .El
 .Sh FILES
-.Bl -tag -width "/var/unwind/db/root.keyXXX" -compact
+.Bl -tag -width "/etc/unwind/trustanchor/root.keyXXX" -compact
 .It Pa /etc/unwind.conf
 Default
 .Nm
 configuration file.
+.It Pa /etc/unwind/trustanchor/root.key
+Trust anchor for DNSSEC validation.
 .It Pa /var/run/unwind.sock
 .Ux Ns -domain
 socket used for communication with
 .Xr unwindctl 8 .
-.It Pa /var/unwind/db/root.key
-Trust anchor for DNSSEC validation.
 .El
 .Sh SEE ALSO
 .Xr unwind.conf 5 ,



unwind: fix typo

2019-01-24 Thread Caspar Schutijser
Fix typo.

Best regards,
Caspar Schutijser


Index: resolver.c
===
RCS file: /cvs/src/sbin/unwind/resolver.c,v
retrieving revision 1.3
diff -u -p -U5 -r1.3 resolver.c
--- resolver.c  24 Jan 2019 15:33:44 -  1.3
+++ resolver.c  24 Jan 2019 19:20:07 -
@@ -668,11 +668,11 @@ create_resolver(enum unwind_resolver_typ
if (!log_getdebug()) {
if((err = ub_ctx_set_option(res->ctx, "use-syslog:", "yes"))
!= 0) {
ub_ctx_delete(res->ctx);
free(res);
-   log_warnx("error setting aggressive-nsec: yes: %s",
+   log_warnx("error setting use-syslog: yes: %s",
ub_strerror(err));
return (NULL);
}
}
 



unwind Makefile: remove configparser.c when cleaning

2019-01-24 Thread Caspar Schutijser
configparser.c is left behind when running "make clean". You may want
to indent the assignments in the lines above to make it look nicer.

Best regards,
Caspar Schutijser


Index: Makefile
===
RCS file: /cvs/src/sbin/unwind/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile24 Jan 2019 15:33:44 -  1.2
+++ Makefile24 Jan 2019 19:12:52 -
@@ -3,6 +3,7 @@
 PROG=  unwind
 SRCS=  control.c resolver.c frontend.c uw_log.c unwind.c uw_parse.y printconf.c
 MAN=   unwind.8 unwind.conf.5
+CLEANFILES+=   configparser.c
 
 .include "${.CURDIR}/libunbound/Makefile.inc"
 



unwind: replace PF_ROUTE with AF_ROUTE

2019-01-24 Thread Caspar Schutijser
Similar to these commits:

https://marc.info/?l=openbsd-cvs=154713176926865=2
https://marc.info/?l=openbsd-cvs=154814914309779=2

Thanks,
Caspar Schutijser


Index: unwinc.d
===
RCS file: /cvs/src/sbin/unwind/unwind.c,v
retrieving revision 1.1
diff -u -p -r1.1 unwind.c
--- unwind.c23 Jan 2019 13:11:00 -  1.1
+++ unwind.c24 Jan 2019 19:12:49 -
@@ -307,13 +307,13 @@ main(int argc, char *argv[])
if ((control_fd = control_init(csock)) == -1)
fatalx("control socket setup failed");
 
-   if ((frontend_routesock = socket(PF_ROUTE, SOCK_RAW | SOCK_CLOEXEC,
+   if ((frontend_routesock = socket(AF_ROUTE, SOCK_RAW | SOCK_CLOEXEC,
AF_INET)) < 0)
fatal("route socket");
 
rtfilter = ROUTE_FILTER(RTM_IFINFO) | ROUTE_FILTER(RTM_PROPOSAL) |
ROUTE_FILTER(RTM_GET);
-   if (setsockopt(frontend_routesock, PF_ROUTE, ROUTE_MSGFILTER,
+   if (setsockopt(frontend_routesock, AF_ROUTE, ROUTE_MSGFILTER,
, sizeof(rtfilter)) < 0)
fatal("setsockopt(ROUTE_MSGFILTER)");
 



kern_tame.c: fix strncmp call

2015-08-23 Thread Caspar Schutijser
Patch below.

Thanks,
Caspar Schutijser


Index: sys/kern/kern_tame.c
===
RCS file: /cvs/src/sys/kern/kern_tame.c,v
retrieving revision 1.25
diff -u -p -r1.25 kern_tame.c
--- sys/kern/kern_tame.c23 Aug 2015 19:32:20 -  1.25
+++ sys/kern/kern_tame.c23 Aug 2015 21:22:38 -
@@ -423,7 +423,7 @@ tame_namei(struct proc *p, char *origpat
 */
if ((p-p_p-ps_tame  _TM_TMPPATH) 
(p-p_tame_syscall == SYS_unlink) 
-   strncmp(path, /tmp/, sizeof(/tmp) - 1) == 0) {
+   strncmp(path, /tmp/, sizeof(/tmp/) - 1) == 0) {
return (0);
}
 



strlcat.c typo in comment

2015-03-02 Thread Caspar Schutijser

A similar change has been made to strlcpy.c when it was updated to
make the code slightly easier to read.

Best regards,
Caspar Schutijser

Index: strlcat.c
===
RCS file: /cvs/src/lib/libc/string/strlcat.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 strlcat.c
--- strlcat.c   15 Jan 2015 03:54:12 -  1.14
+++ strlcat.c   2 Mar 2015 21:28:41 -
@@ -24,7 +24,7 @@
 * full size of dst, not space left).  At most dsize-1 characters
 * will be copied.  Always NUL terminates (unless dsize = strlen(dst)).
 * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
- * If retval = siz, truncation occurred.
+ * If retval = dsize, truncation occurred.
 */
size_t
strlcat(char *dst, const char *src, size_t dsize)




[PATCH] root.mail: fix date

2015-01-02 Thread Caspar Schutijser

Index: etc/root/root.mail
===
RCS file: /cvs/src/etc/root/root.mail,v
retrieving revision 1.105
diff -u -p -u -r1.105 root.mail
--- etc/root/root.mail  1 Jan 2015 15:50:27 -   1.105
+++ etc/root/root.mail  2 Jan 2015 09:43:50 -
@@ -1,6 +1,6 @@
-From dera...@do-not-reply.openbsd.org Sat May  1 07:56:56 MST 2014
+From dera...@do-not-reply.openbsd.org Sat May  1 07:56:56 MST 2015
Return-Path: root
-Date: May 1 07:56:56 MST 2014
+Date: May 1 07:56:56 MST 2015
From: dera...@do-not-reply.openbsd.org (Theo de Raadt)
To: root
Subject: Welcome to OpenBSD 5.7!




Re: [PATCH] root.mail: fix date

2015-01-02 Thread Caspar Schutijser

On Friday, 2 January 2015 11:28:49 CEST, Janne Johansson wrote:

May 01 2015 will be a Friday, no?


Good catch. deraadt@ changed it now but he changed the day to Sunday
instead of Friday. Patch below addresses the issue.

Index: etc/root/root.mail
===
RCS file: /cvs/src/etc/root/root.mail,v
retrieving revision 1.106
diff -u -p -u -r1.106 root.mail
--- etc/root/root.mail  2 Jan 2015 11:03:50 -   1.106
+++ etc/root/root.mail  2 Jan 2015 19:13:03 -
@@ -1,4 +1,4 @@
-From dera...@do-not-reply.openbsd.org Sun May  1 07:56:56 MST 2015
+From dera...@do-not-reply.openbsd.org Fri May  1 07:56:56 MST 2015
Return-Path: root
Date: May 1 07:56:56 MST 2015
From: dera...@do-not-reply.openbsd.org (Theo de Raadt)




Typo in usr.bin/make/compat.c

2013-06-20 Thread Caspar Schutijser

Hi tech@,

I found a typo in usr.bin/make/compat.c.

The patch is below.

Best regards,
Caspar Schutijser

Index: compat.c
===
RCS file: /cvs/src/usr.bin/make/compat.c,v
retrieving revision 1.82
diff -u -r1.82 compat.c
--- compat.c30 May 2013 08:58:38 -  1.82
+++ compat.c20 Jun 2013 19:35:45 -
@@ -139,7 +139,7 @@
return;
}
-   /* All the children were made ok. Now youngest poinst to
+   /* All the children were made ok. Now youngest points to
 * the newest child, we need to find out
 * if we exist and when we were modified last. The criteria
 * for datedness are defined by the Make_OODate function.  */