mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-06 23:23:51 +02:00
wpa_supplicant: patch for ext file, use a build style
This commit is contained in:
parent
19b66fb67d
commit
65f7cde220
2 changed files with 75 additions and 11 deletions
|
@ -0,0 +1,66 @@
|
||||||
|
From e5ac0dd1af48e085bb824082ef3b64afba673ded Mon Sep 17 00:00:00 2001
|
||||||
|
From: rnhmjoj <rnhmjoj@inventati.org>
|
||||||
|
Date: Wed, 18 Sep 2024 13:43:44 +0200
|
||||||
|
Subject: [PATCH] ext_password_file: do not use wpa_config_get_line
|
||||||
|
To: hostap@lists.infradead.org
|
||||||
|
|
||||||
|
The file-based backed of the ext_password framework uses
|
||||||
|
`wpa_config_get_line` to read the passwords line-by-line from a file.
|
||||||
|
This function is meant to parse a single line from the
|
||||||
|
wpa_supplicant.conf file, so it handles whitespace, quotes and other
|
||||||
|
characters specially.
|
||||||
|
|
||||||
|
Its behavior, however, it's not compatible with the rest of the
|
||||||
|
ext_password framework implementation. For example, if a passphrase
|
||||||
|
contains a `#` character it must be quoted to prevent parsing the
|
||||||
|
remaining characters as an inline comment, but the code handling the
|
||||||
|
external password in `wpa_supplicant_get_psk` does not handle quotes.
|
||||||
|
The result is that either it will hash the enclosing quotes, producing a
|
||||||
|
wrong PSK, or if the passphrase is long enough, fail the length check.
|
||||||
|
As a consequence, some passphrases are impossible to input correctly.
|
||||||
|
|
||||||
|
To solve this and other issues, this patch changes the behaviour of the
|
||||||
|
`ext_password_file_get` function (which was not documented in details,
|
||||||
|
at least w.r.t. special characters) to simply treat all characters
|
||||||
|
literally: including trailing whitespaces (except CR and LF), `#` for
|
||||||
|
inline comments, etc. Empty lines and full-line comments are still
|
||||||
|
supported.
|
||||||
|
|
||||||
|
Signed-off-by: Michele Guerini Rocco <rnhmjoj@inventati.org>
|
||||||
|
---
|
||||||
|
src/utils/ext_password_file.c | 12 ++++++++++--
|
||||||
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/utils/ext_password_file.c b/src/utils/ext_password_file.c
|
||||||
|
index 4bb0095f3..f631ff15c 100644
|
||||||
|
--- a/src/utils/ext_password_file.c
|
||||||
|
+++ b/src/utils/ext_password_file.c
|
||||||
|
@@ -9,7 +9,6 @@
|
||||||
|
#include "includes.h"
|
||||||
|
|
||||||
|
#include "utils/common.h"
|
||||||
|
-#include "utils/config.h"
|
||||||
|
#include "ext_password_i.h"
|
||||||
|
|
||||||
|
|
||||||
|
@@ -97,7 +96,16 @@ static struct wpabuf * ext_password_file_get(void *ctx, const char *name)
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "EXT PW FILE: get(%s)", name);
|
||||||
|
|
||||||
|
- while (wpa_config_get_line(buf, sizeof(buf), f, &line, &pos)) {
|
||||||
|
+ while ((pos = fgets(buf, sizeof(buf), f))) {
|
||||||
|
+ line++;
|
||||||
|
+
|
||||||
|
+ /* Strip newline characters */
|
||||||
|
+ pos[strcspn(pos, "\r\n")] = 0;
|
||||||
|
+
|
||||||
|
+ /* Skip comments and empty lines */
|
||||||
|
+ if (*pos == '#' || *pos == '\0')
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
char *sep = os_strchr(pos, '=');
|
||||||
|
|
||||||
|
if (!sep) {
|
||||||
|
--
|
||||||
|
2.44.1
|
||||||
|
|
|
@ -1,22 +1,27 @@
|
||||||
# Template file for 'wpa_supplicant'
|
# Template file for 'wpa_supplicant'
|
||||||
pkgname=wpa_supplicant
|
pkgname=wpa_supplicant
|
||||||
version=2.11
|
version=2.11
|
||||||
revision=1
|
revision=2
|
||||||
build_wrksrc="${pkgname}"
|
build_wrksrc="${pkgname}"
|
||||||
|
build_style=gnu-makefile
|
||||||
|
make_build_args="V=1 BINDIR=/usr/bin"
|
||||||
|
make_install_args="BINDIR=/usr/bin"
|
||||||
|
make_use_env=true
|
||||||
hostmakedepends="pkg-config"
|
hostmakedepends="pkg-config"
|
||||||
makedepends="libnl3-devel openssl-devel $(vopt_if dbus dbus-devel) $(vopt_if readline readline-devel)"
|
makedepends="libnl3-devel openssl-devel $(vopt_if dbus dbus-devel)
|
||||||
|
$(vopt_if readline readline-devel)"
|
||||||
short_desc="WPA/WPA2/IEEE 802.1X Supplicant"
|
short_desc="WPA/WPA2/IEEE 802.1X Supplicant"
|
||||||
maintainer="Enno Boland <gottox@voidlinux.org>"
|
maintainer="Enno Boland <gottox@voidlinux.org>"
|
||||||
license="BSD-3-Clause"
|
license="BSD-3-Clause"
|
||||||
homepage="http://w1.fi/wpa_supplicant/"
|
homepage="http://w1.fi/wpa_supplicant/"
|
||||||
distfiles="http://w1.fi/releases/${pkgname}-${version}.tar.gz"
|
distfiles="http://w1.fi/releases/${pkgname}-${version}.tar.gz"
|
||||||
checksum=912ea06f74e30a8e36fbb68064d6cdff218d8d591db0fc5d75dee6c81ac7fc0a
|
checksum=912ea06f74e30a8e36fbb68064d6cdff218d8d591db0fc5d75dee6c81ac7fc0a
|
||||||
|
make_check=no # has no test suite
|
||||||
build_options="dbus readline"
|
build_options="dbus readline"
|
||||||
build_options_default="dbus readline"
|
build_options_default="dbus readline"
|
||||||
conf_files="/etc/${pkgname}/${pkgname}.conf"
|
conf_files="/etc/${pkgname}/${pkgname}.conf"
|
||||||
|
|
||||||
pre_build() {
|
pre_build() {
|
||||||
vsed -e 's|/usr/local|$(PREFIX)|g' -i Makefile
|
|
||||||
cp -f ${FILESDIR}/config .config
|
cp -f ${FILESDIR}/config .config
|
||||||
|
|
||||||
if [ "$build_option_dbus" ]; then
|
if [ "$build_option_dbus" ]; then
|
||||||
|
@ -31,14 +36,7 @@ pre_build() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
do_build() {
|
post_install() {
|
||||||
export CFLAGS+=" $(pkg-config --cflags libnl-3.0) $CPPFLAGS"
|
|
||||||
make ${makejobs} V=1 PREFIX=/usr BINDIR=/usr/bin
|
|
||||||
}
|
|
||||||
|
|
||||||
do_install() {
|
|
||||||
make PREFIX=/usr BINDIR=/usr/bin DESTDIR=${DESTDIR} install
|
|
||||||
|
|
||||||
if [ "$build_option_dbus" ]; then
|
if [ "$build_option_dbus" ]; then
|
||||||
install -d ${DESTDIR}/usr/share/dbus-1/system-services
|
install -d ${DESTDIR}/usr/share/dbus-1/system-services
|
||||||
install -m644 dbus/*.service ${DESTDIR}/usr/share/dbus-1/system-services/
|
install -m644 dbus/*.service ${DESTDIR}/usr/share/dbus-1/system-services/
|
||||||
|
|
Loading…
Add table
Reference in a new issue