CVS commit: src/usr.sbin/wgconfig

2024-01-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jan 15 08:29:14 UTC 2024

Modified Files:
src/usr.sbin/wgconfig: wgconfig.8

Log Message:
Fix typo in wgconfig(8)

>From rudolf in PR 57663


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/wgconfig/wgconfig.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wgconfig/wgconfig.8
diff -u src/usr.sbin/wgconfig/wgconfig.8:1.10 src/usr.sbin/wgconfig/wgconfig.8:1.11
--- src/usr.sbin/wgconfig/wgconfig.8:1.10	Wed Aug 26 16:03:42 2020
+++ src/usr.sbin/wgconfig/wgconfig.8	Mon Jan 15 08:29:14 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wgconfig.8,v 1.10 2020/08/26 16:03:42 riastradh Exp $
+.\"	$NetBSD: wgconfig.8,v 1.11 2024/01/15 08:29:14 wiz Exp $
 .\"
 .\" Copyright (C) Ryota Ozaki 
 .\" All rights reserved.
@@ -138,7 +138,7 @@ is the peer's base64-encoded public key,
 .Pp
 The following options may be specified:
 .Bl -tag -width abcd
-.It Fl Fl preshared-key-file Ns Li \&= Ns Ar filename
+.It Fl Fl preshared-key Ns Li \&= Ns Ar filename
 Set a secret preshared key generated by
 .Nm wg-keygen
 .Fl Fl psk .



CVS commit: src/usr.sbin/wgconfig

2024-01-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jan 15 08:29:14 UTC 2024

Modified Files:
src/usr.sbin/wgconfig: wgconfig.8

Log Message:
Fix typo in wgconfig(8)

>From rudolf in PR 57663


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/wgconfig/wgconfig.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wgconfig

2023-05-07 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun May  7 16:05:07 UTC 2023

Modified Files:
src/usr.sbin/wgconfig: wgconfig.c

Log Message:
Don't allow "wgconfig add peer ..." to accept invalid options.

Addresses PR bin/57392 .


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/wgconfig/wgconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wgconfig

2023-05-07 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun May  7 16:05:07 UTC 2023

Modified Files:
src/usr.sbin/wgconfig: wgconfig.c

Log Message:
Don't allow "wgconfig add peer ..." to accept invalid options.

Addresses PR bin/57392 .


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/wgconfig/wgconfig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wgconfig/wgconfig.c
diff -u src/usr.sbin/wgconfig/wgconfig.c:1.5 src/usr.sbin/wgconfig/wgconfig.c:1.6
--- src/usr.sbin/wgconfig/wgconfig.c:1.5	Fri Aug 28 17:17:53 2020
+++ src/usr.sbin/wgconfig/wgconfig.c	Sun May  7 16:05:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: wgconfig.c,v 1.5 2020/08/28 17:17:53 tih Exp $	*/
+/*	$NetBSD: wgconfig.c,v 1.6 2023/05/07 16:05:07 oster Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: wgconfig.c,v 1.5 2020/08/28 17:17:53 tih Exp $");
+__RCSID("$NetBSD: wgconfig.c,v 1.6 2023/05/07 16:05:07 oster Exp $");
 
 #include 
 
@@ -680,14 +680,18 @@ handle_options(int argc, char *argv[], p
 {
 
 	while (argc > 0) {
+		int found = 0;
 		for (size_t i = 0; i < __arraycount(options); i++) {
 			const struct option *opt = [i];
 			size_t optlen = strlen(opt->option);
 			if (strncmp(argv[0], opt->option, optlen) == 0) {
 opt->func(argv[0] + optlen, prop_dict);
+found = 1;
 break;
 			}
 		}
+		if (found == 0)
+			errx(EXIT_FAILURE, "invalid option: %s", argv[0]);
 		argc -= 1;
 		argv += 1;
 	}