Re: faq/current.html: Mention sudo removal

2015-07-07 Thread sven falempin
On Mon, Jul 6, 2015 at 8:14 PM, Theo de Raadt dera...@cvs.openbsd.org
wrote:

  On Sun, Jul 05, 2015 at 05:52:54PM -0600, Theo de Raadt wrote:
   Why is sudo being removed from base? It is pretty useful. I imagine
 many
   use sudo
  
   Sorry, we are making room in the tree so that lynx can come back.
 
  An actual serious answer would make sense at this point, you know...

 Marc, cut the BS.  Others, including Todd Miller, have seriously
 explained the situation.


A resume for those who failed to read the zillions of lines of tedu, from a
BS specialist.

SUDO is up to date in ports.
SUDO is not 'compliant' to openBSD code style.
SUDO is of course very usefull but mtier makes package availaible even in
corner case situation.

so SUDO stay in ports not in base.

-- 
-
() ascii ribbon campaign - against html e-mail
/\


Re: [patch] vi: fix file modified more recently than this copy ... error

2015-07-07 Thread Todd C. Miller
I prefer this diff instead.

 - todd

Index: usr.bin/vi/common/exf.c
===
RCS file: /cvs/src/usr.bin/vi/common/exf.c,v
retrieving revision 1.36
diff -u -p -u -r1.36 exf.c
--- usr.bin/vi/common/exf.c 24 Apr 2015 21:48:31 -  1.36
+++ usr.bin/vi/common/exf.c 7 Jul 2015 15:53:28 -
@@ -185,7 +185,8 @@ file_init(SCR *sp, FREF *frp, char *rcv_
(void)snprintf(tname, sizeof(tname),
%s/vi.XX, O_STR(sp, O_TMP_DIRECTORY));
fd = mkstemp(tname);
-   if (fd == -1 || fchmod(fd, S_IRUSR | S_IWUSR) == -1) {
+   if (fd == -1 || fstat(fd, sb) == -1 ||
+   fchmod(fd, S_IRUSR | S_IWUSR) == -1) {
msgq(sp, M_SYSERR,
237|Unable to create temporary file);
if (fd != -1) {
@@ -210,8 +211,6 @@ file_init(SCR *sp, FREF *frp, char *rcv_
psize = 1024;
if (!LF_ISSET(FS_OPENERR))
F_SET(frp, FR_NEWFILE);
-
-   (void)clock_gettime(CLOCK_REALTIME, ep-mtim);
} else {
/*
 * XXX
@@ -226,16 +225,17 @@ file_init(SCR *sp, FREF *frp, char *rcv_
psize = 1;
psize *= 1024;
 
-   F_SET(ep, F_DEVSET);
-   ep-mdev = sb.st_dev;
-   ep-minode = sb.st_ino;
-
-   ep-mtim = sb.st_mtim;
-
if (!S_ISREG(sb.st_mode))
msgq_str(sp, M_ERR, oname,
238|Warning: %s is not a regular file);
}
+
+   /* Save device, inode and modification time. */
+   F_SET(ep, F_DEVSET);
+   ep-mdev = sb.st_dev;
+   ep-minode = sb.st_ino;
+
+   ep-mtim = sb.st_mtim;
 
/* Set up recovery. */
memset(oinfo, 0, sizeof(RECNOINFO));



Re: Small in6_addr2scopeid() tweak

2015-07-07 Thread Todd C. Miller
On Tue, 07 Jul 2015 15:56:35 +0200, Martin Pieuchot wrote:

 Now that packet headers include the interface index of their receiving
 interface, pass it directly to in6_addr2scopeid().
 
 This does not change anything with regards to the scopeid hack but it
 reduces the number of if_get().

OK, but you should update the comment preceding the in6_addr2scopeid()
function.  It's probably best to just remove the:

 * ifp - must not be NULL

 - todd



Kill arp_ifinit()?

2015-07-07 Thread Martin Pieuchot
Maybe not yet but at least I'd like to do the ARP request a bit later.

We create a RTF_LOCAL route entry for every configured address.  So
use this information to emit a who-has for the configured address.

This also has the advantage of *not* sending an ARP request if 
something wrong happens between the SIOCSIFADDR ioctl and the
RTF_LOCAL route creation.

Ok?

Index: netinet/if_ether.c
===
RCS file: /cvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.157
diff -u -p -r1.157 if_ether.c
--- netinet/if_ether.c  7 Jul 2015 14:22:25 -   1.157
+++ netinet/if_ether.c  7 Jul 2015 15:56:15 -
@@ -196,8 +196,11 @@ arp_rtrequest(int req, struct rtentry *r
if ((rt-rt_flags  RTF_CLONING) != 0)
break;
}
-   /* Announce a new entry if requested. */
-   if (rt-rt_flags  RTF_ANNOUNCE)
+   /*
+* Announce a new entry if requested or warn the user
+* if another station has this IP address.
+*/
+   if (rt-rt_flags  (RTF_ANNOUNCE|RTF_LOCAL))
arprequest(ifp,
satosin(rt_key(rt))-sin_addr.s_addr,
satosin(rt_key(rt))-sin_addr.s_addr,
@@ -850,12 +853,6 @@ arpproxy(struct in_addr in, u_int rdomai
 void
 arp_ifinit(struct arpcom *ac, struct ifaddr *ifa)
 {
-
-   /* Warn the user if another station has this IP address. */
-   arprequest(ac-ac_if,
-   satosin(ifa-ifa_addr)-sin_addr.s_addr,
-   satosin(ifa-ifa_addr)-sin_addr.s_addr,
-   ac-ac_enaddr);
ifa-ifa_rtrequest = arp_rtrequest;
 }
 



Re: unwritable PKG_CACHE directory

2015-07-07 Thread Craig Skinner
On 2015-07-06 Mon 23:08 PM |, Chris Bennett wrote:
 If you want to have a writable PKG_CACHE, why not do something simple
 like /home/dude/pkg_cache?
 

$ printenv PKG_CACHE
/var/cache/pkgs

$ ls -lod /var/cache /var/cache/pkgs
drwxr-xr-x  8 root  wheel  nodump  512 May 28 21:57 /var/cache/
drwxrwxr-x  2 root  wheel  -  8704 Jul  6 07:39 /var/cache/pkgs/

Those in wheel group can pkg_add -n, caching for later root install.



Re: [patch] unsync between ctype and wctype

2015-07-07 Thread Sebastien Marie
On Tue, Jul 07, 2015 at 10:37:34AM +0200, Stefan Sperling wrote:
 On Tue, Jul 07, 2015 at 09:25:30AM +0200, Sebastien Marie wrote:
  Hi,
  
  _C_ctype_ (ctype) and _DefaultRuneLocale.rl_runetype (wctype) are
  currently unsynced, resulting regress/lib/libc/locale/check_isw to
  failed.
  
 
 Yes, the C locale should contain only ASCII.
 
 I must have missed this second table when I changed the default locale
 to ASCII from latin1.
 
  Comments ? OK ?
 
 In my opinion we can remove these lines instead of using #if 0.
 

New patch with lines removed.

-- 
Sebastien Marie

Index: locale/runetable.c
===
RCS file: /cvs/src/lib/libc/locale/runetable.c,v
retrieving revision 1.6
diff -u -p -r1.6 runetable.c
--- locale/runetable.c  12 Apr 2015 20:18:41 -  1.6
+++ locale/runetable.c  7 Jul 2015 08:50:33 -
@@ -177,134 +177,6 @@ _RuneLocale _DefaultRuneLocale = {
_CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
_CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
_CTYPE_C,
-   /*80*/  _CTYPE_C, 
-   _CTYPE_C, 
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   /*88*/  _CTYPE_C, 
-   _CTYPE_C, 
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   /*90*/  _CTYPE_C, 
-   _CTYPE_C, 
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   /*98*/  _CTYPE_C, 
-   _CTYPE_C, 
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   _CTYPE_C,
-   /*A0*/  _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   /*A8*/  _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   /*B0*/  _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   /*B8*/  _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   /*C0*/  _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   /*C8*/  _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   /*D0*/  _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
-  

[patch] unsync between ctype and wctype

2015-07-07 Thread Sebastien Marie
Hi,

_C_ctype_ (ctype) and _DefaultRuneLocale.rl_runetype (wctype) are
currently unsynced, resulting regress/lib/libc/locale/check_isw to
failed.

The problem is _C_ctype_ (in gen/ctype_.c) and _DefaultRuneLocale (in
locale/runetable.c) define differently characters class for char = 0x80.

After checking with FreeBSD, NetBSD and DragonFlyBSD: OpenBSD is alone
to define something different from 0 for char = 0x80 (outside 7bit
ASCII) in default configuration (which should be C or POSIX).

The following chart
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html
show that the portable character set have 7bit long. POSIX.1-2008 uses
character names other than the above, but only in an informative way.

The following patch reduce defining rl_runetype of _DefaultRuneLocale to
0x00-0x7f.

After this patch, regress/lib/libc/locale/check_isw pass.


Note I am unsure on a point: the array is defined to be _CACHED_RUNES
(18 = 256) elements in size. Here the initialisation is for 128
elements.

 int tab[256] = {0, 1, 2, ..., 126, 127};

Should the rest of the array be initialised with zero ? or the compiler
will do it alone ? I have checked NetBSD, FreeBSD and DragonflyBSD: all
have this construct (array of 256, initialisation with 128 elements).

I also do several tests with MALLOC_OPTIONS and differents sizes of
array, and all remainings elements are 0.

Comments ? OK ?
-- 
Sebastien Marie

Index: locale/runetable.c
===
RCS file: /cvs/src/lib/libc/locale/runetable.c,v
retrieving revision 1.6
diff -u -p -r1.6 runetable.c
--- locale/runetable.c  12 Apr 2015 20:18:41 -  1.6
+++ locale/runetable.c  7 Jul 2015 06:39:47 -
@@ -177,6 +177,7 @@ _RuneLocale _DefaultRuneLocale = {
_CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
_CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
_CTYPE_C,
+#if 0
/*80*/  _CTYPE_C, 
_CTYPE_C, 
_CTYPE_C,
@@ -305,6 +306,7 @@ _RuneLocale _DefaultRuneLocale = {
_CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
_CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
_CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
+#endif
 },
 {  0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
0x08,   0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,



Re: [patch] vi: fix file modified more recently than this copy ... error

2015-07-07 Thread patrick keshishian
ping?

On 6/9/15, patrick keshishian sids...@boxsoft.com wrote:
 Hi,

 Noticed a regression with vi and recent changes to timespec
 data types.

 To reproduce, run vi without a file name to edit. Try save buffer
 via :w and you'll be presented by following message:

 file modified more recently than this this copy; use ! to override

 Patch below fixes this.

 Hope this is acceptable.

 Thanks,
 --patrick

 Index: common/exf.c
 ===
 RCS file: /cvs/obsd/src/usr.bin/vi/common/exf.c,v
 retrieving revision 1.36
 diff -u -p -u -p -r1.36 exf.c
 --- common/exf.c  24 Apr 2015 21:48:31 -  1.36
 +++ common/exf.c  10 Jun 2015 03:55:58 -
 @@ -211,7 +211,10 @@ file_init(SCR *sp, FREF *frp, char *rcv_
   if (!LF_ISSET(FS_OPENERR))
   F_SET(frp, FR_NEWFILE);

 - (void)clock_gettime(CLOCK_REALTIME, ep-mtim);
 + if (stat(tname, sb))
 + (void)clock_gettime(CLOCK_REALTIME, ep-mtim);
 + else
 + ep-mtim = sb.st_mtim;
   } else {
   /*
* XXX





regress locale/check_isw

2015-07-07 Thread Sebastien Marie
Hi,

While working on regress test for locale, I saw check_isw regress test
have same message for isgraph/islower ('6').

Discriminate the both, and renumerate tests.

Comments ? OK ?

Please note the regress test is currently failing. I hope to fix it
soon.

-- 
Sebastien Marie


Index: check_isw.c
===
RCS file: /cvs/src/regress/lib/libc/locale/check_isw/check_isw.c,v
retrieving revision 1.1
diff -u -p -r1.1 check_isw.c
--- check_isw.c 11 Aug 2005 21:57:02 -  1.1
+++ check_isw.c 7 Jul 2015 06:34:47 -
@@ -58,14 +58,14 @@ test1()
check_bool(iscntrl(i), iswcntrl(i), '4');
check_bool(isdigit(i), iswdigit(i), '5');
check_bool(isgraph(i), iswgraph(i), '6');
-   check_bool(islower(i), iswlower(i), '6');
-   check_bool(isprint(i), iswprint(i), '7');
-   check_bool(ispunct(i), iswpunct(i), '8');
-   check_bool(isspace(i), iswspace(i), '9');
-   check_bool(isupper(i), iswupper(i), 'a');
-   check_bool(isxdigit(i), iswxdigit(i), 'b');
-   check_value(tolower(i), towlower(i), 'c');
-   check_value(toupper(i), towupper(i), 'd');
+   check_bool(islower(i), iswlower(i), '7');
+   check_bool(isprint(i), iswprint(i), '8');
+   check_bool(ispunct(i), iswpunct(i), '9');
+   check_bool(isspace(i), iswspace(i), 'a');
+   check_bool(isupper(i), iswupper(i), 'b');
+   check_bool(isxdigit(i), iswxdigit(i), 'c');
+   check_value(tolower(i), towlower(i), 'd');
+   check_value(toupper(i), towupper(i), 'e');
if (i % 8 == 7)
printf(\n);
}
@@ -108,21 +108,21 @@ test2()
check_bool(iscntrl(s[j]), iswcntrl(c), '4');
check_bool(isdigit(s[j]), iswdigit(c), '5');
check_bool(isgraph(s[j]), iswgraph(c), '6');
-   check_bool(islower(s[j]), iswlower(c), '6');
-   check_bool(isprint(s[j]), iswprint(c), '7');
-   check_bool(ispunct(s[j]), iswpunct(c), '8');
-   check_bool(isspace(s[j]), iswspace(c), '9');
-   check_bool(isupper(s[j]), iswupper(c), 'a');
-   check_bool(isxdigit(s[j]), iswxdigit(c), 'b');
+   check_bool(islower(s[j]), iswlower(c), '7');
+   check_bool(isprint(s[j]), iswprint(c), '8');
+   check_bool(ispunct(s[j]), iswpunct(c), '9');
+   check_bool(isspace(s[j]), iswspace(c), 'a');
+   check_bool(isupper(s[j]), iswupper(c), 'b');
+   check_bool(isxdigit(s[j]), iswxdigit(c), 'c');
d = towlower(c);
if (wctomb(buf, d) == 1) {  
-   check_value(tolower(s[j]), buf[0], 'c');
+   check_value(tolower(s[j]), buf[0], 'd');
} else {
bad++;
}
d = towupper(c);
if (wctomb(buf, d) == 1) {  
-   check_value(toupper(s[j]), buf[0], 'c');
+   check_value(toupper(s[j]), buf[0], 'e');
} else {
bad++;
}



Re: [patch] unsync between ctype and wctype

2015-07-07 Thread Stefan Sperling
On Tue, Jul 07, 2015 at 09:25:30AM +0200, Sebastien Marie wrote:
 Hi,
 
 _C_ctype_ (ctype) and _DefaultRuneLocale.rl_runetype (wctype) are
 currently unsynced, resulting regress/lib/libc/locale/check_isw to
 failed.
 
 The problem is _C_ctype_ (in gen/ctype_.c) and _DefaultRuneLocale (in
 locale/runetable.c) define differently characters class for char = 0x80.
 
 After checking with FreeBSD, NetBSD and DragonFlyBSD: OpenBSD is alone
 to define something different from 0 for char = 0x80 (outside 7bit
 ASCII) in default configuration (which should be C or POSIX).

Yes, the C locale should contain only ASCII.

I must have missed this second table when I changed the default locale
to ASCII from latin1.

 Comments ? OK ?

In my opinion we can remove these lines instead of using #if 0.

 -- 
 Sebastien Marie
 
 Index: locale/runetable.c
 ===
 RCS file: /cvs/src/lib/libc/locale/runetable.c,v
 retrieving revision 1.6
 diff -u -p -r1.6 runetable.c
 --- locale/runetable.c12 Apr 2015 20:18:41 -  1.6
 +++ locale/runetable.c7 Jul 2015 06:39:47 -
 @@ -177,6 +177,7 @@ _RuneLocale _DefaultRuneLocale = {
   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
   _CTYPE_C,
 +#if 0
   /*80*/  _CTYPE_C, 
   _CTYPE_C, 
   _CTYPE_C,
 @@ -305,6 +306,7 @@ _RuneLocale _DefaultRuneLocale = {
   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
   _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
 +#endif
  },
  {0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
   0x08,   0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,



Re: [patch] vi: fix file modified more recently than this copy ... error

2015-07-07 Thread patrick keshishian
On 7/7/15, Todd C. Miller todd.mil...@courtesan.com wrote:
 I prefer this diff instead.

Thanks. I too like this better.
--patrick


  - todd

 Index: usr.bin/vi/common/exf.c
 ===
 RCS file: /cvs/src/usr.bin/vi/common/exf.c,v
 retrieving revision 1.36
 diff -u -p -u -r1.36 exf.c
 --- usr.bin/vi/common/exf.c   24 Apr 2015 21:48:31 -  1.36
 +++ usr.bin/vi/common/exf.c   7 Jul 2015 15:53:28 -
 @@ -185,7 +185,8 @@ file_init(SCR *sp, FREF *frp, char *rcv_
   (void)snprintf(tname, sizeof(tname),
   %s/vi.XX, O_STR(sp, O_TMP_DIRECTORY));
   fd = mkstemp(tname);
 - if (fd == -1 || fchmod(fd, S_IRUSR | S_IWUSR) == -1) {
 + if (fd == -1 || fstat(fd, sb) == -1 ||
 + fchmod(fd, S_IRUSR | S_IWUSR) == -1) {
   msgq(sp, M_SYSERR,
   237|Unable to create temporary file);
   if (fd != -1) {
 @@ -210,8 +211,6 @@ file_init(SCR *sp, FREF *frp, char *rcv_
   psize = 1024;
   if (!LF_ISSET(FS_OPENERR))
   F_SET(frp, FR_NEWFILE);
 -
 - (void)clock_gettime(CLOCK_REALTIME, ep-mtim);
   } else {
   /*
* XXX
 @@ -226,16 +225,17 @@ file_init(SCR *sp, FREF *frp, char *rcv_
   psize = 1;
   psize *= 1024;

 - F_SET(ep, F_DEVSET);
 - ep-mdev = sb.st_dev;
 - ep-minode = sb.st_ino;
 -
 - ep-mtim = sb.st_mtim;
 -
   if (!S_ISREG(sb.st_mode))
   msgq_str(sp, M_ERR, oname,
   238|Warning: %s is not a regular file);
   }
 +
 + /* Save device, inode and modification time. */
 + F_SET(ep, F_DEVSET);
 + ep-mdev = sb.st_dev;
 + ep-minode = sb.st_ino;
 +
 + ep-mtim = sb.st_mtim;

   /* Set up recovery. */
   memset(oinfo, 0, sizeof(RECNOINFO));





Re: unwritable PKG_CACHE directory

2015-07-07 Thread Marc Espie
On Mon, Jul 06, 2015 at 07:15:06PM -0600, Dale Lindskog wrote:
 It is discouraged but possible to run pkg_add(1) with -n or -s as a user 
 other than root.  However, if pkg_add(1) does not have write permission to 
 $PKG_CACHE, then unclear error messages are produced.  For example:
 
 $ ls -ld $PKG_CACHE
 drwxr-xr-x  2 root  wheel  3072 Jul  2 12:13 /var/pkg_cache
 $ pkg_add -vn gcal
 pkg_add should be run as root
 Update candidates: quirks-2.54 - quirks-2.54
 quirks-2.54 signed on 2015-03-08T12:33:05Z
 Fatal error: Ustar 
 [ftp://ftp.openbsd.org/pub/OpenBSD/5.7/packages/amd64/gcal-3.6.3p0.tgz][?]: 
 Error while reading header
  at /usr/libdata/perl5/OpenBSD/Ustar.pm line 89.
 
 One solution is for pkg_add(1) to silently omit the attempt to copy the 
 package to an unwritable $PKG_CACHE.  Below is a diff that achieves this, 
 and modifies pkg_add(1)'s man page accordingly.
 
 Index: pkg_add.1
 ===
 RCS file: /cvs/src/usr.sbin/pkg_add/pkg_add.1,v
 retrieving revision 1.132
 diff -u -p -r1.132 pkg_add.1
 --- pkg_add.1 16 Apr 2015 20:01:39 -  1.132
 +++ pkg_add.1 7 Jul 2015 00:51:22 -
 @@ -371,7 +371,7 @@ Don't actually install a package, just r
  would be taken if it was.
  Will still copy packages to
  .Ev PKG_CACHE
 -if applicable.
 +if applicable, and if pkg_add has write permission to that directory.
  .It Fl P Ar type
  Check permissions for distribution, where
  .Ar type
 Index: OpenBSD/PackageRepository.pm
 ===
 RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v
 retrieving revision 1.113
 diff -u -p -r1.113 PackageRepository.pm
 --- OpenBSD/PackageRepository.pm  4 Mar 2015 13:55:32 -   1.113
 +++ OpenBSD/PackageRepository.pm  7 Jul 2015 00:51:22 -
 @@ -534,7 +534,7 @@ sub open_pipe
   $object-{pid2} = $pid2;
   } else {
   open STDERR, '', $object-{errors};
 - if (defined $object-{cache_dir}) {
 + if (defined $object-{cache_dir} and -w $object-{cache_dir}) {
   my $pid3 = open(my $in, -|);
   $self-did_it_fork($pid3);
   if ($pid3) {
I object to the silent part... if you're trying to actually use PKG_CACHE
then, having it fail silently and then discovering several GB later that oops,
it didn't save anything anywhere looks like a huge mistake.

But I'll try to make the error message be completely explicit.



Re: Pure L2TP client upload performance

2015-07-07 Thread Sergey Ryazanov
 2015-06-26 9:20 GMT+03:00 Claudio Jeker cje...@diehard.n-r-g.com:
 On Fri, Jun 26, 2015 at 04:59:32AM +0300, Sergey Ryazanov wrote:
 Hello,

 during building l2tp tunnel with xl2tpd-1.3.1 I was faced with its too
 low  upload  performance.  When  download,  the  speed is 20 mbit/s at
 nearly  100% CPU utilization. CPU is Pentium D 930 3 GHz. When upload,
 the speed is below 2 mbit/s at nearly zero CPU utilization.

 First,  I  examined xl2tpd code and did not find any potential issues.
 Then  I  compiled  it with -pg option and do a quick test with help of
 iperf(1):  4  TCP  flows,  direction  is toward the L2TP server, 2 min
 test.   Then  I run gprof and got pretty strange output:

 [skip]

 During  upload  tests, everything looks like if xl2tpd doesn't perform
 any work and stucks somewhere in I/O operation.

 May  be  there are some options, what could be tuned to speedup ppp(4)
 I/O  performance  or  did  I missed something during my tests? I am in
 doubts. Any clues?


 Can you get a ktrace output to figure out what write is doing?
 Could it be that it busy loops with EINTR or EAGAIN?
 It sure smells like something is going on there.


 I did make the trace, which shows that write(2) works good, there are no
 errors:
 # kdump -f ktrace.out-0-tx | grep 'RET   write' | wc -l
23999
 # kdump -f ktrace.out-0-tx | grep 'RET   write.*errno' | wc -l
0

 That was bad news. Let's talk about something good. I finally found a way
 to speed up the upload. I got 91 mbit/s, as reported by speedtest.net,
 over 100 mbit Ethernet link (at 100% CPU utilization, with the patched
 non-SMP kernel).

 Looks like the issue is caused by too small size of pty output buffer, and
 too small watermarks, which control the pty buffer filling. When pty driver
 requests the tty allocation, it passes 0 as baud rate. For any rates, which
 is less or equal to 115200, tty driver allocates an output buffer of size
 of 1024 byte. And most likely, hardcoded watermarks in the ppp discipline
 code are selected according to this buffer size. May be these values were
 reasonable for 56k modems, but not for 100 mbit uplink.

 Patch for tests is inlined below. All numbers are arbitrary selected values.
 I just took first reasonable values and got a positive result, without any
 further experiments.

 This patch is not suitable for merging, since it just quick and dirty fix.
 To solve the issue in more generic way I see several approaches, each of
 which has pros and cons:
 (a) increase default value (as in this patch);
 (b) provide some API (IOCTL) to control buffer size from pppd(8);
 (c) make some hack that would reveal pty for high-speed links and increase
 their buffer.

 Any thoughts?

 P.S. If I can get 91 mbit/s of upload rate, then why I get only 20 mbit/s
 of download rate on the same machine?

 Index: kern/tty_pty.c
 ===
 RCS file: /cvs/src/sys/kern/tty_pty.c,v
 retrieving revision 1.70
 diff -u -p -r1.70 tty_pty.c
 --- kern/tty_pty.c  10 Feb 2015 21:56:10 -  1.70
 +++ kern/tty_pty.c  28 Jun 2015 14:18:16 -
 @@ -58,6 +58,7 @@
  #include sys/rwlock.h
  
  #define BUFSIZ 100 /* Chunk size iomoved to/from user */
 +#define PTY_DEF_BAUD 100
  
  /*
   * pts == /dev/tty[p-zP-T][0-9a-zA-Z]
 @@ -192,7 +193,7 @@ check_pty(int minor)
 if (!pt_softc[minor]) {
 pti = malloc(sizeof(struct pt_softc), M_DEVBUF,
 M_WAITOK|M_ZERO);
 -   pti-pt_tty = ttymalloc(0);
 +   pti-pt_tty = ttymalloc(PTY_DEF_BAUD);
 ptydevname(minor, pti);
 pt_softc[minor] = pti;
 }
 @@ -235,7 +236,7 @@ ptsopen(dev_t dev, int flag, int devtype
  
 pti = pt_softc[minor(dev)];
 if (!pti-pt_tty) {
 -   tp = pti-pt_tty = ttymalloc(0);
 +   tp = pti-pt_tty = ttymalloc(PTY_DEF_BAUD);
 } else
 tp = pti-pt_tty;
 if ((tp-t_state  TS_ISOPEN) == 0) {
 @@ -413,7 +414,7 @@ ptcopen(dev_t dev, int flag, int devtype
  
 pti = pt_softc[minor(dev)];
 if (!pti-pt_tty) {
 -   tp = pti-pt_tty = ttymalloc(0);
 +   tp = pti-pt_tty = ttymalloc(PTY_DEF_BAUD);
 } else
 tp = pti-pt_tty;
 if (tp-t_oproc)
 Index: net/ppp_tty.c
 ===
 RCS file: /cvs/src/sys/net/ppp_tty.c,v
 retrieving revision 1.33
 diff -u -p -r1.33 ppp_tty.c
 --- net/ppp_tty.c   3 Jun 2015 00:50:09 -   1.33
 +++ net/ppp_tty.c   28 Jun 2015 14:18:16 -
 @@ -163,8 +163,8 @@ struct pool ppp_pkts;
  /* This is a NetBSD-1.0 or later kernel. */
  #define CCOUNT(q)  ((q)-c_cc)
  
 -#define PPP_LOWAT  100 /* Process more output when  LOWAT on queue 
 */
 -#definePPP_HIWAT   400 /* Don't start a new packet if HIWAT 
 on queue */
 +#define PPP_LOWAT  1024/* Process 

Re: [patch] unsync between ctype and wctype

2015-07-07 Thread Todd C. Miller
On Tue, 07 Jul 2015 10:51:22 +0200, Sebastien Marie wrote:

 New patch with lines removed.

Makes sense.  OK millert@

 - todd



Re: unifdef IN6_IFSTAT_STRICT

2015-07-07 Thread Todd C. Miller
On Tue, 07 Jul 2015 15:51:12 +0200, Martin Pieuchot wrote:

 I'd like to remove this 16 years old define.  We always used the correct
 behavior.  My goal is to reduce the uses of if_get().
 
 Ok?

I'm in favor of fewer useless knobs.  OK millert@.

 - todd



Re: [libressl] Improve XMPP protocol support for starttls on s_client

2015-07-07 Thread Stuart Henderson
On 2015/07/06 13:40, Landry Breuil wrote:
 Hi,
 
 i'm not an ssl hacker at all, but while debugging openssl -starttls
 issues against an xmpp server, i stumbled upon
 https://rt.openssl.org/Ticket/Display.html?id=2860user=guestpass=guest
 which fixes some issue with -starttls xmpp and adds the possibility to
 use -xmpphost in case there's some virtualhost. Backported the patch to
 libressl and applied style(9), works fine here in basic testing against
 prosody, before -starttls xmpp host was just stalling. I havent touched
 the documentation chunks since i dont really know if we still use the
 pod format or...

Seems useful to me, some of the starttls-based protocols can be a
pain to diagnose without a tool like this.

It definitely needs the documentation chunk for -xmpphost though,
it should go in src/usr.bin/openssl/openssl.1, and I think probably
adding to sc_usage() in s_client.c.



Re: Fix some titles

2015-07-07 Thread Pavel Plamenov
Updated patch, paying more attention to style.

Index: plus52.html
===
RCS file: /cvs/www/plus52.html,v
retrieving revision 1.11
diff -u -p -r1.11 plus52.html
--- plus52.html 2 Jul 2015 05:49:04 -   1.11
+++ plus52.html 7 Jul 2015 10:31:28 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.2 changes/title
 meta name=description content=OpenBSD 5.2 changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus52.html;
Index: plus53.html
===
RCS file: /cvs/www/plus53.html,v
retrieving revision 1.10
diff -u -p -r1.10 plus53.html
--- plus53.html 2 Jul 2015 05:49:04 -   1.10
+++ plus53.html 7 Jul 2015 10:31:28 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.3 changes/title
 meta name=description content=OpenBSD 5.3 changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus53.html;
Index: plus54.html
===
RCS file: /cvs/www/plus54.html,v
retrieving revision 1.12
diff -u -p -r1.12 plus54.html
--- plus54.html 2 Jul 2015 05:49:04 -   1.12
+++ plus54.html 7 Jul 2015 10:31:28 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.4 changes/title
 meta name=description content=OpenBSD -current changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus54.html;
Index: plus55.html
===
RCS file: /cvs/www/plus55.html,v
retrieving revision 1.8
diff -u -p -r1.8 plus55.html
--- plus55.html 2 Jul 2015 05:49:04 -   1.8
+++ plus55.html 7 Jul 2015 10:31:28 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.5 changes/title
 meta name=description content=OpenBSD -current changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus55.html;
Index: plus56.html
===
RCS file: /cvs/www/plus56.html,v
retrieving revision 1.9
diff -u -p -r1.9 plus56.html
--- plus56.html 2 Jul 2015 05:49:04 -   1.9
+++ plus56.html 7 Jul 2015 10:31:28 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.6 changes/title
 meta name=description content=OpenBSD 5.6 changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus56.html;
Index: plus57.html
===
RCS file: /cvs/www/plus57.html,v
retrieving revision 1.4
diff -u -p -r1.4 plus57.html
--- plus57.html 2 Jul 2015 05:49:04 -   1.4
+++ plus57.html 7 Jul 2015 10:31:29 -
@@ -2,7 +2,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.7 changes/title
 meta name=description content=OpenBSD 5.7 changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus57.html;
Index: faq/upgrade35.html
===
RCS file: /cvs/www/faq/upgrade35.html,v
retrieving revision 1.4
diff -u -p -r1.4 upgrade35.html
--- faq/upgrade35.html  2 Jul 2015 05:49:04 -   1.4
+++ faq/upgrade35.html  7 Jul 2015 10:31:29 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD Upgrade Guide/title
+titleOpenBSD Upgrade Guide: 3.5 to 3.6/title
 meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
 meta name=description   content=the OpenBSD FAQ page
 meta name=copyright content=This document copyright 2004 by OpenBSD
Index: faq/upgrade36.html
===
RCS file: /cvs/www/faq/upgrade36.html,v
retrieving revision 1.16
diff -u -p -r1.16 upgrade36.html
--- faq/upgrade36.html  2 Jul 2015 05:49:04 -   1.16
+++ faq/upgrade36.html  7 Jul 2015 10:31:29 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD Upgrade Guide/title
+titleOpenBSD Upgrade Guide: 3.5 to 3.6/title
 meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
 meta name=description   content=the OpenBSD FAQ page
 

Fix some titles

2015-07-07 Thread Pavel Plamenov
Fix some titles and make others more descriptive.

Index: plus52.html
===
RCS file: /cvs/www/plus52.html,v
retrieving revision 1.11
diff -u -p -r1.11 plus52.html
--- plus52.html 2 Jul 2015 05:49:04 -   1.11
+++ plus52.html 7 Jul 2015 09:49:03 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.2 changes/title
 meta name=description content=OpenBSD 5.2 changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus52.html;
Index: plus53.html
===
RCS file: /cvs/www/plus53.html,v
retrieving revision 1.10
diff -u -p -r1.10 plus53.html
--- plus53.html 2 Jul 2015 05:49:04 -   1.10
+++ plus53.html 7 Jul 2015 09:49:03 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.3 changes/title
 meta name=description content=OpenBSD 5.3 changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus53.html;
Index: plus54.html
===
RCS file: /cvs/www/plus54.html,v
retrieving revision 1.12
diff -u -p -r1.12 plus54.html
--- plus54.html 2 Jul 2015 05:49:04 -   1.12
+++ plus54.html 7 Jul 2015 09:49:03 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.4 changes/title
 meta name=description content=OpenBSD -current changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus54.html;
Index: plus55.html
===
RCS file: /cvs/www/plus55.html,v
retrieving revision 1.8
diff -u -p -r1.8 plus55.html
--- plus55.html 2 Jul 2015 05:49:04 -   1.8
+++ plus55.html 7 Jul 2015 09:49:04 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.5 changes/title
 meta name=description content=OpenBSD -current changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus55.html;
Index: plus56.html
===
RCS file: /cvs/www/plus56.html,v
retrieving revision 1.9
diff -u -p -r1.9 plus56.html
--- plus56.html 2 Jul 2015 05:49:04 -   1.9
+++ plus56.html 7 Jul 2015 09:49:04 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.6 changes/title
 meta name=description content=OpenBSD 5.6 changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus56.html;
Index: plus57.html
===
RCS file: /cvs/www/plus57.html,v
retrieving revision 1.4
diff -u -p -r1.4 plus57.html
--- plus57.html 2 Jul 2015 05:49:04 -   1.4
+++ plus57.html 7 Jul 2015 09:49:04 -
@@ -2,7 +2,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD -current changes/title
+titleOpenBSD 5.7 changes/title
 meta name=description content=OpenBSD 5.7 changes
 meta name=copyright content=This document copyright 1996-2012 by OpenBSD.
 link rel=canonical href=http://www.openbsd.org/plus57.html;
Index: faq/upgrade39.html
===
RCS file: /cvs/www/faq/upgrade39.html,v
retrieving revision 1.12
diff -u -p -r1.12 upgrade39.html
--- faq/upgrade39.html  2 Jul 2015 05:49:04 -   1.12
+++ faq/upgrade39.html  7 Jul 2015 09:49:04 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD Upgrade Guide/title
+titleOpenBSD Upgrade Guide - 3.8 to 3.9/title
 meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
 meta name=description   content=the OpenBSD FAQ page
 meta name=copyright content=This document copyright 2006 by OpenBSD
Index: faq/upgrade40.html
===
RCS file: /cvs/www/faq/upgrade40.html,v
retrieving revision 1.10
diff -u -p -r1.10 upgrade40.html
--- faq/upgrade40.html  2 Jul 2015 05:49:04 -   1.10
+++ faq/upgrade40.html  7 Jul 2015 09:49:04 -
@@ -1,7 +1,7 @@
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 head
-titleOpenBSD Upgrade Guide/title
+titleOpenBSD Upgrade Guide - 3.9 to 4.0/title
 meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
 meta name=description   content=the OpenBSD 

Re: [patch] unsync between ctype and wctype

2015-07-07 Thread Roland Kammerer
On Tue, Jul 07, 2015 at 09:25:30AM +0200, Sebastien Marie wrote:
 
 Note I am unsure on a point: the array is defined to be _CACHED_RUNES
 (18 = 256) elements in size. Here the initialisation is for 128
 elements.
 
  int tab[256] = {0, 1, 2, ..., 126, 127};
 
 Should the rest of the array be initialised with zero ? or the compiler
 will do it alone ? I have checked NetBSD, FreeBSD and DragonflyBSD: all
 have this construct (array of 256, initialisation with 128 elements).

That is fine, if you partially initialize an array, the rest gets a
default value of 0. A quite common idiom is for example:

int ar[1024] = {0}; /* make all elements zero */

Regards, rck



Re: Fix some titles

2015-07-07 Thread Nick Holland
On 07/07/15 06:34, Pavel Plamenov wrote:
 Updated patch, paying more attention to style.
 
 Index: plus52.html
...
yep, I like those.  Thanks!

Nick.

 ===
 RCS file: /cvs/www/plus52.html,v
 retrieving revision 1.11
 diff -u -p -r1.11 plus52.html
 --- plus52.html   2 Jul 2015 05:49:04 -   1.11
 +++ plus52.html   7 Jul 2015 10:31:28 -
 @@ -1,7 +1,7 @@
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
 -titleOpenBSD -current changes/title
 +titleOpenBSD 5.2 changes/title
  meta name=description content=OpenBSD 5.2 changes
  meta name=copyright content=This document copyright 1996-2012 by 
 OpenBSD.
  link rel=canonical href=http://www.openbsd.org/plus52.html;
 Index: plus53.html
 ===
 RCS file: /cvs/www/plus53.html,v
 retrieving revision 1.10
 diff -u -p -r1.10 plus53.html
 --- plus53.html   2 Jul 2015 05:49:04 -   1.10
 +++ plus53.html   7 Jul 2015 10:31:28 -
 @@ -1,7 +1,7 @@
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
 -titleOpenBSD -current changes/title
 +titleOpenBSD 5.3 changes/title
  meta name=description content=OpenBSD 5.3 changes
  meta name=copyright content=This document copyright 1996-2012 by 
 OpenBSD.
  link rel=canonical href=http://www.openbsd.org/plus53.html;
 Index: plus54.html
 ===
 RCS file: /cvs/www/plus54.html,v
 retrieving revision 1.12
 diff -u -p -r1.12 plus54.html
 --- plus54.html   2 Jul 2015 05:49:04 -   1.12
 +++ plus54.html   7 Jul 2015 10:31:28 -
 @@ -1,7 +1,7 @@
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
 -titleOpenBSD -current changes/title
 +titleOpenBSD 5.4 changes/title
  meta name=description content=OpenBSD -current changes
  meta name=copyright content=This document copyright 1996-2012 by 
 OpenBSD.
  link rel=canonical href=http://www.openbsd.org/plus54.html;
 Index: plus55.html
 ===
 RCS file: /cvs/www/plus55.html,v
 retrieving revision 1.8
 diff -u -p -r1.8 plus55.html
 --- plus55.html   2 Jul 2015 05:49:04 -   1.8
 +++ plus55.html   7 Jul 2015 10:31:28 -
 @@ -1,7 +1,7 @@
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
 -titleOpenBSD -current changes/title
 +titleOpenBSD 5.5 changes/title
  meta name=description content=OpenBSD -current changes
  meta name=copyright content=This document copyright 1996-2012 by 
 OpenBSD.
  link rel=canonical href=http://www.openbsd.org/plus55.html;
 Index: plus56.html
 ===
 RCS file: /cvs/www/plus56.html,v
 retrieving revision 1.9
 diff -u -p -r1.9 plus56.html
 --- plus56.html   2 Jul 2015 05:49:04 -   1.9
 +++ plus56.html   7 Jul 2015 10:31:28 -
 @@ -1,7 +1,7 @@
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
 -titleOpenBSD -current changes/title
 +titleOpenBSD 5.6 changes/title
  meta name=description content=OpenBSD 5.6 changes
  meta name=copyright content=This document copyright 1996-2012 by 
 OpenBSD.
  link rel=canonical href=http://www.openbsd.org/plus56.html;
 Index: plus57.html
 ===
 RCS file: /cvs/www/plus57.html,v
 retrieving revision 1.4
 diff -u -p -r1.4 plus57.html
 --- plus57.html   2 Jul 2015 05:49:04 -   1.4
 +++ plus57.html   7 Jul 2015 10:31:29 -
 @@ -2,7 +2,7 @@
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
 -titleOpenBSD -current changes/title
 +titleOpenBSD 5.7 changes/title
  meta name=description content=OpenBSD 5.7 changes
  meta name=copyright content=This document copyright 1996-2012 by 
 OpenBSD.
  link rel=canonical href=http://www.openbsd.org/plus57.html;
 Index: faq/upgrade35.html
 ===
 RCS file: /cvs/www/faq/upgrade35.html,v
 retrieving revision 1.4
 diff -u -p -r1.4 upgrade35.html
 --- faq/upgrade35.html2 Jul 2015 05:49:04 -   1.4
 +++ faq/upgrade35.html7 Jul 2015 10:31:29 -
 @@ -1,7 +1,7 @@
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
 -titleOpenBSD Upgrade Guide/title
 +titleOpenBSD Upgrade Guide: 3.5 to 3.6/title
  meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
  meta name=description   content=the OpenBSD FAQ page
  meta name=copyright content=This document copyright 2004 by OpenBSD
 Index: faq/upgrade36.html
 ===
 RCS file: /cvs/www/faq/upgrade36.html,v
 retrieving revision 1.16
 diff -u -p -r1.16 upgrade36.html
 --- faq/upgrade36.html2 Jul 2015 05:49:04 -   1.16
 +++ faq/upgrade36.html7 Jul 

Re: unwritable PKG_CACHE directory

2015-07-07 Thread Chris Bennett
On Mon, Jul 06, 2015 at 10:15:20PM -0600, Dale Lindskog wrote:
 On Mon, 6 Jul 2015, Chris Bennett wrote:
 
  If you don't have root access, should you really be installing packages?
 
 It is impossible to install packages when you are not root.  pkg_add won't 
 let you.
 
 This isn't about installing packages without root access.  This is about 
 the -n and -s options, which I often run as a non-root user.  The -n and 
 -s options don't actually install packages.

OK, now I see what you are doing and asking for.
Makes sense and seems useful. Sorry for the noise.

Chris Bennett



unifdef IN6_IFSTAT_STRICT

2015-07-07 Thread Martin Pieuchot
I'd like to remove this 16 years old define.  We always used the correct
behavior.  My goal is to reduce the uses of if_get().

Ok?

Index: netinet6/frag6.c
===
RCS file: /cvs/src/sys/netinet6/frag6.c,v
retrieving revision 1.60
diff -u -p -r1.60 frag6.c
--- netinet6/frag6.c16 Jun 2015 11:09:40 -  1.60
+++ netinet6/frag6.c7 Jul 2015 13:46:18 -
@@ -53,13 +53,6 @@
 #include netinet/icmp6.h
 #include netinet/ip.h/* for ECN definitions */
 
-/*
- * Define it to get a correct behavior on per-interface statistics.
- * You will need to perform an extra routing table lookup, per fragment,
- * to do it.  This may, or may not be, a performance hit.
- */
-#define IN6_IFSTAT_STRICT
-
 void frag6_freef(struct ip6q *);
 
 static int ip6q_locked;
@@ -172,10 +165,8 @@ frag6_input(struct mbuf **mp, int *offp,
int first_frag = 0;
int fragoff, frgpartlen;/* must be larger than u_int16_t */
struct ifnet *dstifp;
-#ifdef IN6_IFSTAT_STRICT
struct sockaddr_in6 dst;
struct rtentry *rt;
-#endif
u_int8_t ecn, ecn0;
 
ip6 = mtod(m, struct ip6_hdr *);
@@ -184,7 +175,6 @@ frag6_input(struct mbuf **mp, int *offp,
return IPPROTO_DONE;
 
dstifp = NULL;
-#ifdef IN6_IFSTAT_STRICT
/* find the destination interface of the packet. */
memset(dst, 0, sizeof(dst));
dst.sin6_family = AF_INET6;
@@ -200,11 +190,6 @@ frag6_input(struct mbuf **mp, int *offp,
rtfree(rt);
rt = NULL;
}
-#else
-   /* we are violating the spec, this is not the destination interface */
-   if ((m-m_flags  M_PKTHDR) != 0)
-   dstifp = if_get(m-m_pkthdr.ph_ifidx);
-#endif
 
/* jumbo payload can't contain a fragment header */
if (ip6-ip6_plen == 0) {



Re: nsd.conf in /etc/changelist

2015-07-07 Thread Antoine Jacoutot
On Sun, May 17, 2015 at 11:42:24AM +0200, Tim van der Molen wrote:
 nsd.conf may contain keys, so store its checksum only. Also update the
 path to unbound's root.key.

Thanks Tim, committed.
I did change /var/unbound/db/root.key to be stored as a checksum as well.


 Index: changelist
 ===
 RCS file: /cvs/src/etc/changelist,v
 retrieving revision 1.103
 diff -u -r1.103 changelist
 --- changelist2 Oct 2014 09:02:48 -   1.103
 +++ changelist17 May 2015 09:26:59 -
 @@ -145,8 +145,8 @@
  /var/cron/cron.allow
  /var/cron/cron.deny
  /var/cron/tabs/root
 -/var/nsd/etc/nsd.conf
 -/var/unbound/etc/root.key
 ++/var/nsd/etc/nsd.conf
 +/var/unbound/db/root.key
  /var/unbound/etc/unbound.conf
  /var/yp/Makefile.main
  /var/yp/Makefile.yp
 

-- 
Antoine



Small in6_addr2scopeid() tweak

2015-07-07 Thread Martin Pieuchot
Now that packet headers include the interface index of their receiving
interface, pass it directly to in6_addr2scopeid().

This does not change anything with regards to the scopeid hack but it
reduces the number of if_get().

Ok?

Index: netinet/udp_usrreq.c
===
RCS file: /cvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.202
diff -u -p -r1.202 udp_usrreq.c
--- netinet/udp_usrreq.c30 Jun 2015 15:30:17 -  1.202
+++ netinet/udp_usrreq.c7 Jul 2015 13:52:42 -
@@ -757,8 +757,8 @@ udp6_ctlinput(int cmd, struct sockaddr *
sa6.sin6_len = sizeof(sa6);
sa6.sin6_addr = *ip6cp-ip6c_finaldst;
/* XXX: assuming M is valid in this case */
-   sa6.sin6_scope_id = in6_addr2scopeid(
-   if_get(m-m_pkthdr.ph_ifidx), ip6cp-ip6c_finaldst);
+   sa6.sin6_scope_id = in6_addr2scopeid(m-m_pkthdr.ph_ifidx,
+   ip6cp-ip6c_finaldst);
if (in6_embedscope(ip6cp-ip6c_finaldst, sa6, NULL, NULL)) {
/* should be impossible */
return;
@@ -790,8 +790,8 @@ udp6_ctlinput(int cmd, struct sockaddr *
sa6_src.sin6_family = AF_INET6;
sa6_src.sin6_len = sizeof(sa6_src);
sa6_src.sin6_addr = ip6-ip6_src;
-   sa6_src.sin6_scope_id = in6_addr2scopeid(
-   if_get(m-m_pkthdr.ph_ifidx), ip6-ip6_src);
+   sa6_src.sin6_scope_id = in6_addr2scopeid(m-m_pkthdr.ph_ifidx,
+   ip6-ip6_src);
if (in6_embedscope(sa6_src.sin6_addr, sa6_src, NULL, NULL)) {
/* should be impossible */
return;
Index: netinet6/icmp6.c
===
RCS file: /cvs/src/sys/netinet6/icmp6.c,v
retrieving revision 1.160
diff -u -p -r1.160 icmp6.c
--- netinet6/icmp6.c30 Jun 2015 15:30:17 -  1.160
+++ netinet6/icmp6.c7 Jul 2015 13:52:42 -
@@ -928,8 +928,8 @@ icmp6_notify_error(struct mbuf *m, int o
icmp6dst.sin6_addr = eip6-ip6_dst;
else
icmp6dst.sin6_addr = *finaldst;
-   icmp6dst.sin6_scope_id = in6_addr2scopeid(
-   if_get(m-m_pkthdr.ph_ifidx), icmp6dst.sin6_addr);
+   icmp6dst.sin6_scope_id = in6_addr2scopeid(m-m_pkthdr.ph_ifidx,
+   icmp6dst.sin6_addr);
if (in6_embedscope(icmp6dst.sin6_addr, icmp6dst,
   NULL, NULL)) {
/* should be impossbile */
@@ -946,8 +946,8 @@ icmp6_notify_error(struct mbuf *m, int o
icmp6src.sin6_len = sizeof(struct sockaddr_in6);
icmp6src.sin6_family = AF_INET6;
icmp6src.sin6_addr = eip6-ip6_src;
-   icmp6src.sin6_scope_id = in6_addr2scopeid(
-   if_get(m-m_pkthdr.ph_ifidx), icmp6src.sin6_addr);
+   icmp6src.sin6_scope_id = in6_addr2scopeid(m-m_pkthdr.ph_ifidx,
+   icmp6src.sin6_addr);
if (in6_embedscope(icmp6src.sin6_addr, icmp6src,
   NULL, NULL)) {
/* should be impossbile */
@@ -1034,7 +1034,7 @@ icmp6_mtudisc_update(struct ip6ctlparam 
if (IN6_IS_ADDR_LINKLOCAL(dst)) {
sin6.sin6_addr.s6_addr16[1] = htons(m-m_pkthdr.ph_ifidx);
}
-   sin6.sin6_scope_id = in6_addr2scopeid(if_get(m-m_pkthdr.ph_ifidx),
+   sin6.sin6_scope_id = in6_addr2scopeid(m-m_pkthdr.ph_ifidx,
sin6.sin6_addr);
 
rt = icmp6_mtudisc_clone(sin6tosa(sin6), m-m_pkthdr.ph_rtableid);
@@ -1610,7 +1610,7 @@ icmp6_redirect_output(struct mbuf *m0, s
src_sa.sin6_len = sizeof(src_sa);
src_sa.sin6_addr = sip6-ip6_src;
/* we don't currently use sin6_scope_id, but eventually use it */
-   src_sa.sin6_scope_id = in6_addr2scopeid(ifp, sip6-ip6_src);
+   src_sa.sin6_scope_id = in6_addr2scopeid(ifp-if_index, sip6-ip6_src);
if (nd6_is_addr_neighbor(src_sa, ifp) == 0)
goto fail;
if (IN6_IS_ADDR_MULTICAST(sip6-ip6_dst))
Index: netinet6/in6.c
===
RCS file: /cvs/src/sys/netinet6/in6.c,v
retrieving revision 1.159
diff -u -p -r1.159 in6.c
--- netinet6/in6.c  8 Jun 2015 22:19:27 -   1.159
+++ netinet6/in6.c  7 Jul 2015 13:52:42 -
@@ -1671,7 +1671,7 @@ in6_addrscope(struct in6_addr *addr)
  */
 
 int
-in6_addr2scopeid(struct ifnet *ifp, struct in6_addr *addr)
+in6_addr2scopeid(unsigned int ifidx, struct in6_addr *addr)
 {
int scope = in6_addrscope(addr);
 
@@ -1679,7 +1679,7 @@ in6_addr2scopeid(struct ifnet *ifp, stru
case __IPV6_ADDR_SCOPE_INTFACELOCAL:
case __IPV6_ADDR_SCOPE_LINKLOCAL:
/* XXX: we do not distinguish between 

Re: [libressl] Improve XMPP protocol support for starttls on s_client

2015-07-07 Thread Landry Breuil
On Tue, Jul 07, 2015 at 01:35:00PM +0100, Stuart Henderson wrote:
 On 2015/07/06 13:40, Landry Breuil wrote:
  Hi,
  
  i'm not an ssl hacker at all, but while debugging openssl -starttls
  issues against an xmpp server, i stumbled upon
  https://rt.openssl.org/Ticket/Display.html?id=2860user=guestpass=guest
  which fixes some issue with -starttls xmpp and adds the possibility to
  use -xmpphost in case there's some virtualhost. Backported the patch to
  libressl and applied style(9), works fine here in basic testing against
  prosody, before -starttls xmpp host was just stalling. I havent touched
  the documentation chunks since i dont really know if we still use the
  pod format or...
 
 Seems useful to me, some of the starttls-based protocols can be a
 pain to diagnose without a tool like this.
 
 It definitely needs the documentation chunk for -xmpphost though,
 it should go in src/usr.bin/openssl/openssl.1, and I think probably
 adding to sc_usage() in s_client.c.

New version with manpage  usage amended.

Landry
Index: openssl.1
===
RCS file: /cvs/src/usr.bin/openssl/openssl.1,v
retrieving revision 1.15
diff -u -r1.15 openssl.1
--- openssl.1   20 Jun 2015 01:07:25 -  1.15
+++ openssl.1   8 Jul 2015 04:42:04 -
@@ -7137,6 +7137,13 @@
 command for more information.
 .It Fl connect Ar host : Ns Ar port
 This specifies the host and optional port to connect to.
+.It Fl xmpphost Ar hostname
+This option, when used with
+.Fl starttls Ar xmpp,
+specifies the host for the to attribute of the stream element.
+If this option is not specified, then the host specified with
+.Fl connect
+will be used.
 .It Fl key Ar keyfile
 The private key to use.
 If not specified, the certificate file will be used.
Index: s_client.c
===
RCS file: /cvs/src/usr.bin/openssl/s_client.c,v
retrieving revision 1.13
diff -u -r1.13 s_client.c
--- s_client.c  14 Apr 2015 12:56:36 -  1.13
+++ s_client.c  8 Jul 2015 04:42:04 -
@@ -238,6 +238,7 @@
BIO_printf(bio_err,  'prot' defines which one to 
assume.  Currently,\n);
BIO_printf(bio_err,  only \smtp\, \lmtp\, 
\pop3\, \imap\, \ftp\ and \xmpp\\n);
BIO_printf(bio_err,  are supported.\n);
+   BIO_printf(bio_err,  -xmpphost host - connect to this virtual host on 
the xmpp server\n);
 #ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err,  -engine id- Initialise and use the specified 
engine\n);
 #endif
@@ -335,6 +336,7 @@
char *port = PORT_STR;
int full_log = 1;
char *host = SSL_HOST_NAME;
+   char *xmpphost = NULL;
char *proxy = NULL, *connect = NULL;
char *cert_file = NULL, *key_file = NULL;
int cert_format = FORMAT_PEM, key_format = FORMAT_PEM;
@@ -415,6 +417,10 @@
if (--argc  1)
goto bad;
proxy = *(++argv);
+   } else if (strcmp(*argv,-xmpphost) == 0) {
+   if (--argc  1)
+   goto bad;
+   xmpphost= *(++argv);
} else if (strcmp(*argv, -verify) == 0) {
verify = SSL_VERIFY_PEER;
if (--argc  1)
@@ -985,13 +991,16 @@
int seen = 0;
BIO_printf(sbio, stream:stream 
xmlns:stream='http://etherx.jabber.org/streams' 
-   xmlns='jabber:client' to='%s' version='1.0', host);
+   xmlns='jabber:client' to='%s' version='1.0', xmpphost? 
xmpphost:host);
seen = BIO_read(sbio, mbuf, BUFSIZZ);
mbuf[seen] = 0;
-   while (!strstr(mbuf, starttls 
xmlns='urn:ietf:params:xml:ns:xmpp-tls')) {
-   if (strstr(mbuf, /stream:features))
-   goto shut;
+   while (!strstr(mbuf, starttls 
xmlns='urn:ietf:params:xml:ns:xmpp-tls') 
+  !strstr(mbuf, starttls 
xmlns=\urn:ietf:params:xml:ns:xmpp-tls\)) {
seen = BIO_read(sbio, mbuf, BUFSIZZ);
+
+   if (seen = 0)
+   goto shut;
+
mbuf[seen] = 0;
}
BIO_printf(sbio, starttls 
xmlns='urn:ietf:params:xml:ns:xmpp-tls'/);