sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-08-18 19:17:13 +00:00
parent 27298272ec
commit 7116a5838e
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
35 changed files with 509 additions and 254 deletions

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: cksum.1,v 1.40 2022/08/04 06:20:24 jsg Exp $ .\" $OpenBSD: cksum.1,v 1.41 2023/08/18 14:10:33 kn Exp $
.\" .\"
.\" Copyright (c) 1991, 1993 .\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -32,7 +32,7 @@
.\" .\"
.\" @(#)cksum.1 8.2 (Berkeley) 4/28/95 .\" @(#)cksum.1 8.2 (Berkeley) 4/28/95
.\" .\"
.Dd $Mdocdate: August 4 2022 $ .Dd $Mdocdate: August 18 2023 $
.Dt CKSUM 1 .Dt CKSUM 1
.Os .Os
.Sh NAME .Sh NAME
@ -131,7 +131,7 @@ Place the checksum into
.Ar hashfile .Ar hashfile
instead of stdout. instead of stdout.
.It Fl p .It Fl p
Echoes stdin to stdout and appends the Echo stdin to stdout and append the
checksum to stdout. checksum to stdout.
.It Fl q .It Fl q
Only print the checksum (quiet mode) or if used in conjunction with the Only print the checksum (quiet mode) or if used in conjunction with the
@ -141,16 +141,16 @@ flag, only print the failed cases.
Reverse the format of the hash algorithm output, making Reverse the format of the hash algorithm output, making
it match the checksum output format. it match the checksum output format.
.It Fl s Ar string .It Fl s Ar string
Prints a checksum of the given Print a checksum of the given
.Ar string . .Ar string .
.It Fl t .It Fl t
Runs a built-in time trial. Run a built-in time trial.
Specifying Specifying
.Fl t .Fl t
multiple times results in the number of rounds being multiplied multiple times results in the number of rounds being multiplied
by 10 for each additional flag. by 10 for each additional flag.
.It Fl x .It Fl x
Runs a built-in test script. Run a built-in test script.
.El .El
.Pp .Pp
The default CRC used is based on the polynomial used for CRC error checking The default CRC used is based on the polynomial used for CRC error checking

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: md5.1,v 1.48 2019/01/25 00:19:25 millert Exp $ .\" $OpenBSD: md5.1,v 1.49 2023/08/18 14:10:33 kn Exp $
.\" .\"
.\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <millert@openbsd.org> .\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <millert@openbsd.org>
.\" .\"
@ -18,7 +18,7 @@
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force .\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\" .\"
.Dd $Mdocdate: January 25 2019 $ .Dd $Mdocdate: August 18 2023 $
.Dt MD5 1 .Dt MD5 1
.Os .Os
.Sh NAME .Sh NAME
@ -89,7 +89,7 @@ Place the checksum into
.Ar hashfile .Ar hashfile
instead of stdout. instead of stdout.
.It Fl p .It Fl p
Echoes stdin to stdout and appends the Echo stdin to stdout and append the
checksum to stdout. checksum to stdout.
.It Fl q .It Fl q
Only print the checksum (quiet mode) or if used in conjunction with the Only print the checksum (quiet mode) or if used in conjunction with the
@ -100,16 +100,16 @@ Reverse the format of the hash algorithm output, making
it match the output format used by it match the output format used by
.Xr cksum 1 . .Xr cksum 1 .
.It Fl s Ar string .It Fl s Ar string
Prints a checksum of the given Print a checksum of the given
.Ar string . .Ar string .
.It Fl t .It Fl t
Runs a built-in time trial. Run a built-in time trial.
Specifying Specifying
.Fl t .Fl t
multiple times results in the number of rounds being multiplied multiple times results in the number of rounds being multiplied
by 10 for each additional flag. by 10 for each additional flag.
.It Fl x .It Fl x
Runs a built-in test script. Run a built-in test script.
.El .El
.Sh EXIT STATUS .Sh EXIT STATUS
These utilities exit 0 on success, These utilities exit 0 on success,

View file

@ -1,18 +1,20 @@
# $OpenBSD: radiusd.conf,v 1.2 2019/04/01 09:40:16 yasuoka Exp $ # $OpenBSD: radiusd.conf,v 1.3 2023/08/18 06:45:15 yasuoka Exp $
listen on 0.0.0.0 listen on 0.0.0.0
#listen on :: #listen on ::
client 127.0.0.1/32 { client 127.0.0.1/32 {
secret "secret" secret "secret"
# "msgauth-required no" to disable message authentication check for
# some implementations (e.g. login_radius(8)) don't support msgauth
msgauth-required no
} }
client 192.168.0.0/24 { client 192.168.0.0/24 {
secret "secret" secret "secret"
msgauth-required yes
} }
module load "bsdauth" "/usr/libexec/radiusd/radiusd_bsdauth" module load "bsdauth" "/usr/libexec/radiusd/radiusd_bsdauth"
module set "bsdauth" "restrict-group" "operator" #module set "bsdauth" "restrict-group" "users"
module load "radius" "/usr/libexec/radiusd/radiusd_radius" module load "radius" "/usr/libexec/radiusd/radiusd_radius"
module set "radius" "secret" "testing123" module set "radius" "secret" "testing123"

View file

@ -10,12 +10,12 @@ AutoGen definitions Makefile.tpl;
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@ -59,7 +59,7 @@ host_modules= { module= fixincludes;
missing= installcheck; }; missing= installcheck; };
host_modules= { module= flex; no_check_cross= true; }; host_modules= { module= flex; no_check_cross= true; };
host_modules= { module= gas; bootstrap=true; }; host_modules= { module= gas; bootstrap=true; };
host_modules= { module= gcc; bootstrap=true; host_modules= { module= gcc; bootstrap=true;
target="`if [ -f stage_last ]; then echo quickstrap ; else echo all; fi`"; target="`if [ -f stage_last ]; then echo quickstrap ; else echo all; fi`";
extra_make_flags="$(EXTRA_GCC_FLAGS)"; }; extra_make_flags="$(EXTRA_GCC_FLAGS)"; };
host_modules= { module= gawk; }; host_modules= { module= gawk; };
@ -106,7 +106,7 @@ host_modules= { module= gdb; extra_make_flags="$(X11_FLAGS_TO_PASS)"; };
host_modules= { module= expect; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; host_modules= { module= expect; extra_make_flags="$(X11_FLAGS_TO_PASS)"; };
host_modules= { module= guile; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; host_modules= { module= guile; extra_make_flags="$(X11_FLAGS_TO_PASS)"; };
host_modules= { module= tk; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; host_modules= { module= tk; extra_make_flags="$(X11_FLAGS_TO_PASS)"; };
host_modules= { module= libtermcap; no_check=true; host_modules= { module= libtermcap; no_check=true;
missing=mostlyclean; missing=mostlyclean;
missing=clean; missing=clean;
missing=distclean; missing=distclean;
@ -144,21 +144,21 @@ target_modules = { module= libgomp; lib_path=.libs; };
// Not all; these are the ones which don't have special options. // Not all; these are the ones which don't have special options.
// "depend" indicates that a target depends on another target uniformly // "depend" indicates that a target depends on another target uniformly
// for each subdirectory. There can be several such lines per target. // for each subdirectory. There can be several such lines per target.
recursive_targets = { make_target= info; recursive_targets = { make_target= info;
depend=configure; }; depend=configure; };
recursive_targets = { make_target= dvi; recursive_targets = { make_target= dvi;
depend=configure; }; depend=configure; };
recursive_targets = { make_target= html; recursive_targets = { make_target= html;
depend=configure; }; depend=configure; };
recursive_targets = { make_target= TAGS; recursive_targets = { make_target= TAGS;
depend=configure; }; depend=configure; };
recursive_targets = { make_target= install-info; recursive_targets = { make_target= install-info;
depend=configure; depend=configure;
depend=info; }; depend=info; };
recursive_targets = { make_target= install-html; recursive_targets = { make_target= install-html;
depend=configure; depend=configure;
depend=html; }; depend=html; };
recursive_targets = { make_target= installcheck; recursive_targets = { make_target= installcheck;
depend=configure; }; depend=configure; };
recursive_targets = { make_target= mostlyclean; }; recursive_targets = { make_target= mostlyclean; };
recursive_targets = { make_target= clean; }; recursive_targets = { make_target= clean; };

View file

@ -129,7 +129,7 @@ LIB1ASMFUNCS+= _cmpsf2 _fixunssfsi _negsf2
LIB1ASMFUNCS+= _cmpdf2 _fixunsdfsi _negdf2 LIB1ASMFUNCS+= _cmpdf2 _fixunsdfsi _negdf2
LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c
SWFLOATFUNCS = SWFLOATFUNCS =
DWFLOATFUNCS = _floatundisf _floatundidf DWFLOATFUNCS = _floatundisf _floatundidf
# Not now # Not now

View file

@ -1,4 +1,4 @@
/* $OpenBSD: obj_dat.c,v 1.54 2023/07/08 12:27:51 beck Exp $ */ /* $OpenBSD: obj_dat.c,v 1.60 2023/08/17 09:28:43 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -166,7 +166,6 @@ added_obj_hash(const ADDED_OBJ *ca)
ret = a->nid; ret = a->nid;
break; break;
default: default:
/* abort(); */
return 0; return 0;
} }
ret &= 0x3fffffffL; ret &= 0x3fffffffL;
@ -178,38 +177,32 @@ static IMPLEMENT_LHASH_HASH_FN(added_obj, ADDED_OBJ)
static int static int
added_obj_cmp(const ADDED_OBJ *ca, const ADDED_OBJ *cb) added_obj_cmp(const ADDED_OBJ *ca, const ADDED_OBJ *cb)
{ {
ASN1_OBJECT *a, *b; const ASN1_OBJECT *a, *b;
int i; int cmp;
if ((cmp = ca->type - cb->type) != 0)
return cmp;
i = ca->type - cb->type;
if (i)
return (i);
a = ca->obj; a = ca->obj;
b = cb->obj; b = cb->obj;
switch (ca->type) { switch (ca->type) {
case ADDED_DATA: case ADDED_DATA:
i = (a->length - b->length); return OBJ_cmp(a, b);
if (i)
return (i);
return (memcmp(a->data, b->data, (size_t)a->length));
case ADDED_SNAME: case ADDED_SNAME:
if (a->sn == NULL) if (a->sn == NULL)
return (-1); return -1;
else if (b->sn == NULL) if (b->sn == NULL)
return (1); return 1;
else return strcmp(a->sn, b->sn);
return (strcmp(a->sn, b->sn));
case ADDED_LNAME: case ADDED_LNAME:
if (a->ln == NULL) if (a->ln == NULL)
return (-1); return -1;
else if (b->ln == NULL) if (b->ln == NULL)
return (1); return 1;
else return strcmp(a->ln, b->ln);
return (strcmp(a->ln, b->ln));
case ADDED_NID: case ADDED_NID:
return (a->nid - b->nid); return a->nid - b->nid;
default: default:
/* abort(); */
return 0; return 0;
} }
} }
@ -432,17 +425,12 @@ LCRYPTO_ALIAS(OBJ_nid2ln);
static int static int
obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp) obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp)
{ {
int j; const ASN1_OBJECT *a = *ap;
const ASN1_OBJECT *a= *ap;
const ASN1_OBJECT *b = &nid_objs[*bp]; const ASN1_OBJECT *b = &nid_objs[*bp];
j = (a->length - b->length); return OBJ_cmp(a, b);
if (j)
return (j);
return (memcmp(a->data, b->data, a->length));
} }
static int static int
obj_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) obj_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
{ {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: obj_lib.c,v 1.18 2023/07/08 12:27:51 beck Exp $ */ /* $OpenBSD: obj_lib.c,v 1.19 2023/08/17 09:13:01 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -124,11 +124,12 @@ LCRYPTO_ALIAS(OBJ_dup);
int int
OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b) OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b)
{ {
int ret; int cmp;
ret = (a->length - b->length); if ((cmp = a->length - b->length) != 0)
if (ret) return cmp;
return (ret); if (a->length == 0)
return (memcmp(a->data, b->data, a->length)); return 0;
return memcmp(a->data, b->data, a->length);
} }
LCRYPTO_ALIAS(OBJ_cmp); LCRYPTO_ALIAS(OBJ_cmp);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_purp.c,v 1.28 2023/07/02 17:12:17 tb Exp $ */ /* $OpenBSD: x509_purp.c,v 1.29 2023/08/18 08:42:41 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2001. * project 2001.
*/ */
@ -550,7 +550,8 @@ x509v3_cache_extensions_internal(X509 *x)
if (x->ex_flags & EXFLAG_SET) if (x->ex_flags & EXFLAG_SET)
return; return;
X509_digest(x, X509_CERT_HASH_EVP, x->hash, NULL); if (!X509_digest(x, X509_CERT_HASH_EVP, x->hash, NULL))
x->ex_flags |= EXFLAG_INVALID;
version = X509_get_version(x); version = X509_get_version(x);
if (version < 0 || version > 2) if (version < 0 || version > 2)

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: compress.3,v 1.24 2023/07/30 16:43:28 tb Exp $ .\" $OpenBSD: compress.3,v 1.25 2023/08/18 06:08:19 tb Exp $
.\" .\"
.\" Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler .\" Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
.\" .\"
@ -23,7 +23,7 @@
.\" .\"
.\" This page corresponds to zlib version 1.2.3 .\" This page corresponds to zlib version 1.2.3
.\" .\"
.Dd $Mdocdate: July 30 2023 $ .Dd $Mdocdate: August 18 2023 $
.Dt COMPRESS 3 .Dt COMPRESS 3
.Os .Os
.Sh NAME .Sh NAME
@ -551,8 +551,10 @@ or a
.Dv Z_SYNC_FLUSH , .Dv Z_SYNC_FLUSH ,
make sure that make sure that
.Fa avail_out .Fa avail_out
is greater than six to avoid repeated flush markers due to avail_out == 0 is greater than six when the flush marker begins,
on return. in order to avoid repeated flush markers upon calling
.Fn deflate
again when avail_out == 0.
.Pp .Pp
If the parameter If the parameter
.Fa flush .Fa flush

View file

@ -320,8 +320,8 @@ ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush);
with the same value of the flush parameter and more output space (updated with the same value of the flush parameter and more output space (updated
avail_out), until the flush is complete (deflate returns with non-zero avail_out), until the flush is complete (deflate returns with non-zero
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
avail_out is greater than six to avoid repeated flush markers due to avail_out is greater than six when the flush marker begins, in order to avoid
avail_out == 0 on return. repeated flush markers upon calling deflate() again when avail_out == 0.
If the parameter flush is set to Z_FINISH, pending input is processed, If the parameter flush is set to Z_FINISH, pending input is processed,
pending output is flushed and deflate returns with Z_STREAM_END if there was pending output is flushed and deflate returns with Z_STREAM_END if there was

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: bioctl.8,v 1.111 2023/07/06 21:08:50 kn Exp $ .\" $OpenBSD: bioctl.8,v 1.112 2023/08/18 14:09:19 kn Exp $
.\" .\"
.\" Copyright (c) 2004, 2005 Marco Peereboom .\" Copyright (c) 2004, 2005 Marco Peereboom
.\" .\"
@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: July 6 2023 $ .Dd $Mdocdate: August 18 2023 $
.Dt BIOCTL 8 .Dt BIOCTL 8
.Os .Os
.Sh NAME .Sh NAME
@ -288,7 +288,7 @@ is specified as "auto", the number of rounds will be automatically determined
based on system performance. based on system performance.
Otherwise the minimum is 4 rounds and the default is 16. Otherwise the minimum is 4 rounds and the default is 16.
.It Fl s .It Fl s
Read the passphrase for the selected crypto volume from Omit prompts and read passphrases without confirmation from
.Pa /dev/stdin .Pa /dev/stdin
rather than rather than
.Pa /dev/tty . .Pa /dev/tty .

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bioctl.c,v 1.151 2022/10/18 07:04:20 kn Exp $ */ /* $OpenBSD: bioctl.c,v 1.152 2023/08/18 14:09:19 kn Exp $ */
/* /*
* Copyright (c) 2004, 2005 Marco Peereboom * Copyright (c) 2004, 2005 Marco Peereboom
@ -94,7 +94,7 @@ char *password;
void *bio_cookie; void *bio_cookie;
int rpp_flag = RPP_REQUIRE_TTY; int interactive = 1;
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@ -200,7 +200,7 @@ main(int argc, char *argv[])
al_arg = optarg; al_arg = optarg;
break; break;
case 's': case 's':
rpp_flag = RPP_STDIN; interactive = 0;
break; break;
case 't': /* patrol */ case 't': /* patrol */
func |= BIOC_PATROL; func |= BIOC_PATROL;
@ -989,7 +989,7 @@ bio_kdf_generate(struct sr_crypto_kdfinfo *kdfinfo)
derive_key(kdfinfo->pbkdf.generic.type, kdfinfo->pbkdf.rounds, derive_key(kdfinfo->pbkdf.generic.type, kdfinfo->pbkdf.rounds,
kdfinfo->maskkey, sizeof(kdfinfo->maskkey), kdfinfo->maskkey, sizeof(kdfinfo->maskkey),
kdfinfo->pbkdf.salt, sizeof(kdfinfo->pbkdf.salt), kdfinfo->pbkdf.salt, sizeof(kdfinfo->pbkdf.salt),
"New passphrase: ", 1); "New passphrase: ", interactive);
} }
int int
@ -1316,6 +1316,7 @@ derive_key(u_int32_t type, int rounds, u_int8_t *key, size_t keysz,
size_t pl; size_t pl;
struct stat sb; struct stat sb;
char passphrase[1024], verifybuf[1024]; char passphrase[1024], verifybuf[1024];
int rpp_flag = RPP_ECHO_OFF;
if (!key) if (!key)
errx(1, "Invalid key"); errx(1, "Invalid key");
@ -1351,6 +1352,8 @@ derive_key(u_int32_t type, int rounds, u_int8_t *key, size_t keysz,
fclose(f); fclose(f);
} else { } else {
rpp_flag |= interactive ? RPP_REQUIRE_TTY : RPP_STDIN;
if (readpassphrase(prompt, passphrase, sizeof(passphrase), if (readpassphrase(prompt, passphrase, sizeof(passphrase),
rpp_flag) == NULL) rpp_flag) == NULL)
err(1, "unable to read passphrase"); err(1, "unable to read passphrase");

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: cargo-module.5,v 1.5 2023/08/17 05:43:09 tb Exp $ .\" $OpenBSD: cargo-module.5,v 1.7 2023/08/18 08:22:29 tb Exp $
.\" .\"
.\" Copyright (c) 2008 Marc Espie .\" Copyright (c) 2008 Marc Espie
.\" Copyright (c) 2017 Daniel Jakots .\" Copyright (c) 2017 Daniel Jakots
@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: August 17 2023 $ .Dd $Mdocdate: August 18 2023 $
.Dt CARGO-MODULE 5 .Dt CARGO-MODULE 5
.Os .Os
.Sh NAME .Sh NAME
@ -86,26 +86,35 @@ is used to download the crates.
.Pp .Pp
This module defines: This module defines:
.Bl -tag -width MODCARGO_INSTALL_TARGET_PATH .Bl -tag -width MODCARGO_INSTALL_TARGET_PATH
.It MODCARGO_CARGOTOML .It Ev MODCARGO_CARGOTOML
Path to cargo manifest. Path to cargo manifest.
Defaults to Defaults to
.Pa ${WRKSRC}/Cargo.toml . .Pa ${WRKSRC}/Cargo.toml .
.It MODCARGO_CRATES .It Ev MODCARGO_CRATES
Crates that will be downloaded by the module. Crates that will be downloaded by the module.
.It MODCARGO_CRATES_UPDATE .It Ev MODCARGO_CRATES_UPDATE
List of crates to update, overriding the version listed in Cargo.lock. List of crates to update, overriding the version listed in Cargo.lock.
.It MODCARGO_FEATURES .It Ev MODCARGO_FEATURES
List of features to be used when building. List of features to be used when building.
.It MODCARGO_INSTALL_TARGET_PATH .It Ev MODCARGO_INSTALL_TARGET_PATH
Path to pass to Path to pass to
.Cm cargo install .Cm cargo install
instead of instead of
.Pa \&. . .Pa \&. .
Needs to be set for some virtual manifests. Needs to be set for some virtual manifests.
.It MODCARGO_VENDOR_DIR .It Ev MODCARGO_VENDOR_DIR
Name of the local directory for vendoring crates. Name of the local directory for vendoring crates.
Defaults to Defaults to
.Pa ${WRKSRC}/modcargo-crates . .Pa ${WRKSRC}/modcargo-crates .
.It Ev MODCARGO_WANTLIB
Architecture-specific
.Ev WANTLIB
entries required by all Rust code.
Should be used instead of explicit entries for
.Dq c ,
.Dq pthread ,
and
.Dq c++abi .
.El .El
.Pp .Pp
This module adds three This module adds three

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: port-modules.5,v 1.264 2023/05/09 19:44:06 jmc Exp $ .\" $OpenBSD: port-modules.5,v 1.265 2023/08/17 10:51:54 sthen Exp $
.\" .\"
.\" Copyright (c) 2008 Marc Espie .\" Copyright (c) 2008 Marc Espie
.\" .\"
@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: May 9 2023 $ .Dd $Mdocdate: August 17 2023 $
.Dt PORT-MODULES 5 .Dt PORT-MODULES 5
.Os .Os
.Sh NAME .Sh NAME
@ -789,7 +789,7 @@ target (if not already defined).
It heeds It heeds
.Ev NO_BUILD . .Ev NO_BUILD .
.It lang/clang .It lang/clang
Similar to gcc3 and gcc4 modules. Similar to gcc4 module.
If architecture is in MODCLANG_ARCHS, the Clang compilers will be If architecture is in MODCLANG_ARCHS, the Clang compilers will be
put at the front of the path. put at the front of the path.
By default, only C language support is included by this module. By default, only C language support is included by this module.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sched_bsd.c,v 1.81 2023/08/14 08:33:24 mpi Exp $ */ /* $OpenBSD: sched_bsd.c,v 1.82 2023/08/18 09:18:52 claudio Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*- /*-
@ -61,9 +61,24 @@ int lbolt; /* once a second sleep address */
struct __mp_lock sched_lock; struct __mp_lock sched_lock;
#endif #endif
void update_loadavg(void *);
void schedcpu(void *); void schedcpu(void *);
uint32_t decay_aftersleep(uint32_t, uint32_t); uint32_t decay_aftersleep(uint32_t, uint32_t);
extern struct cpuset sched_idle_cpus;
/*
* constants for averages over 1, 5, and 15 minutes when sampling at
* 5 second intervals.
*/
static const fixpt_t cexp[3] = {
0.9200444146293232 * FSCALE, /* exp(-1/12) */
0.9834714538216174 * FSCALE, /* exp(-1/60) */
0.9944598480048967 * FSCALE, /* exp(-1/180) */
};
struct loadavg averunnable;
/* /*
* Force switch among equal priority processes every 100ms. * Force switch among equal priority processes every 100ms.
*/ */
@ -95,6 +110,34 @@ roundrobin(struct clockintr *cl, void *cf)
need_resched(ci); need_resched(ci);
} }
/*
* update_loadav: compute a tenex style load average of a quantity on
* 1, 5, and 15 minute intervals.
*/
void
update_loadavg(void *arg)
{
struct timeout *to = (struct timeout *)arg;
CPU_INFO_ITERATOR cii;
struct cpu_info *ci;
u_int i, nrun = 0;
CPU_INFO_FOREACH(cii, ci) {
if (!cpuset_isset(&sched_idle_cpus, ci))
nrun++;
nrun += ci->ci_schedstate.spc_nrun;
}
for (i = 0; i < 3; i++) {
averunnable.ldavg[i] = (cexp[i] * averunnable.ldavg[i] +
nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT;
}
timeout_add_sec(to, 5);
}
/* /*
* Constants for digital decay and forget: * Constants for digital decay and forget:
* 90% of (p_estcpu) usage in 5 * loadav time * 90% of (p_estcpu) usage in 5 * loadav time
@ -236,7 +279,6 @@ schedcpu(void *arg)
} }
SCHED_UNLOCK(s); SCHED_UNLOCK(s);
} }
uvm_meter();
wakeup(&lbolt); wakeup(&lbolt);
timeout_add_sec(to, 1); timeout_add_sec(to, 1);
} }
@ -691,6 +733,7 @@ void
scheduler_start(void) scheduler_start(void)
{ {
static struct timeout schedcpu_to; static struct timeout schedcpu_to;
static struct timeout loadavg_to;
/* /*
* We avoid polluting the global namespace by keeping the scheduler * We avoid polluting the global namespace by keeping the scheduler
@ -699,7 +742,10 @@ scheduler_start(void)
* its job. * its job.
*/ */
timeout_set(&schedcpu_to, schedcpu, &schedcpu_to); timeout_set(&schedcpu_to, schedcpu, &schedcpu_to);
timeout_set(&loadavg_to, update_loadavg, &loadavg_to);
schedcpu(&schedcpu_to); schedcpu(&schedcpu_to);
update_loadavg(&loadavg_to);
#ifndef SMALL_KERNEL #ifndef SMALL_KERNEL
if (perfpolicy == PERFPOL_AUTO) if (perfpolicy == PERFPOL_AUTO)

View file

@ -320,8 +320,8 @@ ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush);
with the same value of the flush parameter and more output space (updated with the same value of the flush parameter and more output space (updated
avail_out), until the flush is complete (deflate returns with non-zero avail_out), until the flush is complete (deflate returns with non-zero
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
avail_out is greater than six to avoid repeated flush markers due to avail_out is greater than six when the flush marker begins, in order to avoid
avail_out == 0 on return. repeated flush markers upon calling deflate() again when avail_out == 0.
If the parameter flush is set to Z_FINISH, pending input is processed, If the parameter flush is set to Z_FINISH, pending input is processed,
pending output is flushed and deflate returns with Z_STREAM_END if there was pending output is flushed and deflate returns with Z_STREAM_END if there was

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if.c,v 1.706 2023/07/07 19:45:26 bluhm Exp $ */ /* $OpenBSD: if.c,v 1.707 2023/08/18 08:10:16 jsg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/* /*
@ -910,7 +910,7 @@ if_output_tso(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst,
/* /*
* Try to send with TSO first. When forwarding LRO may set * Try to send with TSO first. When forwarding LRO may set
* maximium segment size in mbuf header. Chop TCP segment * maximum segment size in mbuf header. Chop TCP segment
* even if it would fit interface MTU to preserve maximum * even if it would fit interface MTU to preserve maximum
* path MTU. * path MTU.
*/ */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_pfsync.c,v 1.319 2023/07/31 11:13:09 dlg Exp $ */ /* $OpenBSD: if_pfsync.c,v 1.320 2023/08/18 08:03:57 jsg Exp $ */
/* /*
* Copyright (c) 2002 Michael Shalayeff * Copyright (c) 2002 Michael Shalayeff
@ -1528,7 +1528,7 @@ pfsync_sendout(struct pfsync_softc *sc, struct mbuf *m)
{ {
struct ip_moptions imo; struct ip_moptions imo;
unsigned int len = m->m_pkthdr.len; unsigned int len = m->m_pkthdr.len;
#if NBPF > 0 #if NBPFILTER > 0
caddr_t if_bpf = sc->sc_if.if_bpf; caddr_t if_bpf = sc->sc_if.if_bpf;
if (if_bpf) if (if_bpf)
bpf_mtap(if_bpf, m, BPF_DIRECTION_OUT); bpf_mtap(if_bpf, m, BPF_DIRECTION_OUT);
@ -2628,9 +2628,6 @@ pfsync_input(struct mbuf *m, uint8_t ttl, unsigned int hlen)
unsigned int len; unsigned int len;
void (*in)(struct pfsync_softc *, void (*in)(struct pfsync_softc *,
const caddr_t, unsigned int, unsigned int); const caddr_t, unsigned int, unsigned int);
#if NBPF > 0
caddr_t if_bpf;
#endif
pfsyncstat_inc(pfsyncs_ipackets); pfsyncstat_inc(pfsyncs_ipackets);
@ -2650,9 +2647,6 @@ pfsync_input(struct mbuf *m, uint8_t ttl, unsigned int hlen)
goto leave; goto leave;
} }
#if NBPF > 0
#endif
/* verify that the IP TTL is 255. */ /* verify that the IP TTL is 255. */
if (ttl != PFSYNC_DFLTTL) { if (ttl != PFSYNC_DFLTTL) {
pfsyncstat_inc(pfsyncs_badttl); pfsyncstat_inc(pfsyncs_badttl);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: wg_cookie.c,v 1.4 2022/03/17 18:51:56 tb Exp $ */ /* $OpenBSD: wg_cookie.c,v 1.5 2023/08/18 08:11:47 jsg Exp $ */
/* /*
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. * Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
* Copyright (C) 2019-2020 Matt Dunwoodie <ncon@noconroy.net> * Copyright (C) 2019-2020 Matt Dunwoodie <ncon@noconroy.net>
@ -385,7 +385,7 @@ ratelimit_allow(struct ratelimit *rl, struct sockaddr *sa)
* lapsed since our last_time, adding that, ensuring that we * lapsed since our last_time, adding that, ensuring that we
* cap the tokens at TOKEN_MAX. If the endpoint has no tokens * cap the tokens at TOKEN_MAX. If the endpoint has no tokens
* left (that is tokens <= INITIATION_COST) then we block the * left (that is tokens <= INITIATION_COST) then we block the
* request, otherwise we subtract the INITITIATION_COST and * request, otherwise we subtract the INITIATION_COST and
* return OK. */ * return OK. */
diff = r->r_last_time; diff = r->r_last_time;
getnanouptime(&r->r_last_time); getnanouptime(&r->r_last_time);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_extern.h,v 1.170 2023/06/21 21:16:21 cheloha Exp $ */ /* $OpenBSD: uvm_extern.h,v 1.171 2023/08/18 09:18:52 claudio Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/* /*
@ -414,7 +414,6 @@ void uvmspace_free(struct vmspace *);
struct vmspace *uvmspace_share(struct process *); struct vmspace *uvmspace_share(struct process *);
int uvm_share(vm_map_t, vaddr_t, vm_prot_t, int uvm_share(vm_map_t, vaddr_t, vm_prot_t,
vm_map_t, vaddr_t, vsize_t); vm_map_t, vaddr_t, vsize_t);
void uvm_meter(void);
int uvm_sysctl(int *, u_int, void *, size_t *, int uvm_sysctl(int *, u_int, void *, size_t *,
void *, size_t, struct proc *); void *, size_t, struct proc *);
struct vm_page *uvm_pagealloc(struct uvm_object *, struct vm_page *uvm_pagealloc(struct uvm_object *,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_meter.c,v 1.48 2023/08/03 16:12:08 claudio Exp $ */ /* $OpenBSD: uvm_meter.c,v 1.49 2023/08/18 09:18:52 claudio Exp $ */
/* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */ /* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */
/* /*
@ -63,58 +63,12 @@
#define MAXSLP 20 #define MAXSLP 20
int maxslp = MAXSLP; /* patchable ... */ int maxslp = MAXSLP; /* patchable ... */
struct loadavg averunnable;
/* extern struct loadavg averunnable;
* constants for averages over 1, 5, and 15 minutes when sampling at
* 5 second intervals.
*/
static const fixpt_t cexp[3] = {
0.9200444146293232 * FSCALE, /* exp(-1/12) */
0.9834714538216174 * FSCALE, /* exp(-1/60) */
0.9944598480048967 * FSCALE, /* exp(-1/180) */
};
static void uvm_loadav(struct loadavg *);
void uvm_total(struct vmtotal *); void uvm_total(struct vmtotal *);
void uvmexp_read(struct uvmexp *); void uvmexp_read(struct uvmexp *);
/*
* uvm_meter: calculate load average
*/
void
uvm_meter(void)
{
if ((gettime() % 5) == 0)
uvm_loadav(&averunnable);
}
/*
* uvm_loadav: compute a tenex style load average of a quantity on
* 1, 5, and 15 minute intervals.
*/
static void
uvm_loadav(struct loadavg *avg)
{
extern struct cpuset sched_idle_cpus;
CPU_INFO_ITERATOR cii;
struct cpu_info *ci;
u_int i, nrun = 0;
CPU_INFO_FOREACH(cii, ci) {
if (!cpuset_isset(&sched_idle_cpus, ci))
nrun++;
nrun += ci->ci_schedstate.spc_nrun;
}
for (i = 0; i < 3; i++) {
avg->ldavg[i] = (cexp[i] * avg->ldavg[i] +
nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT;
}
}
char malloc_conf[16]; char malloc_conf[16];
/* /*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kex.c,v 1.178 2023/03/12 10:40:39 dtucker Exp $ */ /* $OpenBSD: kex.c,v 1.179 2023/08/18 01:37:41 djm Exp $ */
/* /*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* *
@ -1317,7 +1317,7 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms,
for (;;) { for (;;) {
if (timeout_ms > 0) { if (timeout_ms > 0) {
r = waitrfd(ssh_packet_get_connection_in(ssh), r = waitrfd(ssh_packet_get_connection_in(ssh),
&timeout_ms); &timeout_ms, NULL);
if (r == -1 && errno == ETIMEDOUT) { if (r == -1 && errno == ETIMEDOUT) {
send_error(ssh, "Timed out waiting " send_error(ssh, "Timed out waiting "
"for SSH identification string."); "for SSH identification string.");

View file

@ -1,4 +1,4 @@
/* $OpenBSD: misc.c,v 1.185 2023/08/04 06:32:40 dtucker Exp $ */ /* $OpenBSD: misc.c,v 1.186 2023/08/18 01:37:41 djm Exp $ */
/* /*
* Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved. * Copyright (c) 2005-2020 Damien Miller. All rights reserved.
@ -269,20 +269,38 @@ set_sock_tos(int fd, int tos)
* Returns 0 if fd ready or -1 on timeout or error (see errno). * Returns 0 if fd ready or -1 on timeout or error (see errno).
*/ */
static int static int
waitfd(int fd, int *timeoutp, short events) waitfd(int fd, int *timeoutp, short events, volatile sig_atomic_t *stop)
{ {
struct pollfd pfd; struct pollfd pfd;
struct timeval t_start; struct timespec timeout;
int oerrno, r, have_timeout = (*timeoutp >= 0); int oerrno, r;
sigset_t nsigset, osigset;
if (timeoutp && *timeoutp == -1)
timeoutp = NULL;
pfd.fd = fd; pfd.fd = fd;
pfd.events = events; pfd.events = events;
for (; !have_timeout || *timeoutp >= 0;) { ptimeout_init(&timeout);
monotime_tv(&t_start); if (timeoutp != NULL)
r = poll(&pfd, 1, *timeoutp); ptimeout_deadline_ms(&timeout, *timeoutp);
if (stop != NULL)
sigfillset(&nsigset);
for (; timeoutp == NULL || *timeoutp >= 0;) {
if (stop != NULL) {
sigprocmask(SIG_BLOCK, &nsigset, &osigset);
if (*stop) {
sigprocmask(SIG_SETMASK, &osigset, NULL);
errno = EINTR;
return -1;
}
}
r = ppoll(&pfd, 1, ptimeout_get_tsp(&timeout),
stop != NULL ? &osigset : NULL);
oerrno = errno; oerrno = errno;
if (have_timeout) if (stop != NULL)
ms_subtract_diff(&t_start, timeoutp); sigprocmask(SIG_SETMASK, &osigset, NULL);
if (timeoutp)
*timeoutp = ptimeout_get_ms(&timeout);
errno = oerrno; errno = oerrno;
if (r > 0) if (r > 0)
return 0; return 0;
@ -302,8 +320,8 @@ waitfd(int fd, int *timeoutp, short events)
* Returns 0 if fd ready or -1 on timeout or error (see errno). * Returns 0 if fd ready or -1 on timeout or error (see errno).
*/ */
int int
waitrfd(int fd, int *timeoutp) { waitrfd(int fd, int *timeoutp, volatile sig_atomic_t *stop) {
return waitfd(fd, timeoutp, POLLIN); return waitfd(fd, timeoutp, POLLIN, stop);
} }
/* /*
@ -337,7 +355,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
break; break;
} }
if (waitfd(sockfd, timeoutp, POLLIN | POLLOUT) == -1) if (waitfd(sockfd, timeoutp, POLLIN | POLLOUT, NULL) == -1)
return -1; return -1;
/* Completed or failed */ /* Completed or failed */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: misc.h,v 1.103 2023/07/19 14:02:27 djm Exp $ */ /* $OpenBSD: misc.h,v 1.104 2023/08/18 01:37:41 djm Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -19,6 +19,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <stdio.h> #include <stdio.h>
#include <signal.h>
/* Data structure for representing a forwarding request. */ /* Data structure for representing a forwarding request. */
struct Forward { struct Forward {
@ -57,7 +58,7 @@ char *get_rdomain(int);
int set_rdomain(int, const char *); int set_rdomain(int, const char *);
int get_sock_af(int); int get_sock_af(int);
void set_sock_tos(int, int); void set_sock_tos(int, int);
int waitrfd(int, int *); int waitrfd(int, int *, volatile sig_atomic_t *);
int timeout_connect(int, const struct sockaddr *, socklen_t, int *); int timeout_connect(int, const struct sockaddr *, socklen_t, int *);
int a2port(const char *); int a2port(const char *);
int a2tun(const char *, int *); int a2tun(const char *, int *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: mux.c,v 1.99 2023/08/04 06:32:40 dtucker Exp $ */ /* $OpenBSD: mux.c,v 1.100 2023/08/18 01:37:41 djm Exp $ */
/* /*
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
* *
@ -1464,7 +1464,9 @@ mux_client_read(int fd, struct sshbuf *b, size_t need, int timeout_ms)
if (len == -1) { if (len == -1) {
switch (errno) { switch (errno) {
case EAGAIN: case EAGAIN:
if (waitrfd(fd, &timeout_ms) == -1) if (waitrfd(fd, &timeout_ms,
&muxclient_terminate) == -1 &&
errno != EINTR)
return -1; /* timeout */ return -1; /* timeout */
/* FALLTHROUGH */ /* FALLTHROUGH */
case EINTR: case EINTR:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cmd.c,v 1.174 2022/05/30 12:48:57 nicm Exp $ */ /* $OpenBSD: cmd.c,v 1.175 2023/08/17 14:10:28 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -813,10 +813,14 @@ cmd_mouse_pane(struct mouse_event *m, struct session **sp,
if ((wl = cmd_mouse_window(m, sp)) == NULL) if ((wl = cmd_mouse_window(m, sp)) == NULL)
return (NULL); return (NULL);
if ((wp = window_pane_find_by_id(m->wp)) == NULL) if (m->wp == -1)
return (NULL); wp = wl->window->active;
if (!window_has_pane(wl->window, wp)) else {
return (NULL); if ((wp = window_pane_find_by_id(m->wp)) == NULL)
return (NULL);
if (!window_has_pane(wl->window, wp))
return (NULL);
}
if (wlp != NULL) if (wlp != NULL)
*wlp = wl; *wlp = wl;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: format-draw.c,v 1.27 2023/08/07 10:04:29 nicm Exp $ */ /* $OpenBSD: format-draw.c,v 1.28 2023/08/17 14:10:28 nicm Exp $ */
/* /*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -33,6 +33,7 @@ struct format_range {
enum style_range_type type; enum style_range_type type;
u_int argument; u_int argument;
char string[16];
TAILQ_ENTRY(format_range) entry; TAILQ_ENTRY(format_range) entry;
}; };
@ -44,9 +45,18 @@ format_is_type(struct format_range *fr, struct style *sy)
{ {
if (fr->type != sy->range_type) if (fr->type != sy->range_type)
return (0); return (0);
if (fr->type == STYLE_RANGE_WINDOW && switch (fr->type) {
fr->argument != sy->range_argument) case STYLE_RANGE_NONE:
return (0); case STYLE_RANGE_LEFT:
case STYLE_RANGE_RIGHT:
return (1);
case STYLE_RANGE_PANE:
case STYLE_RANGE_WINDOW:
case STYLE_RANGE_SESSION:
return (fr->argument == sy->range_argument);
case STYLE_RANGE_USER:
return (strcmp(fr->string, sy->range_string) == 0);
}
return (1); return (1);
} }
@ -942,6 +952,8 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base,
fr->type = sy.range_type; fr->type = sy.range_type;
fr->argument = sy.range_argument; fr->argument = sy.range_argument;
strlcpy(fr->string, sy.range_string,
sizeof fr->string);
} }
} }
@ -1013,13 +1025,39 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base,
sr = xcalloc(1, sizeof *sr); sr = xcalloc(1, sizeof *sr);
sr->type = fr->type; sr->type = fr->type;
sr->argument = fr->argument; sr->argument = fr->argument;
strlcpy(sr->string, fr->string, sizeof sr->string);
sr->start = fr->start; sr->start = fr->start;
sr->end = fr->end; sr->end = fr->end;
TAILQ_INSERT_TAIL(srs, sr, entry); TAILQ_INSERT_TAIL(srs, sr, entry);
log_debug("%s: range %d|%u at %u-%u", __func__, sr->type, switch (sr->type) {
sr->argument, sr->start, sr->end); case STYLE_RANGE_NONE:
break;
case STYLE_RANGE_LEFT:
log_debug("%s: range left at %u-%u", __func__,
sr->start, sr->end);
break;
case STYLE_RANGE_RIGHT:
log_debug("%s: range right at %u-%u", __func__,
sr->start, sr->end);
break;
case STYLE_RANGE_PANE:
log_debug("%s: range pane|%%%u at %u-%u", __func__,
sr->argument, sr->start, sr->end);
break;
case STYLE_RANGE_WINDOW:
log_debug("%s: range window|%u at %u-%u", __func__,
sr->argument, sr->start, sr->end);
break;
case STYLE_RANGE_SESSION:
log_debug("%s: range session|$%u at %u-%u", __func__,
sr->argument, sr->start, sr->end);
break;
case STYLE_RANGE_USER:
log_debug("%s: range user|%u at %u-%u", __func__,
sr->argument, sr->start, sr->end);
break;
}
format_free_range(&frs, fr); format_free_range(&frs, fr);
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: format.c,v 1.316 2023/07/10 09:24:53 nicm Exp $ */ /* $OpenBSD: format.c,v 1.317 2023/08/17 14:10:28 nicm Exp $ */
/* /*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -1191,6 +1191,72 @@ format_cb_mouse_line(struct format_tree *ft)
return (format_grid_line(gd, gd->hsize + y)); return (format_grid_line(gd, gd->hsize + y));
} }
/* Callback for mouse_status_line. */
static void *
format_cb_mouse_status_line(struct format_tree *ft)
{
char *value;
u_int y;
if (!ft->m.valid)
return (NULL);
if (ft->c == NULL || (~ft->c->tty.flags & TTY_STARTED))
return (NULL);
if (ft->m.statusat == 0 && ft->m.y < ft->m.statuslines) {
y = ft->m.y;
} else if (ft->m.statusat > 0 && ft->m.y >= (u_int)ft->m.statusat) {
y = ft->m.y - ft->m.statusat;
} else
return (NULL);
xasprintf(&value, "%u", y);
return (value);
}
/* Callback for mouse_status_range. */
static void *
format_cb_mouse_status_range(struct format_tree *ft)
{
struct style_range *sr;
u_int x, y;
if (!ft->m.valid)
return (NULL);
if (ft->c == NULL || (~ft->c->tty.flags & TTY_STARTED))
return (NULL);
if (ft->m.statusat == 0 && ft->m.y < ft->m.statuslines) {
x = ft->m.x;
y = ft->m.y;
} else if (ft->m.statusat > 0 && ft->m.y >= (u_int)ft->m.statusat) {
x = ft->m.x;
y = ft->m.y - ft->m.statusat;
} else
return (NULL);
sr = status_get_range(ft->c, x, y);
if (sr == NULL)
return (NULL);
switch (sr->type) {
case STYLE_RANGE_NONE:
return (NULL);
case STYLE_RANGE_LEFT:
return (xstrdup("left"));
case STYLE_RANGE_RIGHT:
return (xstrdup("right"));
case STYLE_RANGE_PANE:
return (xstrdup("pane"));
case STYLE_RANGE_WINDOW:
return (xstrdup("window"));
case STYLE_RANGE_SESSION:
return (xstrdup("session"));
case STYLE_RANGE_USER:
return (xstrdup(sr->string));
}
return (NULL);
}
/* Callback for alternate_on. */ /* Callback for alternate_on. */
static void * static void *
format_cb_alternate_on(struct format_tree *ft) format_cb_alternate_on(struct format_tree *ft)
@ -2848,6 +2914,12 @@ static const struct format_table_entry format_table[] = {
{ "mouse_standard_flag", FORMAT_TABLE_STRING, { "mouse_standard_flag", FORMAT_TABLE_STRING,
format_cb_mouse_standard_flag format_cb_mouse_standard_flag
}, },
{ "mouse_status_line", FORMAT_TABLE_STRING,
format_cb_mouse_status_line
},
{ "mouse_status_range", FORMAT_TABLE_STRING,
format_cb_mouse_status_range
},
{ "mouse_utf8_flag", FORMAT_TABLE_STRING, { "mouse_utf8_flag", FORMAT_TABLE_STRING,
format_cb_mouse_utf8_flag format_cb_mouse_utf8_flag
}, },

View file

@ -1,4 +1,4 @@
/* $OpenBSD: server-client.c,v 1.400 2023/02/05 21:15:32 nicm Exp $ */ /* $OpenBSD: server-client.c,v 1.401 2023/08/17 14:10:28 nicm Exp $ */
/* /*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -564,9 +564,9 @@ static key_code
server_client_check_mouse(struct client *c, struct key_event *event) server_client_check_mouse(struct client *c, struct key_event *event)
{ {
struct mouse_event *m = &event->m; struct mouse_event *m = &event->m;
struct session *s = c->session; struct session *s = c->session, *fs;
struct winlink *wl; struct winlink *fwl;
struct window_pane *wp; struct window_pane *wp, *fwp;
u_int x, y, b, sx, sy, px, py; u_int x, y, b, sx, sy, px, py;
int ignore = 0; int ignore = 0;
key_code key; key_code key;
@ -672,6 +672,7 @@ have_event:
/* Save the session. */ /* Save the session. */
m->s = s->id; m->s = s->id;
m->w = -1; m->w = -1;
m->wp = -1;
m->ignore = ignore; m->ignore = ignore;
/* Is this on the status line? */ /* Is this on the status line? */
@ -688,18 +689,42 @@ have_event:
case STYLE_RANGE_NONE: case STYLE_RANGE_NONE:
return (KEYC_UNKNOWN); return (KEYC_UNKNOWN);
case STYLE_RANGE_LEFT: case STYLE_RANGE_LEFT:
log_debug("mouse range: left");
where = STATUS_LEFT; where = STATUS_LEFT;
break; break;
case STYLE_RANGE_RIGHT: case STYLE_RANGE_RIGHT:
log_debug("mouse range: right");
where = STATUS_RIGHT; where = STATUS_RIGHT;
break; break;
case STYLE_RANGE_WINDOW: case STYLE_RANGE_PANE:
wl = winlink_find_by_index(&s->windows, fwp = window_pane_find_by_id(sr->argument);
sr->argument); if (fwp == NULL)
if (wl == NULL)
return (KEYC_UNKNOWN); return (KEYC_UNKNOWN);
m->w = wl->window->id; m->wp = sr->argument;
log_debug("mouse range: pane %%%u", m->wp);
where = STATUS;
break;
case STYLE_RANGE_WINDOW:
fwl = winlink_find_by_index(&s->windows,
sr->argument);
if (fwl == NULL)
return (KEYC_UNKNOWN);
m->w = fwl->window->id;
log_debug("mouse range: window @%u", m->w);
where = STATUS;
break;
case STYLE_RANGE_SESSION:
fs = session_find_by_id(sr->argument);
if (fs == NULL)
return (KEYC_UNKNOWN);
m->s = sr->argument;
log_debug("mouse range: session $%u", m->s);
where = STATUS;
break;
case STYLE_RANGE_USER:
where = STATUS; where = STATUS;
break; break;
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: style.c,v 1.32 2023/06/26 07:17:40 nicm Exp $ */ /* $OpenBSD: style.c,v 1.33 2023/08/17 14:10:28 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -37,11 +37,18 @@ static struct style style_default = {
STYLE_ALIGN_DEFAULT, STYLE_ALIGN_DEFAULT,
STYLE_LIST_OFF, STYLE_LIST_OFF,
STYLE_RANGE_NONE, 0, STYLE_RANGE_NONE, 0, "",
STYLE_DEFAULT_BASE STYLE_DEFAULT_BASE
}; };
/* Set range string. */
static void
style_set_range_string(struct style *sy, const char *s)
{
strlcpy(sy->range_string, s, sizeof sy->range_string);
}
/* /*
* Parse an embedded style of the form "fg=colour,bg=colour,bright,...". Note * Parse an embedded style of the form "fg=colour,bg=colour,bright,...". Note
* that this adds onto the given style, so it must have been initialized * that this adds onto the given style, so it must have been initialized
@ -104,32 +111,67 @@ style_parse(struct style *sy, const struct grid_cell *base, const char *in)
} else if (strcasecmp(tmp, "norange") == 0) { } else if (strcasecmp(tmp, "norange") == 0) {
sy->range_type = style_default.range_type; sy->range_type = style_default.range_type;
sy->range_argument = style_default.range_type; sy->range_argument = style_default.range_type;
strlcpy(sy->range_string, style_default.range_string,
sizeof sy->range_string);
} else if (end > 6 && strncasecmp(tmp, "range=", 6) == 0) { } else if (end > 6 && strncasecmp(tmp, "range=", 6) == 0) {
found = strchr(tmp + 6, '|'); found = strchr(tmp + 6, '|');
if (found != NULL) { if (found != NULL) {
*found++ = '\0'; *found++ = '\0';
if (*found == '\0') if (*found == '\0')
goto error; goto error;
for (cp = found; *cp != '\0'; cp++) {
if (!isdigit((u_char)*cp))
goto error;
}
} }
if (strcasecmp(tmp + 6, "left") == 0) { if (strcasecmp(tmp + 6, "left") == 0) {
if (found != NULL) if (found != NULL)
goto error; goto error;
sy->range_type = STYLE_RANGE_LEFT; sy->range_type = STYLE_RANGE_LEFT;
sy->range_argument = 0; sy->range_argument = 0;
style_set_range_string(sy, "");
} else if (strcasecmp(tmp + 6, "right") == 0) { } else if (strcasecmp(tmp + 6, "right") == 0) {
if (found != NULL) if (found != NULL)
goto error; goto error;
sy->range_type = STYLE_RANGE_RIGHT; sy->range_type = STYLE_RANGE_RIGHT;
sy->range_argument = 0; sy->range_argument = 0;
style_set_range_string(sy, "");
} else if (strcasecmp(tmp + 6, "pane") == 0) {
if (found == NULL)
goto error;
if (*found != '%' || found[1] == '\0')
goto error;
for (cp = found + 1; *cp != '\0'; cp++) {
if (!isdigit((u_char)*cp))
goto error;
}
sy->range_type = STYLE_RANGE_PANE;
sy->range_argument = atoi(found + 1);
style_set_range_string(sy, "");
} else if (strcasecmp(tmp + 6, "window") == 0) { } else if (strcasecmp(tmp + 6, "window") == 0) {
if (found == NULL) if (found == NULL)
goto error; goto error;
for (cp = found; *cp != '\0'; cp++) {
if (!isdigit((u_char)*cp))
goto error;
}
sy->range_type = STYLE_RANGE_WINDOW; sy->range_type = STYLE_RANGE_WINDOW;
sy->range_argument = atoi(found); sy->range_argument = atoi(found);
style_set_range_string(sy, "");
} else if (strcasecmp(tmp + 6, "session") == 0) {
if (found == NULL)
goto error;
if (*found != '$' || found[1] == '\0')
goto error;
for (cp = found + 1; *cp != '\0'; cp++) {
if (!isdigit((u_char)*cp))
goto error;
}
sy->range_type = STYLE_RANGE_SESSION;
sy->range_argument = atoi(found + 1);
style_set_range_string(sy, "");
} else if (strcasecmp(tmp + 6, "user") == 0) {
if (found == NULL)
goto error;
sy->range_type = STYLE_RANGE_USER;
sy->range_argument = 0;
style_set_range_string(sy, found);
} }
} else if (strcasecmp(tmp, "noalign") == 0) } else if (strcasecmp(tmp, "noalign") == 0)
sy->align = style_default.align; sy->align = style_default.align;
@ -222,9 +264,19 @@ style_tostring(struct style *sy)
tmp = "left"; tmp = "left";
else if (sy->range_type == STYLE_RANGE_RIGHT) else if (sy->range_type == STYLE_RANGE_RIGHT)
tmp = "right"; tmp = "right";
else if (sy->range_type == STYLE_RANGE_WINDOW) { else if (sy->range_type == STYLE_RANGE_PANE) {
snprintf(b, sizeof b, "pane|%%%u", sy->range_argument);
tmp = b;
} else if (sy->range_type == STYLE_RANGE_WINDOW) {
snprintf(b, sizeof b, "window|%u", sy->range_argument); snprintf(b, sizeof b, "window|%u", sy->range_argument);
tmp = b; tmp = b;
} else if (sy->range_type == STYLE_RANGE_SESSION) {
snprintf(b, sizeof b, "session|$%u",
sy->range_argument);
tmp = b;
} else if (sy->range_type == STYLE_RANGE_USER) {
snprintf(b, sizeof b, "user|%s", sy->range_string);
tmp = b;
} }
off += xsnprintf(s + off, sizeof s - off, "%srange=%s", comma, off += xsnprintf(s + off, sizeof s - off, "%srange=%s", comma,
tmp); tmp);

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.927 2023/08/15 07:01:47 nicm Exp $ .\" $OpenBSD: tmux.1,v 1.928 2023/08/17 14:10:28 nicm Exp $
.\" .\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\" .\"
@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: August 15 2023 $ .Dd $Mdocdate: August 17 2023 $
.Dt TMUX 1 .Dt TMUX 1
.Os .Os
.Sh NAME .Sh NAME
@ -5443,6 +5443,8 @@ The following variables are available, where appropriate:
.It Li "mouse_line" Ta "" Ta "Line under mouse, if any" .It Li "mouse_line" Ta "" Ta "Line under mouse, if any"
.It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag" .It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag"
.It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag" .It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
.It Li "mouse_status_line" Ta "" Ta "Status line on which mouse event took place"
.It Li "mouse_status_range" Ta "" Ta "Range type or argument of mouse event on status line"
.It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag" .It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
.It Li "mouse_word" Ta "" Ta "Word under mouse, if any" .It Li "mouse_word" Ta "" Ta "Word under mouse, if any"
.It Li "mouse_x" Ta "" Ta "Mouse X position, if any" .It Li "mouse_x" Ta "" Ta "Mouse X position, if any"
@ -5681,26 +5683,56 @@ Only one default may be pushed (each
replaces the previous saved default). replaces the previous saved default).
.It Xo Ic range=left , .It Xo Ic range=left ,
.Ic range=right , .Ic range=right ,
.Ic range=session|X ,
.Ic range=window|X , .Ic range=window|X ,
.Ic range=pane|X ,
.Ic range=user|X ,
.Ic norange .Ic norange
.Xc .Xc
Mark a range in the Mark a range for mouse events in the
.Ic status-format .Ic status-format
option. option.
When a mouse event occurs in the
.Ic range=left .Ic range=left
and or
.Ic range=right .Ic range=right
are the text used for the range, the
.Ql StatusLeft .Ql StatusLeft
and and
.Ql StatusRight .Ql StatusRight
mouse keys. key bindings are triggered.
.Pp
.Ic range=session|X ,
.Ic range=window|X .Ic range=window|X
is the range for a window passed to the and
.Ic range=pane|X
are ranges for a session, window or pane.
These trigger the
.Ql Status .Ql Status
mouse key, where mouse key with the target session, window or pane given by the
.Ql X .Ql X
is a window index. argument.
.Ql X
is a session ID, window index in the current session or a pane ID.
For these, the
.Ic mouse_status_range
format variable will be set to
.Ql session ,
.Ql window
or
.Ql pane .
.Pp
.Ic range=user|X
is a user-defined range; it triggers the
.Ql Status
mouse key.
The argument
.Ql X
will be available in the
.Ic mouse_status_range
format variable.
.Ql X
must be at most 15 bytes in length.
.El .El
.Pp .Pp
Examples are: Examples are:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1205 2023/08/15 07:01:47 nicm Exp $ */ /* $OpenBSD: tmux.h,v 1.1206 2023/08/17 14:10:28 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -795,11 +795,15 @@ enum style_range_type {
STYLE_RANGE_NONE, STYLE_RANGE_NONE,
STYLE_RANGE_LEFT, STYLE_RANGE_LEFT,
STYLE_RANGE_RIGHT, STYLE_RANGE_RIGHT,
STYLE_RANGE_WINDOW STYLE_RANGE_PANE,
STYLE_RANGE_WINDOW,
STYLE_RANGE_SESSION,
STYLE_RANGE_USER
}; };
struct style_range { struct style_range {
enum style_range_type type; enum style_range_type type;
u_int argument; u_int argument;
char string[16];
u_int start; u_int start;
u_int end; /* not included */ u_int end; /* not included */
@ -826,6 +830,7 @@ struct style {
enum style_range_type range_type; enum style_range_type range_type;
u_int range_argument; u_int range_argument;
char range_string[16];
enum style_default_type default_type; enum style_default_type default_type;
}; };

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: httpd.conf.5,v 1.122 2022/09/02 07:38:14 benno Exp $ .\" $OpenBSD: httpd.conf.5,v 1.123 2023/08/17 07:25:57 op Exp $
.\" .\"
.\" Copyright (c) 2014, 2015 Reyk Floeter <reyk@openbsd.org> .\" Copyright (c) 2014, 2015 Reyk Floeter <reyk@openbsd.org>
.\" .\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: September 2 2022 $ .Dd $Mdocdate: August 17 2023 $
.Dt HTTPD.CONF 5 .Dt HTTPD.CONF 5
.Os .Os
.Sh NAME .Sh NAME
@ -98,7 +98,7 @@ Macros are not expanded inside quotes.
For example: For example:
.Bd -literal -offset indent .Bd -literal -offset indent
ext_ip="10.0.0.1" ext_ip="10.0.0.1"
server "default" { server "example.com" {
listen on $ext_ip port 80 listen on $ext_ip port 80
} }
.Ed .Ed
@ -179,7 +179,11 @@ The configured web servers.
Each Each
.Ic server .Ic server
section starts with a declaration of the server section starts with a declaration of the server
.Ar name : .Ar name .
If a request does not match any server name, it is handled by the
first defined
.Ic server
section that matches the listening port.
.Bl -tag -width Ds .Bl -tag -width Ds
.It Ic server Ar name Brq ... .It Ic server Ar name Brq ...
Match the server name using shell globbing rules. Match the server name using shell globbing rules.
@ -779,7 +783,7 @@ It additionally defines some media types overriding the defaults.
.Bd -literal -offset indent .Bd -literal -offset indent
prefork 2 prefork 2
server "default" { server "example.com" {
listen on * port 80 listen on * port 80
} }
@ -800,7 +804,7 @@ address of the network interface that is a member of the
.Qq egress .Qq egress
group. group.
.Bd -literal -offset indent .Bd -literal -offset indent
server "default" { server "example.com" {
listen on egress port 80 listen on egress port 80
} }
.Ed .Ed

View file

@ -1,4 +1,4 @@
/* $OpenBSD: parse.y,v 1.13 2021/10/15 15:01:28 naddy Exp $ */ /* $OpenBSD: parse.y,v 1.14 2023/08/18 06:37:20 yasuoka Exp $ */
/* /*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -167,7 +167,9 @@ listen_addr : STRING optport {
optport : { $$ = 0; } optport : { $$ = 0; }
| PORT NUMBER { $$ = $2; } | PORT NUMBER { $$ = $2; }
; ;
client : CLIENT prefix optnl clientopts_b { client : CLIENT {
radiusd_client_init(&client);
} prefix optnl '{' clientopts '}' {
struct radiusd_client *client0; struct radiusd_client *client0;
if (client.secret[0] == '\0') { if (client.secret[0] == '\0') {
@ -181,31 +183,33 @@ client : CLIENT prefix optnl clientopts_b {
strlcpy(client0->secret, client.secret, strlcpy(client0->secret, client.secret,
sizeof(client0->secret)); sizeof(client0->secret));
client0->msgauth_required = client.msgauth_required; client0->msgauth_required = client.msgauth_required;
client0->af = $2.af; client0->af = $3.af;
client0->addr = $2.addr; client0->addr = $3.addr;
client0->mask = $2.mask; client0->mask = $3.mask;
TAILQ_INSERT_TAIL(&conf->client, client0, next); TAILQ_INSERT_TAIL(&conf->client, client0, next);
radiusd_client_init(&client);
} }
clientopts_b : '{' optnl_l clientopts_l optnl_l '}' clientopts : clientopts '\n' clientopt
| '{' optnl_l '}' /* allow empty block */ | clientopt
; ;
clientopts_l : clientopts_l nl clientopts clientopt : SECRET STRING {
| clientopts if (client.secret[0] != '\0') {
; free($2);
yyerror("secret is specified already");
clientopts : SECRET STRING { YYERROR;
if (strlcpy(client.secret, $2, sizeof(client.secret)) } else if (strlcpy(client.secret, $2,
>= sizeof(client.secret)) { sizeof(client.secret)) >= sizeof(client.secret)) {
free($2);
yyerror("secret is too long"); yyerror("secret is too long");
YYERROR; YYERROR;
} }
free($2);
} }
| MSGAUTH_REQUIRED yesno { | MSGAUTH_REQUIRED yesno {
client.msgauth_required = $2; client.msgauth_required = $2;
} }
|
; ;
prefix : STRING '/' NUMBER { prefix : STRING '/' NUMBER {
@ -297,34 +301,37 @@ setstrerr:
free_str_l(&$5); free_str_l(&$5);
} }
; ;
authenticate : AUTHENTICATE str_l optnl authopts_b { authenticate : AUTHENTICATE {
radiusd_authentication_init(&authen);
} str_l optnl '{' authopts '}' {
struct radiusd_authentication *a; struct radiusd_authentication *a;
if ((a = calloc(1, if ((a = calloc(1,
sizeof(struct radiusd_authentication))) == NULL) { sizeof(struct radiusd_authentication))) == NULL) {
free_str_l(&$2); free_str_l(&$3);
goto outofmemory; goto outofmemory;
} }
a->auth = authen.auth; a->auth = authen.auth;
authen.auth = NULL;
a->deco = authen.deco; a->deco = authen.deco;
a->username = $2.v; a->username = $3.v;
TAILQ_INSERT_TAIL(&conf->authen, a, next); TAILQ_INSERT_TAIL(&conf->authen, a, next);
radiusd_authentication_init(&authen);
} }
; ;
authopts_b : '{' optnl_l authopts_l optnl_l '}' authopts : authopts '\n' authopt
| '{' optnl_l '}' /* empty options */ | authopt
; ;
authopts_l : authopts_l nl authopts authopt : AUTHENTICATE_BY STRING {
| authopts
;
authopts : AUTHENTICATE_BY STRING {
struct radiusd_module_ref *modref; struct radiusd_module_ref *modref;
if (authen.auth != NULL) {
free($2);
yyerror("authenticate is specified already");
YYERROR;
}
modref = create_module_ref($2); modref = create_module_ref($2);
free($2); free($2);
if (modref == NULL) if (modref == NULL)
@ -346,6 +353,7 @@ authopts : AUTHENTICATE_BY STRING {
} }
free_str_l(&$2); free_str_l(&$2);
} }
|
; ;
str_l : str_l strnum { str_l : str_l strnum {
int i; int i;
@ -379,11 +387,6 @@ strnum : STRING { $$ = $1; }
optnl : optnl :
| '\n' | '\n'
; ;
nl : '\n' optnl /* one new line or more */
;
optnl_l :
| '\n' optnl_l
;
yesno : YES { $$ = true; } yesno : YES { $$ = true; }
| NO { $$ = false; } | NO { $$ = false; }
; ;
@ -717,7 +720,6 @@ parse_config(const char *filename, struct radiusd *radiusd)
radiusd_conf_init(conf); radiusd_conf_init(conf);
radiusd_authentication_init(&authen); radiusd_authentication_init(&authen);
radiusd_client_init(&client); radiusd_client_init(&client);
authen.auth = NULL;
if ((file = pushfile(filename)) == NULL) { if ((file = pushfile(filename)) == NULL) {
errors++; errors++;
@ -745,8 +747,7 @@ parse_config(const char *filename, struct radiusd *radiusd)
TAILQ_FOREACH(l, &conf->listen, next) { TAILQ_FOREACH(l, &conf->listen, next) {
l->sock = -1; l->sock = -1;
} }
if (authen.auth != NULL) radiusd_authentication_init(&authen);
free(authen.auth);
TAILQ_FOREACH_SAFE(m, &authen.deco, next, mt) { TAILQ_FOREACH_SAFE(m, &authen.deco, next, mt) {
TAILQ_REMOVE(&authen.deco, m, next); TAILQ_REMOVE(&authen.deco, m, next);
free(m); free(m);
@ -805,6 +806,7 @@ create_module_ref(const char *modulename)
static void static void
radiusd_authentication_init(struct radiusd_authentication *auth) radiusd_authentication_init(struct radiusd_authentication *auth)
{ {
free(auth->auth);
memset(auth, 0, sizeof(struct radiusd_authentication)); memset(auth, 0, sizeof(struct radiusd_authentication));
TAILQ_INIT(&auth->deco); TAILQ_INIT(&auth->deco);
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: radiusd_bsdauth.c,v 1.14 2019/12/14 15:56:20 millert Exp $ */ /* $OpenBSD: radiusd_bsdauth.c,v 1.15 2023/08/18 06:12:27 yasuoka Exp $ */
/* /*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@ -418,6 +418,7 @@ start_child(char *argv0, int fd)
argv[argc++] = argv0; argv[argc++] = argv0;
argv[argc++] = "-M"; /* main proc */ argv[argc++] = "-M"; /* main proc */
argv[argc++] = NULL;
execvp(argv0, argv); execvp(argv0, argv);
fatal("execvp"); fatal("execvp");
} }