aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-12-19 20:23:16 +0000
committerTimo Teräs <timo.teras@iki.fi>2013-12-19 20:23:16 +0000
commit1d42c05157d154c65e8a86609583170125fd1a3d (patch)
treea07dafd4f52a1e35d806a8898737bb6530fecfe7
parent122f2cf1b91b4a8c06e341bb36d5b59dbd5b5ee3 (diff)
downloadaports-1d42c05157d154c65e8a86609583170125fd1a3d.tar.bz2
aports-1d42c05157d154c65e8a86609583170125fd1a3d.tar.xz
main/squark: cherry-pick upstream commits (fixes musl build)
-rw-r--r--main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch129
-rw-r--r--main/squark/0002-all-fix-includes-for-strict-compliance.patch52
-rw-r--r--main/squark/APKBUILD16
3 files changed, 193 insertions, 4 deletions
diff --git a/main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch b/main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch
new file mode 100644
index 0000000000..1b11d516dc
--- /dev/null
+++ b/main/squark/0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch
@@ -0,0 +1,129 @@
+From c43e15006ee6f36f74de12928687f16c8338eadf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Tue, 26 Feb 2013 09:00:20 +0200
+Subject: [PATCH 1/2] auth-snmp: use ifIndex as ifName if that MIB entry is not
+ support
+
+E.g. HP ProCurve 1800 does not seem to support ifName.
+---
+ src/squark-auth-snmp.c | 56 ++++++++++++++++++++++++++++++++++++++------------
+ 1 file changed, 43 insertions(+), 13 deletions(-)
+
+diff --git a/src/squark-auth-snmp.c b/src/squark-auth-snmp.c
+index 2ac1a7f..9a35d33 100644
+--- a/src/squark-auth-snmp.c
++++ b/src/squark-auth-snmp.c
+@@ -64,6 +64,7 @@
+ #define SWITCHF_NO_LLDP_MIB 0x01
+ #define SWITCHF_QBRIDGE_MIB_HAS_VLAN_NUMBER 0x02
+ #define SWITCHF_BRIDGE_MIB_HAS_VLAN 0x04
++#define SWITCHF_NO_IF_MIB_IFNAME 0x08
+
+ /* IANA-AddressFamilyNumbers */
+ #define IANA_AFN_OTHER 0
+@@ -291,6 +292,17 @@ struct auth_context {
+ struct auth_context * next_sleeper;
+ };
+
++void switchinfo_create_ifname(struct auth_context *auth)
++{
++ char name[64];
++
++ if (auth->info_available & FORMAT_PORT_INDEX) {
++ sprintf(name, "%d", auth->local_port);
++ auth->port_name = strdup(name);
++ auth->info_available |= FORMAT_PORT_NAME;
++ }
++}
++
+ static void cache_update_time(void)
+ {
+ current_time = time(NULL);
+@@ -695,6 +707,13 @@ static void auth_force_reauthentication(struct auth_context *auth)
+ snmp_free_pdu(pdu);
+ }
+
++static int auth_need_info(struct auth_context *auth, int needed_flags)
++{
++ if ((auth->info_available & needed_flags) == needed_flags)
++ return 0;
++ return username_format_flags & needed_flags;
++}
++
+ static int auth_handle_portinfo_reply(int oper, netsnmp_session *s, int reqid, netsnmp_pdu *resp, void *data)
+ {
+ struct auth_context *auth = data;
+@@ -704,18 +723,25 @@ static int auth_handle_portinfo_reply(int oper, netsnmp_session *s, int reqid, n
+ goto done;
+
+ var = resp->variables;
+- if (username_format_flags & FORMAT_PORT_NAME)
++ if (auth_need_info(auth, FORMAT_PORT_NAME)) {
+ auth->port_name = blob_cstr_dup(var_parse_type(&var, ASN_OCTET_STR));
+- if (auth->port_name)
+- auth->info_available |= FORMAT_PORT_NAME;
+- if (username_format_flags & FORMAT_PORT_DESCR)
++ if (auth->port_name) {
++ auth->info_available |= FORMAT_PORT_NAME;
++ } else {
++ auth->current_switch->flags |= SWITCHF_NO_IF_MIB_IFNAME;
++ switchinfo_create_ifname(auth);
++ }
++ }
++ if (auth_need_info(auth, FORMAT_PORT_DESCR)) {
+ auth->port_descr = blob_cstr_dup(var_parse_type(&var, ASN_OCTET_STR));
+- if (auth->port_descr)
+- auth->info_available |= FORMAT_PORT_DESCR;
+- if (username_format_flags & FORMAT_PORT_WEBAUTH)
++ if (auth->port_descr)
++ auth->info_available |= FORMAT_PORT_DESCR;
++ }
++ if (auth_need_info(auth, FORMAT_PORT_WEBAUTH)) {
+ auth->webauth_name = blob_cstr_dup(var_parse_type(&var, ASN_OCTET_STR));
+- if (auth->webauth_name)
+- auth->info_available |= FORMAT_PORT_WEBAUTH;
++ if (auth->webauth_name)
++ auth->info_available |= FORMAT_PORT_WEBAUTH;
++ }
+
+ snprintf(auth->status_msg, sizeof(auth->status_msg)-1,
+ "required info missing: info_available=%08x",
+@@ -737,27 +763,31 @@ static void auth_query_port_info(struct auth_context *auth)
+ oid query_oids[MAX_OID_LEN];
+ blob_t query;
+
+- if (auth_ok(auth)) {
++ if (si->flags & SWITCHF_NO_IF_MIB_IFNAME)
++ switchinfo_create_ifname(auth);
++
++ if (auth_ok(auth) ||
++ !auth_need_info(auth, FORMAT_PORT_NAME | FORMAT_PORT_DESCR | FORMAT_PORT_WEBAUTH)) {
+ auth_completed(auth);
+ return;
+ }
+
+ pdu = snmp_pdu_create(SNMP_MSG_GET);
+- if (username_format_flags & FORMAT_PORT_NAME) {
++ if (auth_need_info(auth, FORMAT_PORT_NAME)) {
+ query = BLOB_OID(query_oids);
+ blob_push(&query, BLOB_OID(IF_MIB_ifName));
+ blob_push_oid(&query, auth->local_port);
+ query = blob_pushed(BLOB_OID(query_oids), query);
+ snmp_add_null_var(pdu, oid_blob(query));
+ }
+- if (username_format_flags & FORMAT_PORT_DESCR) {
++ if (auth_need_info(auth, FORMAT_PORT_DESCR)) {
+ query = BLOB_OID(query_oids);
+ blob_push(&query, BLOB_OID(IF_MIB_ifDescr));
+ blob_push_oid(&query, auth->local_port);
+ query = blob_pushed(BLOB_OID(query_oids), query);
+ snmp_add_null_var(pdu, oid_blob(query));
+ }
+- if (username_format_flags & FORMAT_PORT_WEBAUTH) {
++ if (auth_need_info(auth, FORMAT_PORT_WEBAUTH)) {
+ query = BLOB_OID(query_oids);
+ blob_push(&query, BLOB_OID(HP_hpicfUsrAuthWebAuthSessionName));
+ blob_push_oid(&query, auth->local_port);
+--
+1.8.5.1
+
diff --git a/main/squark/0002-all-fix-includes-for-strict-compliance.patch b/main/squark/0002-all-fix-includes-for-strict-compliance.patch
new file mode 100644
index 0000000000..c57c78b3cf
--- /dev/null
+++ b/main/squark/0002-all-fix-includes-for-strict-compliance.patch
@@ -0,0 +1,52 @@
+From 7efc2ebeda4414bf3c633a6cf86b49c033973f52 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Thu, 19 Dec 2013 22:20:39 +0200
+Subject: [PATCH 2/2] all: fix #includes for strict compliance
+
+---
+ src/authdb.c | 3 ++-
+ src/blob.c | 2 +-
+ src/blob.h | 1 +
+ 3 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/authdb.c b/src/authdb.c
+index a0c0478..b9d38c8 100644
+--- a/src/authdb.c
++++ b/src/authdb.c
+@@ -1,7 +1,8 @@
+ #include <sys/mman.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+-#include <malloc.h>
++#include <stdlib.h>
++#include <stdio.h>
+ #include <sched.h>
+ #include <fcntl.h>
+ #include <ctype.h>
+diff --git a/src/blob.c b/src/blob.c
+index a6ccc62..c526d9b 100644
+--- a/src/blob.c
++++ b/src/blob.c
+@@ -1,6 +1,6 @@
+ #include <time.h>
+ #include <ctype.h>
+-#include <malloc.h>
++#include <stdlib.h>
+ #include <string.h>
+ #include <arpa/inet.h>
+
+diff --git a/src/blob.h b/src/blob.h
+index 971ce61..6a8e51c 100644
+--- a/src/blob.h
++++ b/src/blob.h
+@@ -2,6 +2,7 @@
+ #define BLOB_H
+
+ #include <string.h>
++#include <time.h>
+
+ struct in_addr;
+
+--
+1.8.5.1
+
diff --git a/main/squark/APKBUILD b/main/squark/APKBUILD
index 01b34b7593..69d93eb986 100644
--- a/main/squark/APKBUILD
+++ b/main/squark/APKBUILD
@@ -1,12 +1,14 @@
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=squark
pkgver=0.5
-pkgrel=0
+pkgrel=1
pkgdesc="Squark - Squid User Authentication and Rating Kit"
subpackages=
depends="haserl"
makedepends="net-snmp-dev cmph-dev lua-dev pkgconfig"
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.bz2
+ 0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch
+ 0002-all-fix-includes-for-strict-compliance.patch
"
url="http://git.alpinelinux.org/cgit/squark/"
arch="all"
@@ -36,6 +38,12 @@ package() {
make FULL_VERSION="$pkgver-r$pkgrel" DESTDIR="$pkgdir" install
}
-md5sums="da9ff8ceaa277781dcebd8d3c0e886d1 squark-0.5.tar.bz2"
-sha256sums="327b6578ace9629cefce3f67489b030ac33efb66b813087b3d7a451917df09ec squark-0.5.tar.bz2"
-sha512sums="772696730612fc67ca63dd8c843a3596e37f2f0a02df1a3e0bf2156987bb728ae6213efc7ab556d7cb8c9d9fe83cd75bfe45aa09b4ffde2cefc20f54ba509819 squark-0.5.tar.bz2"
+md5sums="da9ff8ceaa277781dcebd8d3c0e886d1 squark-0.5.tar.bz2
+badc55a43f2eee9b7b02083bc6879f51 0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch
+2b6c8d5d8136fa8450c4fbb95936c3d7 0002-all-fix-includes-for-strict-compliance.patch"
+sha256sums="327b6578ace9629cefce3f67489b030ac33efb66b813087b3d7a451917df09ec squark-0.5.tar.bz2
+1c6733e2d0afed808a2ed89de35c2ac203b42b720ff8bc6208cf4e329aa01d64 0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch
+323b34c54f30b31e16b51ea6de7488aca42397ea3336db0bc0dfc1cc256bd34d 0002-all-fix-includes-for-strict-compliance.patch"
+sha512sums="772696730612fc67ca63dd8c843a3596e37f2f0a02df1a3e0bf2156987bb728ae6213efc7ab556d7cb8c9d9fe83cd75bfe45aa09b4ffde2cefc20f54ba509819 squark-0.5.tar.bz2
+ccb1f3d742f2ed4452c435e5f543570ba43becbbc22ba8d6d78d006774b8e2115bdbb3461dcaf9376efda4f5223c012b43c02e439ffdd3d9398ed3fba085f62b 0001-auth-snmp-use-ifIndex-as-ifName-if-that-MIB-entry-is.patch
+046d38073cbd1ece2c2464c3f3861d040ceabd82849aff4efa0c3f18ac8ed5159e0bb2b772d9fb373e6141f9fdcd06888a89729d14254752ecf0aec1d564fb3f 0002-all-fix-includes-for-strict-compliance.patch"