Re: [patch] kbd should give an error unless we're root

2017-08-29 Thread Jeremie Courreges-Anglas
On Tue, Aug 29 2017, Jesper Wallin  wrote:
> Hi,
>
> I noticed that kbd(8) lets you list all available keyboard encodings
> with the -l flag.  However, we get no error and no list unless we're
> running this as root.  I apologize if this is intended and I fail to
> understand why.  If not intended, the patch below will check if we're
> root or otherwise error out.

Well, the behavior of kbd depends on the permissions of the device
files, not on the fact that you're root or not.  Maybe something like
this would be more appropriate?


Index: kbd_wscons.c
===
RCS file: /d/cvs/src/sbin/kbd/kbd_wscons.c,v
retrieving revision 1.32
diff -u -p -p -u -r1.32 kbd_wscons.c
--- kbd_wscons.c3 Oct 2016 13:03:49 -   1.32
+++ kbd_wscons.c30 Aug 2017 06:11:23 -
@@ -150,11 +150,12 @@ kbd_list(void)
 {
int kbds[SA_MAX];
struct wskbd_encoding_data encs[SA_MAX];
-   int fd, i, kbtype, t;
+   int fd, i, kbtype, gotone, t;
chardevice[PATH_MAX];
 
memset(kbds, 0, sizeof(kbds));
memset(encs, 0, sizeof(encs));
+   gotone = 0;
 
/* Go through all keyboards. */
for (i = 0; i < NUM_KBD; i++) {
@@ -165,6 +166,7 @@ kbd_list(void)
if (fd >= 0) {
if (ioctl(fd, WSKBDIO_GTYPE, &kbtype) < 0)
err(1, "WSKBDIO_GTYPE");
+   gotone = 1;
switch (kbtype) {
case WSKBD_TYPE_PC_XT:
case WSKBD_TYPE_PC_AT:
@@ -208,6 +210,9 @@ kbd_list(void)
close(fd);
}
}
+
+   if (!gotone)
+   errx(1, "could not open any keyboard device");
 
for (i = 0; i < SA_MAX; i++)
if (kbds[i] != 0)

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Remove the no longer true CAVEATS section in rasops.9

2017-08-29 Thread Frederic Cambus
Hi tech@,

Remove the CAVEATS section in rasops.9, which no longer holds truth.

Comments? OK?

Index: share/man/man9/rasops.9
===
RCS file: /cvs/src/share/man/man9/rasops.9,v
retrieving revision 1.18
diff -u -p -r1.18 rasops.9
--- share/man/man9/rasops.9 21 Aug 2017 11:49:50 -  1.18
+++ share/man/man9/rasops.9 29 Aug 2017 22:25:52 -
@@ -235,5 +235,3 @@ subsystem was written by
 .An Andrew Doran Aq Mt a...@netbsd.org .
 Display rotation was written by
 .An Christopher Pascoe Aq Mt pas...@openbsd.org .
-.Sh CAVEATS
-Display rotation only works for 16bpp displays.



[PATCH] update links to USB audio specs.

2017-08-29 Thread Robert Klein
Hi,

the USB audio specs seem to have changed their location.  Below is a
patch to update the links to the currentlocation of the specs.

Best regards
Robert

---
 sys/dev/usb/uaudio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index 863a106cf56..a6e80c98d71 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -32,9 +32,9 @@
  */
 
 /*
- * USB audio specs: http://www.usb.org/developers/devclass_docs/audio10.pdf
- *  http://www.usb.org/developers/devclass_docs/frmts10.pdf
- *  http://www.usb.org/developers/devclass_docs/termt10.pdf
+ * USB audio specs: 
http://www.usb.org/developers/docs/devclass_docs/audio10.pdf
+ *  
http://www.usb.org/developers/docs/devclass_docs/frmts10.pdf
+ *  
http://www.usb.org/developers/docs/devclass_docs/termt10.pdf
  */
 
 #include 



Re: i386 zzz broken, Was: CVS: cvs.openbsd.org: src

2017-08-29 Thread Chris Cappuccio
li...@wrant.com [li...@wrant.com] wrote:
> 
> Please let me know if you want me to generate some dumps or similar, but
> unfortunately, I can't yet test patches or handle compilation on my own.
> I realise my info on this is incredibly lacking as quality & usefulness.
> 

Stuart Henderson has an archive of kernels from snapshot builds that you
can use to better narrow down when the regression started.

Unfortunately I don't remember the URL. Someone who has it easily accessible
may choose to provide it in a reply. You should be able to boot the older
kernels with either the 6.2-beta userland, or with the 6.1 userland. One or
the other will work typically. If you can try them and narrow down,
that's all that's necessary.

Chris



Re: i386 zzz broken, Was: CVS: cvs.openbsd.org: src

2017-08-29 Thread lists
Tue, 29 Aug 2017 16:32:04 -0700 Mike Larkin 
> On Mon, Aug 28, 2017 at 11:18:13PM +0300, li...@wrant.com wrote:
> > Mon, 28 Aug 2017 10:16:58 -0600 (MDT) Ted Unangst   
> > > CVSROOT:  /cvs
> > > Module name:  src
> > > Changes by:   t...@cvs.openbsd.org2017/08/28 10:16:58
> > > 
> > > Modified files:
> > >   usr.sbin/apmd  : apmd.8 apmd.c 
> > > 
> > > Log message:
> > > add -z and -Z options to auto suspend or hibernate when low on battery.
> > > from Jesper Wallin
> > >   
> > 
> > Hi tech@,
> > 
> > Could someone please test and confirm suspend still works on i386?  I am
> > getting the laptop to wake but it's stuck, black screen, high fan speed,
> > no response, only long press on the power button works.  It used to work
> > flawless, I suspect it might be from the last few snapshots, can't tell.
> > 
> > Ready to provide details if this works elsewhere & someone's interested.
> > Please let me know if it's a known/expected issue, or better sendbug(1).
> > 
> > Kind regards,
> > Anton Lazarov
> >   
> 
> Hmm, I can repro this here even with qemu. It's stuck in lapic_delay.
> 
> I'll see if I can track down what's going wrong. It would also help if you
> could narrow down when it broke.
> 
> -ml
> 

Hi Mike,

Thank you for looking into this.  I'm using the laptop as a 24/7 desktop
machine, and rarely suspend it to be honest, especially since it started
having this problem, maybe somewhere after the last release.  Sorry that
I can not be more specific about it, I'll keep a track on this from now.

Please let me know if you want me to generate some dumps or similar, but
unfortunately, I can't yet test patches or handle compilation on my own.
I realise my info on this is incredibly lacking as quality & usefulness.

Kind regards,
Anton Lazarov

> > OpenBSD 6.2-beta (GENERIC.MP) #91: Sun Aug 27 17:26:00 MDT 2017
> > dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
> > cpu0: Intel(R) Atom(TM) CPU N280 @ 1.66GHz ("GenuineIntel" 686-class) 1.67 
> > GHz
> > cpu0: 
> > FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,SSE3,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,xTPR,PDCM,MOVBE,LAHF,PERF,SENSOR
> > real mem  = 1064452096 (1015MB)
> > avail mem = 1029943296 (982MB)
> > mpath0 at root
> > scsibus0 at mpath0: 256 targets
> > mainbus0 at root
> > bios0 at mainbus0: date 04/18/11, BIOS32 rev. 0 @ 0xf0010, SMBIOS rev. 2.5 
> > @ 0xf0720 (30 entries)
> > bios0: vendor American Megatrends Inc. version "1601" date 04/18/2011
> > bios0: ASUSTeK Computer INC. 1005HA
> > acpi0 at bios0: rev 0
> > acpi0: sleep states S0 S3 S4 S5
> > acpi0: tables DSDT FACP APIC MCFG OEMB HPET SSDT
> > acpi0: wakeup devices P0P2(S4) P0P1(S4) HDAC(S4) P0P4(S4) P0P8(S4) P0P5(S4) 
> > P0P7(S4) P0P9(S4) P0P6(S4)
> > acpitimer0 at acpi0: 3579545 Hz, 24 bits
> > acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> > cpu0 at mainbus0: apid 0 (boot processor)
> > mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
> > cpu0: apic clock running at 166MHz
> > cpu0: mwait min=64, max=64, C-substates=0.2.2.0.2, IBE
> > cpu1 at mainbus0: apid 1 (application processor)
> > cpu1: Intel(R) Atom(TM) CPU N280 @ 1.66GHz ("GenuineIntel" 686-class) 1.67 
> > GHz
> > cpu1: 
> > FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,SSE3,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,xTPR,PDCM,MOVBE,LAHF,PERF,SENSOR
> > ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
> > acpimcfg0 at acpi0 addr 0xe000, bus 0-63
> > acpihpet0 at acpi0: 14318179 Hz
> > acpiprt0 at acpi0: bus 0 (PCI0)
> > acpiprt1 at acpi0: bus 2 (P0P5)
> > acpiprt2 at acpi0: bus 1 (P0P7)
> > acpiprt3 at acpi0: bus -1 (P0P6)
> > acpiec0 at acpi0
> > acpicpu0 at acpi0: !C2(500@1 mwait.1@0x10), C1(1000@1 mwait.1), PSS
> > acpicpu1 at acpi0: !C2(500@1 mwait.1@0x10), C1(1000@1 mwait.1), PSS
> > acpitz0 at acpi0: critical temperature is 88 degC
> > "SYN0A13" at acpi0 not configured
> > acpibat0 at acpi0: BAT0 model "1005HA" serial   type LION oem "ASUS"
> > acpiac0 at acpi0: AC unit online
> > acpibtn0 at acpi0: LID_
> > acpibtn1 at acpi0: SLPB
> > acpibtn2 at acpi0: PWRB
> > "PNP0C14" at acpi0 not configured
> > acpivideo0 at acpi0: VGA_
> > acpivout0 at acpivideo0: LCDD
> > bios0: ROM list: 0xc/0xec00! 0xcf000/0x1000
> > cpu0: Enhanced SpeedStep 1667 MHz: speeds: 1667, 1333, 1000 MHz
> > pci0 at mainbus0 bus 0: configuration mode 1 (bios)
> > pchb0 at pci0 dev 0 function 0 "Intel 82945GME Host" rev 0x03
> > inteldrm0 at pci0 dev 2 function 0 "Intel 82945GME Video" rev 0x03
> > drm0 at inteldrm0
> > intagp0 at inteldrm0
> > agp0 at intagp0: aperture at 0xd000, size 0x1000
> > inteldrm0: apic 2 int 16
> > inteldrm0: 1024x600, 32bpp
> > wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
> > wsdisplay0: screen 1-5 added (std, vt100 emulation)
> > "Intel 82945GM Video" rev 0x03 at pci0 dev 2 function 1 not configured
>

i386 zzz broken, Was: CVS: cvs.openbsd.org: src

2017-08-29 Thread Mike Larkin
On Mon, Aug 28, 2017 at 11:18:13PM +0300, li...@wrant.com wrote:
> Mon, 28 Aug 2017 10:16:58 -0600 (MDT) Ted Unangst 
> > CVSROOT:/cvs
> > Module name:src
> > Changes by: t...@cvs.openbsd.org2017/08/28 10:16:58
> > 
> > Modified files:
> > usr.sbin/apmd  : apmd.8 apmd.c 
> > 
> > Log message:
> > add -z and -Z options to auto suspend or hibernate when low on battery.
> > from Jesper Wallin
> > 
> 
> Hi tech@,
> 
> Could someone please test and confirm suspend still works on i386?  I am
> getting the laptop to wake but it's stuck, black screen, high fan speed,
> no response, only long press on the power button works.  It used to work
> flawless, I suspect it might be from the last few snapshots, can't tell.
> 
> Ready to provide details if this works elsewhere & someone's interested.
> Please let me know if it's a known/expected issue, or better sendbug(1).
> 
> Kind regards,
> Anton Lazarov
> 

Hmm, I can repro this here even with qemu. It's stuck in lapic_delay.

I'll see if I can track down what's going wrong. It would also help if you
could narrow down when it broke.

-ml

> OpenBSD 6.2-beta (GENERIC.MP) #91: Sun Aug 27 17:26:00 MDT 2017
> dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
> cpu0: Intel(R) Atom(TM) CPU N280 @ 1.66GHz ("GenuineIntel" 686-class) 1.67 GHz
> cpu0: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,SSE3,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,xTPR,PDCM,MOVBE,LAHF,PERF,SENSOR
> real mem  = 1064452096 (1015MB)
> avail mem = 1029943296 (982MB)
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: date 04/18/11, BIOS32 rev. 0 @ 0xf0010, SMBIOS rev. 2.5 @ 
> 0xf0720 (30 entries)
> bios0: vendor American Megatrends Inc. version "1601" date 04/18/2011
> bios0: ASUSTeK Computer INC. 1005HA
> acpi0 at bios0: rev 0
> acpi0: sleep states S0 S3 S4 S5
> acpi0: tables DSDT FACP APIC MCFG OEMB HPET SSDT
> acpi0: wakeup devices P0P2(S4) P0P1(S4) HDAC(S4) P0P4(S4) P0P8(S4) P0P5(S4) 
> P0P7(S4) P0P9(S4) P0P6(S4)
> acpitimer0 at acpi0: 3579545 Hz, 24 bits
> acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> cpu0 at mainbus0: apid 0 (boot processor)
> mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
> cpu0: apic clock running at 166MHz
> cpu0: mwait min=64, max=64, C-substates=0.2.2.0.2, IBE
> cpu1 at mainbus0: apid 1 (application processor)
> cpu1: Intel(R) Atom(TM) CPU N280 @ 1.66GHz ("GenuineIntel" 686-class) 1.67 GHz
> cpu1: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,SSE3,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,xTPR,PDCM,MOVBE,LAHF,PERF,SENSOR
> ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
> acpimcfg0 at acpi0 addr 0xe000, bus 0-63
> acpihpet0 at acpi0: 14318179 Hz
> acpiprt0 at acpi0: bus 0 (PCI0)
> acpiprt1 at acpi0: bus 2 (P0P5)
> acpiprt2 at acpi0: bus 1 (P0P7)
> acpiprt3 at acpi0: bus -1 (P0P6)
> acpiec0 at acpi0
> acpicpu0 at acpi0: !C2(500@1 mwait.1@0x10), C1(1000@1 mwait.1), PSS
> acpicpu1 at acpi0: !C2(500@1 mwait.1@0x10), C1(1000@1 mwait.1), PSS
> acpitz0 at acpi0: critical temperature is 88 degC
> "SYN0A13" at acpi0 not configured
> acpibat0 at acpi0: BAT0 model "1005HA" serial   type LION oem "ASUS"
> acpiac0 at acpi0: AC unit online
> acpibtn0 at acpi0: LID_
> acpibtn1 at acpi0: SLPB
> acpibtn2 at acpi0: PWRB
> "PNP0C14" at acpi0 not configured
> acpivideo0 at acpi0: VGA_
> acpivout0 at acpivideo0: LCDD
> bios0: ROM list: 0xc/0xec00! 0xcf000/0x1000
> cpu0: Enhanced SpeedStep 1667 MHz: speeds: 1667, 1333, 1000 MHz
> pci0 at mainbus0 bus 0: configuration mode 1 (bios)
> pchb0 at pci0 dev 0 function 0 "Intel 82945GME Host" rev 0x03
> inteldrm0 at pci0 dev 2 function 0 "Intel 82945GME Video" rev 0x03
> drm0 at inteldrm0
> intagp0 at inteldrm0
> agp0 at intagp0: aperture at 0xd000, size 0x1000
> inteldrm0: apic 2 int 16
> inteldrm0: 1024x600, 32bpp
> wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
> wsdisplay0: screen 1-5 added (std, vt100 emulation)
> "Intel 82945GM Video" rev 0x03 at pci0 dev 2 function 1 not configured
> azalia0 at pci0 dev 27 function 0 "Intel 82801GB HD Audio" rev 0x02: msi
> azalia0: codecs: Realtek ALC269
> audio0 at azalia0
> ppb0 at pci0 dev 28 function 0 "Intel 82801GB PCIE" rev 0x02: apic 2 int 16
> pci1 at ppb0 bus 4
> ppb1 at pci0 dev 28 function 1 "Intel 82801GB PCIE" rev 0x02: apic 2 int 17
> pci2 at ppb1 bus 2
> athn0 at pci2 dev 0 function 0 "Atheros AR9285" rev 0x01: apic 2 int 17
> athn0: AR9285 rev 2 (1T1R), ROM rev 13, address 00:25:d3:5f:06:4c
> ppb2 at pci0 dev 28 function 3 "Intel 82801GB PCIE" rev 0x02: apic 2 int 19
> pci3 at ppb2 bus 1
> alc0 at pci3 dev 0 function 0 "Attansic Technology L2C" rev 0xc0: msi, 
> address 00:26:18:93:af:0b
> atphy0 at alc0 phy 0: F1 10/100/1000 PHY, rev. 11
> uhci0 at pci0 dev 29 function 0 "Intel 82801GB USB" rev 0x02: apic 2 int 23
> uhci1 a

Re: [PATCH] usr.sbin/ldapd/ldapd.conf.5 - Macros can be defined...

2017-08-29 Thread Raf Czlonka
Hi Jason,

That's what I wasn't sure about - haven't seen many "that" used in
that way ;^)

Thanks for the explanation.

Raf

On Tue, Aug 29, 2017 at 09:35:25PM BST, Jason McIntyre wrote:
> On Tue, Aug 29, 2017 at 09:22:30PM +0100, Raf Czlonka wrote:
> > Hi all,
> > 
> > Not entirely sure what the author had in mind but the current
> > sentence, as it is, doesn't seem right somehow.
> > 
> > The below is my best guess.
> > 
> > Cheers,
> > 
> > Raf
> > 
> 
> hi.
> 
> what's there is fine. it is a common text blurb in many similar pages.
> i'm not sure how to explain it grammatically, but in this context "that"
> is just a way of pointing back to "macros".
> 
> so it would probably be nicer to say:
> 
>   Macros can be defined, which will later be expanded in context.
> 
> relative pronouns...? "that" is a sloppy catch all, but it is valid.
> 
> jmc
> 
> > Index: usr.sbin/ldapd/ldapd.conf.5
> > ===
> > RCS file: /cvs/src/usr.sbin/ldapd/ldapd.conf.5,v
> > retrieving revision 1.22
> > diff -u -p -r1.22 ldapd.conf.5
> > --- usr.sbin/ldapd/ldapd.conf.5 17 Oct 2016 14:03:17 -  1.22
> > +++ usr.sbin/ldapd/ldapd.conf.5 29 Aug 2017 20:18:33 -
> > @@ -41,7 +41,7 @@ must be quoted.
> >  Arguments containing whitespace should be surrounded by double quotes
> >  .Pq \&" .
> >  .Pp
> > -Macros can be defined that will later be expanded in context.
> > +Macros can be defined and will later be expanded in context.
> >  Macro names must start with a letter, digit, or underscore,
> >  and may contain any of those characters.
> >  Macro names may not be reserved words (for example
> > 
> 



Re: [PATCH] usr.sbin/ldapd/ldapd.conf.5 - Macros can be defined...

2017-08-29 Thread Jason McIntyre
On Tue, Aug 29, 2017 at 09:22:30PM +0100, Raf Czlonka wrote:
> Hi all,
> 
> Not entirely sure what the author had in mind but the current
> sentence, as it is, doesn't seem right somehow.
> 
> The below is my best guess.
> 
> Cheers,
> 
> Raf
> 

hi.

what's there is fine. it is a common text blurb in many similar pages.
i'm not sure how to explain it grammatically, but in this context "that"
is just a way of pointing back to "macros".

so it would probably be nicer to say:

Macros can be defined, which will later be expanded in context.

relative pronouns...? "that" is a sloppy catch all, but it is valid.

jmc

> Index: usr.sbin/ldapd/ldapd.conf.5
> ===
> RCS file: /cvs/src/usr.sbin/ldapd/ldapd.conf.5,v
> retrieving revision 1.22
> diff -u -p -r1.22 ldapd.conf.5
> --- usr.sbin/ldapd/ldapd.conf.5   17 Oct 2016 14:03:17 -  1.22
> +++ usr.sbin/ldapd/ldapd.conf.5   29 Aug 2017 20:18:33 -
> @@ -41,7 +41,7 @@ must be quoted.
>  Arguments containing whitespace should be surrounded by double quotes
>  .Pq \&" .
>  .Pp
> -Macros can be defined that will later be expanded in context.
> +Macros can be defined and will later be expanded in context.
>  Macro names must start with a letter, digit, or underscore,
>  and may contain any of those characters.
>  Macro names may not be reserved words (for example
> 



Re: [PATCH] usr.sbin/ldapd/ldapd.conf.5 - Macros can be defined...

2017-08-29 Thread Theo de Raadt
I don't see any problem with the sentence as it stands now.  This
same text exists in 18 other pages.  I'd say it originally came
from pf.conf(5).

> Not entirely sure what the author had in mind but the current
> sentence, as it is, doesn't seem right somehow.
> 
> The below is my best guess.
> 
> Cheers,
> 
> Raf
> 
> Index: usr.sbin/ldapd/ldapd.conf.5
> ===
> RCS file: /cvs/src/usr.sbin/ldapd/ldapd.conf.5,v
> retrieving revision 1.22
> diff -u -p -r1.22 ldapd.conf.5
> --- usr.sbin/ldapd/ldapd.conf.5   17 Oct 2016 14:03:17 -  1.22
> +++ usr.sbin/ldapd/ldapd.conf.5   29 Aug 2017 20:18:33 -
> @@ -41,7 +41,7 @@ must be quoted.
>  Arguments containing whitespace should be surrounded by double quotes
>  .Pq \&" .
>  .Pp
> -Macros can be defined that will later be expanded in context.
> +Macros can be defined and will later be expanded in context.
>  Macro names must start with a letter, digit, or underscore,
>  and may contain any of those characters.
>  Macro names may not be reserved words (for example
> 



[PATCH] usr.sbin/ldapd/ldapd.conf.5 - Macros can be defined...

2017-08-29 Thread Raf Czlonka
Hi all,

Not entirely sure what the author had in mind but the current
sentence, as it is, doesn't seem right somehow.

The below is my best guess.

Cheers,

Raf

Index: usr.sbin/ldapd/ldapd.conf.5
===
RCS file: /cvs/src/usr.sbin/ldapd/ldapd.conf.5,v
retrieving revision 1.22
diff -u -p -r1.22 ldapd.conf.5
--- usr.sbin/ldapd/ldapd.conf.5 17 Oct 2016 14:03:17 -  1.22
+++ usr.sbin/ldapd/ldapd.conf.5 29 Aug 2017 20:18:33 -
@@ -41,7 +41,7 @@ must be quoted.
 Arguments containing whitespace should be surrounded by double quotes
 .Pq \&" .
 .Pp
-Macros can be defined that will later be expanded in context.
+Macros can be defined and will later be expanded in context.
 Macro names must start with a letter, digit, or underscore,
 and may contain any of those characters.
 Macro names may not be reserved words (for example



Re: [PATCH] usr.sbin/ypldap/ypldap.8 - incomplete sentence(?)

2017-08-29 Thread Jason McIntyre
On Tue, Aug 29, 2017 at 09:01:10PM +0100, Raf Czlonka wrote:
> Hi all,
> 
> Not entirely sure whether the current sentence is correct but it
> seems a bit incomplete.
> 
> Looks like job for jmc! ;^)
> 
> Cheers,
> 
> Raf
> 

fixed, thanks.
jmc

> Index: usr.sbin/ypldap/ypldap.8
> ===
> RCS file: /cvs/src/usr.sbin/ypldap/ypldap.8,v
> retrieving revision 1.10
> diff -u -p -r1.10 ypldap.8
> --- usr.sbin/ypldap/ypldap.8  27 Jul 2015 17:28:40 -  1.10
> +++ usr.sbin/ypldap/ypldap.8  29 Aug 2017 19:53:46 -
> @@ -32,7 +32,7 @@ RFC 2307 or similar LDAP schemas can be 
>  .Nm
>  has the same role as
>  .Xr ypserv 8
> -and the two daemons are exclusive.
> +and the two daemons are mutually exclusive.
>  .Pp
>  The options are as follows:
>  .Bl -tag -width Ds
> 



[PATCH] usr.sbin/ypldap/ypldap.8 - incomplete sentence(?)

2017-08-29 Thread Raf Czlonka
Hi all,

Not entirely sure whether the current sentence is correct but it
seems a bit incomplete.

Looks like job for jmc! ;^)

Cheers,

Raf

Index: usr.sbin/ypldap/ypldap.8
===
RCS file: /cvs/src/usr.sbin/ypldap/ypldap.8,v
retrieving revision 1.10
diff -u -p -r1.10 ypldap.8
--- usr.sbin/ypldap/ypldap.827 Jul 2015 17:28:40 -  1.10
+++ usr.sbin/ypldap/ypldap.829 Aug 2017 19:53:46 -
@@ -32,7 +32,7 @@ RFC 2307 or similar LDAP schemas can be 
 .Nm
 has the same role as
 .Xr ypserv 8
-and the two daemons are exclusive.
+and the two daemons are mutually exclusive.
 .Pp
 The options are as follows:
 .Bl -tag -width Ds



Re: [PATCH] etc/ksh.kshrc - unify command substitution

2017-08-29 Thread Raf Czlonka
Ping.

Anyone?

On Sun, Jul 16, 2017 at 01:43:32PM BST, Raf Czlonka wrote:
> Hi all,
> 
> Further simplification - 'ps | grep' can be replaced by pgrep(1)
> and if-then-fi by &&.
> 
> > While there:
> > 
> > - remove ':' (null utility) from the very first line of the file -
> >   I *do* understand what it does but it doesn't seem like it's needed
> >   at all, unless I'm missing something (as is the case with some idioms)
> > [...]
> > 
> 
> As it transpired, this does indeed seem to be an old idiom denoting
> a Bourne shell script.
> 
> To quote rpe@: "I guess it's fine to remove the : line in 2017."
> 
> I agree.
> 
> Thanks again to Robert for all the feedback and suggestions.
> 
> Regards,
> 
> Raf
> 
> Index: etc/ksh.kshrc
> ===
> RCS file: /cvs/src/etc/ksh.kshrc,v
> retrieving revision 1.28
> diff -u -p -r1.28 ksh.kshrc
> --- etc/ksh.kshrc 15 Jul 2017 07:11:42 -  1.28
> +++ etc/ksh.kshrc 16 Jul 2017 11:49:55 -
> @@ -1,4 +1,3 @@
> -:
>  #$OpenBSD: ksh.kshrc,v 1.28 2017/07/15 07:11:42 tb Exp $
>  #
>  # NAME:
> @@ -74,9 +73,7 @@ case "$-" in
>   xterm*)
>   ILS='\033]1;'; ILE='\007'
>   WLS='\033]2;'; WLE='\007'
> - if ps -p $PPID -o command | grep -q telnet; then
> - export TERM=xterms
> - fi
> + pgrep -qxs $PPID telnet && export TERM=xterms
>   ;;
>   *)  ;;
>   esac



[patch] kbd should give an error unless we're root

2017-08-29 Thread Jesper Wallin
Hi,

I noticed that kbd(8) lets you list all available keyboard encodings
with the -l flag.  However, we get no error and no list unless we're
running this as root.  I apologize if this is intended and I fail to
understand why.  If not intended, the patch below will check if we're
root or otherwise error out.


Jesper Wallin


Index: sbin/kbd/main.c
===
RCS file: /cvs/src/sbin/kbd/main.c,v
retrieving revision 1.8
diff -u -p -r1.8 main.c
--- sbin/kbd/main.c 30 Dec 2007 13:50:43 -  1.8
+++ sbin/kbd/main.c 29 Aug 2017 18:40:27 -
@@ -32,6 +32,7 @@
  * SUCH DAMAGE.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -68,6 +69,9 @@ main(int argc, char *argv[])
}
if (argc != optind + list_tables ? 0 : 1)
usage();
+
+   if (geteuid() != 0)
+   errx(1, "need root privileges");
 
if (list_tables)
kbd_list();



Re: smtpd: remove filter leftovers

2017-08-29 Thread Gilles Chehade
On Tue, Aug 29, 2017 at 12:13:28PM +0200, Eric Faurot wrote:
> On Tue, Aug 29, 2017 at 10:26:19AM +0200, Eric Faurot wrote:
> 
> > Now that the filter code path has been short-circuited, start removing stub
> > smtp_filter_*() indirections. I'm doing this one function at a time to keep
> > the diffs simple, starting with smtp_filter_connect().
> 
> Actually the complete diff is simple enough.
> 

yes

ok gilles@


> Index: smtp_session.c
> ===
> RCS file: /cvs/src/usr.sbin/smtpd/smtp_session.c,v
> retrieving revision 1.305
> diff -u -p -r1.305 smtp_session.c
> --- smtp_session.c13 Aug 2017 11:10:30 -  1.305
> +++ smtp_session.c29 Aug 2017 10:08:06 -
> @@ -189,12 +189,6 @@ static void smtp_queue_open_message(stru
>  static void smtp_queue_commit(struct smtp_session *);
>  static void smtp_queue_rollback(struct smtp_session *);
>  
> -static void smtp_filter_connect(struct smtp_session *, struct sockaddr *);
> -static void smtp_filter_eom(struct smtp_session *);
> -static void smtp_filter_helo(struct smtp_session *);
> -static void smtp_filter_mail(struct smtp_session *);
> -static void smtp_filter_rcpt(struct smtp_session *);
> -static void smtp_filter_data(struct smtp_session *);
>  static void smtp_filter_dataline(struct smtp_session *, const char *);
>  
>  static struct { int code; const char *cmd; } commands[] = {
> @@ -1001,150 +995,6 @@ smtp_tls_verified(struct smtp_session *s
>  }
>  
>  void
> -smtp_filter_response(uint64_t id, int query, int status, uint32_t code,
> -const char *line)
> -{
> - struct smtp_session *s;
> - struct ca_cert_req_msg   req_ca_cert;
> -
> - s = tree_xpop(&wait_filter, id);
> -
> - if (status == FILTER_CLOSE) {
> - code = code ? code : 421;
> - line = line ? line : "Temporary failure";
> - smtp_reply(s, "%d %s", code, line);
> - smtp_enter_state(s, STATE_QUIT);
> - return;
> - }
> -
> - switch (query) {
> -
> - case QUERY_CONNECT:
> - if (status != FILTER_OK) {
> - log_info("%016"PRIx64" smtp "
> - "event=closed address=%s host=%s 
> reason=filter-reject",
> - s->id, ss_to_text(&s->ss), s->hostname);
> - smtp_free(s, "rejected by filter");
> - return;
> - }
> -
> - if (s->listener->flags & F_SMTPS) {
> - req_ca_cert.reqid = s->id;
> - if (s->listener->pki_name[0]) {
> - (void)strlcpy(req_ca_cert.name, 
> s->listener->pki_name,
> - sizeof req_ca_cert.name);
> - req_ca_cert.fallback = 0;
> - }
> - else {
> - (void)strlcpy(req_ca_cert.name, s->smtpname,
> - sizeof req_ca_cert.name);
> - req_ca_cert.fallback = 1;
> - }
> - m_compose(p_lka, IMSG_SMTP_TLS_INIT, 0, 0, -1,
> - &req_ca_cert, sizeof(req_ca_cert));
> - tree_xset(&wait_ssl_init, s->id, s);
> - return;
> - }
> - smtp_send_banner(s);
> - return;
> -
> - case QUERY_HELO:
> - if (status != FILTER_OK) {
> - code = code ? code : 530;
> - line = line ? line : "Hello rejected";
> - smtp_reply(s, "%d %s", code, line);
> - return;
> - }
> -
> - smtp_enter_state(s, STATE_HELO);
> - smtp_reply(s, "250%c%s Hello %s [%s], pleased to meet you",
> - (s->flags & SF_EHLO) ? '-' : ' ',
> - s->smtpname,
> - s->helo,
> - ss_to_text(&s->ss));
> -
> - if (s->flags & SF_EHLO) {
> - smtp_reply(s, "250-8BITMIME");
> - smtp_reply(s, "250-ENHANCEDSTATUSCODES");
> - smtp_reply(s, "250-SIZE %zu", env->sc_maxsize);
> - if (ADVERTISE_EXT_DSN(s))
> - smtp_reply(s, "250-DSN");
> - if (ADVERTISE_TLS(s))
> - smtp_reply(s, "250-STARTTLS");
> - if (ADVERTISE_AUTH(s))
> - smtp_reply(s, "250-AUTH PLAIN LOGIN");
> - smtp_reply(s, "250 HELP");
> - }
> - return;
> -
> - case QUERY_MAIL:
> - if (status != FILTER_OK) {
> - smtp_tx_free(s->tx);
> - code = code ? code : 530;
> - line = line ? line : "Sender rejected";
> - smtp_reply(s, "%d %s", code, line);
> - return;
> - }
> -
> -   

ksh: completely drop setlocale(3)

2017-08-29 Thread Jeremie Courreges-Anglas

Since last year ksh no longer sets the locale in main.c, so the diff
below is a no-op but removes 6k of text from a static ksh(1).

The emacs-usemeta flag is unused since 2012. I'm working on a diff to
kill it gracefully.

ok?


Index: emacs.c
===
RCS file: /d/cvs/src/bin/ksh/emacs.c,v
retrieving revision 1.70
diff -u -p -p -u -r1.70 emacs.c
--- emacs.c 25 Jun 2017 17:28:39 -  1.70
+++ emacs.c 29 Aug 2017 13:14:08 -
@@ -18,7 +18,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1449,19 +1448,12 @@ x_bind(const char *a1, const char *a2,
 void
 x_init_emacs(void)
 {
-   char *locale;
-
x_tty = 1;
ainit(AEDIT);
x_nextcmd = -1;
 
-   /* Determine if we can translate meta key or use 8-bit AscII
-* XXX - It would be nice if there was a locale attribute to
-* determine if the locale is 7-bit or not.
-*/
-   locale = setlocale(LC_CTYPE, NULL);
-   if (locale == NULL || !strcmp(locale, "C") || !strcmp(locale, "POSIX"))
-   Flag(FEMACSUSEMETA) = 1;
+   /* XXX unused */
+   Flag(FEMACSUSEMETA) = 1;
 
/* new keybinding stuff */
TAILQ_INIT(&kblist);

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: smtpd: remove filter leftovers

2017-08-29 Thread Eric Faurot
On Tue, Aug 29, 2017 at 10:26:19AM +0200, Eric Faurot wrote:

> Now that the filter code path has been short-circuited, start removing stub
> smtp_filter_*() indirections. I'm doing this one function at a time to keep
> the diffs simple, starting with smtp_filter_connect().

Actually the complete diff is simple enough.

Eric.

Index: smtp_session.c
===
RCS file: /cvs/src/usr.sbin/smtpd/smtp_session.c,v
retrieving revision 1.305
diff -u -p -r1.305 smtp_session.c
--- smtp_session.c  13 Aug 2017 11:10:30 -  1.305
+++ smtp_session.c  29 Aug 2017 10:08:06 -
@@ -189,12 +189,6 @@ static void smtp_queue_open_message(stru
 static void smtp_queue_commit(struct smtp_session *);
 static void smtp_queue_rollback(struct smtp_session *);
 
-static void smtp_filter_connect(struct smtp_session *, struct sockaddr *);
-static void smtp_filter_eom(struct smtp_session *);
-static void smtp_filter_helo(struct smtp_session *);
-static void smtp_filter_mail(struct smtp_session *);
-static void smtp_filter_rcpt(struct smtp_session *);
-static void smtp_filter_data(struct smtp_session *);
 static void smtp_filter_dataline(struct smtp_session *, const char *);
 
 static struct { int code; const char *cmd; } commands[] = {
@@ -1001,150 +995,6 @@ smtp_tls_verified(struct smtp_session *s
 }
 
 void
-smtp_filter_response(uint64_t id, int query, int status, uint32_t code,
-const char *line)
-{
-   struct smtp_session *s;
-   struct ca_cert_req_msg   req_ca_cert;
-
-   s = tree_xpop(&wait_filter, id);
-
-   if (status == FILTER_CLOSE) {
-   code = code ? code : 421;
-   line = line ? line : "Temporary failure";
-   smtp_reply(s, "%d %s", code, line);
-   smtp_enter_state(s, STATE_QUIT);
-   return;
-   }
-
-   switch (query) {
-
-   case QUERY_CONNECT:
-   if (status != FILTER_OK) {
-   log_info("%016"PRIx64" smtp "
-   "event=closed address=%s host=%s 
reason=filter-reject",
-   s->id, ss_to_text(&s->ss), s->hostname);
-   smtp_free(s, "rejected by filter");
-   return;
-   }
-
-   if (s->listener->flags & F_SMTPS) {
-   req_ca_cert.reqid = s->id;
-   if (s->listener->pki_name[0]) {
-   (void)strlcpy(req_ca_cert.name, 
s->listener->pki_name,
-   sizeof req_ca_cert.name);
-   req_ca_cert.fallback = 0;
-   }
-   else {
-   (void)strlcpy(req_ca_cert.name, s->smtpname,
-   sizeof req_ca_cert.name);
-   req_ca_cert.fallback = 1;
-   }
-   m_compose(p_lka, IMSG_SMTP_TLS_INIT, 0, 0, -1,
-   &req_ca_cert, sizeof(req_ca_cert));
-   tree_xset(&wait_ssl_init, s->id, s);
-   return;
-   }
-   smtp_send_banner(s);
-   return;
-
-   case QUERY_HELO:
-   if (status != FILTER_OK) {
-   code = code ? code : 530;
-   line = line ? line : "Hello rejected";
-   smtp_reply(s, "%d %s", code, line);
-   return;
-   }
-
-   smtp_enter_state(s, STATE_HELO);
-   smtp_reply(s, "250%c%s Hello %s [%s], pleased to meet you",
-   (s->flags & SF_EHLO) ? '-' : ' ',
-   s->smtpname,
-   s->helo,
-   ss_to_text(&s->ss));
-
-   if (s->flags & SF_EHLO) {
-   smtp_reply(s, "250-8BITMIME");
-   smtp_reply(s, "250-ENHANCEDSTATUSCODES");
-   smtp_reply(s, "250-SIZE %zu", env->sc_maxsize);
-   if (ADVERTISE_EXT_DSN(s))
-   smtp_reply(s, "250-DSN");
-   if (ADVERTISE_TLS(s))
-   smtp_reply(s, "250-STARTTLS");
-   if (ADVERTISE_AUTH(s))
-   smtp_reply(s, "250-AUTH PLAIN LOGIN");
-   smtp_reply(s, "250 HELP");
-   }
-   return;
-
-   case QUERY_MAIL:
-   if (status != FILTER_OK) {
-   smtp_tx_free(s->tx);
-   code = code ? code : 530;
-   line = line ? line : "Sender rejected";
-   smtp_reply(s, "%d %s", code, line);
-   return;
-   }
-
-   /* only check sendertable if defined and user has authenticated 
*/
-   if (s->flags & SF_AUTHENTICATED && s->listener->sendertable[0]) 
{
- 

smtpd: remove filter leftovers

2017-08-29 Thread Eric Faurot
Now that the filter code path has been short-circuited, start removing stub
smtp_filter_*() indirections. I'm doing this one function at a time to keep
the diffs simple, starting with smtp_filter_connect().

Eric.

Index: smtp_session.c
===
RCS file: /cvs/src/usr.sbin/smtpd/smtp_session.c,v
retrieving revision 1.305
diff -u -p -r1.305 smtp_session.c
--- smtp_session.c  13 Aug 2017 11:10:30 -  1.305
+++ smtp_session.c  29 Aug 2017 08:03:49 -
@@ -189,7 +189,6 @@ static void smtp_queue_open_message(stru
 static void smtp_queue_commit(struct smtp_session *);
 static void smtp_queue_rollback(struct smtp_session *);
 
-static void smtp_filter_connect(struct smtp_session *, struct sockaddr *);
 static void smtp_filter_eom(struct smtp_session *);
 static void smtp_filter_helo(struct smtp_session *);
 static void smtp_filter_mail(struct smtp_session *);
@@ -1005,7 +1004,6 @@ smtp_filter_response(uint64_t id, int qu
 const char *line)
 {
struct smtp_session *s;
-   struct ca_cert_req_msg   req_ca_cert;
 
s = tree_xpop(&wait_filter, id);
 
@@ -1019,35 +1017,6 @@ smtp_filter_response(uint64_t id, int qu
 
switch (query) {
 
-   case QUERY_CONNECT:
-   if (status != FILTER_OK) {
-   log_info("%016"PRIx64" smtp "
-   "event=closed address=%s host=%s 
reason=filter-reject",
-   s->id, ss_to_text(&s->ss), s->hostname);
-   smtp_free(s, "rejected by filter");
-   return;
-   }
-
-   if (s->listener->flags & F_SMTPS) {
-   req_ca_cert.reqid = s->id;
-   if (s->listener->pki_name[0]) {
-   (void)strlcpy(req_ca_cert.name, 
s->listener->pki_name,
-   sizeof req_ca_cert.name);
-   req_ca_cert.fallback = 0;
-   }
-   else {
-   (void)strlcpy(req_ca_cert.name, s->smtpname,
-   sizeof req_ca_cert.name);
-   req_ca_cert.fallback = 1;
-   }
-   m_compose(p_lka, IMSG_SMTP_TLS_INIT, 0, 0, -1,
-   &req_ca_cert, sizeof(req_ca_cert));
-   tree_xset(&wait_ssl_init, s->id, s);
-   return;
-   }
-   smtp_send_banner(s);
-   return;
-
case QUERY_HELO:
if (status != FILTER_OK) {
code = code ? code : 530;
@@ -2023,6 +1992,7 @@ smtp_lookup_servername(struct smtp_sessi
 static void
 smtp_connected(struct smtp_session *s)
 {
+   struct ca_cert_req_msg  req_ca_cert;
struct sockaddr_storage ss;
socklen_t   sl;
 
@@ -2037,7 +2007,25 @@ smtp_connected(struct smtp_session *s)
return;
}
 
-   smtp_filter_connect(s, (struct sockaddr *)&ss);
+   if (s->listener->flags & F_SMTPS) {
+   req_ca_cert.reqid = s->id;
+   if (s->listener->pki_name[0]) {
+   (void)strlcpy(req_ca_cert.name, s->listener->pki_name,
+   sizeof req_ca_cert.name);
+   req_ca_cert.fallback = 0;
+   }
+   else {
+   (void)strlcpy(req_ca_cert.name, s->smtpname,
+   sizeof req_ca_cert.name);
+   req_ca_cert.fallback = 1;
+   }
+   m_compose(p_lka, IMSG_SMTP_TLS_INIT, 0, 0, -1,
+   &req_ca_cert, sizeof(req_ca_cert));
+   tree_xset(&wait_ssl_init, s->id, s);
+   return;
+   }
+
+   smtp_send_banner(s);
 }
 
 static void
@@ -2416,13 +2404,6 @@ smtp_queue_rollback(struct smtp_session 
m_create(p_queue, IMSG_SMTP_MESSAGE_ROLLBACK, 0, 0, -1);
m_add_msgid(p_queue, s->tx->msgid);
m_close(p_queue);
-}
-
-static void
-smtp_filter_connect(struct smtp_session *s, struct sockaddr *sa)
-{
-   tree_xset(&wait_filter, s->id, s);
-   smtp_filter_response(s->id, QUERY_CONNECT, FILTER_OK, 0, NULL);
 }
 
 static void