[[patch]] /usr/src/regress/sys/ffs/ffs/Makefile

2021-11-26 Thread Edgar Pettijohn

Allow running as non-root via ${SUDO}.

Thanks,


Edgar
Index: Makefile
===
RCS file: /cvs/src/regress/sys/ffs/ffs/Makefile,v
retrieving revision 1.5
diff -u -p -u -r1.5 Makefile
--- Makefile	16 Dec 2020 21:49:20 -	1.5
+++ Makefile	27 Nov 2021 01:10:25 -
@@ -8,23 +8,23 @@ CLEANFILES=	diskimage
 
 disk: unconfig
 	dd if=/dev/zero of=diskimage bs=512 count=4k
-	vnconfig vnd0 diskimage
-	newfs vnd0c
+	${SUDO} vnconfig vnd0 diskimage
+	${SUDO} newfs vnd0c
 
 REGRESS_SETUP_ONCE+=	mount
 mount: disk
-	mkdir -p /mnt/regress-ffs
-	mount /dev/vnd0c /mnt/regress-ffs
+	${SUDO} mkdir -p /mnt/regress-ffs
+	${SUDO} mount /dev/vnd0c /mnt/regress-ffs
 
 REGRESS_CLEANUP+=	umount
 umount:
-	umount /mnt/regress-ffs
+	${SUDO} umount /mnt/regress-ffs
 
 REGRESS_CLEANUP+=	unconfig
 unconfig:
-	-umount -f /dev/vnd0c 2>/dev/null || true
+	-${SUDO} umount -f /dev/vnd0c 2>/dev/null || true
 	-rmdir /mnt/regress-ffs 2>/dev/null || true
-	-vnconfig -u vnd0 2>/dev/null || true
+	-${SUDO} vnconfig -u vnd0 2>/dev/null || true
 	rm -f stamp-mount
 
 REGRESS_SETUP+=		${.OBJDIR}/../fstest


recv.2 patch

2021-05-01 Thread Edgar Pettijohn
slight wording change. it doesn't return these values it sets errno to
these values...
Index: recv.2
===
RCS file: /cvs/src/lib/libc/sys/recv.2,v
retrieving revision 1.47
diff -u -p -u -r1.47 recv.2
--- recv.2  11 Jan 2019 06:10:13 -  1.47
+++ recv.2  1 May 2021 18:37:19 -
@@ -300,7 +300,7 @@ In addition,
 .Fn recv
 and
 .Fn recvfrom
-may return the following error:
+may fail if:
 .Bl -tag -width Er
 .It Bq Er EINVAL
 .Fa len
@@ -310,7 +310,7 @@ was larger than
 .Pp
 And
 .Fn recvmsg
-may return one of the following errors:
+may fail if:
 .Bl -tag -width Er
 .It Bq Er EINVAL
 The sum of the


date.1 patch

2021-04-28 Thread Edgar Pettijohn
Slightly more consistent.
Index: date.1
===
RCS file: /cvs/src/bin/date/date.1,v
retrieving revision 1.71
diff -u -p -u -r1.71 date.1
--- date.1  8 Aug 2019 02:17:51 -   1.71
+++ date.1  29 Apr 2021 00:19:36 -
@@ -196,7 +196,7 @@ without modifying the date:
 .Dl # date 1432
 .Pp
 If the mailing list server located in California
-is being taken offline at 05.45,
+is being taken offline at 5:45 AM,
 work out what time it will be locally, here in Tokyo:
 .Pp
 .Dl $ TZ=America/Los_Angeles date -j -z Asia/Tokyo 0545


typo in 69.html

2021-04-10 Thread Edgar Pettijohn
numberous should be numerous

Edgar
--- 69.html.origSat Apr 10 18:53:49 2021
+++ 69.html Sat Apr 10 18:54:44 2021
@@ -855,7 +855,7 @@
interop problem with strongswan if make-before-break is enabled.
 
 
-The https://man.openbsd.org/httpd.8";>httpd(8) webserver 
saw numberous improvements:
+The https://man.openbsd.org/httpd.8";>httpd(8) webserver 
saw numerous improvements:
 
Prevented a crash due to
https://man.openbsd.org/httpd.8";>httpd(8) 
listening on port


getopt.3 bugs section

2021-01-08 Thread Edgar Pettijohn
In the BUGS section for the getopt(3) manual it mentions not using
single digits for options. I know spamd uses -4 and -6 there are
probably others. Should they be changed? Or is the manual mistaken?

Edgar



[patch] correct return type in pcap_open_live.3

2020-05-26 Thread Edgar Pettijohn
Please see attached diff.
Index: pcap_open_live.3
===
RCS file: /cvs/src/lib/libpcap/pcap_open_live.3,v
retrieving revision 1.3
diff -u -p -u -r1.3 pcap_open_live.3
--- pcap_open_live.325 Sep 2019 17:02:00 -  1.3
+++ pcap_open_live.326 May 2020 22:09:24 -
@@ -95,7 +95,7 @@
 .Fn pcap_dump_fopen "pcap_t *p" "FILE *f"
 .Ft "char *"
 .Fn pcap_lookupdev "char *errbuf"
-.Ft uint
+.Ft int
 .Fn pcap_lookupnet "const char *device" "bpf_u_int32 *netp" "bpf_u_int32 
*maskp" "char *errbuf"
 .Ft int
 .Fn pcap_dispatch "pcap_t *p" "int cnt" "pcap_handler callback" "u_char *user"


[patch] httpd remove unused struct

2020-05-23 Thread Edgar Pettijohn
Remove an unused struct from parse.y.
Index: parse.y
===
RCS file: /cvs/src/usr.sbin/httpd/parse.y,v
retrieving revision 1.114
diff -u -p -u -r1.114 parse.y
--- parse.y 9 Feb 2020 09:44:04 -   1.114
+++ parse.y 24 May 2020 00:46:03 -
@@ -124,10 +124,6 @@ typedef struct {
struct timeval   tv;
struct portrange port;
struct auth  auth;
-   struct {
-   struct sockaddr_storage  ss;
-   char name[HOST_NAME_MAX+1];
-   }addr;
} v;
int lineno;
 } YYSTYPE;


[patch] smtpd add timeout to filter registration

2020-05-23 Thread Edgar Pettijohn
Following patch adds a timeout to filter registration. Its easy to have
a filter fail to register due to buffering or just experimenting. With
the timeout smtpd will die and let the user know why instead of
remaining in an unresponsive state.
Index: lka_filter.c
===
RCS file: /cvs/src/usr.sbin/smtpd/lka_filter.c,v
retrieving revision 1.62
diff -u -p -u -r1.62 lka_filter.c
--- lka_filter.c24 Apr 2020 11:34:07 -  1.62
+++ lka_filter.c2 May 2020 15:37:56 -
@@ -66,6 +66,7 @@ static void   filter_result_disconnect(uin
 static voidfilter_session_io(struct io *, int, void *);
 void   lka_filter_process_response(const char *, const char *);
 
+static voidlka_proc_timeout(int, short, void *);
 
 struct filter_session {
uint64_tid;
@@ -180,6 +181,7 @@ struct processor_instance {
char*name;
struct io   *io;
struct io   *errfd;
+   struct event tmo;
int  ready;
uint32_t subsystems;
 };
@@ -213,10 +215,13 @@ lka_proc_config(struct processor_instanc
io_printf(pi->io, "config
 }
 
+#define TIMEOUT 10
+
 void
 lka_proc_forked(const char *name, uint32_t subsystems, int fd)
 {
struct processor_instance   *processor;
+   struct timeval timeout = { TIMEOUT, 0 };
 
if (!processors_inited) {
dict_init(&processors);
@@ -232,6 +237,10 @@ lka_proc_forked(const char *name, uint32
 
io_set_fd(processor->io, fd);
io_set_callback(processor->io, processor_io, processor->name);
+
+   evtimer_set(&processor->tmo, lka_proc_timeout, processor);
+   evtimer_add(&processor->tmo, &timeout);
+
dict_xset(&processors, name, processor);
 }
 
@@ -269,6 +278,7 @@ processor_register(const char *name, con
processor = dict_xget(&processors, name);
 
if (strcmp(line, "register
+   evtimer_del(&processor->tmo);
processor->ready = 1;
return;
}
@@ -1741,4 +1751,12 @@ lka_report_proc(const char *name, const 
sp = ep + 1;
 
lka_report_filter_report(reqid, name, 0, direction, &tv, sp);
+}
+
+static void
+lka_proc_timeout(int fd, short events, void *arg)
+{
+   struct processor_instance *processor = arg;
+
+   fatalx("%s: failed to register", processor->name);
 }


[patch] fuse_main.3 - fix example to compile without warnings and apply style changes

2020-05-23 Thread Edgar Pettijohn

Index: fuse_main.3
===
RCS file: /cvs/src/lib/libfuse/fuse_main.3,v
retrieving revision 1.6
diff -u -p -u -r1.6 fuse_main.3
--- fuse_main.3 28 Nov 2018 21:19:11 -  1.6
+++ fuse_main.3 23 May 2020 18:11:16 -
@@ -56,39 +56,46 @@ Here is a simple example of a FUSE imple
 
 static int
 fs_readdir(const char *path, void *data, fuse_fill_dir_t filler,
-off_t off, struct fuse_file_info *ffi)
+   off_t off, struct fuse_file_info *ffi)
 {
if (strcmp(path, "/") != 0)
-   return (-ENOENT);
+   return -ENOENT;
 
filler(data, ".", NULL, 0);
filler(data, "..", NULL, 0);
filler(data, "file", NULL, 0);
-   return (0);
+   return 0;
 }
 
 static int
 fs_read(const char *path, char *buf, size_t size, off_t off,
-struct fuse_file_info *ffi)
+struct fuse_file_info *ffi)
 {
-   if (off >= 5)
-   return (0);
+   size_t len;
+   const char *file_contents = "fuse filesystem example\\n";
 
-   size = 5 - off;
-   memcpy(buf, "data." + off, size);
-   return (size);
+   len = strlen(file_contents);
+
+   if (off < len) {
+   if (off + size > len)
+   size = len - off;
+   memcpy(buf, file_contents + off, size);
+   } else
+   size = 0;
+
+   return size;
 }
 
 static int
 fs_open(const char *path, struct fuse_file_info *ffi)
 {
if (strncmp(path, "/file", 10) != 0)
-   return (-ENOENT);
+   return -ENOENT;
 
if ((ffi->flags & 3) != O_RDONLY)
-   return (-EACCES);
+   return -EACCES;
 
-   return (0);
+   return 0;
 }
 
 static int
@@ -104,10 +111,10 @@ fs_getattr(const char *path, struct stat
st->st_nlink = 1;
st->st_size = 5;
} else {
-   return (-ENOENT);
+   return -ENOENT;
}
 
-   return (0);
+   return 0;
 }
 
 struct fuse_operations fsops = {
@@ -118,9 +125,9 @@ struct fuse_operations fsops = {
 };
 
 int
-main(int ac, char **av)
+main(int argc, char **argv)
 {
-   return (fuse_main(ac, av, &fsops, NULL));
+   return (fuse_main(argc, argv, &fsops, NULL));
 }
 .Ed
 .Sh SEE ALSO


[patch] pkg_info -C doesn't show usage without pkg-name

2020-05-09 Thread Edgar Pettijohn
display usage() if pkg_info -C issued without package name provided
Index: PkgInfo.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v
retrieving revision 1.50
diff -u -p -u -r1.50 PkgInfo.pm
--- PkgInfo.pm  19 Feb 2020 14:23:26 -  1.50
+++ PkgInfo.pm  10 May 2020 01:37:14 -
@@ -608,7 +608,7 @@ sub parse_and_run
 
my $nonames = @ARGV == 0 && @extra == 0;
 
-   unless ($state->hasanyopt('cMUdfILRsSP') 
+   unless ($state->hasanyopt('cCMUdfILRsSP') 
if ($nonames) {
if ($state->opt('Q')) {
$state->setopts('I');


[m...@umaxx.net: Re: [patch] add a timeout to filter registration]

2020-05-04 Thread Edgar Pettijohn
- Forwarded message from Joerg Jung  -

Date: Mon, 4 May 2020 13:39:09 +0200
From: Joerg Jung 
To: Edgar Pettijohn 
Cc: m...@opensmtpd.org
Subject: Re: [patch] add a timeout to filter registration
X-Mailer: Apple Mail (2.3608.60.0.2.5)


> On 2. May 2020, at 17:41, Edgar Pettijohn  wrote:
> 
> When playing with filters its easy to forget to register
> stdout, etc...
> 
> Here is a patch to add a timeout and give a little helpful info as
> opposed to just hanging in an unusable state.

The patch makes sense to me, can you send it to tech@openbsd.org 
<mailto:tech@openbsd.org> 
for review, please?


- End forwarded message -
Index: lka_filter.c
===
RCS file: /cvs/src/usr.sbin/smtpd/lka_filter.c,v
retrieving revision 1.62
diff -u -p -u -r1.62 lka_filter.c
--- lka_filter.c24 Apr 2020 11:34:07 -  1.62
+++ lka_filter.c2 May 2020 15:37:56 -
@@ -66,6 +66,7 @@ static void   filter_result_disconnect(uin
 static voidfilter_session_io(struct io *, int, void *);
 void   lka_filter_process_response(const char *, const char *);
 
+static voidlka_proc_timeout(int, short, void *);
 
 struct filter_session {
uint64_tid;
@@ -180,6 +181,7 @@ struct processor_instance {
char*name;
struct io   *io;
struct io   *errfd;
+   struct event tmo;
int  ready;
uint32_t subsystems;
 };
@@ -213,10 +215,13 @@ lka_proc_config(struct processor_instanc
io_printf(pi->io, "config
 }
 
+#define TIMEOUT 10
+
 void
 lka_proc_forked(const char *name, uint32_t subsystems, int fd)
 {
struct processor_instance   *processor;
+   struct timeval timeout = { TIMEOUT, 0 };
 
if (!processors_inited) {
dict_init(&processors);
@@ -232,6 +237,10 @@ lka_proc_forked(const char *name, uint32
 
io_set_fd(processor->io, fd);
io_set_callback(processor->io, processor_io, processor->name);
+
+   evtimer_set(&processor->tmo, lka_proc_timeout, processor);
+   evtimer_add(&processor->tmo, &timeout);
+
dict_xset(&processors, name, processor);
 }
 
@@ -269,6 +278,7 @@ processor_register(const char *name, con
processor = dict_xget(&processors, name);
 
if (strcmp(line, "register
+   evtimer_del(&processor->tmo);
processor->ready = 1;
return;
}
@@ -1741,4 +1751,12 @@ lka_report_proc(const char *name, const 
sp = ep + 1;
 
lka_report_filter_report(reqid, name, 0, direction, &tv, sp);
+}
+
+static void
+lka_proc_timeout(int fd, short events, void *arg)
+{
+   struct processor_instance *processor = arg;
+
+   fatalx("%s: failed to register", processor->name);
 }


httpd parse.y patch

2019-09-13 Thread Edgar Pettijohn
Remove unused struct.


Index: parse.y
===
RCS file: /cvs/src/usr.sbin/httpd/parse.y,v
retrieving revision 1.113
diff -u -p -u -p -r1.113 parse.y
--- parse.y 28 Jun 2019 13:32:47 -  1.113
+++ parse.y 13 Sep 2019 20:41:26 -
@@ -124,10 +124,6 @@ typedef struct {
struct timeval   tv;
struct portrange port;
struct auth  auth;
-   struct {
-   struct sockaddr_storage  ss;
-   char name[HOST_NAME_MAX+1];
-   }addr;
} v;
int lineno;
 } YYSTYPE;


OpenBSD::Pledge documentation bug

2019-07-21 Thread Edgar Pettijohn
Please see attached diff.

Thanks,

Edgar
Index: Pledge.pm
===
RCS file: /cvs/src/gnu/usr.bin/perl/cpan/OpenBSD-Pledge/lib/OpenBSD/Pledge.pm,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 Pledge.pm
--- Pledge.pm   9 Sep 2017 14:53:57 -   1.3
+++ Pledge.pm   21 Jul 2019 07:20:15 -
@@ -79,8 +79,6 @@ Returns true on success, returns false a
 
 Returns a list of the possible promises you can pass to L.
 
-=back
-
 =head1 BUGS AND LIMITATIONS
 
 Perl is particularly fond of C so that promise is always added by


Re: fuse_opt.3 patch

2018-11-30 Thread Edgar Pettijohn
Here is a diff to remove the dubious example and fix one gramatical issue. 

Index: fuse_opt.3
===
RCS file: /cvs/src/lib/libfuse/fuse_opt.3,v
retrieving revision 1.2
diff -u -p -u -r1.2 fuse_opt.3
--- fuse_opt.3  8 Jul 2018 06:17:10 -   1.2
+++ fuse_opt.3  30 Nov 2018 13:05:22 -
@@ -224,7 +224,7 @@ automatically depending on the format of
 If
 .Fa proc
 is not NULL, then this is called for any argument that matches a template
-with that has
+that has
 .Fa val
 = FUSE_OPT_KEY.
 .Fa opts
@@ -272,47 +272,6 @@ return 0 on success, -1 on error.
 .Pp
 .Fn fuse_opt_match
 returns 1 on match, 0 if no match.
-.Sh EXAMPLES
-.Bd -literal -offset indent
-struct foo_config {
-   char *foor;
-   int bar;
-};
-
-#define FOO_OPT(t, m) {t, offsetof(struct foo_config, m), 1}
-
-struct fuse_opt opts[] {
-   FUSE_OPT_KEY("--foo ",  KEY_FOO),
-   FOO_OPT("-b",   bar),
-   FOO_OPT("gid=", set_gid), /* set to 1 if present */
-   FOO_OPT("gid=%u",   gid),   /* set to parsed value of %u */
-   FUSE_OPT_END
-}
-
-int
-foo_process_proc(void *data, int key, char *val, struct fuse_args *args)
-{
-   foo_cofig *conf = data;
-
-   switch(key)
-   {
-   case KEY_FOO:
-   /* Do something... */
-   conf.foo = val;
-   return (0); /* discard */
-   }
-
-   /* didn't process so keep the option */
-   return (1);
-}
-
-int
-main(int argc, char *argv[])
-{
-   struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
-
-   if (fuse_opt_parse(opts, config, foo_process_proc) != 0) {
-   ...
 .Ed
 .Sh ERRORS
 .Fn fuse_opt_add_arg ,



fuse_opt.3 patch

2018-11-29 Thread Edgar Pettijohn
Mostly just typos. Corrected the example some. However, please see below. I 
don't
think the example works or I'm just doing something wrong.

Index: fuse_opt.3
===
RCS file: /cvs/src/lib/libfuse/fuse_opt.3,v
retrieving revision 1.2
diff -u -p -u -r1.2 fuse_opt.3
--- fuse_opt.3  8 Jul 2018 06:17:10 -   1.2
+++ fuse_opt.3  29 Nov 2018 13:27:26 -
@@ -224,7 +224,7 @@ automatically depending on the format of
 If
 .Fa proc
 is not NULL, then this is called for any argument that matches a template
-with that has
+that has
 .Fa val
 = FUSE_OPT_KEY.
 .Fa opts
@@ -275,35 +275,34 @@ returns 1 on match, 0 if no match.
 .Sh EXAMPLES
 .Bd -literal -offset indent
 struct foo_config {
-   char *foor;
+   char *foo;
int bar;
-};
+} config;
 
-#define FOO_OPT(t, m) {t, offsetof(struct foo_config, m), 1}
+#define FOO_OPT(t, m) { t, offsetof(struct foo_config, m), 1 }
 
 struct fuse_opt opts[] {
-   FUSE_OPT_KEY("--foo ",  KEY_FOO),
-   FOO_OPT("-b",   bar),
-   FOO_OPT("gid=", set_gid), /* set to 1 if present */
-   FOO_OPT("gid=%u",   gid),   /* set to parsed value of %u */
+   FUSE_OPT_KEY("--foo %s",KEY_FOO),
+   FOO_OPT("-b",   bar),
+   FOO_OPT("gid=", set_gid), /* set to 1 if present */
+   FOO_OPT("gid=%u",   gid), /* set to parsed value of %u 
*/
FUSE_OPT_END
 }
 
 int
-foo_process_proc(void *data, int key, char *val, struct fuse_args *args)
+foo_process_proc(void *data, const char *val, int key, struct fuse_args *args)
 {
-   foo_cofig *conf = data;
+   foo_config *conf = data;
 
-   switch(key)
-   {
+   switch(key) {
case KEY_FOO:
/* Do something... */
-   conf.foo = val;
+   conf->foo = val;
return (0); /* discard */
+   default:
+   /* didn't process so keep the option */
+   return (1);
}
-
-   /* didn't process so keep the option */
-   return (1);
 }
 
 int
@@ -311,7 +310,7 @@ main(int argc, char *argv[])
 {
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
 
-   if (fuse_opt_parse(opts, config, foo_process_proc) != 0) {
+   if (fuse_opt_parse(opts, &config, opts, foo_process_proc) != 0) {
...
 .Ed
 .Sh ERRORS

Here was my test to ensure the above worked.

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

struct fuse_operations fsops = {
};

struct fuse_config {
char *string;
int num;
} config;

#define TEST_FUSE_OPT(t, m) \
{ t, offsetof(struct fuse_config, m), 1 }

enum {
KEY_STRING,
};

static struct fuse_opt opts[] = {
/* with "--s " this test gives the following output 
 * config.string = --sstring
 * config.num = 1
 * fuse: bad mount point string : No such file or directory
 */
FUSE_OPT_KEY("--s %s", KEY_STRING),
TEST_FUSE_OPT("--n", num), /* should set num to 1 */
FUSE_OPT_END
};

static int
fuse_opt_cb(void *data, const char *val, int key, struct fuse_args *outargs)
{
struct fuse_config *conf = data;

switch (key) {
case KEY_STRING:
/* I had to use strdup. conf->string = val didn't seem to work 
*/
conf->string = strdup(val); 
return (0);
default:
break;
}

return (1);
}

int
main(int argc, char *argv[])
{
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
int rv;

if (fuse_opt_parse(&args, &config, opts, fuse_opt_cb) == -1)
return(1);

fprintf(stderr, "config.string = %s\n", config.string);
fprintf(stderr, "config.num = %d\n", config.num);

rv = fuse_main(argc, argv, &fsops, NULL);

fuse_opt_free_args(&args);

return(rv);
}

clang -o fuse fuse.c -lfuse /* I know creative */

$ mkdir /tmp/test
$ doas ./fuse -d --n --s string /tmp/test
config.string = string
config.num = 1
fuse: bad mount point string : No such file or directory

Thanks,

Edgar



fuse_parse_cmd_line.3 patch

2018-11-27 Thread Edgar Pettijohn III

remove a bunch of `_' where there shouldn't be `_'s

Index: fuse_parse_cmd_line.3
===
RCS file: /cvs/src/lib/libfuse/fuse_parse_cmd_line.3,v
retrieving revision 1.2
diff -u -p -u -r1.2 fuse_parse_cmd_line.3
--- fuse_parse_cmd_line.3    8 Jul 2018 06:17:10 -    1.2
+++ fuse_parse_cmd_line.3    28 Nov 2018 02:54:13 -
@@ -15,25 +15,25 @@
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
 .Dd $Mdocdate: July 8 2018 $
-.Dt FUSE_PARSE_CMD_LINE 3
+.Dt FUSE_PARSE_CMDLINE 3
 .Os
 .Sh NAME
-.Nm fuse_parse_cmd_line
+.Nm fuse_parse_cmdline
 .Nd FUSE helper function to parse command line arguments
 .Sh SYNOPSIS
 .In fuse.h
 .Ft int
-.Fn fuse_parse_cmd_line "struct fuse_args *args" "char **mp" \
+.Fn fuse_parse_cmdline "struct fuse_args *args" "char **mp" \
 "int *mt" "int *fg"
 .Sh DESCRIPTION
-.Fn fuse_parse_cmd_line
+.Fn fuse_parse_cmdline
 is a helper function to parse standard FUSE arguments.
 .Fa args
 can be constructed using the
 .Xr FUSE_ARGS_INIT 3
 macro.
 .Pp
-.Fn fuse_parse_cmd_line
+.Fn fuse_parse_cmdline
 supports the following arguments.
 .Bl -tag -width Ds
 .It Fl d , Fl odebug
@@ -65,13 +65,13 @@ Print the FUSE library version to stderr
 .El
 .Pp
 If the first argument not recognised by
-.Fn fuse_parse_cmd_line
+.Fn fuse_parse_cmdline
 is a valid directory then
 .Fa mp
 will be set to the canonicalized absolute pathname of this directory.
 .Sh RETURN VALUES
 The
-.Fn fuse_parse_cmd_line
+.Fn fuse_parse_cmdline
 function will return 0 on success and -1 if
 .Fl h , Fl -help , Fl ho , Fl v
 or
@@ -88,11 +88,11 @@ does not exist or is not a directory.
 .Xr fuse_setup 3
 .Sh STANDARDS
 The
-.Fn fuse_parse_cmd_line
+.Fn fuse_parse_cmdline
 function conforms to FUSE 2.6.
 .Sh HISTORY
 The
-.Fn fuse_parse_cmd_line
+.Fn fuse_parse_cmdline
 function first appeared in
 .Ox 5.4 .
 .Sh AUTHORS



Re: makemap.8 patch

2018-11-20 Thread Edgar Pettijohn


On Nov 20, 2018 9:15 AM, Gilles Chehade  wrote:
>
> On Sun, Nov 18, 2018 at 08:32:47AM -0600, Edgar Pettijohn III wrote:
> > Use new syntax.
> > 
>
> Sorry was on the road.
>
> Comment inlined:
>
>
> > Index: makemap.8
> > 
> > ===
> > RCS file: /cvs/src/usr.sbin/smtpd/makemap.8,v
> > retrieving revision 1.29
> > diff -u -p -u -r1.29 makemap.8
> > --- makemap.8 ??13 Feb 2016 08:53:18 - ??1.29
> > +++ makemap.8 ??18 Nov 2018 14:29:33 -
> > @@ -105,8 +105,11 @@ In addition to adding an entry to the pr
> > ??one must add a filter rule that accepts mail for the domain
> > ??map, for example:
> > ??.Bd -literal -offset indent
> > -table domains "/etc/mail/domains"
> > -accept for domain  deliver to mbox
> > +table domains db:/etc/mail/domains.db
> > +
>
> why db ?

Do you need makemap for file backend?

>
> > +action "local" mbox
> > +
> > +match for domain  action "local"
> > ??.Ed
> > ??.Sh VIRTUAL DOMAINS
> > ??Virtual domains may also be kept in tables.
> > @@ -140,11 +143,13 @@ In addition to adding an entry to the vi
> > ??one must add a filter rule that accepts mail for virtual domains,
> > ??for example:
> > ??.Bd -literal -offset indent
> > -table vdomains "/etc/mail/vdomains"
> > -table vusers "/etc/mail/users"
> > +table vdomains db:/etc/mail/vdomains.db
> > +table vusers db:/etc/mail/users.db
> > +
>
> why db ?
>
> > +action "local" mbox virtual 
> > 
> > -accept for domain  virtual  deliver to mbox
> > -accept for domain example.org virtual  deliver to mbox
> > +match for domain  action "local"
> > +match for domain "example.org" action "local"
> > ??.Ed
> > ??.Sh FILES
> > ??.Bl -tag -width "/etc/mail/aliasesXXX" -compact
> > 
>
> Documentation should stick to the file backend which is the best one for
> the general case.
>
> The db backend is an extension of the file backend and unless you have a
> very specific use case, it brings no benefit whatsoever. It ISN'T faster
> than the file backend and unless you have a good rationale for using it,
> there's actually no good reason to.
>
> The only reason we still support it is because some corner cases do make
> sense, and even in those cases I'd argue there are better backends.
>
>
> -- 
> Gilles Chehade    @poolpOrg
>
> https://www.poolp.org tip me: https://paypal.me/poolpOrg



makemap.8 patch

2018-11-18 Thread Edgar Pettijohn III

Use new syntax.


Index: makemap.8

===
RCS file: /cvs/src/usr.sbin/smtpd/makemap.8,v
retrieving revision 1.29
diff -u -p -u -r1.29 makemap.8
--- makemap.8    13 Feb 2016 08:53:18 -    1.29
+++ makemap.8    18 Nov 2018 14:29:33 -
@@ -105,8 +105,11 @@ In addition to adding an entry to the pr
 one must add a filter rule that accepts mail for the domain
 map, for example:
 .Bd -literal -offset indent
-table domains "/etc/mail/domains"
-accept for domain  deliver to mbox
+table domains db:/etc/mail/domains.db
+
+action "local" mbox
+
+match for domain  action "local"
 .Ed
 .Sh VIRTUAL DOMAINS
 Virtual domains may also be kept in tables.
@@ -140,11 +143,13 @@ In addition to adding an entry to the vi
 one must add a filter rule that accepts mail for virtual domains,
 for example:
 .Bd -literal -offset indent
-table vdomains "/etc/mail/vdomains"
-table vusers "/etc/mail/users"
+table vdomains db:/etc/mail/vdomains.db
+table vusers db:/etc/mail/users.db
+
+action "local" mbox virtual 

-accept for domain  virtual  deliver to mbox
-accept for domain example.org virtual  deliver to mbox
+match for domain  action "local"
+match for domain "example.org" action "local"
 .Ed
 .Sh FILES
 .Bl -tag -width "/etc/mail/aliasesXXX" -compact



s_client.c typo

2018-11-13 Thread Edgar Pettijohn III

Index: s_client.c
===
RCS file: /cvs/src/usr.bin/openssl/s_client.c,v
retrieving revision 1.36
diff -u -p -u -r1.36 s_client.c
--- s_client.c    11 Feb 2018 20:03:10 -    1.36
+++ s_client.c    14 Nov 2018 03:51:08 -
@@ -891,7 +891,7 @@ re_start:
     BIO_free(fbio);
     if (!foundit)
         BIO_printf(bio_err,
-                "didn't found STARTTLS in server response,"
+                "didn't find STARTTLS in server response,"
             " try anyway...\n");
     BIO_printf(sbio, ". STARTTLS\r\n");
     BIO_read(sbio, sbuf, BUFSIZZ);



Re: cron.c patch

2018-10-20 Thread Edgar Pettijohn III



On 10/20/18 6:40 PM, Philip Guenther wrote:
On Sat, Oct 20, 2018 at 2:34 PM Edgar Pettijohn III 
mailto:ed...@pettijohn-web.com>> wrote:


I'm guessing the if block will never hit since listen returns
either 0 or -1.


Uh, but -1 is true.

Philip



my bad. -1 just feels so untrue.



cron.c patch

2018-10-20 Thread Edgar Pettijohn III
I'm guessing the if block will never hit since listen returns either 0 
or -1.



Index: cron.c

===
RCS file: /cvs/src/usr.sbin/cron/cron.c,v
retrieving revision 1.77
diff -u -p -u -r1.77 cron.c
--- cron.c  23 Oct 2017 15:15:22 -  1.77
+++ cron.c  20 Oct 2018 23:27:46 -
@@ -462,7 +462,7 @@ open_socket(void)
    syslog(LOG_ERR, "(CRON) DEATH (can't bind socket)");
    exit(EXIT_FAILURE);
    }
-   if (listen(sock, SOMAXCONN)) {
+   if (listen(sock, SOMAXCONN) != 0) {
    warn("listen");
    syslog(LOG_ERR, "(CRON) DEATH (can't listen on socket)");
    exit(EXIT_FAILURE);
*
*



libnv

2018-09-23 Thread Edgar Pettijohn III

Does OpenBSD have anything similar to FreeBSD's libnv? It looks interesting.


Thanks,


Edgar

(please cc me)



Re: Fwd: [patch] ifconfig.c

2018-08-10 Thread Edgar Pettijohn III




On 08/10/18 03:09, Sebastian Benoit wrote:

i know about the tab in ieee80211_listnodes()

but your diffs are unreadable, please fix that.


sorry about that. I blame thunderbird.

Index: ifconfig.c
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.362
diff -u -p -u -r1.362 ifconfig.c
--- ifconfig.c    27 Feb 2018 22:32:26 -    1.362
+++ ifconfig.c    11 Aug 2018 01:27:39 -
@@ -793,9 +793,13 @@ main(int argc, char *argv[])
             } else
                 noarg = 0;

-                if (noarg == 0)
-                    (*p->c_func)(NULL, 0);
-                else
+                if (noarg == 0) {
+                    if (strcmp(p->c_name, "scan") == 0) {
+                        (*p->c_func)(NULL, 0);
+                        goto done;
+                    } else
+                        (*p->c_func)(NULL, 0);
+                } else
                 goto nextarg;
         } else if (p->c_parameter == NEXTARG) {
 nextarg:
@@ -863,6 +867,7 @@ nextarg:
     if (ioctl(s, rafp->af_aifaddr, rafp->af_addreq) < 0)
         err(1, "SIOCAIFADDR");
 }
+done:
 return (0);
 }

@@ -1994,9 +1999,7 @@ setifchan(const char *val, int d)
 void
 setifscan(const char *val, int d)
 {
-    if (shownet80211chans || shownet80211nodes)
-        usage();
-    shownet80211nodes = 1;
+    return(ieee80211_listnodes());
 }

 #ifndef SMALL
@@ -2201,7 +2204,6 @@ ieee80211_status(void)
     putchar(' ');
     printb_status(ifr.ifr_flags, IEEE80211_F_USERBITS);
 }
-
 putchar('\n');
 if (shownet80211chans)
     ieee80211_listchans();
@@ -2288,7 +2290,7 @@ ieee80211_listnodes(void)
     qsort(nr, na.na_nodes, sizeof(*nr), rssicmp);

 for (i = 0; i < na.na_nodes; i++) {
-        printf("\t\t");
+        printf("\t");
     ieee80211_printnode(&nr[i]);
     putchar('\n');
 }



Fwd: [patch] ifconfig.c

2018-08-09 Thread Edgar Pettijohn III
Unfortunantly it wasn't that easy. This version doesn't segfault with 
bad input :) Also just noticed there is a bunch of stuff going on with 
ifconfig in current. So I guess this can just be a conversation starter, 
and perhaps whomever is doing the work can possibly put something like 
this in.


Index: ifconfig.c
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.362
diff -u -p -u -r1.362 ifconfig.c
--- ifconfig.c    27 Feb 2018 22:32:26 -    1.362
+++ ifconfig.c    10 Aug 2018 01:31:10 -
@@ -793,9 +793,13 @@ main(int argc, char *argv[])
             } else
                 noarg = 0;

-                if (noarg == 0)
-                    (*p->c_func)(NULL, 0);
-                else
+                if (noarg == 0) {
+                    if (strcmp(p->c_name, "scan") == 0) {
+                        (*p->c_func)(NULL, 0);
+                        goto done;
+                    } else
+                        (*p->c_func)(NULL, 0);
+                } else
                 goto nextarg;
         } else if (p->c_parameter == NEXTARG) {
 nextarg:
@@ -863,6 +867,7 @@ nextarg:
     if (ioctl(s, rafp->af_aifaddr, rafp->af_addreq) < 0)
         err(1, "SIOCAIFADDR");
 }
+done:
 return (0);
 }

@@ -1994,9 +1999,7 @@ setifchan(const char *val, int d)
 void
 setifscan(const char *val, int d)
 {
-    if (shownet80211chans || shownet80211nodes)
-        usage();
-    shownet80211nodes = 1;
+    return(ieee80211_listnodes());
 }

 #ifndef SMALL
@@ -2201,7 +2204,6 @@ ieee80211_status(void)
     putchar(' ');
     printb_status(ifr.ifr_flags, IEEE80211_F_USERBITS);
 }
-
 putchar('\n');
 if (shownet80211chans)
     ieee80211_listchans();


 Forwarded Message 
Subject:    [patch] ifconfig.c
Date:   Thu, 9 Aug 2018 18:20:47 -0500
From:   Edgar Pettijohn III 
To: tech@openbsd.org



I hate to assume, but I'm going to assume that if one wants to scan for
ap's for their wifi interface to connect to they don't care about
anything else. I also removed what to me is one too many tabs.


Index: ifconfig.c
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.362
diff -u -p -u -r1.362 ifconfig.c
--- ifconfig.c    27 Feb 2018 22:32:26 -    1.362
+++ ifconfig.c    9 Aug 2018 23:16:59 -
@@ -772,6 +772,11 @@ main(int argc, char *argv[])
         return bridge_rule(argc, argv, -1);
     }
 #endif
+        if (strcmp(p->c_name, "scan") == 0) {
+            ieee80211_listnodes();
+            return 0;
+        }
+
     if (p->c_name == 0 && setaddr)
         for (i = setaddr; i > 0; i--) {
             p++;
@@ -2288,7 +2293,7 @@ ieee80211_listnodes(void)
     qsort(nr, na.na_nodes, sizeof(*nr), rssicmp);

 for (i = 0; i < na.na_nodes; i++) {
-        printf("\t\t");
+        printf("\t");
     ieee80211_printnode(&nr[i]);
     putchar('\n');
 }




[patch] ifconfig.c

2018-08-09 Thread Edgar Pettijohn III
I hate to assume, but I'm going to assume that if one wants to scan for 
ap's for their wifi interface to connect to they don't care about 
anything else. I also removed what to me is one too many tabs.



Index: ifconfig.c
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.362
diff -u -p -u -r1.362 ifconfig.c
--- ifconfig.c    27 Feb 2018 22:32:26 -    1.362
+++ ifconfig.c    9 Aug 2018 23:16:59 -
@@ -772,6 +772,11 @@ main(int argc, char *argv[])
         return bridge_rule(argc, argv, -1);
     }
 #endif
+        if (strcmp(p->c_name, "scan") == 0) {
+            ieee80211_listnodes();
+            return 0;
+        }
+
     if (p->c_name == 0 && setaddr)
         for (i = setaddr; i > 0; i--) {
             p++;
@@ -2288,7 +2293,7 @@ ieee80211_listnodes(void)
     qsort(nr, na.na_nodes, sizeof(*nr), rssicmp);

 for (i = 0; i < na.na_nodes; i++) {
-        printf("\t\t");
+        printf("\t");
     ieee80211_printnode(&nr[i]);
     putchar('\n');
 }




[patch] RSA_new.3

2018-04-03 Thread Edgar Pettijohn

typo

Index: RSA_new.3
===
RCS file: /cvs/src/lib/libcrypto/man/RSA_new.3,v
retrieving revision 1.4
diff -u -p -u -r1.4 RSA_new.3
--- RSA_new.3    11 Dec 2016 12:52:28 -    1.4
+++ RSA_new.3    3 Apr 2018 21:12:13 -
@@ -93,7 +93,7 @@ structure consists of several
 components.
 It can contain public as well as private RSA keys:
 .Bd -literal
-typdef struct {
+typedef struct {
 BIGNUM *n;        // public modulus
 BIGNUM *e;        // public exponent
 BIGNUM *d;        // private exponent



Re: arc4random unexpected results

2018-03-24 Thread Edgar Pettijohn



On 03/24/18 21:27, Mike Burns wrote:

On 2018-03-24 21.05.56 -0500, Edgar Pettijohn wrote:

#include 
#include 
#include 

int
main(void)
{
 uint32_t n = arc4random();

 printf("arc4random %d\n", n);
 printf("abs %d\n", abs(n));

 return 0;
}

Which is well and good. However, I get the following output.

laptop$ ./a.out
arc4random 247165650
abs 247165650
laptop$ ./a.out
arc4random 2012715611
abs 2012715611
laptop$ ./a.out
arc4random 222644175
abs 222644175
laptop$ ./a.out
arc4random -843593186
abs 843593186

// -

#include 
#include 
#include 
#include 

int
main(void)
{
 uint32_t n = arc4random();

 printf("arc4random %"PRIu32"\n", n);
 printf("arc4random with %%d %d\n", n);
 printf("abs %d\n", abs(n));

 return 0;
}

//

output:

~% ./a.out
arc4random 1647540484
arc4random with %d 1647540484
abs 1647540484
~% ./a.out
arc4random 3569752639
arc4random with %d -725214657
abs 725214657


More docs:
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/inttypes.h.html
At first Basic C didn't seem like a good answer, but I went back to the 
printf() manual and found the miraculous %u. Which seems to have fixed 
it as well. Thanks for this alternate.




arc4random unexpected results

2018-03-24 Thread Edgar Pettijohn

Take this example program:

#include 
#include 
#include 

int
main(void)
{
uint32_t n = arc4random();

printf("arc4random %d\n", n);
printf("abs %d\n", abs(n));

return 0;
}

It gives the following warning when compiling:

test.c:11:21: warning: taking the absolute value of unsigned type 
'uint32_t' (aka 'unsigned int') has no effect [-Wabsolute-value]

printf("abs %d\n", abs(n));
   ^
test.c:11:21: note: remove the call to 'abs' since unsigned values 
cannot be negative

printf("abs %d\n", abs(n));
   ^~~

Which is well and good. However, I get the following output.

laptop$ ./a.out
arc4random 247165650
abs 247165650
laptop$ ./a.out
arc4random 2012715611
abs 2012715611
laptop$ ./a.out
arc4random 222644175
abs 222644175
laptop$ ./a.out
arc4random -843593186
abs 843593186

So on the fourth try I got what appears to be a negative number back. 
I'm not sure if this is some printf() funny business or what. Please 
explain. In real life I don't intend on using this with printf() so If 
thats the case no worries. However, if not I need to know that my random 
number is positive. I also tried if (n < 0) etc.. and got similar warnings.


Thanks in advance,

Edgar



[patch] INSTALL.octeon

2018-03-11 Thread Edgar Pettijohn

typo fix


--- INSTALL.octeon.origSun Mar 11 12:31:45 2018
+++ INSTALL.octeonSun Mar 11 12:31:55 2018
@@ -252,7 +252,7 @@
 ---

 By default octeon systems are shipped with a Linux (or proprietary) system
-installated on the CompactFlash card or USB drive.
+installed on the CompactFlash card or USB drive.

 First connect your computer via serial port to the device (you may 
need to use

 a Cisco serial cable depending on your hardware) with a command such as



Re: [patch] spamd-setup.c

2018-03-07 Thread Edgar Pettijohn



On 03/07/18 18:55, William Ahern wrote:

On Wed, Mar 07, 2018 at 05:17:59PM -0600, Edgar Pettijohn wrote:

This looks like a good place for reallocarray. Yes?

Index: spamd-setup.c
===
RCS file: /cvs/src/libexec/spamd-setup/spamd-setup.c,v
retrieving revision 1.50
diff -u -p -u -r1.50 spamd-setup.c
--- spamd-setup.c7 Jul 2017 00:10:15 -1.50
+++ spamd-setup.c7 Mar 2018 23:14:00 -
@@ -363,7 +363,7 @@ fix_quoted_colons(char *buf)
  char *newbuf, last;

  /* Allocate enough space for a buf of all colons (impossible). */
-newbuf = malloc(2 * strlen(buf) + 1);
+newbuf = reallocarray(NULL, 2, strlen(buf) + 1);
  if (newbuf == NULL)
  return (NULL);
  last = '\0';

FWIW, the old code evaluates as

   (2 * strlen(buf)) + 1

but the new code evaluates as

   2 * (strlen(buf) + 1)



Those pesky parenthesis. I guess I could argue that the benefits of 
reallocarray() outweigh the wasted memory.

However, that is probably why it hasn't been changed already.



[patch] spamd-setup.c

2018-03-07 Thread Edgar Pettijohn

This looks like a good place for reallocarray. Yes?

Index: spamd-setup.c
===
RCS file: /cvs/src/libexec/spamd-setup/spamd-setup.c,v
retrieving revision 1.50
diff -u -p -u -r1.50 spamd-setup.c
--- spamd-setup.c7 Jul 2017 00:10:15 -1.50
+++ spamd-setup.c7 Mar 2018 23:14:00 -
@@ -363,7 +363,7 @@ fix_quoted_colons(char *buf)
 char *newbuf, last;

 /* Allocate enough space for a buf of all colons (impossible). */
-newbuf = malloc(2 * strlen(buf) + 1);
+newbuf = reallocarray(NULL, 2, strlen(buf) + 1);
 if (newbuf == NULL)
 return (NULL);
 last = '\0';



[patch] sigaction.2 fix spacing

2018-02-26 Thread Edgar Pettijohn

Index: sigaction.2
===
RCS file: /cvs/src/lib/libc/sys/sigaction.2,v
retrieving revision 1.74
diff -u -p -u -r1.74 sigaction.2
--- sigaction.229 May 2017 11:13:09 -1.74
+++ sigaction.227 Feb 2018 02:15:43 -
@@ -49,7 +49,7 @@ struct sigaction {
 };
 .Ed
 .Pp
-.Fd #define sa_handler__sigaction_u.__sa_handler
+.Fd #define sa_handler__sigaction_u.__sa_handler
 .Fd #define sa_sigaction__sigaction_u.__sa_sigaction
 .Ft int
 .Fn sigaction "int sig" "const struct sigaction *act" "struct 
sigaction *oact"



I know this looks wrong in patch form, but after applied it lines up the

`__sigaction's



typo s_client.c

2018-02-11 Thread Edgar Pettijohn

Index: s_client.c
===
RCS file: /cvs/src/usr.bin/openssl/s_client.c,v
retrieving revision 1.33
diff -u -p -u -r1.33 s_client.c
--- s_client.c12 Aug 2017 21:04:33 -1.33
+++ s_client.c11 Feb 2018 16:30:47 -
@@ -859,7 +859,7 @@ re_start:
 BIO_free(fbio);
 if (!foundit)
 BIO_printf(bio_err,
-"didn't found starttls in server response,"
+"didn't find starttls in server response,"
 " try anyway...\n");
 BIO_printf(sbio, "STARTTLS\r\n");
 BIO_read(sbio, sbuf, BUFSIZZ);



[patch] starttls.8

2018-02-10 Thread Edgar Pettijohn

Remove `sendmail' ism's from starttls.8


--- /usr/share/man/man8/starttls.8Tue Oct  3 22:13:42 2017
+++ starttls.8Sat Feb 10 15:57:06 2018
@@ -102,17 +102,6 @@
 .Pp
 .Dl # openssl x509 -in /etc/ssl/mail.example.com.crt -text
 .Pp
-If you don't intend to use TLS for authentication (and if you are using
-self-signed certificates you probably don't) you can simply link
-your new certificate to
-.Pa CAcert.pem .
-.Pp
-.Dl # ln -s /etc/ssl/mail.example.com.crt /etc/ssl/CAcert.pem
-.Pp
-If, on the other hand, you intend to use TLS for authentication
-you should install your certificate authority bundle as
-.Pa /etc/ssl/CAcert.pem .
-.Pp
 Because the private key files are unencrypted,
 MTAs
 can be picky about using tight permissions on those files.
@@ -196,36 +185,9 @@
 We can use this authentication to selectively relay clients, including
 other mail servers and mobile clients like laptops.
 However, there have been some problems getting some mail clients to 
work using

-certificate-based authentication.
-Note that your clients will have to generate certificates and have them
-signed (for trust validation) by a CA (certificate authority) you also 
trust,

-if you configure your server to do client certificate checking.
-Two new entries are available for TLS options:
-.Bl -tag -width Ds -offset indent
-.It VERIFY
-contains the status of the level of verification (held in the macro 
{verify})

-.It ENCR
-the strength of the encryption (in the macro {cipher_bits})
-.El
-.Pp
-VERIFY can also accept the argument for {cipher_bits}.
-Here are a few example entries that illustrate these features, and
-the role based granularity as well:
-.Pp
-Require strong (256-bit) encryption for communication with this server:
-.Pp
-.Dl TLS_Srv:server1.example.netENCR:256
-.Pp
-For a TLS client,
-require verification and a minimum of 128-bit encryption:
-.Pp
-.Dl TLS_Clt:desktop.example.net VERIFY:128
-.Pp
-Much more complicated access maps are possible, and error conditions (such
-as permanent or temporary, PERM+ or TEMP+) can be set on the basis of
-various criteria.
-This allows you fine-grained control over the types of connections you
-can allow.
+certificate-based authentication. If you configure your server to do client
+certificate checking, your clients will have to generate certificates 
signed

+by a CA you also trust.
 .Pp
 Note that it is unwise to force all SMTP clients to use TLS, as it is not
 yet widespread.



patterns.c question or possible bug

2018-01-29 Thread Edgar Pettijohn
I'm trying to use patterns.c for some pattern matching. The manual 
mentions captures using "()" around what you want to capture.  I don't 
see how to get at the data though.  Here is a sample program.


#include 
#include "patterns.h"

int
main(int argc, char *argv[])
{
const char*errstr = NULL;
const char*string = "the quick the brown the fox";
const char*pattern = "the";
intret;
struct str_match match;

ret = str_match(string, pattern, &match, &errstr);

if (errstr != NULL)
printf("%s\n", errstr);
else
printf("number of matches %d\n", match.sm_nmatch);

return 0;
}

It prints 2 which I was expecting 3. I've tried multiple other patterns 
and it seems the answer is always 2. Which leads me to believe I'm doing 
something wrong.  Any assistance appreciated.



Thanks,


Edgar



typo hcreate.3

2018-01-29 Thread Edgar Pettijohn

Index: hcreate.3
==
RCS file: /cvs/src/lib/libc/stdlib/hcreate.3,v
retrieving revision 1.7
diff -u -p -u -r1.7 hcreate.3
--- hcreate.3   12 Mar 2016 21:31:22 -  1.7
+++ hcreate.3   29 Jan 2018 23:45:08 -
@@ -78,7 +78,7 @@ the data can no longer be accessed.
 .Pp
 The
 .Fn hsearch
-function is used to search to the hash table.
+function is used to search the hash table.
 It returns a pointer into the
 hash table indicating the address of an item.
 The


I contemplated changing the second `to' to `through', but less seems to 
be more.




update sendbug

2017-12-27 Thread Edgar Pettijohn
update hardware for sendbug or it could just be removed I think since
the Environment: section will show what your using. So here are two
patches for each.

Index: sendbug.c
===
RCS file: /cvs/src/usr.bin/sendbug/sendbug.c,v
retrieving revision 1.78
diff -u -p -u -r1.78 sendbug.c
--- sendbug.c   21 Aug 2017 21:41:13 -  1.78
+++ sendbug.c   27 Dec 2017 16:17:13 -
@@ -43,8 +43,10 @@ int  sendmail(const char *);
 void   template(FILE *);
 void   usbdevs(FILE *);

-const char *categories = "system user library documentation kernel "
-"alpha amd64 arm hppa i386 m88k mips64 powerpc sh sparc sparc64 vax";
+const char *categories[] = {
+   "system user library documentation kernel",
+   "alpha amd64 arm64 armV7 hppa i386 landisk loongson luna88k macppc 
octeon sgi sparc64"
+   };
 const char *comment[] = {
"",
"",
@@ -554,8 +556,8 @@ template(FILE *fp)
fprintf(fp, "SENDBUG:\n");
fprintf(fp, "SENDBUG: Choose from the following categories:\n");
fprintf(fp, "SENDBUG:\n");
-   fprintf(fp, "SENDBUG: %s\n", categories);
-   fprintf(fp, "SENDBUG:\n");
+   fprintf(fp, "SENDBUG: %s\n", categories[0]);
+   fprintf(fp, "SENDBUG: %s\n", categories[1]);
fprintf(fp, "SENDBUG:\n");
fprintf(fp, "To: %s\n", "b...@openbsd.org");
fprintf(fp, "Subject: \n");

Index: sendbug.c
===
RCS file: /cvs/src/usr.bin/sendbug/sendbug.c,v
retrieving revision 1.78
diff -u -p -u -r1.78 sendbug.c
--- sendbug.c   21 Aug 2017 21:41:13 -  1.78
+++ sendbug.c   27 Dec 2017 16:24:13 -
@@ -43,8 +43,6 @@ int   sendmail(const char *);
 void   template(FILE *);
 void   usbdevs(FILE *);

-const char *categories = "system user library documentation kernel "
-"alpha amd64 arm hppa i386 m88k mips64 powerpc sh sparc sparc64 vax";
 const char *comment[] = {
"",
"",
@@ -549,13 +547,10 @@ void
 template(FILE *fp)
 {
fprintf(fp, "SENDBUG: -*- sendbug -*-\n");
+   fprintf(fp, "SENDBUG:\n");
fprintf(fp, "SENDBUG: Lines starting with `SENDBUG' will"
" be removed automatically.\n");
fprintf(fp, "SENDBUG:\n");
-   fprintf(fp, "SENDBUG: Choose from the following categories:\n");
-   fprintf(fp, "SENDBUG:\n");
-   fprintf(fp, "SENDBUG: %s\n", categories);
-   fprintf(fp, "SENDBUG:\n");
fprintf(fp, "SENDBUG:\n");
fprintf(fp, "To: %s\n", "b...@openbsd.org");
fprintf(fp, "Subject: \n");



fc-list.1 bug

2017-12-22 Thread Edgar Pettijohn
$ diff -u fc-list.1.orig fc-list.1  

--- fc-list.1.orig  Fri Dec 22 18:47:19 2017
+++ fc-list.1   Fri Dec 22 18:54:24 2017
@@ -69,7 +69,7 @@
 \fBfc-scan\fR(1)
 .PP
 The fontconfig user's guide, in HTML format:
-\fI/usr/share/doc/fontconfig/fontconfig-user.html\fR\&.
+\fI/usr/X11R6/share/doc/fontconfig/fontconfig-user.html\fR\&.
 .SH "AUTHOR"
 .PP
 This manual page was written by Keith Packard


correct path to fontconfig-user.html



ocspcheck.c patch

2017-12-20 Thread Edgar Pettijohn
poll.h doesn't appear to be needed

Index: ocspcheck.c
===
RCS file: /cvs/src/usr.sbin/ocspcheck/ocspcheck.c,v
retrieving revision 1.21
diff -u -p -u -r1.21 ocspcheck.c
--- ocspcheck.c 8 May 2017 20:15:34 -   1.21
+++ ocspcheck.c 21 Dec 2017 01:22:55 -
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



faq14.html minor patch

2017-12-12 Thread Edgar Pettijohn
$ diff -u faq14.html faq14.html.orig
 
--- faq14.html  Tue Dec 12 21:50:14 2017
+++ faq14.html.orig Tue Dec 12 21:50:03 2017
@@ -391,7 +391,7 @@
 Here is an example /etc/fstab line:
 
 
-0123456789abcdef.k /home ffs rw,nodev,nosuid,userquota 1 2
+0123456789abcdef.k /home ffs rw,nodev,nosuid,userquota 1 1
 
 
 To set the users' quotas, use


According to fstab(5)
 The root filesystem should be specified with a fs_passno of 1, and other
 filesystems should have a fs_passno of 2.



sshd_config.5.patch

2017-11-30 Thread Edgar Pettijohn
While playing with sftp-server I noticed that sshd_config.5 claims there
are no Subsystems enabled by default. I could be wrong, but my
sshd_config had sftp-server enabled by default.

--- sshd_config.5.orig  Thu Nov 30 20:50:17 2017
+++ sshd_config.5   Thu Nov 30 20:53:25 2017
@@ -1416,8 +1416,6 @@
 This may simplify configurations using
 .Cm ChrootDirectory
 to force a different filesystem root on clients.
-.Pp
-By default no subsystems are defined.
 .It Cm SyslogFacility
 Gives the facility code that is used when logging messages from
 .Xr sshd 8 .


It was weird though because /etc/ssh/sshd_config shows the following:

# override default of no subsystems
Subsystem   sftp/usr/libexec/sftp-server

I was going to also provide a patch with the sftp-server line commented
out, but couldn't find it in /usr/src and while I'm certain I didn't add
the line myself. Its possible it perhaps was the default and has been
removed and I didn't update the file correctly at some point. Either
way. I'll leave it to the professionals.

Thanks



perlreftut.1.patch

2017-11-29 Thread Edgar Pettijohn
--- perlreftut.1.orig   Wed Nov 29 18:45:45 2017
+++ perlreftut.1Wed Nov 29 18:51:52 2017
@@ -140,11 +140,11 @@
 reference that you're already familiar with.  Think of the President
 of the United States: a messy, inconvenient bag of blood and bones.
 But to talk about him, or to represent him in a computer program, all
-you need is the easy, convenient scalar string \*(L"Barack Obama\*(R".
+you need is the easy, convenient scalar string \*(L"Donald Trump\*(R".
 .PP
 References in Perl are like names for arrays and hashes.  They're
 Perl's private, internal names, so you can be sure they're
-unambiguous.  Unlike \*(L"Barack Obama\*(R", a reference only refers to one
+unambiguous.  Unlike \*(L"Donald Trump\*(R", a reference only refers to one
 thing, and you always know what it refers to.  If you have a reference
 to an array, you can recover the entire array from it.  If you have a
 reference to a hash, you can recover the entire hash.  But the



README patch

2017-11-08 Thread Edgar Pettijohn
EADME.orig 2017-11-08 20:11:47.091955000 -0600
+++ README  2017-11-08 20:12:19.787639000 -0600
@@ -49,8 +49,8 @@
 
 No major funding or cost-sharing of the project comes from any company
 or educational institution. Theo works full-time on improving OpenBSD
-and paying bills, many other developers expend spend significant
-quantities of time as well.
+and paying bills, many other developers spend significant quantities
+of time as well.
 
 For those unable to make their contributions as straightforward gifts,
 the OpenBSD Foundation (http://OpenBSDFoundation.org) is a Canadian


Or perhaps it should be expend instead. Not sure, but both sound weird.



Re: dig(1) doesn't play well with rebound(8)

2017-06-29 Thread Edgar Pettijohn
I played with it but kept getting segfaults. So moved my version with a command 
line option to /use/local. I guess Im the only person using rebound and dig.

⁣Sent from BlueMail ​

On Jun 29, 2017, 4:13 AM, at 4:13 AM, Theo Buehler  wrote:
>On Fri, May 26, 2017 at 08:08:08AM -0400, Ted Unangst wrote:
>> Edgar Pettijohn wrote:
>> > This may not be the best way to handle this, but it was the first
>fix to
>> > come to mind.  Not sure where to put this in the manual or if its
>even
>> > worth documenting. Thoughts?
>>
>> I think this is a better fix. the user shouldn't worry about such
>things. at
>> least until a better path forward is determined.
>
>Are there any plans to revisit this?
>
>>
>> Index: bin/dig/dighost.c
>> ===
>> RCS file: /cvs/src/usr.sbin/bind/bin/dig/dighost.c,v
>> retrieving revision 1.15
>> diff -u -p -r1.15 dighost.c
>> --- bin/dig/dighost.c   28 Sep 2015 15:55:54 -  1.15
>> +++ bin/dig/dighost.c   26 May 2017 12:03:53 -
>> @@ -34,6 +34,8 @@
>>  #include 
>>  #include 
>>
>> +#include 
>> +
>>  #ifdef HAVE_LOCALE_H
>>  #include 
>>  #endif
>> @@ -2778,6 +2780,15 @@ recv_done(isc_task_t *task, isc_event_t
>> isc_region_t r;
>> isc_buffer_t *buf = NULL;
>>  #endif
>> +   static int checked_jackport;
>> +   static int jackport;
>> +
>> +   if (!checked_jackport) {
>> +   int dnsjacking[2] = { CTL_KERN, KERN_DNSJACKPORT };
>> +   size_t portlen = sizeof(jackport);
>> +   sysctl(dnsjacking, 2, &jackport, &portlen, NULL, 0);
>> +   checked_jackport = 1;
>> +   }
>>
>> UNUSED(task);
>> INSIST(!free_now);
>> @@ -2854,6 +2865,7 @@ recv_done(isc_task_t *task, isc_event_t
>> * sent to 0.0.0.0, :: or to a multicast addresses.
>> * XXXMPA broadcast needs to be handled here as well.
>> */
>> +   if (jackport == 0)
>> if ((!isc_sockaddr_eqaddr(&query->sockaddr, &any) &&
>>  !isc_sockaddr_ismulticast(&query->sockaddr)) ||
>> isc_sockaddr_getport(&query->sockaddr) !=
>>


dhcp-options(5) conflict with dhcpd.conf(5)

2017-06-26 Thread Edgar Pettijohn

I found the following conflict between dhcp-options(5) and dhcpd.conf(5).


From dhcpd.conf:

 As you can see in Example 2, it's legal to specify host addresses in
 parameters as hostnames rather than as numeric IP addresses. If a 
given
 hostname resolves to more than one IP address (for example, if 
that host
 has two Ethernet interfaces), both addresses are supplied to the 
client.



From dhcp-options:

The ip-address data type can be entered either as an explicit IP address
 (e.g., 239.254.197.10) or as a domain name (e.g., haagen.isc.org).  A
 domain name must resolve to a single IP address.


Does anyone know which is correct? Must it resolve to a single IP 
address or not?



Thanks,

Edgar




Re: [patch] dhcpd.h

2017-06-26 Thread Edgar Pettijohn

found some more unused #defines


Index: dhcpd.h
===
RCS file: /cvs/src/usr.sbin/dhcpd/dhcpd.h,v
retrieving revision 1.64
diff -u -p -u -r1.64 dhcpd.h
--- dhcpd.h24 Apr 2017 14:58:36 -1.64
+++ dhcpd.h26 Jun 2017 21:17:15 -
@@ -54,11 +54,6 @@ struct iaddr {
 unsigned char iabuf[16];
 };

-struct iaddrlist {
-struct iaddrlist *next;
-struct iaddr addr;
-};
-
 #define DEFAULT_HASH_SIZE97

 struct hash_bucket {
@@ -78,25 +73,6 @@ struct option_data {
 u_int8_t *data;
 };

-struct string_list {
-struct string_list *next;
-char *string;
-};
-
-/* A name server, from /etc/resolv.conf. */
-struct name_server {
-struct name_server *next;
-struct sockaddr_in addr;
-time_t rcdate;
-};
-
-/* A domain search list element. */
-struct domain_search_list {
-struct domain_search_list *next;
-char *domain;
-time_t rcdate;
-};
-
 /* A dhcp packet and the pointers to its option values. */
 struct packet {
 struct dhcp_packet *raw;
@@ -107,12 +83,12 @@ struct packet {
 struct iaddr client_addr;
 struct interface_info *interface;/* Interface on which packet
was received. */
-struct hardware *haddr;/* Physical link address
-   of local sender (maybe gateway). */
+struct hardware *haddr;/* Physical link address
+  of local sender (maybe gateway). */
 struct shared_network *shared_network;
 struct option_data options[256];
-int got_requested_address;/* True if client sent the
-   dhcp-requested-address option. */
+int got_requested_address;/* True if client sent the
+   dhcp-requested-address option. */
 };

 struct hardware {
@@ -174,13 +150,12 @@ struct lease_state {
 int max_message_size;
 u_int8_t *prl;
 int prl_len;
-int got_requested_address;/* True if client sent the
-   dhcp-requested-address option. */
-int got_server_identifier;/* True if client sent the
-   dhcp-server-identifier option. */
+int got_requested_address;/* True if client sent the
+   dhcp-requested-address option. */
+int got_server_identifier;/* True if client sent the
+   dhcp-server-identifier option. */
 struct shared_network *shared_network;/* Shared network of 
interface

on which request arrived. */
-
 u_int32_t xid;
 u_int16_t secs;
 u_int16_t bootp_flags;
@@ -278,7 +253,7 @@ struct pf_cmd {
 struct interface_info {
 struct interface_info *next;/* Next interface in list... */
 struct shared_network *shared_network;
-/* Networks connected to this interface. */
+/* Networks connected to this interface. */
 struct hardware hw_address;/* Its physical address. */
 struct in_addr primary_address;/* Primary interface address. */
 char name[IFNAMSIZ];/* Its name... */
@@ -301,12 +276,6 @@ struct interface_info {
 size_t, struct in_addr, struct sockaddr_in *, struct hardware *);
 };

-struct hardware_link {
-struct hardware_link *next;
-char name[IFNAMSIZ];
-struct hardware address;
-};
-
 struct dhcpd_timeout {
 struct dhcpd_timeout *next;
 time_t when;
@@ -321,20 +290,8 @@ struct protocol {
 void *local;
 };

-/* Bitmask of dhcp option codes. */
-typedef unsigned char option_mask[16];
-
-/* DHCP Option mask manipulation macros... */
-#define OPTION_ZERO(mask)(memset (mask, 0, 16))
-#define OPTION_SET(mask, bit)(mask[bit >> 8] |= (1 << (bit & 7)))
-#define OPTION_CLR(mask, bit)(mask[bit >> 8] &= ~(1 << (bit & 7)))
-#define OPTION_ISSET(mask, bit)(mask[bit >> 8] & (1 << (bit & 7)))
-#define OPTION_ISCLR(mask, bit)(!OPTION_ISSET (mask, bit))
-
 /* An option occupies its length plus two header bytes (code and
-length) for every 255 bytes that must be stored. */
-#define OPTION_SPACE(x)((x) + 2 * ((x) / 255 + 1))
-
+ * length) for every 255 bytes that must be stored. */
 #define _PATH_DHCPD_CONF"/etc/dhcpd.conf"
 #define _PATH_DHCPD_DB"/var/db/dhcpd.leases"
 #define _PATH_DEV_PF"/dev/pf"


On 06/25/17 13:40, Edgar Pettijohn wrote:

Remove unused structs and line up some comments.


Index: dhcpd.h
===
RCS file: /cvs/src/usr.sbin/dhcpd/dhcpd.h,v
retrieving revision 1.64
diff -u -p -u -r1.64 dhcpd.h
--- dhcpd.h24 Apr 2017 14:58:36 -1.64
+++ dhcpd.h25 Jun 2017 18:36:47 -
@@ -54,11 +54,6 @@ struct iaddr {
 unsigned char iabuf[16];
 };

-struct iaddrlist {
-struct iaddrlist *next;
-struct iaddr addr;
-

[patch] dispatch.c

2017-06-25 Thread Edgar Pettijohn
Move initialization out of if/else block, unruly space, and memset 
struct beforehand.



Index: dispatch.c
===
RCS file: /cvs/src/usr.sbin/dhcpd/dispatch.c,v
retrieving revision 1.43
diff -u -p -u -r1.43 dispatch.c
--- dispatch.c12 Apr 2017 19:17:30 -1.43
+++ dispatch.c26 Jun 2017 00:49:04 -
@@ -549,18 +549,16 @@ add_timeout(time_t when, void (*where)(v
 if (free_timeouts) {
 q = free_timeouts;
 free_timeouts = q->next;
-q->func = where;
-q->what = what;
 } else {
-q = malloc(sizeof (struct dhcpd_timeout));
+q = malloc(sizeof(struct dhcpd_timeout));
 if (!q)
 fatalx("Can't allocate timeout structure!");
-q->func = where;
-q->what = what;
 }
 }
-
+memset(q, 0, sizeof *q);
+q->func = where;
 q->when = when;
+q->what = what;

 /* Now sort this timeout into the timeout list. */




[patch] dhcpd.h

2017-06-25 Thread Edgar Pettijohn

Remove unused structs and line up some comments.


Index: dhcpd.h
===
RCS file: /cvs/src/usr.sbin/dhcpd/dhcpd.h,v
retrieving revision 1.64
diff -u -p -u -r1.64 dhcpd.h
--- dhcpd.h24 Apr 2017 14:58:36 -1.64
+++ dhcpd.h25 Jun 2017 18:36:47 -
@@ -54,11 +54,6 @@ struct iaddr {
 unsigned char iabuf[16];
 };

-struct iaddrlist {
-struct iaddrlist *next;
-struct iaddr addr;
-};
-
 #define DEFAULT_HASH_SIZE97

 struct hash_bucket {
@@ -78,25 +73,6 @@ struct option_data {
 u_int8_t *data;
 };

-struct string_list {
-struct string_list *next;
-char *string;
-};
-
-/* A name server, from /etc/resolv.conf. */
-struct name_server {
-struct name_server *next;
-struct sockaddr_in addr;
-time_t rcdate;
-};
-
-/* A domain search list element. */
-struct domain_search_list {
-struct domain_search_list *next;
-char *domain;
-time_t rcdate;
-};
-
 /* A dhcp packet and the pointers to its option values. */
 struct packet {
 struct dhcp_packet *raw;
@@ -107,12 +83,12 @@ struct packet {
 struct iaddr client_addr;
 struct interface_info *interface;/* Interface on which packet
was received. */
-struct hardware *haddr;/* Physical link address
-   of local sender (maybe gateway). */
+struct hardware *haddr;/* Physical link address
+  of local sender (maybe gateway). */
 struct shared_network *shared_network;
 struct option_data options[256];
-int got_requested_address;/* True if client sent the
-   dhcp-requested-address option. */
+int got_requested_address;/* True if client sent the
+   dhcp-requested-address option. */
 };

 struct hardware {
@@ -174,13 +150,12 @@ struct lease_state {
 int max_message_size;
 u_int8_t *prl;
 int prl_len;
-int got_requested_address;/* True if client sent the
-   dhcp-requested-address option. */
-int got_server_identifier;/* True if client sent the
-   dhcp-server-identifier option. */
+int got_requested_address;/* True if client sent the
+   dhcp-requested-address option. */
+int got_server_identifier;/* True if client sent the
+   dhcp-server-identifier option. */
 struct shared_network *shared_network;/* Shared network of 
interface

on which request arrived. */
-
 u_int32_t xid;
 u_int16_t secs;
 u_int16_t bootp_flags;
@@ -278,7 +253,7 @@ struct pf_cmd {
 struct interface_info {
 struct interface_info *next;/* Next interface in list... */
 struct shared_network *shared_network;
-/* Networks connected to this interface. */
+/* Networks connected to this interface. */
 struct hardware hw_address;/* Its physical address. */
 struct in_addr primary_address;/* Primary interface address. */
 char name[IFNAMSIZ];/* Its name... */
@@ -299,12 +274,6 @@ struct interface_info {
 int is_udpsock;
 ssize_t (*send_packet)(struct interface_info *, struct dhcp_packet *,
 size_t, struct in_addr, struct sockaddr_in *, struct hardware *);
-};
-
-struct hardware_link {
-struct hardware_link *next;
-char name[IFNAMSIZ];
-struct hardware address;
 };

 struct dhcpd_timeout {



Re: [patch] typo smtpd/dns.c

2017-05-31 Thread Edgar Pettijohn
Will do. I just don't trust Thunderbird not to mess them up.

⁣Sent from BlueMail ​

On May 31, 2017, 3:01 AM, at 3:01 AM, Gilles Chehade  wrote:
>On Tue, May 30, 2017 at 05:26:08PM -0500, Edgar Pettijohn wrote:
>> fix typo
>
>thanks, will commit
>
>when sending diffs, please inline them instead of attaching as it is
>easier for us to work with them that way
>
>Gilles
>
>
>> Index: dns.c
>> ===
>> RCS file: /cvs/src/usr.sbin/smtpd/dns.c,v
>> retrieving revision 1.83
>> diff -u -p -u -r1.83 dns.c
>> --- dns.c28 Oct 2015 07:28:13 -  1.83
>> +++ dns.c30 May 2017 22:09:15 -
>> @@ -246,7 +246,7 @@ dns_imsg(struct mproc *p, struct imsg *i
>>
>>  as = res_query_async(s->name, C_IN, T_MX, NULL);
>>  if (as == NULL) {
>> -log_warn("warn: req_query_async: %s", s->name);
>> +log_warn("warn: res_query_async: %s", s->name);
>>  m_create(s->p, IMSG_MTA_DNS_HOST_END, 0, 0, -1);
>>  m_add_id(s->p, s->reqid);
>>  m_add_int(s->p, DNS_EINVAL);
>
>
>--
>Gilles Chehade
>
>https://www.poolp.org
>@poolpOrg


Re: [patch] rebound.c

2017-05-31 Thread Edgar Pettijohn
Will do. Seems like Thunderbird messes then up sometimes.

⁣Sent from BlueMail ​

On May 31, 2017, 2:14 AM, at 2:14 AM, Ted Unangst  wrote:
>Edgar Pettijohn wrote:
>> Be more consistent with logerr usage.
>>
>
>sure, thanks. can you send future diffs inline please? easier than
>attachments.


[patch] rebound.c

2017-05-30 Thread Edgar Pettijohn

Be more consistent with logerr usage.

Index: rebound.c
===
RCS file: /cvs/src/usr.sbin/rebound/rebound.c,v
retrieving revision 1.83
diff -u -p -u -r1.83 rebound.c
--- rebound.c	27 Apr 2017 16:09:32 -	1.83
+++ rebound.c	31 May 2017 02:05:11 -
@@ -591,9 +591,9 @@ workerinit(void)
 		logerr("getpwnam failed");
 
 	if (chroot(pwd->pw_dir) == -1)
-		logerr("chroot failed (%d)", errno);
+		logerr("chroot: %s", strerror(errno));
 	if (chdir("/") == -1)
-		logerr("chdir failed (%d)", errno);
+		logerr("chdir: %s", strerror(errno));
 
 	setproctitle("worker");
 	if (setgroups(1, &pwd->pw_gid) ||


[patch] typo smtpd/dns.c

2017-05-30 Thread Edgar Pettijohn

fix typo
Index: dns.c
===
RCS file: /cvs/src/usr.sbin/smtpd/dns.c,v
retrieving revision 1.83
diff -u -p -u -r1.83 dns.c
--- dns.c	28 Oct 2015 07:28:13 -	1.83
+++ dns.c	30 May 2017 22:09:15 -
@@ -246,7 +246,7 @@ dns_imsg(struct mproc *p, struct imsg *i
 
 		as = res_query_async(s->name, C_IN, T_MX, NULL);
 		if (as == NULL) {
-			log_warn("warn: req_query_async: %s", s->name);
+			log_warn("warn: res_query_async: %s", s->name);
 			m_create(s->p, IMSG_MTA_DNS_HOST_END, 0, 0, -1);
 			m_add_id(s->p, s->reqid);
 			m_add_int(s->p, DNS_EINVAL);


Re: dig(1) doesn't play well with rebound(8)

2017-05-26 Thread Edgar Pettijohn
Sounds good to me. Just started using rebound and thought it would be good to 
use dig to prepopulate the cache. Also noticed host(1) has the same problem but 
was waiting for a response to dig first.

Edgar

⁣Sent from BlueMail ​

On May 26, 2017, 7:34 AM, at 7:34 AM, Ted Unangst  wrote:
>Edgar Pettijohn wrote:
>> This may not be the best way to handle this, but it was the first fix
>to
>> come to mind.  Not sure where to put this in the manual or if its
>even
>> worth documenting. Thoughts?
>
>I think this is a better fix. the user shouldn't worry about such
>things. at
>least until a better path forward is determined.
>
>
>Index: bin/dig/dighost.c
>===
>RCS file: /cvs/src/usr.sbin/bind/bin/dig/dighost.c,v
>retrieving revision 1.15
>diff -u -p -r1.15 dighost.c
>--- bin/dig/dighost.c  28 Sep 2015 15:55:54 -  1.15
>+++ bin/dig/dighost.c  26 May 2017 12:03:53 -
>@@ -34,6 +34,8 @@
> #include 
> #include 
>
>+#include 
>+
> #ifdef HAVE_LOCALE_H
> #include 
> #endif
>@@ -2778,6 +2780,15 @@ recv_done(isc_task_t *task, isc_event_t
>   isc_region_t r;
>   isc_buffer_t *buf = NULL;
> #endif
>+  static int checked_jackport;
>+  static int jackport;
>+
>+  if (!checked_jackport) {
>+  int dnsjacking[2] = { CTL_KERN, KERN_DNSJACKPORT };
>+  size_t portlen = sizeof(jackport);
>+  sysctl(dnsjacking, 2, &jackport, &portlen, NULL, 0);
>+  checked_jackport = 1;
>+  }
>
>   UNUSED(task);
>   INSIST(!free_now);
>@@ -2854,6 +2865,7 @@ recv_done(isc_task_t *task, isc_event_t
>   * sent to 0.0.0.0, :: or to a multicast addresses.
>   * XXXMPA broadcast needs to be handled here as well.
>   */
>+  if (jackport == 0)
>   if ((!isc_sockaddr_eqaddr(&query->sockaddr, &any) &&
>!isc_sockaddr_ismulticast(&query->sockaddr)) ||
>   isc_sockaddr_getport(&query->sockaddr) !=


Re: dig(1) doesn't play well with rebound(8)

2017-05-21 Thread Edgar Pettijohn



On 05/21/17 15:12, Edgar Pettijohn wrote:



On 05/21/17 14:53, Edgar Pettijohn wrote:
This may not be the best way to handle this, but it was the first fix 
to come to mind.  Not sure where to put this in the manual or if its 
even worth documenting. Thoughts?


Thanks,

Edgar

Well it worked when invoked as /usr/src/usr.sbin/bind/bin/dig/dig -r 
but when installed it says Invalid option -r.  Dig's option parsing 
confuses the hell out of me.

Sorry for the noise.  I didn't ./configure correctly :(
I think thats enough for today.



Re: dig(1) doesn't play well with rebound(8)

2017-05-21 Thread Edgar Pettijohn



On 05/21/17 14:53, Edgar Pettijohn wrote:
This may not be the best way to handle this, but it was the first fix 
to come to mind.  Not sure where to put this in the manual or if its 
even worth documenting. Thoughts?


Thanks,

Edgar

Well it worked when invoked as /usr/src/usr.sbin/bind/bin/dig/dig -r but 
when installed it says Invalid option -r.  Dig's option parsing confuses 
the hell out of me.




dig(1) doesn't play well with rebound(8)

2017-05-21 Thread Edgar Pettijohn
This may not be the best way to handle this, but it was the first fix to 
come to mind.  Not sure where to put this in the manual or if its even 
worth documenting. Thoughts?


Thanks,

Edgar

Index: dig.c
===
RCS file: /cvs/src/usr.sbin/bind/bin/dig/dig.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 dig.c
--- dig.c	5 Jun 2016 15:09:17 -	1.17
+++ dig.c	21 May 2017 19:48:09 -
@@ -1053,7 +1053,7 @@ plus_option(char *option, isc_boolean_t 
 /*%
  * #ISC_TRUE returned if value was used
  */
-static const char *single_dash_opts = "46dhimnv";
+static const char *single_dash_opts = "46dhimnrv";
 static const char *dash_opts = "46bcdfhikmnptvyx";
 static isc_boolean_t
 dash_option(char *option, char *next, dig_lookup_t **lookup,
@@ -1121,6 +1121,9 @@ dash_option(char *option, char *next, di
 			break;
 		case 'n':
 			/* deprecated */
+			break;
+		case 'r':
+			rebound = ISC_TRUE;
 			break;
 		case 'v':
 			version();
Index: include/dig/dig.h
===
RCS file: /cvs/src/usr.sbin/bind/bin/dig/include/dig/dig.h,v
retrieving revision 1.8
diff -u -p -u -r1.8 dig.h
--- include/dig/dig.h	16 Aug 2009 13:17:44 -	1.8
+++ include/dig/dig.h	21 May 2017 19:47:52 -
@@ -274,7 +274,7 @@ extern isc_boolean_t validated;
 extern isc_taskmgr_t *taskmgr;
 extern isc_task_t *global_task;
 extern isc_boolean_t free_now;
-extern isc_boolean_t debugging, memdebugging;
+extern isc_boolean_t debugging, memdebugging, rebound;
 
 extern char *progname;
 extern int tries;
Index: dighost.c
===
RCS file: /cvs/src/usr.sbin/bind/bin/dig/dighost.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 dighost.c
--- dighost.c	28 Sep 2015 15:55:54 -	1.15
+++ dighost.c	21 May 2017 19:47:27 -
@@ -118,6 +118,7 @@ isc_boolean_t
 	showsearch = ISC_FALSE,
 	qr = ISC_FALSE,
 	is_dst_up = ISC_FALSE;
+isc_boolean_t rebound;
 in_port_t port = 0;
 unsigned int timeout = 0;
 unsigned int extrabytes;
@@ -2854,17 +2855,19 @@ recv_done(isc_task_t *task, isc_event_t 
 		* sent to 0.0.0.0, :: or to a multicast addresses.
 		* XXXMPA broadcast needs to be handled here as well.
 		*/
-		if ((!isc_sockaddr_eqaddr(&query->sockaddr, &any) &&
-		 !isc_sockaddr_ismulticast(&query->sockaddr)) ||
-		isc_sockaddr_getport(&query->sockaddr) !=
-		isc_sockaddr_getport(&sevent->address)) {
-			isc_sockaddr_format(&sevent->address, buf1,
-			sizeof(buf1));
-			isc_sockaddr_format(&query->sockaddr, buf2,
-			sizeof(buf2));
-			printf(";; reply from unexpected source: %s,"
-			" expected %s\n", buf1, buf2);
-			match = ISC_FALSE;
+		if (!rebound) {
+			if ((!isc_sockaddr_eqaddr(&query->sockaddr, &any) &&
+		 		!isc_sockaddr_ismulticast(&query->sockaddr)) ||
+				isc_sockaddr_getport(&query->sockaddr) !=
+				isc_sockaddr_getport(&sevent->address)) {
+	isc_sockaddr_format(&sevent->address, buf1,
+	sizeof(buf1));
+	isc_sockaddr_format(&query->sockaddr, buf2,
+	sizeof(buf2));
+	printf(";; reply from unexpected source: %s,"
+	" expected %s\n", buf1, buf2);
+	match = ISC_FALSE;
+			}
 		}
 	}
 


mail.file.c patch

2017-04-24 Thread Edgar Pettijohn
Not sure if this was intentional or not, but here is a patch to remove a 
"damned if you do, damned if you don't" situation.



Thanks,


Edgar


Index: mail.file.c
===
RCS file: /cvs/src/usr.sbin/smtpd/mail.file.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 mail.file.c
--- mail.file.c	14 Feb 2017 16:43:28 -	1.1
+++ mail.file.c	25 Apr 2017 02:52:01 -
@@ -47,7 +47,7 @@ main(int argc, char *argv[])
 	if (argc == 0)
 		errx(1, "mail.file: filename required");
 
-	if (argc != 0)
+	if (argc > 1)
 		errx(1, "mail.file: only one filename is supported");
 
 	file_engine(argv[0]);


hotplugd feature request

2017-04-23 Thread Edgar Pettijohn

tech@,


There may be security implications that I'm not aware of, but would the 
following be possible?



Change /dev/hotplug

cr--r-  1 root   operator   82,   0 Apr 11 20:55 hotplug

This way a member of the operator group can start hotplugd from .xinitrc 
and use it to launch graphical programs.



Thanks,


Edgar



spamd.c patch

2017-04-06 Thread Edgar Pettijohn
Use errx() instead of fprintf() like the rest of the options. Originally 
noticed because of the missing '\' for the newline.



Index: spamd.c
===
RCS file: /cvs/src/libexec/spamd/spamd.c,v
retrieving revision 1.150
diff -u -p -u -r1.150 spamd.c
--- spamd.c 23 Jan 2017 09:21:04 -  1.150
+++ spamd.c 6 Apr 2017 13:18:09 -
@@ -1287,8 +1287,7 @@ main(int argc, char *argv[])
case 'c':
maxcon = strtonum(optarg, 1, maxfiles, &errstr);
if (errstr) {
-   fprintf(stderr, "-c %s: %sn", optarg, 
errstr);

-   usage();
+   errx(1, "-c %s: %s", optarg, errstr);
}
break;
case 'p':



identd.c patch

2017-04-05 Thread Edgar Pettijohn

Remove unused function getport()


Index: identd.c
===
RCS file: /cvs/src/usr.sbin/identd/identd.c,v
retrieving revision 1.34
diff -u -p -u -r1.34 identd.c
--- identd.c4 Sep 2016 14:39:32 -   1.34
+++ identd.c5 Apr 2017 16:47:49 -
@@ -128,7 +128,6 @@ voididentd_response(int, short, void *)
 intfetchuid(struct ident_client *);

 const char *gethost(struct sockaddr_storage *);
-const char *getport(struct sockaddr_storage *);
 const char *gentoken(void);

 struct loggers {
@@ -1146,19 +1145,6 @@ gethost(struct sockaddr_storage *ss)

if (getnameinfo(sa, sa->sa_len, buf, sizeof(buf),
NULL, 0, NI_NUMERICHOST) != 0)
-   return ("(unknown)");
-
-   return (buf);
-}
-
-const char *
-getport(struct sockaddr_storage *ss)
-{
-   struct sockaddr *sa = (struct sockaddr *)ss;
-   static char buf[NI_MAXSERV];
-
-   if (getnameinfo(sa, sa->sa_len, NULL, 0, buf, sizeof(buf),
-   NI_NUMERICSERV) != 0)
return ("(unknown)");

return (buf);



Re: usermod.8 patch

2017-03-31 Thread Edgar Pettijohn


Sent from my iPhone

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

I guess that's possible.


usermod.8 patch

2017-03-31 Thread Edgar Pettijohn
usermod(8) doesn't have an option for setting defaults.  Here is a patch 
to correct the manual.


Index: usermod.8
===
RCS file: /cvs/src/usr.sbin/user/usermod.8,v
retrieving revision 1.35
diff -u -p -u -r1.35 usermod.8
--- usermod.8	30 Nov 2016 20:26:37 -	1.35
+++ usermod.8	31 Mar 2017 13:00:42 -
@@ -60,7 +60,7 @@ Default values are taken from the inform
 file, which, if running as root, is created using the built-in defaults if
 it does not exist.
 .Pp
-After setting any defaults, and then reading values from
+After reading values from
 .Pa /etc/usermgmt.conf ,
 the following command line options are processed:
 .Bl -tag -width Ds


faq6.html patch

2017-03-29 Thread Edgar Pettijohn

I noticed this a few months ago, but forgot to send it.


Index: faq6.html
===
RCS file: /cvs/www/faq/faq6.html,v
retrieving revision 1.435
diff -u -p -u -r1.435 faq6.html
--- faq6.html   25 Mar 2017 19:07:05 -  1.435
+++ faq6.html   29 Mar 2017 22:57:24 -
@@ -745,7 +745,7 @@ from the NFS client, access would be den

 
 The user and group that root are mapped to are configurable via the
-http://man.openbsd.org/export";>exports(5) file on the NFS 
server.
+http://man.openbsd.org/exports";>exports(5) file on the NFS 
server.


 Checking Stats on NFS



Re: util.c patch res_comp.c patch

2016-09-26 Thread Edgar Pettijohn
On 16-09-26 21:42:09, Peter Hessler wrote:
> On 2016 Sep 26 (Mon) at 14:31:04 -0500 (-0500), Edgar Pettijohn wrote:
> :On 16-09-26 09:26:04, Gilles Chehade wrote:
> :> On Sun, Sep 25, 2016 at 11:20:39AM -0500, Edgar Pettijohn wrote:
> :> > In my testing it did not, but I could be wrong.
> :> > 
> :> > On 16-09-25 17:56:42, Eric Faurot wrote:
> :> > > On Sat, Sep 24, 2016 at 08:42:25PM -0500, Edgar Pettijohn wrote:
> :> > > > Enforce stricter rfc helo compliance.
> :> > > > -- 
> :> > > > Edgar Pettijohn
> :> > > 
> :> > > I am pretty sure res_hnok already does that check.
> :> > > 
> :> > > Eric.
> :> > > 
> :> 
> :> turns out res_hnok() doesn't, but should this be fixed in it or in smtpd ?
> :
> :The following catches: 
> :.my.domain
> :my..domain
> 
> these are invalid domains
> 
> :my.domain.
> 
> this is not!

Looks like that may break stuff.  This may be better and allows for a trailing 
'.'.

Index: res_comp.c
===
RCS file: /cvs/src/lib/libc/net/res_comp.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 res_comp.c
--- res_comp.c  1 May 2016 15:17:29 -   1.20
+++ res_comp.c  26 Sep 2016 21:47:24 -
@@ -347,21 +347,16 @@ dn_find(u_char *exp_dn, u_char *msg, u_c
 int
 __res_hnok(const char *dn)
 {
-   int pch = PERIOD, ch = *dn++;
+   int pch = PERIOD, ch = *dn;
+
+   if (ch == '.')
+   return (0);
 
while (ch != '\0') {
int nch = *dn++;
 
if (periodchar(ch)) {
-   ;
-   } else if (periodchar(pch)) {
-   if (!borderchar(ch))
-   return (0);
-   } else if (periodchar(nch) || nch == '\0') {
-   if (!borderchar(ch))
-   return (0);
-   } else {
-   if (!middlechar(ch))
+   if (!borderchar(pch) || !borderchar(nch) && nch != '\0')
return (0);
}
pch = ch, ch = nch;

> 
> 
> :
> :I haven't tested to see if it breaks anything else though.
> :> 
> :> 
> :> > > > Index: util.c
> :> > > > ===
> :> > > > RCS file: /cvs/src/usr.sbin/smtpd/util.c,v
> :> > > > retrieving revision 1.128
> :> > > > diff -u -p -u -r1.128 util.c
> :> > > > --- util.c   31 Aug 2016 10:18:08 -  1.128
> :> > > > +++ util.c   25 Sep 2016 01:41:34 -
> :> > > > @@ -495,6 +495,9 @@ valid_domainpart(const char *s)
> :> > > >  struct in6_addr  ina6;
> :> > > >  char*c, domain[SMTPD_MAXDOMAINPARTSIZE];
> :> > > >  const char  *p;
> :> > > > +size_t  len;
> :> > > > +
> :> > > > +len = strlen(s);
> :> > > >  
> :> > > >  if (*s == '[') {
> :> > > >  if (strncasecmp("[IPv6:", s, 6) == 0)
> :> > > > @@ -519,8 +522,9 @@ valid_domainpart(const char *s)
> :> > > >  return 0;
> :> > > >  }
> :> > > >  
> :> > > > -if (*s == '\0')
> :> > > > +if (*s == '\0' || s[0] == '.' || s[len - 1] == '.') {
> :> > > >  return 0;
> :> > > > +}
> :> > > >  
> :> > > >  return res_hnok(s);
> :> > > >  }
> :> > > 
> :> > > 
> :> > > -- 
> :> > > You received this mail because you are subscribed to m...@opensmtpd.org
> :> > > To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org
> :> > 
> :> > -- 
> :> > Edgar Pettijohn
> :> > 
> :> > -- 
> :> > You received this mail because you are subscribed to m...@opensmtpd.org
> :> > To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org
> :> > 
> :> 
> :> -- 
> :> Gilles Chehade
> :> 
> :> https://www.poolp.org  @poolpOrg
> :> 
> :> -- 
> :> You received this mail because you are subscribed to m...@opensmtpd.org
> :> To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org
> :
> :-- 
> :Edgar Pettijohn
> 
> :Index: res_comp.c
> :=

Re: util.c patch res_comp.c patch

2016-09-26 Thread Edgar Pettijohn
On 16-09-26 09:26:04, Gilles Chehade wrote:
> On Sun, Sep 25, 2016 at 11:20:39AM -0500, Edgar Pettijohn wrote:
> > In my testing it did not, but I could be wrong.
> > 
> > On 16-09-25 17:56:42, Eric Faurot wrote:
> > > On Sat, Sep 24, 2016 at 08:42:25PM -0500, Edgar Pettijohn wrote:
> > > > Enforce stricter rfc helo compliance.
> > > > -- 
> > > > Edgar Pettijohn
> > > 
> > > I am pretty sure res_hnok already does that check.
> > > 
> > > Eric.
> > > 
> 
> turns out res_hnok() doesn't, but should this be fixed in it or in smtpd ?

The following catches: 
.my.domain
my..domain
my.domain.

I haven't tested to see if it breaks anything else though.
> 
> 
> > > > Index: util.c
> > > > ===
> > > > RCS file: /cvs/src/usr.sbin/smtpd/util.c,v
> > > > retrieving revision 1.128
> > > > diff -u -p -u -r1.128 util.c
> > > > --- util.c  31 Aug 2016 10:18:08 -  1.128
> > > > +++ util.c  25 Sep 2016 01:41:34 -
> > > > @@ -495,6 +495,9 @@ valid_domainpart(const char *s)
> > > > struct in6_addr  ina6;
> > > > char*c, domain[SMTPD_MAXDOMAINPARTSIZE];
> > > > const char  *p;
> > > > +   size_t  len;
> > > > +
> > > > +   len = strlen(s);
> > > >  
> > > > if (*s == '[') {
> > > > if (strncasecmp("[IPv6:", s, 6) == 0)
> > > > @@ -519,8 +522,9 @@ valid_domainpart(const char *s)
> > > > return 0;
> > > > }
> > > >  
> > > > -   if (*s == '\0')
> > > > +   if (*s == '\0' || s[0] == '.' || s[len - 1] == '.') {
> > > > return 0;
> > > > +   }
> > > >  
> > > > return res_hnok(s);
> > > >  }
> > > 
> > > 
> > > -- 
> > > You received this mail because you are subscribed to m...@opensmtpd.org
> > > To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org
> > 
> > -- 
> > Edgar Pettijohn
> > 
> > -- 
> > You received this mail because you are subscribed to m...@opensmtpd.org
> > To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org
> > 
> 
> -- 
> Gilles Chehade
> 
> https://www.poolp.org  @poolpOrg
> 
> -- 
> You received this mail because you are subscribed to m...@opensmtpd.org
> To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org

-- 
Edgar Pettijohn
Index: res_comp.c
===
RCS file: /cvs/src/lib/libc/net/res_comp.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 res_comp.c
--- res_comp.c  1 May 2016 15:17:29 -   1.20
+++ res_comp.c  26 Sep 2016 18:51:59 -
@@ -347,21 +347,16 @@ dn_find(u_char *exp_dn, u_char *msg, u_c
 int
 __res_hnok(const char *dn)
 {
-   int pch = PERIOD, ch = *dn++;
+   int pch = PERIOD, ch = *dn;
+
+   if (ch == '.')
+   return (0);
 
while (ch != '\0') {
int nch = *dn++;
 
if (periodchar(ch)) {
-   ;
-   } else if (periodchar(pch)) {
-   if (!borderchar(ch))
-   return (0);
-   } else if (periodchar(nch) || nch == '\0') {
-   if (!borderchar(ch))
-   return (0);
-   } else {
-   if (!middlechar(ch))
+   if (!borderchar(pch) || !borderchar(nch))
return (0);
}
pch = ch, ch = nch;


Re: confpars.c patch

2016-08-02 Thread Edgar Pettijohn


Sent from my iPhone

> On Aug 2, 2016, at 7:00 AM, Jeremie Courreges-Anglas  wrote:
> 
> Edgar Pettijohn  writes:
> 
>> I'm not sure if this was intentional or not, but here is a small diff
>> for usr.sbin/dhcpd/confpars.c.
> 
> K&R vs ANSI function definitions.  That file contains other occurrences.
> 
> -- 
> jca | PGP: 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Is there any interest in changing them? If so I'll dig through and find them.


confpars.c patch

2016-08-01 Thread Edgar Pettijohn
I'm not sure if this was intentional or not, but here is a small diff
for usr.sbin/dhcpd/confpars.c.
-- 
Edgar Pettijohn
Index: confpars.c
===
RCS file: /cvs/src/usr.sbin/dhcpd/confpars.c,v
retrieving revision 1.26
diff -u -p -u -r1.26 confpars.c
--- confpars.c  6 Feb 2016 23:50:10 -   1.26
+++ confpars.c  2 Aug 2016 03:57:41 -
@@ -176,13 +176,9 @@ read_leases(void)
 | VENDOR_CLASS class-declaration
 | USER_CLASS class-declaration
 | RANGE address-range-declaration */
-
-int parse_statement(cfile, group, type, host_decl, declaration)
-   FILE *cfile;
-   struct group *group;
-   int type;
-   struct host_decl *host_decl;
-   int declaration;
+int
+parse_statement(FILE *cfile, struct group *group, int type, 
+   struct host_decl *host_decl, int declaration)
 {
int token;
char *val;


Re: jot(1) changed behavior

2016-07-14 Thread Edgar Pettijohn
On 16-07-14 12:00:21, Philippe Meunier wrote:
> Hello,
> 
> According to jot(1)'s man page:
> 
> "$ jot -w %d -r 10 1 4 | sort -n | uniq -c
> 33306 1
> 33473 2
> 33221 3
> 
> Note that with random sequences, all numbers generated will be smaller
> than the upper bound.  The largest value generated will be a tiny bit
> smaller than the upper bound.  For floating point formats, the value
> is rounded as described before being printed.  For integer formats,
> the highest value printed will be one less than the requested upper
> bound, because the generated value will be truncated."
> 
> The "smaller than the upper bound" part used to be correct but not
> anymore:
> 
> $ uname -a
> OpenBSD something.somewhere 5.9 GENERIC#1561 i386
> $ jot -w %d -r 10 1 4 | sort -n | uniq -c
> 24729 1
> 25035 2
> 25106 3
> 25130 4
> 
> Looking at the cvs log for jot.c, this seems to be a known change:
> 
> "revision 1.27 [...] Internally, jot -r now uses arc4random_uniform()
> whenever this is clearly possible.  In particular `jot -r 1 10 20'
> yields an unbiased random number between 10 and 20 (both ends
> inclusive) from the shell."
> 
> I only discovered this change today after noticing that one of my
> shell scripts that used to work fine had started to fail with a low
> probability: the script uses jot(1) to generate a sequence of random
> array indexes, and with this change an index can now be out of bounds
> with a probability of about 1/1700.  Fortunately it isn't an important
> script but given the low probability of failure it wasn't exactly fun
> to debug.  Anyway, I don't know which one of jot or jot's man page is
> going to be fixed but I'd advocate for reverting to the previous
> behavior to preserve the semantics of scripts that rely on it.
> 
> Cheers,
> 
> Philippe
> 
Try this patch.  I don't use jot, but in my simple testing I think this is
what you are looking for.
-- 
Edgar Pettijohn
Index: jot.c
===
RCS file: /cvs/src/usr.bin/jot/jot.c,v
retrieving revision 1.27
diff -u -p -u -r1.27 jot.c
--- jot.c   10 Jan 2016 01:15:52 -  1.27
+++ jot.c   14 Jul 2016 22:53:41 -
@@ -296,7 +296,6 @@ main(int argc, char *argv[])
uintx = pow10 * (ender - begin);
if (uintx >= UINT32_MAX)
errx(1, "requested range too large");
-   uintx++;
}
 
for (i = 1; i <= reps || infinity; i++) {


[patch] daemon.3

2016-05-17 Thread Edgar Pettijohn
The wording made it hard for me to understand at first.  The "unless" 
"non-zero" seem like double negatives.



Index: daemon.3
===
RCS file: /cvs/src/lib/libc/gen/daemon.3,v
retrieving revision 1.12
diff -u -p -u -r1.12 daemon.3
--- daemon.35 Jun 2013 03:39:22 -1.12
+++ daemon.317 May 2016 23:42:25 -
@@ -43,16 +43,16 @@ The
 function is for programs wishing to detach themselves from the
 controlling terminal and run in the background as system daemons.
 .Pp
-Unless the argument
+If the argument
 .Fa nochdir
-is non-zero,
+is zero,
 .Fn daemon
 changes the current working directory to the root
 .Pq Pa / .
 .Pp
-Unless the argument
+If the argument
 .Fa noclose
-is non-zero,
+is zero,
 .Fn daemon
 will redirect standard input, standard output and standard error to
 .Pa /dev/null .



Re: Is loss of read-only /usr permanent?

2016-05-13 Thread Edgar Pettijohn


Sent from my iPhone

> On May 13, 2016, at 4:16 PM, RD Thrush  wrote:
> 
> On 05/13/16 11:07, Theo de Raadt wrote:
>>> Since the anti-ROP mechanism in libc [2] was added in late April, -current 
>>> with read-only /usr produces something like the following message:
>>> re-ordering libraries:install: /usr/lib/INS@OPOjn7ck17: Read-only file 
>>> system
>> 
>> Look, your statement is false.  I can install a snapshot right now,
>> and I won't see what you report.
> 
> The report is fairly easy to reproduce.  Make the /usr filesystem read-only 
> in /etc/fstab, go to single user mode and exit back to multi-user.  I've 
> appended a transcript.
> 
>> That is the result of a mis-configuration on your part.
> 
> It's unfortunate that mounting /usr read-only is now a mis-configuration.
> 
>>> I thought I was following best practice by mounting /usr,
>>> /usr/X11R6, and /usr/local read-only.  I submitted a bug report and a
>>> patch to fix my problem [2] but have had no response.
>> 
>> That is not best practice.  If it was, we would be heading towards
>> making it the default.
>> 
>> And why is not best practice? Because it stands directly against the
>> primary purpose of OpenBSD: A development platform, where people
>> constantly rebuild their binaries, iterating and fixing bugs.
>> 
>> What you are describing here is really just "you make a local change,
>> you own it".
> 
> # cp -p /etc/fstab /etc/fstab.orig
> # sed -e 's,/usr ffs rw,/usr ffs ro,' /etc/fstab
> # shutdown -f now
> Shutdown NOW!
> shutdown: [pid 82541]
> #
> ?*** FINAL System shutdown message from r...@obsd32.thrush.com ***?
> System going down IMMEDIATELY
> 
> 
> 
> System shutdown time has arrived
> Enter pathname of shell or RETURN for sh:
> # exit
> Fast boot: skipping disk checks.
> setting tty flags
> pfctl: pf already enabled
> machdep.allowaperture: 2 -> 2
> starting network
> DHCPREQUEST on vio0 to 255.255.255.255
> DHCPACK from 10.1.2.18 (14:da:e9:b5:84:cf)
> bound to 10.1.2.6 -- renewal in 302400 seconds.
> re-ordering libraries:install: /usr/lib/INS@73BiVBOVcW: Read-only file system
> done.
> starting early daemons: syslogd pflogd ntpd.
> starting RPC daemons:.
> savecore: no core dump
> checking quotas: done.
> clearing /tmp
> kern.securelevel: 0 -> 1
> creating runtime link editor directory cache.
> preserving editor files.
> starting network daemons: sshd smtpd sndiod.
> starting local daemons: cron.
> Fri May 13 16:30:55 EDT 2016
> 
> 
> ##
> OpenBSD 6.0-beta (GENERIC.MP) #1742: Fri May 13 08:52:53 MDT 2016
>dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
> cpu0: Common 32-bit KVM processor ("GenuineIntel" 686-class) 3.41 GHz
> cpu0: 
> FPU,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,x2APIC,HV
> real mem  = 2146844672 (2047MB)
> avail mem = 2093015040 (1996MB)
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: date 06/23/99, BIOS32 rev. 0 @ 0xfd4be, SMBIOS rev. 2.8 @ 
> 0xf0cd0 (9 entries)
> bios0: vendor SeaBIOS version 
> "rel-1.7.5.1-0-g8936dbb-20141113_115728-nilsson.home.kraxel.org" date 
> 04/01/2014
> bios0: QEMU Standard PC (i440FX + PIIX, 1996)
> acpi0 at bios0: rev 0
> acpi0: sleep states S3 S4 S5
> acpi0: tables DSDT FACP SSDT APIC HPET
> acpi0: wakeup devices
> 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 1000MHz
> cpu1 at mainbus0: apid 1 (application processor)
> cpu1: Common 32-bit KVM processor ("GenuineIntel" 686-class) 3.41 GHz
> cpu1: 
> FPU,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,x2APIC,HV
> ioapic0 at mainbus0: apid 0 pa 0xfec0, version 11, 24 pins
> acpihpet0 at acpi0: 1 Hz
> acpiprt0 at acpi0: bus 0 (PCI0)
> acpicpu0 at acpi0: C1(@1 halt!)
> acpicpu1 at acpi0: C1(@1 halt!)
> "ACPI0006" at acpi0 not configured
> "PNP0303" at acpi0 not configured
> "PNP0F13" at acpi0 not configured
> "PNP0700" at acpi0 not configured
> "PNP0501" at acpi0 not configured
> "PNP0A06" at acpi0 not configured
> "ACPI0007" at acpi0 not configured
> "ACPI0007" at acpi0 not configured
> bios0: ROM list: 0xc/0x9200 0xc9800/0xa00 0xca800/0x2400 0xed000/0x3000!
> pvbus0 at mainbus0: KVM
> pci0 at mainbus0 bus 0: configuration mode 1 (bios)
> pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02
> pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00
> pciide0 at pci0 dev 1 function 1 "Intel 82371SB IDE" rev 0x00: DMA, channel 0 
> wired to compatibility, channel 1 wired to compatibility
> pciide0: channel 0 disabled (no drives)
> atapiscsi0 at pciide0 channel 1 drive 0
> scsibus1 at atapiscsi0: 2 targets
> cd0 at scsibus1 targ 0 lun 0:  ATAPI 5/cdrom 
> removable
> cd0(pciide0:1:0): using PIO

Re: xclock patch

2016-05-07 Thread Edgar Pettijohn


Sent from my iPhone

> On May 7, 2016, at 8:03 AM, Sebastien Marie  wrote:
> 
> On Sat, May 07, 2016 at 06:48:58AM -0500, Edgar Pettijohn wrote:
>>> 
>>> else, if it isn't in xclock code, it could be a open(2) call in some
>>> X11R6 library.
>> I looked all I found was access() which if I'm reading pledge correctly it 
>> doesn't need pledge. Is that right?
> 
> now, I am unsure about correctly understood your message :)
> 
I understand the manual now. When I saw the word "whitelist" it made me think 
access() was white listed but it's only certain files white listed.


> access(2) requires "rpath" too. But some paths could be whitelisted
> (only "/etc/localtime" and "/var/run/ypbind.lock").
> -- 
> Sebastien Marie
> 



Re: xclock patch

2016-05-07 Thread Edgar Pettijohn


Sent from my iPhone

> On May 6, 2016, at 11:49 PM, Sebastien Marie  wrote:
> 
> On Fri, May 06, 2016 at 01:29:11PM -0500, Edgar Pettijohn wrote:
>>> On May 6, 2016, at 12:13 PM, Matthieu Herrb  wrote:
>>> 
>>>> On Tue, May 03, 2016 at 11:40:31AM -0500, Edgar Pettijohn wrote:
>>>> I'll look at it this evening.
>>> 
>>> Ping...
>> 
>> Sorry. I tried to get it to reproduce and couldn't. Looked through the code 
>> and couldn't find anything.
> 
> if you still have the xclock.core file (and the same xclock binary), you
> could get a backtrace using gdb.
> 

Unfortunately I don't.
> 
> else, if it isn't in xclock code, it could be a open(2) call in some
> X11R6 library.
> 
I looked all I found was access() which if I'm reading pledge correctly it 
doesn't need pledge. Is that right?

> One possibility is error code path: in xterm, the commit message for
> justifying "rpath" is: for X11 error ("X Error of failed request: ...")
> which read at least /usr/X11R6/share/X11/XErrorDB.
> 
> Maybe we should identify correctly these open(2) call in X11R6 libraries ?
> -- 
> Sebastien Marie



Re: xclock patch

2016-05-06 Thread Edgar Pettijohn


Sent from my iPhone

> On May 6, 2016, at 12:13 PM, Matthieu Herrb  wrote:
> 
>> On Tue, May 03, 2016 at 11:40:31AM -0500, Edgar Pettijohn wrote:
>> I'll look at it this evening.
> 
> Ping...
> 

Sorry. I tried to get it to reproduce and couldn't. Looked through the code and 
couldn't find anything. 

>> Sent from my iPhone
>> 
>>>> On May 3, 2016, at 9:40 AM, Sebastien Marie  wrote:
>>>> 
>>>> On Mon, May 02, 2016 at 05:39:36PM -0500, Edgar Pettijohn wrote:
>>>> I saw this in /var/log/messages
>>>> 
>>>> May  2 17:19:07 thinkpad /bsd: xclock(81091): syscall 5 "rpath"
>>>> 
>>>> Does it mean xclock needs rpath?  If so here you go.
>>> 
>>> generally it is what it means: at some point, the program required
>>> "rpath" promise but didn't pledge it (so it was killed).
>>> 
>>> But it could be good for us to know *why* it needs it :)
>>> 
>>> Could you provide a way to reproduce it ? It could be command-line used,
>>> actions that have been done, or any others clues... a backtrace could
>>> also be very useful.
>>> 
>>> Thanks.
>>> -- 
>>> Sebastien Marie
> 
> -- 
> Matthieu Herrb



Re: xclock patch

2016-05-03 Thread Edgar Pettijohn
I'll look at it this evening.

Sent from my iPhone

> On May 3, 2016, at 9:40 AM, Sebastien Marie  wrote:
> 
>> On Mon, May 02, 2016 at 05:39:36PM -0500, Edgar Pettijohn wrote:
>> I saw this in /var/log/messages
>> 
>> May  2 17:19:07 thinkpad /bsd: xclock(81091): syscall 5 "rpath"
>> 
>> Does it mean xclock needs rpath?  If so here you go.
> 
> generally it is what it means: at some point, the program required
> "rpath" promise but didn't pledge it (so it was killed).
> 
> But it could be good for us to know *why* it needs it :)
> 
> Could you provide a way to reproduce it ? It could be command-line used,
> actions that have been done, or any others clues... a backtrace could
> also be very useful.
> 
> Thanks.
> -- 
> Sebastien Marie
> 



xclock patch

2016-05-02 Thread Edgar Pettijohn

I saw this in /var/log/messages

May  2 17:19:07 thinkpad /bsd: xclock(81091): syscall 5 "rpath"

Does it mean xclock needs rpath?  If so here you go.

Index: xclock.c
===
RCS file: /cvs/xenocara/app/xclock/xclock.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 xclock.c
--- xclock.c11 Nov 2015 21:12:19 -1.6
+++ xclock.c2 May 2016 22:37:28 -
@@ -228,7 +228,7 @@ main(int argc, char *argv[])
 #endif

 #ifdef HAVE_PLEDGE
-if (pledge("stdio", NULL) == -1)
+if (pledge("stdio rpath", NULL) == -1)
 err(1, "pledge");
 #endif




Re: dc patch

2016-04-21 Thread Edgar Pettijohn

nevermind just found the elusive "q"

On 04/21/16 22:10, Edgar Pettijohn wrote:

While playing with dc discovered you can't control-c to get out.

Probably not the best way, but here goes.

Index: dc.c
===
RCS file: /cvs/src/usr.bin/dc/dc.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 dc.c
--- dc.c3 Nov 2015 04:58:58 -1.17
+++ dc.c22 Apr 2016 03:07:35 -
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,12 @@ usage(void)
 exit(1);
 }

+void
+onintr(int signo)
+{
+_exit(1);
+}
+
 int
 dc_main(int argc, char *argv[])
 {
@@ -109,6 +116,9 @@ dc_main(int argc, char *argv[])

 if (pledge("stdio", NULL) == -1)
 err(1, "pledge");
+
+(void)signal(SIGINT, onintr);
+(void)signal(SIGQUIT, onintr);

 src_setstream(&src, stdin);
 reset_bmachine(&src);
Index: extern.h
===
RCS file: /cvs/src/usr.bin/dc/extern.h,v
retrieving revision 1.5
diff -u -p -u -r1.5 extern.h
--- extern.h10 Oct 2015 19:28:54 -1.5
+++ extern.h22 Apr 2016 03:08:01 -
@@ -61,4 +61,6 @@ voidframe_assign(struct stack *, size_
 struct value *frame_retrieve(const struct stack *, size_t);
 /* voidframe_free(struct stack *); */

+/* dc.c */
 intdc_main(int, char **);
+voidonintr(int signo);





dc patch

2016-04-21 Thread Edgar Pettijohn

While playing with dc discovered you can't control-c to get out.

Probably not the best way, but here goes.

Index: dc.c
===
RCS file: /cvs/src/usr.bin/dc/dc.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 dc.c
--- dc.c3 Nov 2015 04:58:58 -1.17
+++ dc.c22 Apr 2016 03:07:35 -
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,12 @@ usage(void)
 exit(1);
 }

+void
+onintr(int signo)
+{
+_exit(1);
+}
+
 int
 dc_main(int argc, char *argv[])
 {
@@ -109,6 +116,9 @@ dc_main(int argc, char *argv[])

 if (pledge("stdio", NULL) == -1)
 err(1, "pledge");
+
+(void)signal(SIGINT, onintr);
+(void)signal(SIGQUIT, onintr);

 src_setstream(&src, stdin);
 reset_bmachine(&src);
Index: extern.h
===
RCS file: /cvs/src/usr.bin/dc/extern.h,v
retrieving revision 1.5
diff -u -p -u -r1.5 extern.h
--- extern.h10 Oct 2015 19:28:54 -1.5
+++ extern.h22 Apr 2016 03:08:01 -
@@ -61,4 +61,6 @@ voidframe_assign(struct stack *, size_
 struct value *frame_retrieve(const struct stack *, size_t);
 /* voidframe_free(struct stack *); */

+/* dc.c */
 intdc_main(int, char **);
+voidonintr(int signo);



hoststat & purgestat

2016-04-18 Thread Edgar Pettijohn

I noticed these stragglers today and assumed I missed a step in an upgrade then 
realized this laptop never had anything older than 5.8.

Index: upgrade57.html
===
RCS file: /cvs/www/faq/upgrade57.html,v
retrieving revision 1.15
diff -u -p -u -r1.15 upgrade57.html
--- upgrade57.html  15 Apr 2016 20:39:49 -  1.15
+++ upgrade57.html  19 Apr 2016 03:24:43 -
@@ -446,6 +446,7 @@ rm -f /etc/rc.d/sendmail
 rm -f/usr/lib/{libmilter.a,libmilter.so.3.0,libmilter_p.a}
 rm -f /usr/libexec/smrsh
 rm -f/usr/sbin/{editmap,mailstats,praliases}
+rm -f/usr/bin/{hoststat,purgestat}
 rm -f /usr/share/man/man1/{hoststat.1,praliases.1,purgestat.1}
 rm -f /usr/share/man/man8/{editmap.8,mailq.8,mailstats.8,smrsh.8}
 rm -f /var/log/sendmail.st



Re: tcpdump man page

2016-04-09 Thread Edgar Pettijohn



On 04/09/16 21:51, Ted Unangst wrote:

Edgar Pettijohn wrote:

The -i flag doesn't appear to do what the man page suggests. Correcting
the source is above my paygrade, but the man page isn't.

hmm? what do you think tcpdump does if -i isn't specified?


totally misread. thought it meant more like so:

# tcpdump -i

would act like

# tcpdump

Index: tcpdump.8
===
RCS file: /cvs/src/usr.sbin/tcpdump/tcpdump.8,v
retrieving revision 1.88
diff -u -p -u -r1.88 tcpdump.8
--- tcpdump.85 Nov 2015 09:56:21 -1.88
+++ tcpdump.810 Apr 2016 02:44:27 -
@@ -121,13 +121,6 @@ Print the interface on each dump line.
   .It Fl i Ar interface
   Listen on
   .Ar interface .
-If unspecified,
-.Nm
-searches the system interface list for the lowest numbered, configured
-.Dq up
-interface
-.Pq excluding loopback .
-Ties are broken by choosing the earliest match.
   .It Fl L
   List the supported data link types for the interface and exit.
   .It Fl l





tcpdump man page

2016-04-09 Thread Edgar Pettijohn
The -i flag doesn't appear to do what the man page suggests. Correcting 
the source is above my paygrade, but the man page isn't.


Index: tcpdump.8
===
RCS file: /cvs/src/usr.sbin/tcpdump/tcpdump.8,v
retrieving revision 1.88
diff -u -p -u -r1.88 tcpdump.8
--- tcpdump.85 Nov 2015 09:56:21 -1.88
+++ tcpdump.810 Apr 2016 02:44:27 -
@@ -121,13 +121,6 @@ Print the interface on each dump line.
 .It Fl i Ar interface
 Listen on
 .Ar interface .
-If unspecified,
-.Nm
-searches the system interface list for the lowest numbered, configured
-.Dq up
-interface
-.Pq excluding loopback .
-Ties are broken by choosing the earliest match.
 .It Fl L
 List the supported data link types for the interface and exit.
 .It Fl l



stty header cleanup

2016-03-19 Thread Edgar Pettijohn

Index: cchar.c
===
RCS file: /cvs/src/bin/stty/cchar.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 cchar.c
--- cchar.c27 Oct 2009 23:59:22 -1.11
+++ cchar.c16 Mar 2016 23:53:58 -
@@ -30,6 +30,7 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 

 #include 
@@ -37,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "stty.h"
 #include "extern.h"
Index: gfmt.c
===
RCS file: /cvs/src/bin/stty/gfmt.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 gfmt.c
--- gfmt.c28 Oct 2009 07:12:59 -1.8
+++ gfmt.c16 Mar 2016 23:54:29 -
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "stty.h"
 #include "extern.h"
Index: key.c
===
RCS file: /cvs/src/bin/stty/key.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 key.c
--- key.c20 Nov 2015 15:57:39 -1.16
+++ key.c16 Mar 2016 23:55:51 -
@@ -30,14 +30,16 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 

 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
+#include 

 #include "stty.h"
 #include "extern.h"
Index: modes.c
===
RCS file: /cvs/src/bin/stty/modes.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 modes.c
--- modes.c27 Oct 2009 23:59:22 -1.10
+++ modes.c16 Mar 2016 23:56:40 -
@@ -31,8 +31,11 @@
  */

 #include 
+
 #include 
 #include 
+#include 
+
 #include "stty.h"
 #include "extern.h"

Index: print.c
===
RCS file: /cvs/src/bin/stty/print.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 print.c
--- print.c27 Oct 2009 23:59:22 -1.13
+++ print.c16 Mar 2016 23:57:24 -
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "stty.h"
 #include "extern.h"
Index: stty.c
===
RCS file: /cvs/src/bin/stty/stty.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 stty.c
--- stty.c20 Nov 2015 15:58:28 -1.18
+++ stty.c16 Mar 2016 23:58:14 -
@@ -30,16 +30,18 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 

 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 

 #include "stty.h"
Index: stty.h
===
RCS file: /cvs/src/bin/stty/stty.h,v
retrieving revision 1.4
diff -u -p -u -r1.4 stty.h
--- stty.h2 Jun 2003 23:32:09 -1.4
+++ stty.h16 Mar 2016 23:52:41 -
@@ -32,9 +32,6 @@
  *@(#)stty.h8.1 (Berkeley) 5/31/93
  */

-#include 
-#include 
-
 struct info {
 int fd;/* file descriptor */
 int ldisc;/* line discipline */



cron funcs.h patch

2016-03-19 Thread Edgar Pettijohn

I guess I could have organized alphabetically.  Still can if preferred.

Index: funcs.h
===
RCS file: /cvs/src/usr.sbin/cron/funcs.h,v
retrieving revision 1.28
diff -u -p -u -r1.28 funcs.h
--- funcs.h14 Nov 2015 13:09:14 -1.28
+++ funcs.h20 Mar 2016 01:43:01 -
@@ -19,39 +19,51 @@

 /* Notes:
  *This file has to be included by cron.h after data structure defs.
- *We should reorg this into sections by module.
  */

-voidload_database(cron_db **),
-job_add(entry *, user *),
-do_command(entry *, user *),
-free_user(user *),
-env_free(char **),
-unget_char(int, FILE *),
-free_entry(entry *),
-skip_comments(FILE *),
-poke_daemon(unsigned char),
-atrun(at_db *, double, time_t);
-
-intjob_runqueue(void),
-get_char(FILE *),
-get_string(char *, int, FILE *, char *),
-load_env(char *, FILE *),
-cron_pclose(FILE *, pid_t),
-allowed(const char *, const char *, const char *),
-safe_p(const char *, const char *),
-scan_atjobs(at_db **, struct timespec *);
-
-char*env_get(char *, char **),
-*first_word(char *, char *),
-**env_init(void),
-**env_copy(char **),
-**env_set(char **, char *);
-
-user*load_user(int, struct passwd *, const char *),
-*find_user(cron_db *, const char *);
-
-entry*load_entry(FILE *,
-void (*)(const char *), struct passwd *, char **);
-
-FILE*cron_popen(char *, char *, struct passwd *, pid_t *);
+/* database.c */
+voidload_database(cron_db **);
+user   *find_user(cron_db *, const char *);
+
+/* job.c */
+voidjob_add(entry *, user *);
+intjob_runqueue(void);
+
+/* do_command.c */
+voiddo_command(entry *, user *);
+intsafe_p(const char *, const char *);
+
+/* user.c */
+voidfree_user(user *);
+user   *load_user(int, struct passwd *, const char *);
+
+/* env.c */
+voidenv_free(char **);
+intload_env(char *, FILE *);
+char   *env_get(char *, char **);
+char  **env_init(void);
+char  **env_copy(char **);
+char  **env_set(char **, char *);
+
+/* misc.c */
+voidunget_char(int, FILE *);
+voidskip_comments(FILE *);
+intget_char(FILE *);
+intget_string(char *, int, FILE *, char *);
+char   *first_word(char *, char *);
+
+/* entry.c */
+voidfree_entry(entry *);
+entry   *load_entry(FILE *,
+void (*)(const char *), struct passwd *, char **);
+/* client.c */
+voidpoke_daemon(unsigned char);
+intallowed(const char *, const char *, const char *);
+
+/* atrun.c */
+voidatrun(at_db *, double, time_t);
+intscan_atjobs(at_db **, struct timespec *);
+
+/* popen.c */
+intcron_pclose(FILE *, pid_t);
+FILE   *cron_popen(char *, char *, struct passwd *, pid_t *);



csh header cleanup

2016-03-19 Thread Edgar Pettijohn

Index: alloc.c
===
RCS file: /cvs/src/bin/csh/alloc.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 alloc.c
--- alloc.c26 Dec 2015 13:48:38 -1.17
+++ alloc.c16 Mar 2016 22:47:56 -
@@ -30,12 +30,18 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 
-#include 
-#include 
+
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 

 #include "csh.h"
+#include "error.h"
 #include "extern.h"

 void *
Index: char.h
===
RCS file: /cvs/src/bin/csh/char.h,v
retrieving revision 1.5
diff -u -p -u -r1.5 char.h
--- char.h26 Oct 2015 15:01:15 -1.5
+++ char.h15 Mar 2016 02:20:05 -
@@ -32,8 +32,6 @@
  *@(#)char.h8.1 (Berkeley) 5/31/93
  */

-#include 
-
 extern unsigned short _cmap[];

 #define_QF0x0001/* '" (Forward quotes) */
Index: const.c
===
RCS file: /cvs/src/bin/csh/const.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 const.c
--- const.c26 Oct 2015 16:27:04 -1.8
+++ const.c15 Mar 2016 01:56:33 -
@@ -34,6 +34,13 @@
  * tc.const.c: String constants for csh.
  */

+#include 
+#include 
+
+#include 
+#include 
+#include 
+
 #include "csh.h"

 Char STR0[]= { '0', '\0' };
Index: csh.c
===
RCS file: /cvs/src/bin/csh/csh.c,v
retrieving revision 1.37
diff -u -p -u -r1.37 csh.c
--- csh.c26 Dec 2015 13:48:38 -1.37
+++ csh.c16 Mar 2016 22:49:38 -
@@ -30,24 +30,33 @@
  * SUCH DAMAGE.
  */

-#include 
 #include 
+#include 
 #include 
-#include 
+#include 
+
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
-#include 
 #include 
-#include 
 #include 
-#include 

 #include "csh.h"
-#include "proc.h"
+#include "const.h"
+#include "dir.h"
+#include "error.h"
 #include "extern.h"
 #include "pathnames.h"
+#include "proc.h"

 /*
  * C Shell
Index: csh.h
===
RCS file: /cvs/src/bin/csh/csh.h,v
retrieving revision 1.28
diff -u -p -u -r1.28 csh.h
--- csh.h26 Dec 2015 13:48:38 -1.28
+++ csh.h15 Mar 2016 01:46:58 -
@@ -65,15 +65,10 @@ typedef short Char;

 typedef void *ioctl_t;/* Third arg of ioctl */

-#include "const.h"
-#include "char.h"
-#include "error.h"
-
 #define xmalloc(i)Malloc(i)
 #define xreallocarray(p, i, j)Reallocarray(p, i, j)
 #define xcalloc(n, s)Calloc(n, s)

-#include 
 FILE *cshin, *cshout, *csherr;

 #defineisdir(d)(S_ISDIR(d.st_mode))
@@ -118,10 +113,6 @@ Char   *ffile;/* Name of shell file f

 char   *seterr;/* Error message from scanner/parser */

-#include 
-#include 
-#include 
-
 struct timeval time0;/* Time at which the shell started */
 struct rusage ru0;

@@ -160,7 +151,6 @@ int   OLDSTD;/* Old standard input (d
  * Because of source commands and .cshrc we need nested error catches.
  */

-#include 
 jmp_buf reslab;
 int exitset;

@@ -172,7 +162,6 @@ int exitset;

 Char   *gointr;/* Label for an onintr transfer */

-#include 
 sig_t parintr;/* Parents interrupt catch */
 sig_t parterm;/* Parents terminate catch */

@@ -476,7 +465,6 @@ Char   *word_chars;

 Char   *STR_SHELLPATH;

-#include 
 Char   *STR_BSHELL;
 Char   *STR_WORD_CHARS;
 Char  **STR_environ;
Index: dir.c
===
RCS file: /cvs/src/bin/csh/dir.c,v
retrieving revision 1.21
diff -u -p -u -r1.21 dir.c
--- dir.c26 Dec 2015 13:48:38 -1.21
+++ dir.c16 Mar 2016 22:50:15 -
@@ -30,16 +30,25 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 
+
+#include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
-#include 
-#include 

 #include "csh.h"
+#include "char.h"
+#include "const.h"
 #include "dir.h"
+#include "error.h"
 #include "extern.h"

 /* Directory management. */
Index: dol.c
===
RCS file: /cvs/src/bin/csh/dol.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 dol.c
--- dol.c26 Dec 2015 13:48:38 -1.20
+++ dol.c16 Mar 2016 22:50:51 -
@@ -30,15 +30,24 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 
-#include 
+
+#include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
-#include 

+#include "char.h"
 #include "csh.h"
+#include "const.h"
+#include "error.h"
 #include "extern.h"

 /*
Index: error.c
===
RCS file: /cvs/src/bin/csh/error.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 error.c
--- error.c26 Dec 2015 13:48:38 -1.12
+++ error.c16 Mar 2016 22:51:14 -
@@ -30,12 +30,1

ed header cleanup

2016-03-19 Thread Edgar Pettijohn

Index: buf.c
===
RCS file: /cvs/src/bin/ed/buf.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 buf.c
--- buf.c9 Oct 2015 19:47:02 -1.22
+++ buf.c16 Mar 2016 23:23:53 -
@@ -30,6 +30,15 @@
  */

 #include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 

 #include "ed.h"

Index: ed.h
===
RCS file: /cvs/src/bin/ed/ed.h,v
retrieving revision 1.21
diff -u -p -u -r1.21 ed.h
--- ed.h9 Oct 2015 21:24:05 -1.21
+++ ed.h16 Mar 2016 23:11:41 -
@@ -30,16 +30,6 @@
  *@(#)ed.h,v 1.5 1994/02/01 00:34:39 alm Exp
  */

-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
 #define ERR(-2)
 #define EMOD(-3)
 #define FATAL(-4)
Index: glbl.c
===
RCS file: /cvs/src/bin/ed/glbl.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 glbl.c
--- glbl.c9 Oct 2015 20:27:28 -1.17
+++ glbl.c16 Mar 2016 23:26:10 -
@@ -32,6 +32,12 @@
 #include 
 #include 

+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include "ed.h"

 static int set_active_node(line_t *);
Index: io.c
===
RCS file: /cvs/src/bin/ed/io.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 io.c
--- io.c9 Oct 2015 20:27:28 -1.18
+++ io.c16 Mar 2016 23:28:09 -
@@ -28,6 +28,12 @@
  * SUCH DAMAGE.
  */

+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include "ed.h"

 static int read_stream(FILE *, int);
Index: main.c
===
RCS file: /cvs/src/bin/ed/main.c,v
retrieving revision 1.56
diff -u -p -u -r1.56 main.c
--- main.c20 Nov 2015 08:53:28 -1.56
+++ main.c16 Mar 2016 23:31:16 -
@@ -44,11 +44,19 @@
 #include 
 #include 
 #include 
+
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
-#include 
-#include 

 #include "ed.h"

Index: re.c
===
RCS file: /cvs/src/bin/ed/re.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 re.c
--- re.c9 Oct 2015 21:24:05 -1.16
+++ re.c16 Mar 2016 23:34:46 -
@@ -29,6 +29,12 @@
  * SUCH DAMAGE.
  */

+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include "ed.h"

 static char *extract_pattern(int);
Index: sub.c
===
RCS file: /cvs/src/bin/ed/sub.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 sub.c
--- sub.c9 Oct 2015 20:27:28 -1.14
+++ sub.c16 Mar 2016 23:36:29 -
@@ -29,6 +29,13 @@
  * SUCH DAMAGE.
  */

+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include "ed.h"

 static char *extract_subst_template(void);
Index: undo.c
===
RCS file: /cvs/src/bin/ed/undo.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 undo.c
--- undo.c9 Oct 2015 19:47:02 -1.13
+++ undo.c16 Mar 2016 23:37:46 -
@@ -28,8 +28,12 @@
  * SUCH DAMAGE.
  */

-#include "ed.h"
+#include 
+#include 
+#include 
+#include 

+#include "ed.h"

 #define USIZE 100/* undo stack size */
 static undo_t *ustack = NULL;/* undo stack */



battlestar include patch

2016-03-13 Thread Edgar Pettijohn

Index: dayfile.c
===
RCS file: /cvs/src/games/battlestar/dayfile.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 dayfile.c
--- dayfile.c22 Nov 2009 09:16:02 -1.12
+++ dayfile.c13 Mar 2016 16:13:48 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 struct room dayfile[] = {
Index: dayobjs.c
===
RCS file: /cvs/src/games/battlestar/dayobjs.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 dayobjs.c
--- dayobjs.c27 Oct 2009 23:59:24 -1.7
+++ dayobjs.c13 Mar 2016 16:14:23 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 const struct objs dayobjs[] = {
Index: extern.h
===
RCS file: /cvs/src/games/battlestar/extern.h,v
retrieving revision 1.20
diff -u -p -u -r1.20 extern.h
--- extern.h31 Dec 2015 17:51:19 -1.20
+++ extern.h13 Mar 2016 16:10:52 -
@@ -32,8 +32,6 @@
  *@(#)extern.h8.1 (Berkeley) 5/31/93
  */

-#include 
-
 #define BITS (8 * sizeof (int))

 #define OUTSIDE(position > 68 && position < 246 && position != 
218)

Index: globals.c
===
RCS file: /cvs/src/games/battlestar/globals.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 globals.c
--- globals.c5 Apr 2013 01:28:27 -1.14
+++ globals.c13 Mar 2016 16:13:35 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 int WEIGHT = MAXWEIGHT;
Index: misc.c
===
RCS file: /cvs/src/games/battlestar/misc.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 misc.c
--- misc.c27 Oct 2009 23:59:24 -1.8
+++ misc.c13 Mar 2016 16:12:58 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 /* for beenthere, injuries */
Index: nightfile.c
===
RCS file: /cvs/src/games/battlestar/nightfile.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 nightfile.c
--- nightfile.c27 Oct 2009 23:59:24 -1.11
+++ nightfile.c13 Mar 2016 16:14:07 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 struct room nightfile[] = {
Index: nightobjs.c
===
RCS file: /cvs/src/games/battlestar/nightobjs.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 nightobjs.c
--- nightobjs.c27 Oct 2009 23:59:24 -1.7
+++ nightobjs.c13 Mar 2016 16:14:40 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 const struct objs nightobjs[] = {
Index: words.c
===
RCS file: /cvs/src/games/battlestar/words.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 words.c
--- words.c27 Oct 2009 23:59:24 -1.10
+++ words.c13 Mar 2016 16:14:56 -
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 struct wlist wlist[] = {



backgammon include patch

2016-03-13 Thread Edgar Pettijohn
i'm really surprised that this saved 20s in build time.  i guess its 
worthwhile.


Index: backgammon/extra.c
===
RCS file: /cvs/src/games/backgammon/backgammon/extra.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 extra.c
--- backgammon/extra.c30 Nov 2015 08:19:25 -1.8
+++ backgammon/extra.c13 Mar 2016 03:31:03 -
@@ -29,6 +29,9 @@
  * SUCH DAMAGE.
  */

+#include 
+#include 
+
 #include "back.h"
 #include "backlocal.h"

Index: backgammon/main.c
===
RCS file: /cvs/src/games/backgammon/backgammon/main.c,v
retrieving revision 1.23
diff -u -p -u -r1.23 main.c
--- backgammon/main.c3 Jan 2016 14:38:16 -1.23
+++ backgammon/main.c13 Mar 2016 03:37:21 -
@@ -29,7 +29,10 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 
+#include 
+#include 

 #include "back.h"
 #include "backlocal.h"
Index: backgammon/move.c
===
RCS file: /cvs/src/games/backgammon/backgammon/move.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 move.c
--- backgammon/move.c30 Nov 2015 08:19:25 -1.13
+++ backgammon/move.c13 Mar 2016 03:40:02 -
@@ -29,6 +29,10 @@
  * SUCH DAMAGE.
  */

+#include 
+#include 
+#include 
+
 #include "back.h"
 #include "backlocal.h"

Index: backgammon/pubeval.c
===
RCS file: /cvs/src/games/backgammon/backgammon/pubeval.c,v
retrieving revision 1.3
diff -u -p -u -r1.3 pubeval.c
--- backgammon/pubeval.c30 Nov 2015 08:19:25 -1.3
+++ backgammon/pubeval.c13 Mar 2016 03:41:28 -
@@ -33,6 +33,8 @@
  * (negative integer).
  */

+#include 
+
 #include "back.h"
 #include "backlocal.h"

Index: backgammon/text.c
===
RCS file: /cvs/src/games/backgammon/backgammon/text.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 text.c
--- backgammon/text.c30 Nov 2015 08:19:25 -1.9
+++ backgammon/text.c13 Mar 2016 15:25:14 -
@@ -29,6 +29,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "back.h"

 const char *const instruct[] = {
Index: common_source/allow.c
===
RCS file: /cvs/src/games/backgammon/common_source/allow.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 allow.c
--- common_source/allow.c30 Nov 2015 08:19:25 -1.6
+++ common_source/allow.c13 Mar 2016 15:47:47 -
@@ -29,6 +29,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "back.h"

 int
Index: common_source/back.h
===
RCS file: /cvs/src/games/backgammon/common_source/back.h,v
retrieving revision 1.15
diff -u -p -u -r1.15 back.h
--- common_source/back.h26 Dec 2015 00:26:39 -1.15
+++ common_source/back.h13 Mar 2016 03:18:33 -
@@ -31,18 +31,6 @@
  *@(#)back.h8.1 (Berkeley) 5/31/93
  */

-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
 #define rnum(r)arc4random_uniform(r)
 #define D0dice[0]
 #define D1dice[1]
Index: common_source/board.c
===
RCS file: /cvs/src/games/backgammon/common_source/board.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 board.c
--- common_source/board.c30 Nov 2015 08:19:25 -1.10
+++ common_source/board.c13 Mar 2016 15:48:23 -
@@ -29,6 +29,10 @@
  * SUCH DAMAGE.
  */

+#include 
+
+#include 
+
 #include "back.h"

 void
Index: common_source/check.c
===
RCS file: /cvs/src/games/backgammon/common_source/check.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 check.c
--- common_source/check.c30 Nov 2015 08:19:25 -1.7
+++ common_source/check.c13 Mar 2016 15:46:27 -
@@ -29,6 +29,11 @@
  * SUCH DAMAGE.
  */

+#include 
+
+#include 
+#include 
+
 #include "back.h"

 void
Index: common_source/fancy.c
===
RCS file: /cvs/src/games/backgammon/common_source/fancy.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 fancy.c
--- common_source/fancy.c30 Nov 2015 08:19:25 -1.13
+++ common_source/fancy.c13 Mar 2016 03:32:43 -
@@ -29,7 +29,10 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 
+#include 
+
 #include "back.h"

 int oldb[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
Index: common_source/init.c
===
RCS file: /cvs/src/games/backgammon/common_source/init.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 init.c
--- common_source/init.c2 Dec 2015 20:05:01 -1.11
+++ common_source/init.c13 Mar 2016 15:43:48 -
@@ -33,11 +33,13 @@
  * variable initialization.
  */

+#include 
+
 #ifde

adventure patch

2016-03-12 Thread Edgar Pettijohn

Tried to start this project last week, but kept f'ing it up.

Index: src/games/adventure/crc.c
===
RCS file: /cvs/src/games/adventure/crc.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 crc.c
--- src/games/adventure/crc.c27 Oct 2009 23:59:23 -1.7
+++ src/games/adventure/crc.c13 Mar 2016 02:36:23 -
@@ -33,6 +33,8 @@
  * SUCH DAMAGE.
  */

+#include 
+
 #include "extern.h"

 unsigned long crctab[] = {
Index: src/games/adventure/done.c
===
RCS file: /cvs/src/games/adventure/done.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 done.c
--- src/games/adventure/done.c27 Oct 2009 23:59:23 -1.8
+++ src/games/adventure/done.c13 Mar 2016 02:38:24 -
@@ -37,8 +37,10 @@

 /*Re-coding of advent in C: termination routines*/

+#include 
 #include 
 #include 
+
 #include "hdr.h"
 #include "extern.h"

Index: src/games/adventure/init.c
===
RCS file: /cvs/src/games/adventure/init.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 init.c
--- src/games/adventure/init.c3 Jan 2016 14:38:16 -1.14
+++ src/games/adventure/init.c13 Mar 2016 02:48:52 -
@@ -38,6 +38,7 @@
 /*Re-coding of advent in C: data initialization*/

 #include 
+
 #include 
 #include 
 #include 
Index: src/games/adventure/io.c
===
RCS file: /cvs/src/games/adventure/io.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 io.c
--- src/games/adventure/io.c22 Aug 2015 14:47:40 -1.20
+++ src/games/adventure/io.c13 Mar 2016 02:49:03 -
@@ -38,9 +38,11 @@
 /*Re-coding of advent in C: file i/o and user i/o*/

 #include 
+#include 
 #include 
 #include 
 #include 
+
 #include "hdr.h"
 #include "extern.h"

Index: src/games/adventure/main.c
===
RCS file: /cvs/src/games/adventure/main.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 main.c
--- src/games/adventure/main.c7 Jan 2016 16:00:31 -1.22
+++ src/games/adventure/main.c13 Mar 2016 02:49:17 -
@@ -41,7 +41,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+
 #include "hdr.h"
 #include "extern.h"

Index: src/games/adventure/save.c
===
RCS file: /cvs/src/games/adventure/save.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 save.c
--- src/games/adventure/save.c8 Dec 2014 21:56:27 -1.10
+++ src/games/adventure/save.c13 Mar 2016 02:49:25 -
@@ -35,8 +35,10 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 
 #include 
+
 #include "hdr.h"
 #include "extern.h"

Index: src/games/adventure/subr.c
===
RCS file: /cvs/src/games/adventure/subr.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 subr.c
--- src/games/adventure/subr.c27 Oct 2009 23:59:23 -1.10
+++ src/games/adventure/subr.c13 Mar 2016 02:50:28 -
@@ -37,8 +37,11 @@

 /*Re-coding of advent in C: subroutines from main*/

+#include 
 #include 
 #include 
+#include 
+
 #include "hdr.h"
 #include "extern.h"

Index: src/games/adventure/vocab.c
===
RCS file: /cvs/src/games/adventure/vocab.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 vocab.c
--- src/games/adventure/vocab.c13 Jul 2014 19:40:57 -  1.14
+++ src/games/adventure/vocab.c13 Mar 2016 02:50:36 -
@@ -38,8 +38,11 @@
 /*Re-coding of advent in C: data structure routines*/

 #include 
+#include 
 #include 
 #include 
+#include 
+
 #include "hdr.h"
 #include "extern.h"

Index: src/games/adventure/wizard.c
===
RCS file: /cvs/src/games/adventure/wizard.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 wizard.c
--- src/games/adventure/wizard.c3 Jan 2016 14:38:16 -  1.18
+++ src/games/adventure/wizard.c13 Mar 2016 02:50:44 -
@@ -38,6 +38,7 @@
 /*Re-coding of advent in C: privileged operations*/

 #include 
+#include 
 #include 
 #include 
 #include 
Index: src/games/adventure/extern.h
===
RCS file: /cvs/src/games/adventure/extern.h,v
retrieving revision 1.9
diff -u -p -u -r1.9 extern.h
--- src/games/adventure/extern.h1 Jan 2016 15:56:04 -1.9
+++ src/games/adventure/extern.h13 Mar 2016 02:34:17 -
@@ -30,9 +30,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

-#include 
-#include 
-
 /* crc.c */
 void crc_start(void);
 unsigned long crc(const char *, int);
Index: src/games/adventure/hdr.h
===
RCS file: /cvs/src/games/adventure/hdr.h,v
retrieving r

Re: /usr/games/adventure include clean up

2016-03-06 Thread Edgar Pettijohn

--- io.c.origSun Mar  6 12:43:12 2016
+++ io.cSun Mar  6 12:43:36 2016
@@ -37,7 +37,9 @@

 /*Re-coding of advent in C: file i/o and user i/o*/

+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
--- subr.c.origSun Mar  6 12:39:53 2016
+++ subr.cSun Mar  6 12:42:36 2016
@@ -37,8 +37,11 @@

 /*Re-coding of advent in C: subroutines from main*/

+#include 
+#include 
 #include 
 #include 
+#include 
 #include "hdr.h"
 #include "extern.h"

--- wizard.c.origSun Mar  6 12:40:09 2016
+++ wizard.cSun Mar  6 12:40:59 2016
@@ -37,11 +37,12 @@

 /*Re-coding of advent in C: privileged operations*/

+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
-
 #include "extern.h"
 #include "hdr.h"



On 03/06/16 12:35, Michael McConville wrote:

The sys includes should be first and separate. See style(9).

Edgar Pettijohn wrote:

--- crc.c.origSun Mar  6 10:31:34 2016
+++ crc.cSun Mar  6 10:31:55 2016
@@ -33,6 +33,7 @@
   * SUCH DAMAGE.
   */

+#include 
  #include "extern.h"

  unsigned long crctab[] = {
--- done.c.origSun Mar  6 10:40:59 2016
+++ done.cSun Mar  6 10:42:25 2016
@@ -37,8 +37,10 @@

  /*Re-coding of advent in C: termination routines*/

+#include 
  #include 
  #include 
+#include 
  #include "hdr.h"
  #include "extern.h"

--- extern.h.origSun Mar  6 10:24:01 2016
+++ extern.hSun Mar  6 10:24:10 2016
@@ -30,9 +30,6 @@
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   */

-#include 
-#include 
-
  /* crc.c */
  void crc_start(void);
  unsigned long crc(const char *, int);
--- hdr.h.origSun Mar  6 10:40:26 2016
+++ hdr.hSun Mar  6 10:40:43 2016
@@ -52,9 +52,6 @@

  /* hdr.h: included by c advent files */

-#include 
-#include 
-
  int datfd;/* message file descriptor*/
  volatile sig_atomic_t delhit;
  int yea;
--- io.c.origSun Mar  6 10:47:06 2016
+++ io.cSun Mar  6 10:47:42 2016
@@ -38,9 +38,11 @@
  /*Re-coding of advent in C: file i/o and user i/o*/

  #include 
+#include 
  #include 
  #include 
  #include 
+#include 
  #include "hdr.h"
  #include "extern.h"

--- main.c.origSun Mar  6 10:25:22 2016
+++ main.cSun Mar  6 10:25:38 2016
@@ -41,6 +41,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include "hdr.h"
  #include "extern.h"
--- save.c.origSun Mar  6 10:42:59 2016
+++ save.cSun Mar  6 10:43:46 2016
@@ -35,6 +35,7 @@
   * SUCH DAMAGE.
   */

+#include 
  #include 
  #include 
  #include "hdr.h"
--- subr.c.origSun Mar  6 10:26:03 2016
+++ subr.cSun Mar  6 10:45:14 2016
@@ -37,8 +37,11 @@

  /*Re-coding of advent in C: subroutines from main*/

+#include 
  #include 
  #include 
+#include 
+#include 
  #include "hdr.h"
  #include "extern.h"

--- vocab.c.origSun Mar  6 10:26:40 2016
+++ vocab.cSun Mar  6 10:46:00 2016
@@ -38,8 +38,11 @@
  /*Re-coding of advent in C: data structure routines*/

  #include 
+#include 
  #include 
  #include 
+#include 
+#include 
  #include "hdr.h"
  #include "extern.h"

--- wizard.c.origSun Mar  6 10:46:17 2016
+++ wizard.cSun Mar  6 10:46:55 2016
@@ -38,9 +38,11 @@
  /*Re-coding of advent in C: privileged operations*/

  #include 
+#include 
  #include 
  #include 
  #include 
+#include 
  #include "extern.h"
  #include "hdr.h"





Re: rdist.c patch

2016-03-06 Thread Edgar Pettijohn



On 03/06/16 00:12, Philip Guenther wrote:

On Sun, Feb 28, 2016 at 1:35 PM, Edgar Pettijohn
 wrote:

--- rdist.c.origSun Feb 28 15:29:27 2016
+++ rdist.cSun Feb 28 15:32:06 2016
@@ -57,8 +57,7 @@
  char   *path_remsh = NULL;

  static void addhostlist(char *, struct namelist **);
-static void usage(void);
-int main(int, char **, char **);
+__dead void usage(void);

Why remove the 'static'?


Does anyone know if the gcc community has settled on a Best Practice
for where to place attributes relative to storage specifiers such as
'static'?  I.e., which of these is considered better by the gcc 5.x+
community:
attribute((noreturn)) static void foo(void);
static attribute((noreturn)) void foo(void);
?

We have an ugly mix of those and others currently.



-(void) fprintf(stderr,
+fprintf(stderr,

IMO, removing casts to void like this are an all-or-none affair.

I think I was the last dev still using rdist.  Since 5.8 I've almost
completely switched to rsync.  Maybe the diff to apply in this case is
to usr.bin/Makefile, removing rdist and rdistd.

Anyone still *using* rdist?


Philip Guenther


/etc/daily

if configured to do so that is.



/usr/games/adventure include clean up

2016-03-06 Thread Edgar Pettijohn

--- crc.c.origSun Mar  6 10:31:34 2016
+++ crc.cSun Mar  6 10:31:55 2016
@@ -33,6 +33,7 @@
  * SUCH DAMAGE.
  */

+#include 
 #include "extern.h"

 unsigned long crctab[] = {
--- done.c.origSun Mar  6 10:40:59 2016
+++ done.cSun Mar  6 10:42:25 2016
@@ -37,8 +37,10 @@

 /*Re-coding of advent in C: termination routines*/

+#include 
 #include 
 #include 
+#include 
 #include "hdr.h"
 #include "extern.h"

--- extern.h.origSun Mar  6 10:24:01 2016
+++ extern.hSun Mar  6 10:24:10 2016
@@ -30,9 +30,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

-#include 
-#include 
-
 /* crc.c */
 void crc_start(void);
 unsigned long crc(const char *, int);
--- hdr.h.origSun Mar  6 10:40:26 2016
+++ hdr.hSun Mar  6 10:40:43 2016
@@ -52,9 +52,6 @@

 /* hdr.h: included by c advent files */

-#include 
-#include 
-
 int datfd;/* message file descriptor*/
 volatile sig_atomic_t delhit;
 int yea;
--- io.c.origSun Mar  6 10:47:06 2016
+++ io.cSun Mar  6 10:47:42 2016
@@ -38,9 +38,11 @@
 /*Re-coding of advent in C: file i/o and user i/o*/

 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include "hdr.h"
 #include "extern.h"

--- main.c.origSun Mar  6 10:25:22 2016
+++ main.cSun Mar  6 10:25:38 2016
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "hdr.h"
 #include "extern.h"
--- save.c.origSun Mar  6 10:42:59 2016
+++ save.cSun Mar  6 10:43:46 2016
@@ -35,6 +35,7 @@
  * SUCH DAMAGE.
  */

+#include 
 #include 
 #include 
 #include "hdr.h"
--- subr.c.origSun Mar  6 10:26:03 2016
+++ subr.cSun Mar  6 10:45:14 2016
@@ -37,8 +37,11 @@

 /*Re-coding of advent in C: subroutines from main*/

+#include 
 #include 
 #include 
+#include 
+#include 
 #include "hdr.h"
 #include "extern.h"

--- vocab.c.origSun Mar  6 10:26:40 2016
+++ vocab.cSun Mar  6 10:46:00 2016
@@ -38,8 +38,11 @@
 /*Re-coding of advent in C: data structure routines*/

 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
 #include "hdr.h"
 #include "extern.h"

--- wizard.c.origSun Mar  6 10:46:17 2016
+++ wizard.cSun Mar  6 10:46:55 2016
@@ -38,9 +38,11 @@
 /*Re-coding of advent in C: privileged operations*/

 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include "extern.h"
 #include "hdr.h"



rdist.c patch

2016-02-28 Thread Edgar Pettijohn

--- rdist.c.origSun Feb 28 15:29:27 2016
+++ rdist.cSun Feb 28 15:32:06 2016
@@ -57,8 +57,7 @@
 char   *path_remsh = NULL;

 static void addhostlist(char *, struct namelist **);
-static void usage(void);
-int main(int, char **, char **);
+__dead void usage(void);

 /*
  * Add a hostname to the host list
@@ -331,12 +330,12 @@
 /*
  * Print usage message and exit.
  */
-static void
+__dead void
 usage(void)
 {
 extern char *__progname;

-(void) fprintf(stderr,
+fprintf(stderr,
 "usage: %s [-DFnV] [-A num] [-a num] "
 "[-c mini_distfile]\n"
 "\t[-d var=value] [-f distfile] [-L remote_logopts] "
@@ -346,7 +345,7 @@
 "\t[-t timeout] [name ...]\n", __progname);


-(void) fprintf(stderr, "\nThe values for  are:\n\t%s\n",
+fprintf(stderr, "\nThe values for  are:\n\t%s\n",
getdistoptlist());

 msgprusage();



rdist.1 patch

2016-02-22 Thread Edgar Pettijohn

--- rdist.1.origMon Feb 22 18:48:45 2016
+++ rdist.1Mon Feb 22 18:49:29 2016
@@ -117,7 +117,7 @@
 .Pp
 Otherwise,
 .Nm
-run will run the command:
+will run the command:
 .Bd -literal -offset indent
 ssh \*(Lthost\*(Gt -l \*(Ltlogin_name\*(Gt rdistd -S
 .Ed



Re: pkg_add.1

2016-02-08 Thread Edgar Pettijohn


Sent from my iPhone

> On Feb 8, 2016, at 12:28 PM, Marc Espie  wrote:
> 
>> On Sun, Feb 07, 2016 at 09:42:32AM -0600, joshua stein wrote:
>> We don't recommend FTP mirrors anymore, installing a package via a
>> pipe doesn't seem to work anymore, and packages have to be signed to
>> be installed so the advice about miscreants is not very relevant.
> installing packages thru pipes should still work.
> surprised it got broken.
> 

I usually do install thru pipes and I haven't seen it broken. I haven't tried 
with the latest snapshot though.

> you can still install non-signed packages if you really try.
> 



dhclient.c patch

2016-02-04 Thread Edgar Pettijohn

--- dhclient.c.origThu Feb  4 17:57:41 2016
+++ dhclient.cThu Feb  4 17:57:55 2016
@@ -57,7 +57,6 @@
 #include "privsep.h"

 #include 
-#include 
 #include 
 #include 

 is brought in through dhcpd.h



whitespace patch rm.c

2016-01-27 Thread Edgar Pettijohn

Index: rm.c
===
RCS file: /cvs/src/bin/rm/rm.c,v
retrieving revision 1.35
diff -u -p -u -r1.35 rm.c
--- rm.c17 Nov 2015 17:17:24 -1.35
+++ rm.c27 Jan 2016 23:20:05 -
@@ -399,7 +399,7 @@ checkdot(char **argv)
 complained = 0;
 for (t = argv; *t;) {
 /* strip trailing slashes */
-p = strrchr (*t, '\0');
+p = strrchr(*t, '\0');
 while (--p > *t && *p == '/')
 *p = '\0';


Not subscribed to list "cc" if you wish.



Re: httpd: patch to close TLS sockets that,fail before TLS handshake

2015-08-27 Thread Edgar Pettijohn

Good enough for me.

Thanks

On 08/27/15 08:42, Joel Sing wrote:

On Tuesday 25 August 2015 19:19:58 Edgar Pettijohn wrote:

I was curious if this issue is fixed in -current or if there is going to
be a patch available on the errata page?

Yes, this is fixed in -current (and will be in 5.8) - see r1.68 of server.c.
There may be back ports/commits of various httpd fixes at some point, but at
this stage there I'm not sure there will be errata.





Re: httpd: patch to close TLS sockets that,fail before TLS handshake

2015-08-25 Thread Edgar Pettijohn
I was curious if this issue is fixed in -current or if there is going to 
be a patch available on the errata page?


Thanks

Edgar



Re: [Patch] smtpd.conf - change 'priorly' to 'beforehand'

2015-08-12 Thread Edgar Pettijohn



On 08/12/15 21:21, Larry Hynes wrote:

This is a minor quibble, and possibly a purely personal one, but
'priorly' is not really in common usage.

Index: smtpd.conf.5
===
RCS file: /cvs/src/usr.sbin/smtpd/smtpd.conf.5,v
retrieving revision 1.127
diff -u -p -r1.127 smtpd.conf.5
--- smtpd.conf.511 Aug 2015 21:57:24 -1.127
+++ smtpd.conf.513 Aug 2015 02:13:00 -
@@ -635,7 +635,7 @@ able to establish an SMTP session.
.Ic secure
may be specified to provide both STARTTLS and SMTPS services.
Host certificates may be used for these connections,
-and must be priorly declared using the pki directive.
+and must be declared beforehand using the pki directive.
If
.Ic pki
is specified,


I personally prefer the following:

Index: smtpd.conf.5
===
RCS file: /cvs/src/usr.sbin/smtpd/smtpd.conf.5,v
retrieving revision 1.127
diff -u -p -r1.127 smtpd.conf.5
--- smtpd.conf.511 Aug 2015 21:57:24 -1.127
+++ smtpd.conf.513 Aug 2015 02:13:00 -
@@ -635,7 +635,7 @@ able to establish an SMTP session.
.Ic secure
may be specified to provide both STARTTLS and SMTPS services.
Host certificates may be used for these connections,
-and must be priorly declared using the pki directive.
+and must be declared previously using the pki directive.
If
.Ic pki
is specified,



Re: [PATCH] usr.bin/which/Makefile: Allow build without presence of whereis.1 when NOMAN is set

2015-01-04 Thread Edgar Pettijohn


On 01/04/15 19:38, Riley Baird wrote:

On 05/01/15 11:41, Theo de Raadt wrote:

On 05/01/15 11:17, Theo de Raadt wrote:

On Sun, Jan 4, 2015 at 12:52 PM, Riley Baird
 wrote:

Even when building with the NOMAN option, "which" will not build without
the manpage whereis.1 being present.

Building from an incomplete source tree is not supported (deleting
just the manpages!?!?).  If you want to waste your own time in this
particular way, you can bear the cost of doing so by keeping that diff
in your sandbox instead of cluttering the tree.

Riley, this is OpenBSD.

Since you have effectively declared a fork for various reasons -- please
leave.  You are on your own now.  Your presence here just shows that you
don't have what it takes.

What is the name of this fork?  I'm guessing a bunch of random numbers 
and letters.