replace bluez pkgs with a single bluez bundle pkg

upg ghostscript net-snmp unbound vala
This commit is contained in:
joborun linux 2024-03-15 20:49:16 +02:00
parent fffd0297ba
commit 36a350ffcf
17 changed files with 1927 additions and 193 deletions

View File

@ -0,0 +1,924 @@
From 92ed637ab2bc44b812fd8c7bff5b5f41fcc48255 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Fri, 8 Mar 2024 17:02:05 -0500
Subject: [PATCH] shared/uhid: Add dedicated functions for each UHID opcode
This adds bt_uhid_create which uses UHID_CREATE2 and tracks progress of
when the device is ready to receive events and in the meantime queues
them while waiting for UHID_START and other dedicated functions for each
UHID opcode so users don't need to build each command manually.
---
src/shared/uhid.c | 212 +++++++++++++++++++++++++++++++++++++++++++++-
src/shared/uhid.h | 13 +++
2 files changed, 221 insertions(+), 4 deletions(-)
diff --git a/src/shared/uhid.c b/src/shared/uhid.c
index 1f15443cd6..46edb3bfa3 100644
--- a/src/shared/uhid.c
+++ b/src/shared/uhid.c
@@ -26,11 +26,18 @@
#define UHID_DEVICE_FILE "/dev/uhid"
+#ifndef MIN
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#endif
+
struct bt_uhid {
int ref_count;
struct io *io;
unsigned int notify_id;
struct queue *notify_list;
+ struct queue *input;
+ bool created;
+ bool started;
};
struct uhid_notify {
@@ -48,6 +55,9 @@ static void uhid_free(struct bt_uhid *uhid)
if (uhid->notify_list)
queue_destroy(uhid->notify_list, free);
+ if (uhid->input)
+ queue_destroy(uhid->input, free);
+
free(uhid);
}
@@ -215,14 +225,11 @@ bool bt_uhid_unregister_all(struct bt_uhid *uhid)
return true;
}
-int bt_uhid_send(struct bt_uhid *uhid, const struct uhid_event *ev)
+static int uhid_send(struct bt_uhid *uhid, const struct uhid_event *ev)
{
ssize_t len;
struct iovec iov;
- if (!uhid->io)
- return -ENOTCONN;
-
iov.iov_base = (void *) ev;
iov.iov_len = sizeof(*ev);
@@ -233,3 +240,200 @@ int bt_uhid_send(struct bt_uhid *uhid, const struct uhid_event *ev)
/* uHID kernel driver does not handle partial writes */
return len != sizeof(*ev) ? -EIO : 0;
}
+
+int bt_uhid_send(struct bt_uhid *uhid, const struct uhid_event *ev)
+{
+ if (!uhid || !ev)
+ return -EINVAL;
+
+ if (!uhid->io)
+ return -ENOTCONN;
+
+ return uhid_send(uhid, ev);
+}
+
+static bool input_dequeue(const void *data, const void *match_data)
+{
+ struct uhid_event *ev = (void *)data;
+ struct bt_uhid *uhid = (void *)match_data;
+
+ return bt_uhid_send(uhid, ev) == 0;
+}
+
+static void uhid_start(struct uhid_event *ev, void *user_data)
+{
+ struct bt_uhid *uhid = user_data;
+
+ uhid->started = true;
+
+ /* dequeue input events send while UHID_CREATE2 was in progress */
+ queue_remove_all(uhid->input, input_dequeue, uhid, free);
+}
+
+int bt_uhid_create(struct bt_uhid *uhid, const char *name, bdaddr_t *src,
+ bdaddr_t *dst, uint32_t vendor, uint32_t product,
+ uint32_t version, uint32_t country, void *rd_data,
+ size_t rd_size)
+{
+ struct uhid_event ev;
+ int err;
+
+ if (!uhid || !name || rd_size > sizeof(ev.u.create2.rd_data))
+ return -EINVAL;
+
+ if (uhid->created)
+ return 0;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.type = UHID_CREATE2;
+ strncpy((char *) ev.u.create2.name, name,
+ sizeof(ev.u.create2.name) - 1);
+ if (src)
+ sprintf((char *)ev.u.create2.phys,
+ "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",
+ src->b[5], src->b[4], src->b[3], src->b[2], src->b[1],
+ src->b[0]);
+ if (dst)
+ sprintf((char *)ev.u.create2.uniq,
+ "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",
+ dst->b[5], dst->b[4], dst->b[3], dst->b[2], dst->b[1],
+ dst->b[0]);
+ ev.u.create2.vendor = vendor;
+ ev.u.create2.product = product;
+ ev.u.create2.version = version;
+ ev.u.create2.country = country;
+ ev.u.create2.bus = BUS_BLUETOOTH;
+ if (rd_size)
+ memcpy(ev.u.create2.rd_data, rd_data, rd_size);
+ ev.u.create2.rd_size = rd_size;
+
+ err = bt_uhid_send(uhid, &ev);
+ if (err)
+ return err;
+
+ bt_uhid_register(uhid, UHID_START, uhid_start, uhid);
+
+ uhid->created = true;
+ uhid->started = false;
+
+ return 0;
+}
+
+bool bt_uhid_created(struct bt_uhid *uhid)
+{
+ if (!uhid)
+ return false;
+
+ return uhid->created;
+}
+
+bool bt_uhid_started(struct bt_uhid *uhid)
+{
+ if (!uhid)
+ return false;
+
+ return uhid->started;
+}
+
+int bt_uhid_input(struct bt_uhid *uhid, uint8_t number, const void *data,
+ size_t size)
+{
+ struct uhid_event ev;
+ struct uhid_input2_req *req = &ev.u.input2;
+ size_t len = 0;
+
+ if (!uhid)
+ return -EINVAL;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.type = UHID_INPUT2;
+
+ if (number) {
+ req->data[len++] = number;
+ req->size = 1 + MIN(size, sizeof(req->data) - 1);
+ } else
+ req->size = MIN(size, sizeof(req->data));
+
+ if (data && size)
+ memcpy(&req->data[len], data, req->size - len);
+
+ /* Queue events if UHID_START has not been received yet */
+ if (!uhid->started) {
+ if (!uhid->input)
+ uhid->input = queue_new();
+
+ queue_push_tail(uhid->input, util_memdup(&ev, sizeof(ev)));
+ return 0;
+ }
+
+ return bt_uhid_send(uhid, &ev);
+}
+
+int bt_uhid_set_report_reply(struct bt_uhid *uhid, uint8_t id, uint8_t status)
+{
+ struct uhid_event ev;
+ struct uhid_set_report_reply_req *rsp = &ev.u.set_report_reply;
+
+ if (!uhid)
+ return false;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.type = UHID_SET_REPORT_REPLY;
+ rsp->id = id;
+ rsp->err = status;
+
+ return bt_uhid_send(uhid, &ev);
+}
+
+int bt_uhid_get_report_reply(struct bt_uhid *uhid, uint8_t id, uint8_t number,
+ uint8_t status, const void *data, size_t size)
+{
+ struct uhid_event ev;
+ struct uhid_get_report_reply_req *rsp = &ev.u.get_report_reply;
+ size_t len = 0;
+
+ if (!uhid)
+ return false;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.type = UHID_GET_REPORT_REPLY;
+ rsp->id = id;
+ rsp->err = status;
+
+ if (!data || !size)
+ goto done;
+
+ if (number) {
+ rsp->data[len++] = number;
+ rsp->size += MIN(size, sizeof(rsp->data) - 1);
+ } else
+ rsp->size = MIN(size, sizeof(ev.u.input.data));
+
+ memcpy(&rsp->data[len], data, rsp->size - len);
+
+done:
+ return bt_uhid_send(uhid, &ev);
+}
+
+int bt_uhid_destroy(struct bt_uhid *uhid)
+{
+ struct uhid_event ev;
+ int err;
+
+ if (!uhid)
+ return -EINVAL;
+
+ if (!uhid->created)
+ return 0;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.type = UHID_DESTROY;
+
+ err = bt_uhid_send(uhid, &ev);
+ if (err < 0)
+ return err;
+
+ uhid->created = false;
+
+ return err;
+}
diff --git a/src/shared/uhid.h b/src/shared/uhid.h
index 55ae839f30..d705338827 100644
--- a/src/shared/uhid.h
+++ b/src/shared/uhid.h
@@ -11,6 +11,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <linux/uhid.h>
+#include <bluetooth/bluetooth.h>
struct bt_uhid;
@@ -29,3 +30,15 @@ bool bt_uhid_unregister(struct bt_uhid *uhid, unsigned int id);
bool bt_uhid_unregister_all(struct bt_uhid *uhid);
int bt_uhid_send(struct bt_uhid *uhid, const struct uhid_event *ev);
+int bt_uhid_create(struct bt_uhid *uhid, const char *name, bdaddr_t *src,
+ bdaddr_t *dst, uint32_t vendor, uint32_t product,
+ uint32_t version, uint32_t country, void *rd_data,
+ size_t rd_size);
+bool bt_uhid_created(struct bt_uhid *uhid);
+bool bt_uhid_started(struct bt_uhid *uhid);
+int bt_uhid_input(struct bt_uhid *uhid, uint8_t number, const void *data,
+ size_t size);
+int bt_uhid_set_report_reply(struct bt_uhid *uhid, uint8_t id, uint8_t status);
+int bt_uhid_get_report_reply(struct bt_uhid *uhid, uint8_t id, uint8_t number,
+ uint8_t status, const void *data, size_t size);
+int bt_uhid_destroy(struct bt_uhid *uhid);
From 256d0b594d044222975f55e3b2d02990e0f88f87 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Fri, 8 Mar 2024 17:04:50 -0500
Subject: [PATCH] hog-lib: Use bt_uhid functions
This makes use of bt_uhid function instead of directly submitting
events directly using bt_uhid_send.
---
profiles/input/hog-lib.c | 168 ++++++---------------------------------
1 file changed, 25 insertions(+), 143 deletions(-)
diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c
index 67492a63e..8071e1364 100644
--- a/profiles/input/hog-lib.c
+++ b/profiles/input/hog-lib.c
@@ -79,8 +79,6 @@ struct bt_hog {
GSList *reports;
struct bt_uhid *uhid;
int uhid_fd;
- bool uhid_created;
- bool uhid_start;
uint64_t uhid_flags;
uint16_t bcdhid;
uint8_t bcountrycode;
@@ -99,7 +97,6 @@ struct bt_hog {
struct queue *gatt_op;
struct gatt_db *gatt_db;
struct gatt_db_attribute *report_map_attr;
- struct queue *input;
};
struct report {
@@ -326,8 +323,6 @@ static void report_value_cb(const guint8 *pdu, guint16 len, gpointer user_data)
{
struct report *report = user_data;
struct bt_hog *hog = report->hog;
- struct uhid_event ev;
- uint8_t *buf;
int err;
if (len < ATT_NOTIFICATION_HEADER_SIZE) {
@@ -338,40 +333,10 @@ static void report_value_cb(const guint8 *pdu, guint16 len, gpointer user_data)
pdu += ATT_NOTIFICATION_HEADER_SIZE;
len -= ATT_NOTIFICATION_HEADER_SIZE;
- memset(&ev, 0, sizeof(ev));
- ev.type = UHID_INPUT;
- buf = ev.u.input.data;
-
- /* BLUETOOTH SPECIFICATION Page 16 of 26
- * HID Service Specification
- *
- * Report ID shall be nonzero in a Report Reference characteristic
- * descriptor where there is more than one instance of the Report
- * characteristic for any given Report Type.
- */
- if (report->numbered && report->id) {
- buf[0] = report->id;
- len = MIN(len, sizeof(ev.u.input.data) - 1);
- memcpy(buf + 1, pdu, len);
- ev.u.input.size = ++len;
- } else {
- len = MIN(len, sizeof(ev.u.input.data));
- memcpy(buf, pdu, len);
- ev.u.input.size = len;
- }
-
- /* If uhid had not sent UHID_START yet queue up the input */
- if (!hog->uhid_created || !hog->uhid_start) {
- if (!hog->input)
- hog->input = queue_new();
-
- queue_push_tail(hog->input, util_memdup(&ev, sizeof(ev)));
- return;
- }
-
- err = bt_uhid_send(hog->uhid, &ev);
+ err = bt_uhid_input(hog->uhid, report->numbered ? report->id : 0, pdu,
+ len);
if (err < 0)
- error("bt_uhid_send: %s (%d)", strerror(-err), -err);
+ error("bt_uhid_input: %s (%d)", strerror(-err), -err);
}
static void report_notify_destroy(void *user_data)
@@ -832,56 +797,32 @@ static void set_numbered(void *data, void *user_data)
}
}
-static bool input_dequeue(const void *data, const void *match_data)
-{
- const struct uhid_event *ev = data;
- const struct bt_hog *hog = match_data;
- int err;
-
- err = bt_uhid_send(hog->uhid, ev);
- if (err < 0) {
- error("bt_uhid_send: %s (%d)", strerror(-err), -err);
- return false;
- }
-
- return true;
-}
-
static void start_flags(struct uhid_event *ev, void *user_data)
{
struct bt_hog *hog = user_data;
- hog->uhid_start = true;
hog->uhid_flags = ev->u.start.dev_flags;
DBG("uHID device flags: 0x%16" PRIx64, hog->uhid_flags);
if (hog->uhid_flags)
g_slist_foreach(hog->reports, set_numbered, hog);
-
- queue_remove_all(hog->input, input_dequeue, hog, free);
}
static void set_report_cb(guint8 status, const guint8 *pdu,
guint16 plen, gpointer user_data)
{
struct bt_hog *hog = user_data;
- struct uhid_event rsp;
int err;
hog->setrep_att = 0;
- memset(&rsp, 0, sizeof(rsp));
- rsp.type = UHID_SET_REPORT_REPLY;
- rsp.u.set_report_reply.id = hog->setrep_id;
- rsp.u.set_report_reply.err = status;
-
if (status != 0)
error("Error setting Report value: %s", att_ecode2str(status));
- err = bt_uhid_send(hog->uhid, &rsp);
+ err = bt_uhid_set_report_reply(hog->uhid, hog->setrep_id, status);
if (err < 0)
- error("bt_uhid_send: %s", strerror(-err));
+ error("bt_uhid_set_report_reply: %s", strerror(-err));
}
static void set_report(struct uhid_event *ev, void *user_data)
@@ -937,34 +878,16 @@ static void set_report(struct uhid_event *ev, void *user_data)
}
static void report_reply(struct bt_hog *hog, uint8_t status, uint8_t id,
- bool numbered, uint16_t len, const uint8_t *data)
+ uint16_t len, const uint8_t *data)
{
- struct uhid_event rsp;
int err;
hog->getrep_att = 0;
- memset(&rsp, 0, sizeof(rsp));
- rsp.type = UHID_GET_REPORT_REPLY;
- rsp.u.get_report_reply.id = hog->getrep_id;
-
- if (status)
- goto done;
-
- if (numbered && len > 0) {
- rsp.u.get_report_reply.size = len + 1;
- rsp.u.get_report_reply.data[0] = id;
- memcpy(&rsp.u.get_report_reply.data[1], data, len);
- } else {
- rsp.u.get_report_reply.size = len;
- memcpy(rsp.u.get_report_reply.data, data, len);
- }
-
-done:
- rsp.u.get_report_reply.err = status;
- err = bt_uhid_send(hog->uhid, &rsp);
+ err = bt_uhid_get_report_reply(hog->uhid, hog->getrep_id, status, id,
+ data, len);
if (err < 0)
- error("bt_uhid_send: %s", strerror(-err));
+ error("bt_uhid_get_report_reply: %s", strerror(-err));
}
static void get_report_cb(guint8 status, const guint8 *pdu, guint16 len,
@@ -994,7 +917,7 @@ static void get_report_cb(guint8 status, const guint8 *pdu, guint16 len,
++pdu;
exit:
- report_reply(hog, status, report->id, report->numbered, len, pdu);
+ report_reply(hog, status, report->numbered ? report->id : 0, len, pdu);
}
static void get_report(struct uhid_event *ev, void *user_data)
@@ -1030,61 +953,33 @@ static void get_report(struct uhid_event *ev, void *user_data)
fail:
/* reply with an error on failure */
- report_reply(hog, err, 0, false, 0, NULL);
+ report_reply(hog, err, 0, 0, NULL);
}
static void uhid_create(struct bt_hog *hog, uint8_t *report_map,
size_t report_map_len)
{
uint8_t *value = report_map;
- struct uhid_event ev;
size_t vlen = report_map_len;
- int i, err;
+ int err;
GError *gerr = NULL;
-
- if (vlen > sizeof(ev.u.create2.rd_data)) {
- error("Report MAP too big: %zu > %zu", vlen,
- sizeof(ev.u.create2.rd_data));
- return;
- }
-
- /* create uHID device */
- memset(&ev, 0, sizeof(ev));
- ev.type = UHID_CREATE2;
+ bdaddr_t src, dst;
bt_io_get(g_attrib_get_channel(hog->attrib), &gerr,
- BT_IO_OPT_SOURCE, ev.u.create2.phys,
- BT_IO_OPT_DEST, ev.u.create2.uniq,
+ BT_IO_OPT_SOURCE_BDADDR, &src,
+ BT_IO_OPT_DEST_BDADDR, &dst,
BT_IO_OPT_INVALID);
-
if (gerr) {
error("Failed to connection details: %s", gerr->message);
g_error_free(gerr);
return;
}
- /* Phys + uniq are the same size (hw address type) */
- for (i = 0;
- i < (int)sizeof(ev.u.create2.phys) && ev.u.create2.phys[i] != 0;
- ++i) {
- ev.u.create2.phys[i] = tolower(ev.u.create2.phys[i]);
- ev.u.create2.uniq[i] = tolower(ev.u.create2.uniq[i]);
- }
-
- strncpy((char *) ev.u.create2.name, hog->name,
- sizeof(ev.u.create2.name) - 1);
- ev.u.create2.vendor = hog->vendor;
- ev.u.create2.product = hog->product;
- ev.u.create2.version = hog->version;
- ev.u.create2.country = hog->bcountrycode;
- ev.u.create2.bus = BUS_BLUETOOTH;
- ev.u.create2.rd_size = vlen;
-
- memcpy(ev.u.create2.rd_data, value, vlen);
-
- err = bt_uhid_send(hog->uhid, &ev);
+ err = bt_uhid_create(hog->uhid, hog->name, &src, &dst,
+ hog->vendor, hog->product, hog->version,
+ hog->bcountrycode, value, vlen);
if (err < 0) {
- error("bt_uhid_send: %s", strerror(-err));
+ error("bt_uhid_create: %s", strerror(-err));
return;
}
@@ -1093,9 +988,6 @@ static void uhid_create(struct bt_hog *hog, uint8_t *report_map,
bt_uhid_register(hog->uhid, UHID_GET_REPORT, get_report, hog);
bt_uhid_register(hog->uhid, UHID_SET_REPORT, set_report, hog);
- hog->uhid_created = true;
- hog->uhid_start = false;
-
DBG("HoG created uHID device");
}
@@ -1146,7 +1038,8 @@ static void read_report_map(struct bt_hog *hog)
{
uint16_t handle;
- if (!hog->report_map_attr || hog->uhid_created || hog->report_map_id)
+ if (!hog->report_map_attr || bt_uhid_created(hog->uhid) ||
+ hog->report_map_id)
return;
handle = gatt_db_attribute_get_handle(hog->report_map_attr);
@@ -1312,24 +1205,14 @@ static bool cancel_gatt_req(const void *data, const void *user_data)
static void uhid_destroy(struct bt_hog *hog)
{
int err;
- struct uhid_event ev;
-
- if (!hog->uhid_created)
- return;
bt_uhid_unregister_all(hog->uhid);
- memset(&ev, 0, sizeof(ev));
- ev.type = UHID_DESTROY;
-
- err = bt_uhid_send(hog->uhid, &ev);
-
+ err = bt_uhid_destroy(hog->uhid);
if (err < 0) {
- error("bt_uhid_send: %s", strerror(-err));
+ error("bt_uhid_destroy: %s", strerror(-err));
return;
}
-
- hog->uhid_created = false;
}
static void hog_free(void *data)
@@ -1339,7 +1222,6 @@ static void hog_free(void *data)
bt_hog_detach(hog);
uhid_destroy(hog);
- queue_destroy(hog->input, free);
queue_destroy(hog->bas, (void *) bt_bas_unref);
g_slist_free_full(hog->instances, hog_free);
@@ -1810,7 +1692,7 @@ bool bt_hog_attach(struct bt_hog *hog, void *gatt)
bt_hog_attach(instance, gatt);
}
- if (!hog->uhid_created) {
+ if (!bt_uhid_created(hog->uhid)) {
DBG("HoG discovering characteristics");
if (hog->attr)
gatt_db_service_foreach_char(hog->attr,
@@ -1822,7 +1704,7 @@ bool bt_hog_attach(struct bt_hog *hog, void *gatt)
char_discovered_cb, hog);
}
- if (!hog->uhid_created)
+ if (!bt_uhid_created(hog->uhid))
return true;
/* If UHID is already created, set up the report value handlers to
From c0c9e462be465ae3e9458256636f10f4d6acbedb Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Fri, 8 Mar 2024 17:06:25 -0500
Subject: [PATCH] input/device: Use bt_uhid functions
This makes use of bt_uhid function instead of directly submitting
events directly using bt_uhid_send.
Fixes: https://github.com/bluez/bluez/issues/771
---
profiles/input/device.c | 93 ++++++++++-------------------------------
1 file changed, 22 insertions(+), 71 deletions(-)
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 0d32b705b..c4f75c744 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -73,7 +73,6 @@ struct input_device {
unsigned int reconnect_timer;
uint32_t reconnect_attempt;
struct bt_uhid *uhid;
- bool uhid_created;
uint8_t report_req_pending;
unsigned int report_req_timer;
uint32_t report_rsp_id;
@@ -215,32 +214,20 @@ static bool uhid_send_get_report_reply(struct input_device *idev,
const uint8_t *data, size_t size,
uint32_t id, uint16_t err)
{
- struct uhid_event ev;
int ret;
if (data == NULL)
size = 0;
- if (size > sizeof(ev.u.get_report_reply.data))
- size = sizeof(ev.u.get_report_reply.data);
-
- if (!idev->uhid_created) {
+ if (!bt_uhid_created(idev->uhid)) {
DBG("HID report (%zu bytes) dropped", size);
return false;
}
- memset(&ev, 0, sizeof(ev));
- ev.type = UHID_GET_REPORT_REPLY;
- ev.u.get_report_reply.id = id;
- ev.u.get_report_reply.err = err;
- ev.u.get_report_reply.size = size;
-
- if (size > 0)
- memcpy(ev.u.get_report_reply.data, data, size);
-
- ret = bt_uhid_send(idev->uhid, &ev);
+ ret = bt_uhid_get_report_reply(idev->uhid, id, 0, err, data, size);
if (ret < 0) {
- error("bt_uhid_send: %s (%d)", strerror(-ret), -ret);
+ error("bt_uhid_get_report_reply: %s (%d)", strerror(-ret),
+ -ret);
return false;
}
@@ -252,20 +239,15 @@ static bool uhid_send_get_report_reply(struct input_device *idev,
static bool uhid_send_set_report_reply(struct input_device *idev,
uint32_t id, uint16_t err)
{
- struct uhid_event ev;
int ret;
- if (!idev->uhid_created)
+ if (!bt_uhid_created(idev->uhid))
return false;
- memset(&ev, 0, sizeof(ev));
- ev.type = UHID_SET_REPORT_REPLY;
- ev.u.set_report_reply.id = id;
- ev.u.set_report_reply.err = err;
-
- ret = bt_uhid_send(idev->uhid, &ev);
+ ret = bt_uhid_set_report_reply(idev->uhid, id, err);
if (ret < 0) {
- error("bt_uhid_send: %s (%d)", strerror(-ret), -ret);
+ error("bt_uhid_set_report_reply: %s (%d)", strerror(-ret),
+ -ret);
return false;
}
@@ -275,30 +257,19 @@ static bool uhid_send_set_report_reply(struct input_device *idev,
static bool uhid_send_input_report(struct input_device *idev,
const uint8_t *data, size_t size)
{
- struct uhid_event ev;
int err;
if (data == NULL)
size = 0;
- if (size > sizeof(ev.u.input.data))
- size = sizeof(ev.u.input.data);
-
- if (!idev->uhid_created) {
+ if (!bt_uhid_created(idev->uhid)) {
DBG("HID report (%zu bytes) dropped", size);
return false;
}
- memset(&ev, 0, sizeof(ev));
- ev.type = UHID_INPUT;
- ev.u.input.size = size;
-
- if (size > 0)
- memcpy(ev.u.input.data, data, size);
-
- err = bt_uhid_send(idev->uhid, &ev);
+ err = bt_uhid_input(idev->uhid, 0, data, size);
if (err < 0) {
- error("bt_uhid_send: %s (%d)", strerror(-err), -err);
+ error("bt_uhid_input: %s (%d)", strerror(-err), -err);
return false;
}
@@ -385,7 +356,7 @@ static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data
virtual_cable_unplug(idev);
/* If connection abruptly ended, uhid might be not yet disconnected */
- if (idev->uhid_created)
+ if (bt_uhid_created(idev->uhid))
uhid_disconnect(idev);
return FALSE;
@@ -445,6 +416,7 @@ static void hidp_recv_ctrl_handshake(struct input_device *idev, uint8_t param)
timeout_remove(idev->report_req_timer);
idev->report_req_timer = 0;
}
+ uhid_send_set_report_reply(idev, idev->report_rsp_id, 0);
idev->report_rsp_id = 0;
}
}
@@ -625,7 +597,7 @@ static bool hidp_report_req_timeout(gpointer data)
break;
}
- DBG("Device %s HIDP %s request timed out", address, req_type_str);
+ error("Device %s HIDP %s request timed out", address, req_type_str);
idev->report_req_pending = 0;
idev->report_req_timer = 0;
@@ -941,28 +913,15 @@ static int ioctl_disconnect(struct input_device *idev, uint32_t flags)
static int uhid_connadd(struct input_device *idev, struct hidp_connadd_req *req)
{
int err;
- struct uhid_event ev;
- if (idev->uhid_created)
+ if (bt_uhid_created(idev->uhid))
return 0;
- /* create uHID device */
- memset(&ev, 0, sizeof(ev));
- ev.type = UHID_CREATE;
- strncpy((char *) ev.u.create.name, req->name, sizeof(ev.u.create.name));
- ba2strlc(&idev->src, (char *) ev.u.create.phys);
- ba2strlc(&idev->dst, (char *) ev.u.create.uniq);
- ev.u.create.vendor = req->vendor;
- ev.u.create.product = req->product;
- ev.u.create.version = req->version;
- ev.u.create.country = req->country;
- ev.u.create.bus = BUS_BLUETOOTH;
- ev.u.create.rd_data = req->rd_data;
- ev.u.create.rd_size = req->rd_size;
-
- err = bt_uhid_send(idev->uhid, &ev);
+ err = bt_uhid_create(idev->uhid, req->name, &idev->src, &idev->dst,
+ req->vendor, req->product, req->version,
+ req->country, req->rd_data, req->rd_size);
if (err < 0) {
- error("bt_uhid_send: %s", strerror(-err));
+ error("bt_uhid_create: %s", strerror(-err));
return err;
}
@@ -972,17 +931,14 @@ static int uhid_connadd(struct input_device *idev, struct hidp_connadd_req *req)
bt_uhid_register(idev->uhid, UHID_SET_REPORT, hidp_send_set_report,
idev);
- idev->uhid_created = true;
-
return err;
}
static int uhid_disconnect(struct input_device *idev)
{
int err;
- struct uhid_event ev;
- if (!idev->uhid_created)
+ if (!bt_uhid_created(idev->uhid))
return 0;
/* Only destroy the node if virtual cable unplug flag has been set */
@@ -991,17 +947,12 @@ static int uhid_disconnect(struct input_device *idev)
bt_uhid_unregister_all(idev->uhid);
- memset(&ev, 0, sizeof(ev));
- ev.type = UHID_DESTROY;
-
- err = bt_uhid_send(idev->uhid, &ev);
+ err = bt_uhid_destroy(idev->uhid);
if (err < 0) {
- error("bt_uhid_send: %s", strerror(-err));
+ error("bt_uhid_destroy: %s", strerror(-err));
return err;
}
- idev->uhid_created = false;
-
return err;
}
From f5fecf037b1ea31612cb0226cc2634994a4671c4 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Fri, 8 Mar 2024 17:07:27 -0500
Subject: [PATCH] test-uhid: Test bt_uhid functions
This tests bt_uhid_create, bt_uhid_input and bt_uhid_destroy instead of
directly submitting UHID_CREATE, UHID_INPUT and UHID_DESTROY.
---
unit/test-uhid.c | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/unit/test-uhid.c b/unit/test-uhid.c
index 8a8eef855b..516b5441bd 100644
--- a/unit/test-uhid.c
+++ b/unit/test-uhid.c
@@ -117,8 +117,8 @@ static gboolean send_pdu(gpointer user_data)
len = write(context->fd, pdu->data, pdu->size);
-
- util_hexdump('<', pdu->data, len, test_debug, "uHID: ");
+ if (tester_use_debug())
+ util_hexdump('<', pdu->data, len, test_debug, "uHID: ");
g_assert_cmpint(len, ==, pdu->size);
@@ -159,7 +159,8 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
g_assert(len > 0);
- util_hexdump('>', buf, len, test_debug, "uHID: ");
+ if (tester_use_debug())
+ util_hexdump('>', buf, len, test_debug, "uHID: ");
g_assert_cmpint(len, ==, pdu->size);
@@ -228,19 +229,31 @@ static const struct uhid_event ev_feature = {
static void test_client(gconstpointer data)
{
struct context *context = create_context(data);
+ int err;
- if (g_str_equal(context->data->test_name, "/uhid/command/create"))
- bt_uhid_send(context->uhid, &ev_create);
+ err = bt_uhid_create(context->uhid, "", NULL, NULL, 0, 0, 0, 0, NULL,
+ 0);
+ if (err < 0)
+ tester_test_failed();
- if (g_str_equal(context->data->test_name, "/uhid/command/destroy"))
- bt_uhid_send(context->uhid, &ev_destroy);
+ if (g_str_equal(context->data->test_name, "/uhid/command/destroy")) {
+ err = bt_uhid_destroy(context->uhid);
+ if (err < 0)
+ tester_test_failed();
+ }
if (g_str_equal(context->data->test_name,
- "/uhid/command/feature_answer"))
- bt_uhid_send(context->uhid, &ev_feature_answer);
+ "/uhid/command/feature_answer")) {
+ err = bt_uhid_send(context->uhid, &ev_feature_answer);
+ if (err < 0)
+ tester_test_failed();
+ }
- if (g_str_equal(context->data->test_name, "/uhid/command/input"))
- bt_uhid_send(context->uhid, &ev_input);
+ if (g_str_equal(context->data->test_name, "/uhid/command/input")) {
+ err = bt_uhid_input(context->uhid, 0, NULL, 0);
+ if (err < 0)
+ tester_test_failed();
+ }
context_quit(context);
}

View File

@ -5,28 +5,29 @@
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=bluez
pkgname=('bluez' 'bluez-utils' 'bluez-libs' 'bluez-cups' 'bluez-deprecated-tools' 'bluez-hid2hci' 'bluez-mesh' 'bluez-obex')
pkgname=bluez
pkgver=5.73
pkgrel=03
pkgrel=04
pkgdesc="Bluez bundle - Daemons for the bluetooth protocol stack - w/o systemd"
url="http://www.bluez.org/"
# options=('debug') ### uncomment this to have the debug pkgs produced
backup=(etc/bluetooth/{main,input,network,mesh-main}.conf)
makedepends=('glibc' 'dbus' 'libical' 'alsa-lib' 'json-c' 'ell' 'python-docutils' 'python-pygments')
provides=('bluez' 'bluez-utils' 'bluez-libs' 'bluez-cups' 'bluez-deprecated-tools' 'bluez-hid2hci' 'bluez-mesh' 'bluez-obex')
conflicts=('obexd-client' 'obexd-server' 'bluez-plugins' 'bluez-utils' 'bluez-libs' 'bluez-cups' 'bluez-deprecated-tools' 'bluez-hid2hci' 'bluez-mesh' 'bluez-obex')
replaces=('bluez-plugins' 'bluez-utils' 'bluez-libs' 'bluez-cups' 'bluez-deprecated-tools' 'bluez-hid2hci' 'bluez-mesh' 'bluez-obex')
source=(https://www.kernel.org/pub/linux/bluetooth/${pkgname}-${pkgver}.tar.{xz,sign}
bluetooth.modprobe)
bluetooth.modprobe
0001_use_bt_uhid_functions.patch)
#https://gitlab.archlinux.org/archlinux/packaging/packages/bluez/-/issues/2
# see https://www.kernel.org/pub/linux/bluetooth/sha256sums.asc
prepare() {
cd $pkgname-$pkgver
# fix autoconnection - https://github.com/bluez/bluez/issues/686
# https://github.com/tedd-an/bluez-upstream-test/pull/484
# patch -Np1 -i ../fix-bluez-5.71-autoconnection.diff
# fix coredump on a2dp suspend - https://gitlab.archlinux.org/archlinux/packaging/packages/bluez/-/issues/3
# https://lore.kernel.org/linux-bluetooth/20231219124916.44173-2-vlad.pruteanu@nxp.com/
# patch -Np1 -i ../fix-bluez-5.71-coredump-on-a2dp-suspend.diff
cd "${pkgname}"-${pkgver}
# fix DualShock 3 connection - #6
# https://github.com/bluez/bluez/issues/771
patch -Np1 -i ../0001_use_bt_uhid_functions.patch
}
build() {
@ -50,27 +51,6 @@ build() {
--enable-library \
--enable-deprecated # libraries and these tools are deprecated
make
# fake installation to be seperated into packages
make DESTDIR="${srcdir}/fakeinstall" install
# add missing tools FS#41132, FS#41687, FS#42716
for files in `find tools/ -type f -perm -755`; do
filename=$(basename $files)
install -Dm755 "${srcdir}"/"${pkgbase}"-${pkgver}/tools/$filename "${srcdir}/fakeinstall"/usr/bin/$filename
done
}
_install() {
local src f dir
for src; do
f="${src#fakeinstall/}"
dir="${pkgdir}/${f%/*}"
install -m755 -d "${dir}"
# use copy so a new file is created and fakeroot can track properties such as setuid
cp -av "${src}" "${dir}/"
rm -rf "${src}"
done
}
check() {
@ -79,30 +59,23 @@ check() {
make check || /bin/true
}
package_bluez() {
pkgdesc="Daemons for the bluetooth protocol stack w/o systemd"
depends=('glibc' 'dbus' 'glib2' 'alsa-lib')
backup=(etc/bluetooth/{main,input,network}.conf)
# conflicts=('obexd-client' 'obexd-server')
_install fakeinstall/usr/lib/bluetooth/bluetoothd
# _install fakeinstall/usr/lib/systemd/system/bluetooth.service
# _install fakeinstall/usr/share/dbus-1/system-services/org.bluez.service
# _install fakeinstall/usr/share/dbus-1/system.d/bluetooth.conf
# _install fakeinstall/etc/bluetooth/main.conf
# _install fakeinstall/etc/bluetooth/input.conf
# _install fakeinstall/etc/bluetooth/network.conf
_install fakeinstall/usr/share/man/man8/bluetoothd.8
package() {
cd $pkgname-$pkgver
depends=('glibc' 'dbus' 'glib2' 'alsa-lib' 'readline' 'libical' 'json-c' 'cups')
optdepends=('ell: for btpclient')
make DESTDIR="$pkgdir" install
# ship upstream main config files
install -dm555 "${pkgdir}"/etc/bluetooth
install -Dm644 "${srcdir}"/"${pkgbase}"-${pkgver}/src/main.conf "${pkgdir}"/etc/bluetooth/main.conf
install -Dm644 "${srcdir}"/"${pkgbase}"-${pkgver}/profiles/input/input.conf "${pkgdir}"/etc/bluetooth/input.conf
install -Dm644 "${srcdir}"/"${pkgbase}"-${pkgver}/profiles/network/network.conf "${pkgdir}"/etc/bluetooth/network.conf
install -Dm644 "${srcdir}"/"${pkgname}"-${pkgver}/src/main.conf "${pkgdir}"/etc/bluetooth/main.conf
install -Dm644 "${srcdir}"/"${pkgname}"-${pkgver}/profiles/input/input.conf "${pkgdir}"/etc/bluetooth/input.conf
install -Dm644 "${srcdir}"/"${pkgname}"-${pkgver}/profiles/network/network.conf "${pkgdir}"/etc/bluetooth/network.conf
install -Dm644 "${srcdir}"/"${pkgname}"-${pkgver}/mesh/mesh-main.conf "${pkgdir}"/etc/bluetooth/mesh-main.conf
install -dm755 "${pkgdir}"/etc/bluetooth
# add basic documention
install -dm755 "${pkgdir}"/usr/share/doc/"${pkgbase}"/dbus-apis
cp -a "${pkgbase}"-${pkgver}/doc/*.txt "${pkgdir}"/usr/share/doc/"${pkgbase}"/dbus-apis/
install -dm755 "${pkgdir}"/usr/share/doc/"${pkgname}"/dbus-apis
cp -a "${srcdir}"/"${pkgname}"-${pkgver}/doc/*.txt "${pkgdir}"/usr/share/doc/"${pkgname}"/dbus-apis/
# fix module loading errors
install -dm755 "${pkgdir}"/usr/lib/modprobe.d
install -Dm644 "${srcdir}"/bluetooth.modprobe "${pkgdir}"/usr/lib/modprobe.d/bluetooth-usb.conf
@ -110,105 +83,22 @@ package_bluez() {
# https://bugzilla.kernel.org/show_bug.cgi?id=196621
install -dm755 "$pkgdir"/usr/lib/modules-load.d
echo "crypto_user" > "$pkgdir"/usr/lib/modules-load.d/bluez.conf
}
package_bluez-utils() {
pkgdesc="Development and debugging utilities for the bluetooth protocol stack w/o systemd"
depends=('glibc' 'dbus' 'glib2' 'readline')
optdepends=('ell: for btpclient')
provides=('bluez-plugins')
replaces=('bluez-plugins')
_install fakeinstall/usr/bin/{advtest,amptest,avinfo,avtest,bcmfw,bdaddr,bluemoon,bluetoothctl,bluetooth-player,bneptest,btattach,btconfig,btgatt-client,btgatt-server,btinfo,btiotest,btmgmt,btmon,btpclient,btpclientctl,btproxy,btsnoop,check-selftest,cltest,create-image,eddystone,gatt-service,hcieventmask,hcisecfilter,hex2hcd,hid2hci,hwdb,ibeacon,isotest,l2ping,l2test,mcaptest,mpris-proxy,nokfw,oobtest,rctest,rtlfw,scotest,seq2bseq,test-runner}
_install fakeinstall/usr/share/man/man1/bluetoothctl*.1
_install fakeinstall/usr/share/man/man1/{btattach,btmgmt,btmon,isotest,l2ping,rctest}.1
_install fakeinstall/usr/share/man/man5/org.bluez.{A,B,D,G,I,L,M,N,P}*.5
_install fakeinstall/usr/share/zsh/site-functions/_bluetoothctl
}
package_bluez-deprecated-tools() {
pkgdesc="Deprecated tools that are no longer maintained w/o systemd"
depends=('json-c' 'glib2' 'dbus' 'readline' 'glibc')
_install fakeinstall/usr/bin/{ciptool,hciattach,hciconfig,hcidump,hcitool,meshctl,rfcomm,sdptool}
_install fakeinstall/usr/share/man/man1/{ciptool,hciattach,hciconfig,hcidump,hcitool,rfcomm,sdptool}.1
}
package_bluez-libs() {
pkgdesc="Deprecated libraries for the bluetooth protocol stack"
depends=('glibc')
provides=('libbluetooth.so')
license=('LGPL-2.1-only')
_install fakeinstall/usr/include/bluetooth/*
_install fakeinstall/usr/lib/libbluetooth.so*
_install fakeinstall/usr/lib/pkgconfig/*
}
package_bluez-cups() {
pkgdesc="CUPS printer backend for Bluetooth printers"
depends=('cups' 'glib2' 'glibc' 'dbus')
_install fakeinstall/usr/lib/cups/backend/bluetooth
}
package_bluez-hid2hci() {
pkgdesc="Put HID proxying bluetooth HCI's into HCI mode w/o systemd"
depends=('glibc')
_install fakeinstall/usr/lib/udev/*
_install fakeinstall/usr/share/man/man1/hid2hci.1
}
package_bluez-mesh() {
pkgdesc="Services for bluetooth mesh w/o systemd"
depends=('glibc' 'json-c' 'readline' )
backup=('etc/bluetooth/mesh-main.conf')
_install fakeinstall/usr/bin/{mesh-cfgclient,mesh-cfgtest}
_install fakeinstall/usr/lib/bluetooth/bluetooth-meshd
# _install fakeinstall/usr/lib/systemd/system/bluetooth-mesh.service
# _install fakeinstall/usr/share/dbus-1/system-services/org.bluez.mesh.service
# _install fakeinstall/usr/share/dbus-1/system.d/bluetooth-mesh.conf
_install fakeinstall/usr/share/man/man8/bluetooth-meshd.8
# ship upstream mesh config file
install -dm755 "${pkgdir}"/etc/bluetooth
install -Dm644 "${srcdir}"/"${pkgbase}"-${pkgver}/mesh/mesh-main.conf "${pkgdir}"/etc/bluetooth/mesh-main.conf
}
package_bluez-obex() {
pkgdesc="Object Exchange daemon for sharing content w/o systemd"
depends=('glib2' 'libical' 'dbus' 'readline' 'glibc')
_install fakeinstall/usr/bin/{obexctl,obex-client-tool,obex-server-tool}
_install fakeinstall/usr/lib/bluetooth/obexd
# _install fakeinstall/usr/lib/systemd/user/obex.service
# _install fakeinstall/usr/share/dbus-1/services/org.bluez.obex.service
_install fakeinstall/usr/share/man/man5/org.bluez.obex*.5
# make sure there are no files left to install
rm fakeinstall/usr/lib/libbluetooth.la
# rm fakeinstall/etc/bluetooth
# find fakeinstall -depth -print0 | xargs -0 rmdir
# bluetooth.service wants ConfigurationDirectoryMode=0555
chmod -v 555 "${pkgdir}"/etc/bluetooth
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('GPL2')
license=('GPL2' 'LGPL-2.1-only')
validpgpkeys=('E932D120BC2AEC444E558F0106CA9F5D1DCF2659') # Marcel Holtmann <marcel@holtmann.org>
sha256sums=(257e9075ce05c70d48c5defd254e78c418416f7584b45f9dddc884ff88e3fc53 # bluez-5.73.tar.xz
c3e20e079e299a6fb384f30980e5dd9d014c8cbd87f9466eab5a204899433576 # bluez-5.73.tar.sign
46c021be659c9a1c4e55afd04df0c059af1f3d98a96338236412e449bf7477b4) # bluetooth.modprobe
## b56d78b7fa857c6fad8417e08872a81ddeb230b63bcee252d1e09ed2b75669df bluez-5.73-03-x86_64.pkg.tar.lz
## 6ba4142b0a8c9ca697c92a184ec14678e3f285325999a6387d4f567959d4cb4c bluez-cups-5.73-03-x86_64.pkg.tar.lz
## 5f36283303461609da14dc1f5d0e5e33987b015c4335f98db46730ff6d7f5e5b bluez-deprecated-tools-5.73-03-x86_64.pkg.tar.lz
## 0c0c2b59d53f57464dffbcccba28cbe38cf7046a0af999e9b6db6dae73ab6b30 bluez-hid2hci-5.73-03-x86_64.pkg.tar.lz
## 9fa78e3fad7681dfa4890d9bb813b6a605ca5271075ee3103355f6b4f484eee2 bluez-libs-5.73-03-x86_64.pkg.tar.lz
## 0f5898cf97f028c1f6efd21425a926636eb9322d6b4515603b02d5b02f0614de bluez-mesh-5.73-03-x86_64.pkg.tar.lz
## 831489c0e435833ab27565d909c8316b1c24eaae5d11fec4ad783ee190990dbd bluez-obex-5.73-03-x86_64.pkg.tar.lz
## 253d950e2697b13754dbe94f1f741e90838159658f1e0f376cb80d204ad80106 bluez-utils-5.73-03-x86_64.pkg.tar.lz
46c021be659c9a1c4e55afd04df0c059af1f3d98a96338236412e449bf7477b4 # bluetooth.modprobe
24780fc689dc4041ab0c5713c8f2cb09a7038d4936812310534762592d76e2f8) # 0001_use_bt_uhid_functions.patch
## a4f28d2aea48fdeb5f1fe70506721e486cf2a12a8c17a39b3d1a47bae3395138 bluez-5.73-04-x86_64.pkg.tar.lz

View File

@ -7,19 +7,28 @@
pkgbase=bluez
pkgname=('bluez' 'bluez-utils' 'bluez-libs' 'bluez-cups' 'bluez-deprecated-tools' 'bluez-hid2hci' 'bluez-mesh' 'bluez-obex')
pkgver=5.73
pkgrel=2
pkgrel=4
url="http://www.bluez.org/"
arch=('x86_64')
license=('GPL-2.0-only')
makedepends=('dbus' 'libical' 'systemd' 'alsa-lib' 'json-c' 'ell' 'python-docutils' 'python-pygments' 'cups')
source=(https://www.kernel.org/pub/linux/bluetooth/${pkgname}-${pkgver}.tar.{xz,sign}
bluetooth.modprobe)
bluetooth.modprobe
0001_use_bt_uhid_functions.patch)
# see https://www.kernel.org/pub/linux/bluetooth/sha256sums.asc
sha256sums=('257e9075ce05c70d48c5defd254e78c418416f7584b45f9dddc884ff88e3fc53'
'SKIP'
'46c021be659c9a1c4e55afd04df0c059af1f3d98a96338236412e449bf7477b4')
'46c021be659c9a1c4e55afd04df0c059af1f3d98a96338236412e449bf7477b4'
'24780fc689dc4041ab0c5713c8f2cb09a7038d4936812310534762592d76e2f8')
validpgpkeys=('E932D120BC2AEC444E558F0106CA9F5D1DCF2659') # Marcel Holtmann <marcel@holtmann.org>
prepare() {
cd "${pkgname}"-${pkgver}
# fix DualShock 3 connection - #6
# https://github.com/bluez/bluez/issues/771
patch -Np1 -i ../0001_use_bt_uhid_functions.patch
}
build() {
cd "${pkgname}"-${pkgver}
./configure \
@ -73,17 +82,17 @@ package_bluez() {
depends=('systemd' 'dbus' 'glib2' 'alsa-lib' 'glibc')
backup=(etc/bluetooth/{main,input,network}.conf)
_install fakeinstall/etc/bluetooth/main.conf
_install fakeinstall/etc/bluetooth/input.conf
_install fakeinstall/etc/bluetooth/network.conf
_install fakeinstall/usr/lib/bluetooth/bluetoothd
_install fakeinstall/usr/lib/systemd/system/bluetooth.service
_install fakeinstall/usr/share/dbus-1/system-services/org.bluez.service
_install fakeinstall/usr/share/dbus-1/system.d/bluetooth.conf
_install fakeinstall/etc/bluetooth/main.conf
_install fakeinstall/etc/bluetooth/input.conf
_install fakeinstall/etc/bluetooth/network.conf
_install fakeinstall/usr/share/man/man8/bluetoothd.8
# ship upstream main config files
install -dm555 "${pkgdir}"/etc/bluetooth
# bluetooth.service wants ConfigurationDirectoryMode=0555
chmod -v 555 "${pkgdir}"/etc/bluetooth
# add basic documention
install -dm755 "${pkgdir}"/usr/share/doc/"${pkgbase}"/dbus-apis
@ -150,13 +159,16 @@ package_bluez-mesh() {
depends=('systemd' 'json-c' 'readline' 'glibc')
backup=('etc/bluetooth/mesh-main.conf')
_install fakeinstall/etc/bluetooth/mesh-main.conf
_install fakeinstall/usr/bin/{mesh-cfgclient,mesh-cfgtest}
_install fakeinstall/usr/lib/bluetooth/bluetooth-meshd
_install fakeinstall/usr/lib/systemd/system/bluetooth-mesh.service
_install fakeinstall/usr/share/dbus-1/system-services/org.bluez.mesh.service
_install fakeinstall/usr/share/dbus-1/system.d/bluetooth-mesh.conf
_install fakeinstall/etc/bluetooth/mesh-main.conf
_install fakeinstall/usr/share/man/man8/bluetooth-meshd.8
# bluetooth.service wants ConfigurationDirectoryMode=0555
chmod -v 555 "${pkgdir}"/etc/bluetooth
}
package_bluez-obex() {

View File

@ -0,0 +1,214 @@
#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=bluez
pkgname=('bluez' 'bluez-utils' 'bluez-libs' 'bluez-cups' 'bluez-deprecated-tools' 'bluez-hid2hci' 'bluez-mesh' 'bluez-obex')
pkgver=5.73
pkgrel=03
url="http://www.bluez.org/"
# options=('debug') ### uncomment this to have the debug pkgs produced
makedepends=('glibc' 'dbus' 'libical' 'alsa-lib' 'json-c' 'ell' 'python-docutils' 'python-pygments')
source=(https://www.kernel.org/pub/linux/bluetooth/${pkgname}-${pkgver}.tar.{xz,sign}
bluetooth.modprobe)
#https://gitlab.archlinux.org/archlinux/packaging/packages/bluez/-/issues/2
# see https://www.kernel.org/pub/linux/bluetooth/sha256sums.asc
prepare() {
cd $pkgname-$pkgver
# fix autoconnection - https://github.com/bluez/bluez/issues/686
# https://github.com/tedd-an/bluez-upstream-test/pull/484
# patch -Np1 -i ../fix-bluez-5.71-autoconnection.diff
# fix coredump on a2dp suspend - https://gitlab.archlinux.org/archlinux/packaging/packages/bluez/-/issues/3
# https://lore.kernel.org/linux-bluetooth/20231219124916.44173-2-vlad.pruteanu@nxp.com/
# patch -Np1 -i ../fix-bluez-5.71-coredump-on-a2dp-suspend.diff
}
build() {
cd $pkgname-$pkgver
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--sysconfdir=/etc \
--localstatedir=/var \
--libexecdir=/usr/lib \
--with-dbusconfdir=/usr/share \
--with-udevdir=/usr/lib/udev \
--enable-btpclient \
--enable-midi \
--enable-sixaxis \
--disable-systemd \
--enable-mesh \
--enable-hid2hci \
--enable-experimental \
--enable-datafiles \
--enable-library \
--enable-deprecated # libraries and these tools are deprecated
make
# fake installation to be seperated into packages
make DESTDIR="${srcdir}/fakeinstall" install
# add missing tools FS#41132, FS#41687, FS#42716
for files in `find tools/ -type f -perm -755`; do
filename=$(basename $files)
install -Dm755 "${srcdir}"/"${pkgbase}"-${pkgver}/tools/$filename "${srcdir}/fakeinstall"/usr/bin/$filename
done
}
_install() {
local src f dir
for src; do
f="${src#fakeinstall/}"
dir="${pkgdir}/${f%/*}"
install -m755 -d "${dir}"
# use copy so a new file is created and fakeroot can track properties such as setuid
cp -av "${src}" "${dir}/"
rm -rf "${src}"
done
}
check() {
cd $pkgname-$pkgver
# fails test-vcp due to lto - https://github.com/bluez/bluez/issues/683
make check || /bin/true
}
package_bluez() {
pkgdesc="Daemons for the bluetooth protocol stack w/o systemd"
depends=('glibc' 'dbus' 'glib2' 'alsa-lib')
backup=(etc/bluetooth/{main,input,network}.conf)
# conflicts=('obexd-client' 'obexd-server')
_install fakeinstall/usr/lib/bluetooth/bluetoothd
# _install fakeinstall/usr/lib/systemd/system/bluetooth.service
# _install fakeinstall/usr/share/dbus-1/system-services/org.bluez.service
# _install fakeinstall/usr/share/dbus-1/system.d/bluetooth.conf
# _install fakeinstall/etc/bluetooth/main.conf
# _install fakeinstall/etc/bluetooth/input.conf
# _install fakeinstall/etc/bluetooth/network.conf
_install fakeinstall/usr/share/man/man8/bluetoothd.8
# ship upstream main config files
install -dm555 "${pkgdir}"/etc/bluetooth
install -Dm644 "${srcdir}"/"${pkgbase}"-${pkgver}/src/main.conf "${pkgdir}"/etc/bluetooth/main.conf
install -Dm644 "${srcdir}"/"${pkgbase}"-${pkgver}/profiles/input/input.conf "${pkgdir}"/etc/bluetooth/input.conf
install -Dm644 "${srcdir}"/"${pkgbase}"-${pkgver}/profiles/network/network.conf "${pkgdir}"/etc/bluetooth/network.conf
# add basic documention
install -dm755 "${pkgdir}"/usr/share/doc/"${pkgbase}"/dbus-apis
cp -a "${pkgbase}"-${pkgver}/doc/*.txt "${pkgdir}"/usr/share/doc/"${pkgbase}"/dbus-apis/
# fix module loading errors
install -dm755 "${pkgdir}"/usr/lib/modprobe.d
install -Dm644 "${srcdir}"/bluetooth.modprobe "${pkgdir}"/usr/lib/modprobe.d/bluetooth-usb.conf
# load module at system start required by some functions
# https://bugzilla.kernel.org/show_bug.cgi?id=196621
install -dm755 "$pkgdir"/usr/lib/modules-load.d
echo "crypto_user" > "$pkgdir"/usr/lib/modules-load.d/bluez.conf
}
package_bluez-utils() {
pkgdesc="Development and debugging utilities for the bluetooth protocol stack w/o systemd"
depends=('glibc' 'dbus' 'glib2' 'readline')
optdepends=('ell: for btpclient')
provides=('bluez-plugins')
replaces=('bluez-plugins')
_install fakeinstall/usr/bin/{advtest,amptest,avinfo,avtest,bcmfw,bdaddr,bluemoon,bluetoothctl,bluetooth-player,bneptest,btattach,btconfig,btgatt-client,btgatt-server,btinfo,btiotest,btmgmt,btmon,btpclient,btpclientctl,btproxy,btsnoop,check-selftest,cltest,create-image,eddystone,gatt-service,hcieventmask,hcisecfilter,hex2hcd,hid2hci,hwdb,ibeacon,isotest,l2ping,l2test,mcaptest,mpris-proxy,nokfw,oobtest,rctest,rtlfw,scotest,seq2bseq,test-runner}
_install fakeinstall/usr/share/man/man1/bluetoothctl*.1
_install fakeinstall/usr/share/man/man1/{btattach,btmgmt,btmon,isotest,l2ping,rctest}.1
_install fakeinstall/usr/share/man/man5/org.bluez.{A,B,D,G,I,L,M,N,P}*.5
_install fakeinstall/usr/share/zsh/site-functions/_bluetoothctl
}
package_bluez-deprecated-tools() {
pkgdesc="Deprecated tools that are no longer maintained w/o systemd"
depends=('json-c' 'glib2' 'dbus' 'readline' 'glibc')
_install fakeinstall/usr/bin/{ciptool,hciattach,hciconfig,hcidump,hcitool,meshctl,rfcomm,sdptool}
_install fakeinstall/usr/share/man/man1/{ciptool,hciattach,hciconfig,hcidump,hcitool,rfcomm,sdptool}.1
}
package_bluez-libs() {
pkgdesc="Deprecated libraries for the bluetooth protocol stack"
depends=('glibc')
provides=('libbluetooth.so')
license=('LGPL-2.1-only')
_install fakeinstall/usr/include/bluetooth/*
_install fakeinstall/usr/lib/libbluetooth.so*
_install fakeinstall/usr/lib/pkgconfig/*
}
package_bluez-cups() {
pkgdesc="CUPS printer backend for Bluetooth printers"
depends=('cups' 'glib2' 'glibc' 'dbus')
_install fakeinstall/usr/lib/cups/backend/bluetooth
}
package_bluez-hid2hci() {
pkgdesc="Put HID proxying bluetooth HCI's into HCI mode w/o systemd"
depends=('glibc')
_install fakeinstall/usr/lib/udev/*
_install fakeinstall/usr/share/man/man1/hid2hci.1
}
package_bluez-mesh() {
pkgdesc="Services for bluetooth mesh w/o systemd"
depends=('glibc' 'json-c' 'readline' )
backup=('etc/bluetooth/mesh-main.conf')
_install fakeinstall/usr/bin/{mesh-cfgclient,mesh-cfgtest}
_install fakeinstall/usr/lib/bluetooth/bluetooth-meshd
# _install fakeinstall/usr/lib/systemd/system/bluetooth-mesh.service
# _install fakeinstall/usr/share/dbus-1/system-services/org.bluez.mesh.service
# _install fakeinstall/usr/share/dbus-1/system.d/bluetooth-mesh.conf
_install fakeinstall/usr/share/man/man8/bluetooth-meshd.8
# ship upstream mesh config file
install -dm755 "${pkgdir}"/etc/bluetooth
install -Dm644 "${srcdir}"/"${pkgbase}"-${pkgver}/mesh/mesh-main.conf "${pkgdir}"/etc/bluetooth/mesh-main.conf
}
package_bluez-obex() {
pkgdesc="Object Exchange daemon for sharing content w/o systemd"
depends=('glib2' 'libical' 'dbus' 'readline' 'glibc')
_install fakeinstall/usr/bin/{obexctl,obex-client-tool,obex-server-tool}
_install fakeinstall/usr/lib/bluetooth/obexd
# _install fakeinstall/usr/lib/systemd/user/obex.service
# _install fakeinstall/usr/share/dbus-1/services/org.bluez.obex.service
_install fakeinstall/usr/share/man/man5/org.bluez.obex*.5
# make sure there are no files left to install
rm fakeinstall/usr/lib/libbluetooth.la
# rm fakeinstall/etc/bluetooth
# find fakeinstall -depth -print0 | xargs -0 rmdir
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('GPL2')
validpgpkeys=('E932D120BC2AEC444E558F0106CA9F5D1DCF2659') # Marcel Holtmann <marcel@holtmann.org>
sha256sums=(257e9075ce05c70d48c5defd254e78c418416f7584b45f9dddc884ff88e3fc53 # bluez-5.73.tar.xz
c3e20e079e299a6fb384f30980e5dd9d014c8cbd87f9466eab5a204899433576 # bluez-5.73.tar.sign
46c021be659c9a1c4e55afd04df0c059af1f3d98a96338236412e449bf7477b4) # bluetooth.modprobe
## b56d78b7fa857c6fad8417e08872a81ddeb230b63bcee252d1e09ed2b75669df bluez-5.73-03-x86_64.pkg.tar.lz
## 6ba4142b0a8c9ca697c92a184ec14678e3f285325999a6387d4f567959d4cb4c bluez-cups-5.73-03-x86_64.pkg.tar.lz
## 5f36283303461609da14dc1f5d0e5e33987b015c4335f98db46730ff6d7f5e5b bluez-deprecated-tools-5.73-03-x86_64.pkg.tar.lz
## 0c0c2b59d53f57464dffbcccba28cbe38cf7046a0af999e9b6db6dae73ab6b30 bluez-hid2hci-5.73-03-x86_64.pkg.tar.lz
## 9fa78e3fad7681dfa4890d9bb813b6a605ca5271075ee3103355f6b4f484eee2 bluez-libs-5.73-03-x86_64.pkg.tar.lz
## 0f5898cf97f028c1f6efd21425a926636eb9322d6b4515603b02d5b02f0614de bluez-mesh-5.73-03-x86_64.pkg.tar.lz
## 831489c0e435833ab27565d909c8316b1c24eaae5d11fec4ad783ee190990dbd bluez-obex-5.73-03-x86_64.pkg.tar.lz
## 253d950e2697b13754dbe94f1f741e90838159658f1e0f376cb80d204ad80106 bluez-utils-5.73-03-x86_64.pkg.tar.lz

View File

@ -1,6 +1,6 @@
real 3m54.822s
user 3m31.344s
sys 0m22.865s
real 4m40.005s
user 5m59.935s
sys 0m17.282s

View File

@ -0,0 +1,92 @@
From e12b8487283979ab454a32888a3c37d4d9492480 Mon Sep 17 00:00:00 2001
From: Ken Sharp <Ken.Sharp@artifex.com>
Date: Thu, 14 Mar 2024 13:08:38 +0000
Subject: [PATCH] pdfwrite - more improvements for mesh shadings
Bug #707655 "No output visible with pdfwriter"
commit 3d6e3acbcda79a0096cd1ad73c7b9b1101a43187 to fix bug #06852
unfortunately led to this regression. The problem is related to the
scaling of co-ordinates performed when a mesh shading has vertex
co-ordinates which are too large for Acrobat 5 (PDF 1.4).
Acrobat 5 has a limit of =/-32767 on real numbers, which applies to the
/Decode array of a mesh shading. Because this is an Acrobat limit, not a
limit of the PDF specification we would ordinarily ignore it, but the
PDF/A-1 specification chose to carry the Acrobat limitations into the
PDF/A spec.
This commit fixes the problem by correctly scaling the co-ordinate
values to the Decode array values when outputting to PDF 1.4 or less,
even if no actual co-ordinte scaling is required, and modifying the
/Matrix of the Pattern to scale up the Decode values to the real
co-ordinates. Crucially we must not scale the Tx and Ty values of the
CTM.
---
devices/vector/gdevpdfv.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/devices/vector/gdevpdfv.c b/devices/vector/gdevpdfv.c
index e880acafd..90a02158f 100644
--- a/devices/vector/gdevpdfv.c
+++ b/devices/vector/gdevpdfv.c
@@ -42,8 +42,8 @@ extern const gx_device_color_type_t gx_dc_pattern2;
*/
#define ENCODE_VALUE(v, emax, vmin, vmax)\
( ((v) - (vmin)) * ((double)(emax) / ((vmax) - (vmin))) )
-#define PDFA_MIN_MESH_COORDINATE (-0x800000 / 256.0)
-#define PDFA_MAX_MESH_COORDINATE ( 0x7fffff / 256.0)
+#define PDFA_MIN_MESH_COORDINATE (-0x400000 / 128.0)
+#define PDFA_MAX_MESH_COORDINATE ( 0x3fffff / 128.0)
#define PDFA_ENCODE_MESH_COORDINATE(v)\
ENCODE_VALUE(v, 0xffffff, PDFA_MIN_MESH_COORDINATE, PDFA_MAX_MESH_COORDINATE)
#define MIN_MESH_COORDINATE (-0x800000 )
@@ -690,6 +690,7 @@ typedef struct pdf_mesh_data_params_s {
int num_components;
bool is_indexed;
int rescale; /* If the co-ordinates won't fit into crappy Acrobat values, scale them here and in the pattern Matrix */
+ bool old_pdf;
const float *Domain; /* iff Function */
const gs_range_t *ranges;
} pdf_mesh_data_params_t;
@@ -713,7 +714,7 @@ put_clamped(byte *p, double v, int num_bytes)
static inline void
put_clamped_coord(byte *p, double v, int num_bytes, const pdf_mesh_data_params_t *pmdp)
{
- if (pmdp->rescale != 1.0) {
+ if (pmdp->rescale != 1.0 || pmdp->old_pdf) {
v = v / pmdp->rescale;
put_clamped(p, PDFA_ENCODE_MESH_COORDINATE(v), num_bytes);
} else
@@ -1027,7 +1028,9 @@ pdf_put_mesh_shading(gx_device_pdf *pdev, cos_stream_t *pscs, const gs_shading_t
if (z > *rescale)
*rescale = (int)z;
data_params.rescale = *rescale;
- }
+ data_params.old_pdf = 1;
+ } else
+ data_params.old_pdf = 0;
switch (ShadingType(psh)) {
case shading_type_Free_form_Gouraud_triangle: {
@@ -1183,12 +1186,13 @@ pdf_put_pattern2(gx_device_pdf *pdev, const gs_gstate * pgs, const gx_drawing_co
yscale = 72.0 / pdev->HWResolution[1];
}
- if (rescale != 1) {
- xscale *= rescale;
- yscale *= rescale;
- }
smat.xx *= xscale, smat.yx *= xscale, smat.tx *= xscale;
smat.xy *= yscale, smat.yy *= yscale, smat.ty *= yscale;
+
+ if (rescale != 1) {
+ smat.xx *= rescale, smat.yx *= rescale;
+ smat.xy *= rescale, smat.yy *= rescale;
+ }
}
/* Bug #697451, if we emit a PDF with a type 2 Pattern where the
--
2.34.1

View File

@ -8,7 +8,7 @@
pkgbase=ghostscript
pkgname=(ghostscript ghostxps ghostpcl)
pkgver=10.03.0
pkgrel=01
pkgrel=02
pkgdesc="An interpreter for the PostScript language"
url="https://www.ghostscript.com/"
depends=('libxt' 'libcups' 'fontconfig' 'zlib' 'libpng' 'libjpeg' 'jbig2dec'
@ -18,7 +18,8 @@ makedepends=('gtk3' 'gnutls' 'glu' 'freeglut')
# https://github.com/ArtifexSoftware/ghostpdl-downloads/releases
source=(https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${pkgver//./}/ghostpdl-${pkgver}.tar.xz
#https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/ghostpdl-${pkgver/.0//}/ghostpdl-${pkgver}.tar.xz
2010_add_build_timestamp_setting.patch)
2010_add_build_timestamp_setting.patch
0001_No_output_visible_with_pdfwriter.diff)
# https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10021/SHA512SUMS
### update jbig2dec first! ###
@ -61,6 +62,10 @@ prepare() {
# Debian: # allow the build timestamp to be externally set
patch -Np1 -i ../2010_add_build_timestamp_setting.patch
# https://bugs.ghostscript.com/show_bug.cgi?id=707655
patch -Np1 -i ../0001_No_output_visible_with_pdfwriter.diff
}
build() {
@ -136,9 +141,10 @@ arch=(x86_64)
license=('AGPL-3.0-or-later')
sha256sums=(854fd1958711b9b5108c052a6d552b906f1e3ebf3262763febf347d77618639d # ghostpdl-10.03.0.tar.xz
ce6ce3cca271d12de97d99e847f47c1fece0be2b663861654baa217857c00339) # 2010_add_build_timestamp_setting.patch
ce6ce3cca271d12de97d99e847f47c1fece0be2b663861654baa217857c00339 # 2010_add_build_timestamp_setting.patch
76ca1580da8b75b69a2b4f8a67a88bd5c7d29126c7ebce5c863247ce724b30a9) # 0001_No_output_visible_with_pdfwriter.diff
## 3a09eb6797e5d164b63b20727e076d93ab436563d59c34778e5f0dbb2f509cc0 ghostpcl-10.03.0-01-x86_64.pkg.tar.lz
## 99e913651f951559af114bc20776d1efd597c48c7cb59368e879e78c0600322a ghostscript-10.03.0-01-x86_64.pkg.tar.lz
## cdd21492be3a0a12e7853706420e9b38e3e8ef8f187da8ef7160c0aaf2dd7f92 ghostxps-10.03.0-01-x86_64.pkg.tar.lz
## aa1e8bffb5b338e4c2376adc1cbe3170c21109f11ef08e045552f7e630dd58b5 ghostpcl-10.03.0-02-x86_64.pkg.tar.lz
## 8e5e4c69f4d8d6f882beb6c7e5c51ca628d10a40f578e0129407d16ba748b3b4 ghostscript-10.03.0-02-x86_64.pkg.tar.lz
## 662290a1523d247f3cecaa326d0f51d659d6ca179b8ddfc4d46c2b0f731a6a37 ghostxps-10.03.0-02-x86_64.pkg.tar.lz

View File

@ -3,7 +3,7 @@
pkgbase=ghostscript
pkgname=(ghostscript ghostxps ghostpcl)
pkgver=10.03.0
pkgrel=1
pkgrel=2
pkgdesc="An interpreter for the PostScript language"
url="https://www.ghostscript.com/"
arch=('x86_64')
@ -15,10 +15,12 @@ makedepends=('gtk3' 'gnutls' 'glu' 'freeglut')
# https://github.com/ArtifexSoftware/ghostpdl-downloads/releases
source=(https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${pkgver//./}/ghostpdl-${pkgver}.tar.xz
#https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/ghostpdl-${pkgver/.0//}/ghostpdl-${pkgver}.tar.xz
2010_add_build_timestamp_setting.patch)
2010_add_build_timestamp_setting.patch
0001_No_output_visible_with_pdfwriter.diff)
# https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10021/SHA512SUMS
sha512sums=('6c46ca6fada94b165fe9af6bc6d8e0533a3313e1e551c300cf40c2d31167ba2ba8069d802833fa234e4d7f71cb54216377c59f2dac3b7cdd1a23735cc4e45b63'
'cd7794ee4f28b11177021b950196385200b610127ed6cb94a45e3202b690b721a0dfcc0276ff39448d4dab64c1b31a76e6c323696a8315aad9edc22077f18a3d')
'cd7794ee4f28b11177021b950196385200b610127ed6cb94a45e3202b690b721a0dfcc0276ff39448d4dab64c1b31a76e6c323696a8315aad9edc22077f18a3d'
'659077a7e60b6c56cf3f2e70fbfc5a7114e1294e7a912e40bce9d7e34f1907fff6e407be6c528961c06e7de5c80c637584929d08ade63b277793284b8b56208d')
### update jbig2dec first! ###
@ -60,6 +62,9 @@ prepare() {
# Debian: # allow the build timestamp to be externally set
patch -Np1 -i ../2010_add_build_timestamp_setting.patch
# https://bugs.ghostscript.com/show_bug.cgi?id=707655
patch -Np1 -i ../0001_No_output_visible_with_pdfwriter.diff
}
build() {

View File

@ -1,6 +1,6 @@
real 8m31.600s
user 8m5.508s
sys 0m33.100s
real 11m30.036s
user 27m19.531s
sys 1m6.836s

View File

@ -7,20 +7,23 @@
pkgname=net-snmp
pkgver=5.9.2
pkgrel=02
pkgrel=03
pkgdesc="A suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using IPv4 w/o systemd & ipv6"
url="http://www.net-snmp.org/"
depends=('libnsl' 'libpcap' 'lm_sensors' 'pciutils' 'pcre' 'perl')
depends=('libnsl' 'libpcap' 'lm_sensors' 'pciutils' 'pcre2' 'perl')
makedepends=('python-setuptools')
optdepends=('perl-term-readkey: for snmpcheck application'
'perl-tk: for snmpcheck and tkmib applications'
'python: for the python modules')
options=('!emptydirs' '!makeflags')
source=(https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.asc})
source=(https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.asc}
${pkgname}-5.9.2-pcre2.patch)
# removed crap snmpd.service snmptrapd.service)
prepare() {
cd ${pkgname}-${pkgver}
patch -Np1 -i ../${pkgname}-5.9.2-pcre2.patch
autoreconf -i
}
@ -58,10 +61,12 @@ license=('BSD')
validpgpkeys=('8AAA779B597B405BBC329B6376CF47B8A77C5329'
'27CAA4A32E371383A33ED0587D5F9576E0F81533'
'6E6718AEF1EB5C65C32D1B2A356BC0B552D53CAB'
'D0F8F495DA6160C44EFFBF10F07B9D2DACB19FD6') # Net-SNMP Administrators
sha256sums=(21e86b06c8b54639f915781c9bf6433a79da5b7aa109087ea47a9b5378a6c5fd # net-snmp-5.9.2.tar.gz
cac6e9c1d2201c1efadffc911524e1795bfa829aa278a45a856a4d0196a18e73) # net-snmp-5.9.2.tar.gz.asc
cac6e9c1d2201c1efadffc911524e1795bfa829aa278a45a856a4d0196a18e73 # net-snmp-5.9.2.tar.gz.asc
4671c9e0d0062ab5c2111ce2f027dfd360eae1351fbd7e500a0e627891693213) # net-snmp-5.9.2-pcre2.patch
## 58ef815344d04b02935155d9205c8201453c5c8caa716ca107e879c3b51593a5 net-snmp-5.9.2-02-x86_64.pkg.tar.lz
## 07e375ac00bbc61351ee03fc26db0556bba37d25450fbd8449a0271d833c43c0 net-snmp-5.9.2-03-x86_64.pkg.tar.lz

View File

@ -3,29 +3,33 @@
pkgname=net-snmp
pkgver=5.9.2
pkgrel=2
pkgrel=3
pkgdesc="A suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6"
arch=('x86_64')
url="http://www.net-snmp.org/"
license=('BSD')
depends=('libnsl' 'libpcap' 'lm_sensors' 'pciutils' 'pcre' 'perl')
depends=('libnsl' 'libpcap' 'lm_sensors' 'pciutils' 'pcre2' 'perl')
makedepends=('python-setuptools')
optdepends=('perl-term-readkey: for snmpcheck application'
'perl-tk: for snmpcheck and tkmib applications'
'python: for the python modules')
options=('!emptydirs' '!makeflags')
source=(https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.asc}
${pkgname}-5.9.2-pcre2.patch
snmpd.service snmptrapd.service)
sha512sums=('d67810b15c4956a28ccb4d9a3870604bc94e71247d9a8d3a9959041268122b3500cf68a7912cfb01a6cff27f3f4364cbd106629ab80c12974f694b6c548bde59'
'SKIP'
'802057d08f4fe69fa9fafed349d37c0f8a6092002b933292563568db274890ae8932a000ecb60c5db0db792ecca30723fc803c0af6da147d148bf059b7f137eb'
'16234f8bb66f6754d3b61752c2fd479676e504281e9857c72b44d99444aa95bb03263d0d93d1b9996daf760ed78344dcdcc7ab1f701dce9a5b51c7c7158a8f9d'
'4ed2428c04bfbbfba988c0a9222d880771a1022e0544d842b5bee52b88163e213d697cc2419d53dddc482ac2fc3e03929a349720ad73189f28bf47292d0d9c03'
'82b05b805db5f6870242ea4dfaa58de2865c367208cacfa4fc543c9f2a310d7229dee94ea6054d35c4bab69393f33fd367551727279da4411052589ed37bb4a4')
validpgpkeys=('8AAA779B597B405BBC329B6376CF47B8A77C5329'
'27CAA4A32E371383A33ED0587D5F9576E0F81533'
validpgpkeys=('27CAA4A32E371383A33ED0587D5F9576E0F81533'
'6E6718AEF1EB5C65C32D1B2A356BC0B552D53CAB'
'8AAA779B597B405BBC329B6376CF47B8A77C5329'
'D0F8F495DA6160C44EFFBF10F07B9D2DACB19FD6') # Net-SNMP Administrators
prepare() {
cd ${pkgname}-${pkgver}
patch -Np1 -i ../${pkgname}-5.9.2-pcre2.patch
autoreconf -i
}

View File

@ -0,0 +1,581 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: gagan sidhu <gagan@hotmail.com>
Date: Sun, 21 May 2023 15:47:36 -0600
Subject: [PATCH 1/3] add pcre2 support
(cherry picked from commit d3e95c87b32397815f6d5bcfc844259f2552697a)
Conflicts:
agent/mibgroup/host/data_access/swrun.c
agent/mibgroup/if-mib/data_access/interface.c
agent/mibgroup/struct.h
agent/mibgroup/ucd-snmp/proc.c
configure.d/config_os_libs1
include/net-snmp/data_access/interface.h
---
agent/mibgroup/host/data_access/swrun.c | 18 ++++++--
agent/mibgroup/if-mib/data_access/interface.c | 44 ++++++++++++++++---
agent/mibgroup/struct.h | 2 +-
agent/mibgroup/ucd-snmp/proc.c | 27 +++++++++---
agent/mibgroup/ucd-snmp/proc.h | 2 +-
configure.d/config_os_libs1 | 27 ++++++++++++
configure.d/config_project_with_enable | 4 ++
include/net-snmp/data_access/interface.h | 9 +++-
include/net-snmp/data_access/swrun.h | 2 +-
include/net-snmp/types.h | 2 +-
10 files changed, 116 insertions(+), 21 deletions(-)
diff --git a/agent/mibgroup/host/data_access/swrun.c b/agent/mibgroup/host/data_access/swrun.c
index f58143a0b7..f0442b4493 100644
--- a/agent/mibgroup/host/data_access/swrun.c
+++ b/agent/mibgroup/host/data_access/swrun.c
@@ -17,7 +17,10 @@
#include "swrun.h"
#include "swrun_private.h"
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H)
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+#elif defined(HAVE_PCRE_H)
#include <pcre.h>
#endif
@@ -100,14 +103,21 @@ swrun_max_processes( void )
#endif /* NETSNMP_FEATURE_REMOVE_SWRUN_MAX_PROCESSES */
#ifndef NETSNMP_FEATURE_REMOVE_SWRUN_COUNT_PROCESSES_BY_REGEX
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
int
swrun_count_processes_by_regex( char *name, netsnmp_regex_ptr regexp )
{
netsnmp_swrun_entry *entry;
netsnmp_iterator *it;
int i = 0;
+#ifdef HAVE_PCRE2_H
+ pcre2_match_data *ndx_match;
+ int *found_ndx;
+ ndx_match = pcre2_match_data_create(30, NULL);
+ found_ndx = pcre2_get_ovector_pointer(ndx_match);
+#elif HAVE_PCRE_H
int found_ndx[30];
+#endif
int found;
char fullCommand[64 + 128 + 128 + 3];
@@ -125,7 +135,9 @@ swrun_count_processes_by_regex( char *name, netsnmp_regex_ptr regexp )
}
}
ITERATOR_RELEASE( it );
-
+#ifdef HAVE_PCRE2_H
+ pcre2_match_data_free(ndx_match);
+#endif
return i;
}
#endif /* HAVE_PCRE_H */
diff --git a/agent/mibgroup/if-mib/data_access/interface.c b/agent/mibgroup/if-mib/data_access/interface.c
index 3f1b392864..5d714e9895 100644
--- a/agent/mibgroup/if-mib/data_access/interface.c
+++ b/agent/mibgroup/if-mib/data_access/interface.c
@@ -16,7 +16,11 @@
#include "if-mib/ifTable/ifTable.h"
#include "if-mib/data_access/interface.h"
#include "interface_private.h"
-#if defined(HAVE_PCRE_H)
+
+#if defined(HAVE_PCRE2_H)
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+#elif defined(HAVE_PCRE_H)
#include <pcre.h>
#elif defined(HAVE_REGEX_H)
#include <sys/types.h>
@@ -824,7 +828,13 @@ int netsnmp_access_interface_max_reached(const char *name)
int netsnmp_access_interface_include(const char *name)
{
netsnmp_include_if_list *if_ptr;
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H)
+ //pcre_exec->pcre2_match
+ //ovector->pcre2_match_data
+ pcre2_match_data *ndx_match;
+ ndx_match = pcre2_match_data_create(3, NULL);
+ int *found_ndx = pcre2_get_ovector_pointer(ndx_match);
+#elif defined(HAVE_PCRE_H)
int found_ndx[3];
#endif
@@ -840,7 +850,13 @@ int netsnmp_access_interface_include(const char *name)
for (if_ptr = include_list; if_ptr; if_ptr = if_ptr->next) {
-#if defined(HAVE_PCRE_H)
+#if defined(HAVE_PCRE2_H)
+ if (pcre2_match(if_ptr->regex_ptr, name, strlen(name), 0, 0,
+ ndx_match, NULL) >= 0) {
+ pcre2_match_data_free(ndx_match);
+ return TRUE;
+ }
+#elif defined(HAVE_PCRE_H)
if (pcre_exec(if_ptr->regex_ptr, NULL, name, strlen(name), 0, 0,
found_ndx, 3) >= 0)
return TRUE;
@@ -964,7 +980,13 @@ _parse_include_if_config(const char *token, char *cptr)
{
netsnmp_include_if_list *if_ptr, *if_new;
char *name, *st;
-#if defined(HAVE_PCRE_H)
+#if defined(HAVE_PCRE2_H)
+ //we can only get the message upon calling pcre2_error_message.
+ // so an additional variable is required.
+ int pcre2_err_code;
+ unsigned char pcre2_error[128];
+ int pcre2_error_offset;
+#elif defined(HAVE_PCRE_H)
const char *pcre_error;
int pcre_error_offset;
#elif defined(HAVE_REGEX_H)
@@ -996,7 +1018,15 @@ _parse_include_if_config(const char *token, char *cptr)
config_perror("Out of memory");
goto err;
}
-#if defined(HAVE_PCRE_H)
+#if defined(HAVE_PCRE2_H)
+ if_new->regex_ptr = pcre2_compile(if_new->name, PCRE2_ZERO_TERMINATED, 0,
+ &pcre2_err_code, &pcre2_error_offset, NULL);
+ if (!if_new->regex_ptr) {
+ pcre2_get_error_message(pcre2_err_code, pcre2_error, 128);
+ config_perror(pcre2_error);
+ goto err;
+ }
+#elif defined(HAVE_PCRE_H)
if_new->regex_ptr = pcre_compile(if_new->name, 0, &pcre_error,
&pcre_error_offset, NULL);
if (!if_new->regex_ptr) {
@@ -1032,7 +1062,7 @@ _parse_include_if_config(const char *token, char *cptr)
err:
if (if_new) {
-#if defined(HAVE_PCRE_H) || defined(HAVE_REGEX_H)
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H) || defined(HAVE_REGEX_H)
free(if_new->regex_ptr);
#endif
free(if_new->name);
@@ -1047,7 +1077,7 @@ _free_include_if_config(void)
while (if_ptr) {
if_next = if_ptr->next;
-#if defined(HAVE_PCRE_H)
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
free(if_ptr->regex_ptr);
#elif defined(HAVE_REGEX_H)
regfree(if_ptr->regex_ptr);
diff --git a/agent/mibgroup/struct.h b/agent/mibgroup/struct.h
index d6c69c0449..d6d85e4124 100644
--- a/agent/mibgroup/struct.h
+++ b/agent/mibgroup/struct.h
@@ -30,7 +30,7 @@ struct extensible {
struct myproc {
char name[STRMAX];
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
netsnmp_regex_ptr regexp;
#endif
char fixcmd[STRMAX];
diff --git a/agent/mibgroup/ucd-snmp/proc.c b/agent/mibgroup/ucd-snmp/proc.c
index 01704e8f39..f819122bc2 100644
--- a/agent/mibgroup/ucd-snmp/proc.c
+++ b/agent/mibgroup/ucd-snmp/proc.c
@@ -39,7 +39,10 @@
# include <time.h>
# endif
#endif
-#ifdef HAVE_PCRE_H
+#ifdef HAVE_PCRE2_H
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+#elif HAVE_PCRE_H
#include <pcre.h>
#endif
@@ -134,7 +137,7 @@ proc_free_config(void)
for (ptmp = procwatch; ptmp != NULL;) {
ptmp2 = ptmp;
ptmp = ptmp->next;
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
free(ptmp2->regexp.regex_ptr);
#endif
free(ptmp2);
@@ -208,7 +211,7 @@ proc_parse_config(const char *token, char *cptr)
if (*procp == NULL)
return; /* memory alloc error */
numprocs++;
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
(*procp)->regexp.regex_ptr = NULL;
#endif
/*
@@ -220,9 +223,22 @@ proc_parse_config(const char *token, char *cptr)
cptr = skip_not_white(cptr);
if ((cptr = skip_white(cptr))) {
(*procp)->min = atoi(cptr);
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
cptr = skip_not_white(cptr);
if ((cptr = skip_white(cptr))) {
+ DEBUGMSGTL(("ucd-snmp/regexp_proc", "Loading regex %s\n", cptr));
+#ifdef HAVE_PCRE2_H
+ unsigned char pcre2_error_msg[128];
+ int pcre2_err_code;
+ int pcre2_error_offset;
+
+ (*procp)->regexp.regex_ptr =
+ pcre2_compile(cptr, PCRE2_ZERO_TERMINATED, 0, &pcre2_err_code, &pcre2_error_offset, NULL);
+ pcre2_get_error_message(pcre2_err_code, pcre2_error_msg, 128);
+ if ((*procp)->regexp.regex_ptr == NULL) {
+ config_perror(pcre2_error_msg);
+ }
+#elif HAVE_PCRE_H
const char *pcre_error;
int pcre_error_offset;
@@ -232,6 +248,7 @@ proc_parse_config(const char *token, char *cptr)
if ((*procp)->regexp.regex_ptr == NULL) {
config_perror(pcre_error);
}
+#endif
}
#endif
} else
@@ -406,7 +423,7 @@ sh_count_procs(char *procname)
return swrun_count_processes_by_name( procname );
}
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
netsnmp_feature_require(swrun_count_processes_by_regex);
int
sh_count_procs_by_regex(char *procname, netsnmp_regex_ptr regexp)
diff --git a/agent/mibgroup/ucd-snmp/proc.h b/agent/mibgroup/ucd-snmp/proc.h
index dd95082339..001fcfa3be 100644
--- a/agent/mibgroup/ucd-snmp/proc.h
+++ b/agent/mibgroup/ucd-snmp/proc.h
@@ -12,7 +12,7 @@ config_require(util_funcs)
extern WriteMethod fixProcError;
int sh_count_myprocs(struct myproc *);
int sh_count_procs(char *);
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
int sh_count_procs_by_regex(char *, netsnmp_regex_ptr);
#endif
diff --git a/configure.d/config_os_libs1 b/configure.d/config_os_libs1
index 3ccd41c1a8..0bbbf38701 100644
--- a/configure.d/config_os_libs1
+++ b/configure.d/config_os_libs1
@@ -97,6 +97,32 @@ LIBS="$netsnmp_save_LIBS"
#
# regex in process table
#
+if test "x$with_pcre2" != "xno"; then
+ AC_CHECK_HEADER([pcre2.h], [
+ AC_DEFINE([HAVE_PCRE2_H], [1], [Define to 1 if you have <pcre2.h>.])
+ pcre2_h=yes
+ ],
+ [pcre2_h=no], [#define PCRE2_CODE_UNIT_WIDTH 8]
+ )
+fi
+if test "x$pcre2header_h" = "xno" -o "x$pcre2_h" = "xno" ; then
+ if test "x$with_pcre2" = "xyes" ; then
+ AC_MSG_ERROR([Could not find the pcre2 header file needed and was specifically asked to use pcre2 support])
+ else
+ with_pcre2=no
+ fi
+fi
+
+if test "x$with_pcre2" != "xno"; then
+ NETSNMP_SEARCH_LIBS([pcre2_match_8], [pcre2-8], [
+ LMIBLIBS="$LMIBLIBS -lpcre2-8"
+ ],,, LAGENTLIBS)
+ AC_SUBST(LAGENTLIBS)
+ AC_SUBST(LMIBLIBS)
+fi
+
+if test "x$with_pcre2" != "xyes"; then
+
if test "x$with_pcre" != "xno"; then
AC_CHECK_HEADER([pcre.h], [
AC_DEFINE([HAVE_PCRE_H], [1], [Define to 1 if you have <pcre.h>.])
@@ -123,3 +149,4 @@ if test "x$with_pcre" != "xno"; then
AC_SUBST(LAGENTLIBS)
AC_SUBST(LMIBLIBS)
fi
+fi
diff --git a/configure.d/config_project_with_enable b/configure.d/config_project_with_enable
index cdf56deb69..b6dabfbf8d 100644
--- a/configure.d/config_project_with_enable
+++ b/configure.d/config_project_with_enable
@@ -160,6 +160,10 @@ NETSNMP_ARG_WITH(rpm,
management system when building the host MIB
module.])
+NETSNMP_ARG_WITH(pcre2-8,
+[ --without-pcre2 Don't include pcre2 process searching
+ support in the agent.],
+ with_pcre2="$withval", with_pcre2="maybe")
NETSNMP_ARG_WITH(pcre,
[ --without-pcre Don't include pcre process searching
diff --git a/include/net-snmp/data_access/interface.h b/include/net-snmp/data_access/interface.h
index 36c32475f5..2c7c880340 100644
--- a/include/net-snmp/data_access/interface.h
+++ b/include/net-snmp/data_access/interface.h
@@ -10,7 +10,10 @@
extern "C" {
#endif
-#if defined(HAVE_PCRE_H)
+#if defined(HAVE_PCRE2_H)
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+#elif defined(HAVE_PCRE_H)
#include <pcre.h>
#elif defined(HAVE_REGEX_H)
#include <regex.h>
@@ -211,7 +214,9 @@ typedef struct _conf_if_list {
typedef netsnmp_conf_if_list conf_if_list; /* backwards compat */
typedef struct _include_if_list {
-#if defined(HAVE_PCRE_H)
+#if defined(HAVE_PCRE2_H)
+ pcre2_code *regex_ptr;
+#elif defined(HAVE_PCRE_H)
pcre *regex_ptr;
#elif defined(HAVE_REGEX_H)
regex_t *regex_ptr;
diff --git a/include/net-snmp/data_access/swrun.h b/include/net-snmp/data_access/swrun.h
index 2b8636b7a8..578f1ed6d7 100644
--- a/include/net-snmp/data_access/swrun.h
+++ b/include/net-snmp/data_access/swrun.h
@@ -90,7 +90,7 @@ extern "C" {
int swrun_count_processes_by_name( char *name );
#if !defined(NETSNMP_FEATURE_REMOVE_SWRUN_COUNT_PROCESSES_BY_REGEX) \
- && defined(HAVE_PCRE_H)
+ && (defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H))
int swrun_count_processes_by_regex(char *name, netsnmp_regex_ptr regexp);
#endif
diff --git a/include/net-snmp/types.h b/include/net-snmp/types.h
index d489f37b16..eb1b8f1b28 100644
--- a/include/net-snmp/types.h
+++ b/include/net-snmp/types.h
@@ -63,7 +63,7 @@ typedef long ssize_t;
typedef unsigned long int nfds_t;
#endif
-#ifdef HAVE_PCRE_H
+#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
/*
* Abstract the pcre typedef such that not all *.c files have to include
* <pcre.h>.
--
2.43.2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bart Van Assche <bvanassche@acm.org>
Date: Sun, 21 May 2023 16:18:56 -0700
Subject: [PATCH 2/3] Improve pcre2 support
Fix compiler warnings. Convert C++ comments to C comments. Make sure that
declarations occur before statements.
(cherry picked from commit 346b6f8959513320e5b674fd670c49ba2cd43af5)
Conflicts:
agent/mibgroup/host/data_access/swrun.c
---
agent/mibgroup/host/data_access/swrun.c | 16 +++++++---
agent/mibgroup/if-mib/data_access/interface.c | 32 ++++++++++---------
agent/mibgroup/ucd-snmp/proc.c | 12 ++++---
3 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/agent/mibgroup/host/data_access/swrun.c b/agent/mibgroup/host/data_access/swrun.c
index f0442b4493..6bfb267531 100644
--- a/agent/mibgroup/host/data_access/swrun.c
+++ b/agent/mibgroup/host/data_access/swrun.c
@@ -111,10 +111,7 @@ swrun_count_processes_by_regex( char *name, netsnmp_regex_ptr regexp )
netsnmp_iterator *it;
int i = 0;
#ifdef HAVE_PCRE2_H
- pcre2_match_data *ndx_match;
- int *found_ndx;
- ndx_match = pcre2_match_data_create(30, NULL);
- found_ndx = pcre2_get_ovector_pointer(ndx_match);
+ pcre2_match_data *ndx_match = pcre2_match_data_create(30, NULL);
#elif HAVE_PCRE_H
int found_ndx[30];
#endif
@@ -122,14 +119,23 @@ swrun_count_processes_by_regex( char *name, netsnmp_regex_ptr regexp )
char fullCommand[64 + 128 + 128 + 3];
netsnmp_cache_check_and_reload(swrun_cache);
- if ( !swrun_container || !name || !regexp.regex_ptr )
+ if ( !swrun_container || !name || !regexp.regex_ptr ) {
+#ifdef HAVE_PCRE2_H
+ pcre2_match_data_free(ndx_match);
+#endif
return 0; /* or -1 */
+ }
it = CONTAINER_ITERATOR( swrun_container );
while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) {
/* need to assemble full command back so regexps can get full picture */
sprintf(fullCommand, "%s %s", entry->hrSWRunPath, entry->hrSWRunParameters);
+#ifdef HAVE_PCRE2_H
+ found = pcre2_match(regexp.regex_ptr, (unsigned char *)fullCommand,
+ strlen(fullCommand), 0, 0, ndx_match, NULL);
+#elif HAVE_PCRE_H
found = pcre_exec(regexp.regex_ptr, NULL, fullCommand, strlen(fullCommand), 0, 0, found_ndx, 30);
+#endif
if (found > 0) {
i++;
}
diff --git a/agent/mibgroup/if-mib/data_access/interface.c b/agent/mibgroup/if-mib/data_access/interface.c
index 5d714e9895..eda9a17070 100644
--- a/agent/mibgroup/if-mib/data_access/interface.c
+++ b/agent/mibgroup/if-mib/data_access/interface.c
@@ -828,12 +828,8 @@ int netsnmp_access_interface_max_reached(const char *name)
int netsnmp_access_interface_include(const char *name)
{
netsnmp_include_if_list *if_ptr;
-#if defined(HAVE_PCRE2_H)
- //pcre_exec->pcre2_match
- //ovector->pcre2_match_data
- pcre2_match_data *ndx_match;
- ndx_match = pcre2_match_data_create(3, NULL);
- int *found_ndx = pcre2_get_ovector_pointer(ndx_match);
+#if defined(HAVE_PCRE2_H)
+ pcre2_match_data *ndx_match = pcre2_match_data_create(3, NULL);
#elif defined(HAVE_PCRE_H)
int found_ndx[3];
#endif
@@ -851,8 +847,8 @@ int netsnmp_access_interface_include(const char *name)
for (if_ptr = include_list; if_ptr; if_ptr = if_ptr->next) {
#if defined(HAVE_PCRE2_H)
- if (pcre2_match(if_ptr->regex_ptr, name, strlen(name), 0, 0,
- ndx_match, NULL) >= 0) {
+ if (pcre2_match(if_ptr->regex_ptr, (const unsigned char *)name,
+ strlen(name), 0, 0, ndx_match, NULL) >= 0) {
pcre2_match_data_free(ndx_match);
return TRUE;
}
@@ -981,11 +977,13 @@ _parse_include_if_config(const char *token, char *cptr)
netsnmp_include_if_list *if_ptr, *if_new;
char *name, *st;
#if defined(HAVE_PCRE2_H)
- //we can only get the message upon calling pcre2_error_message.
- // so an additional variable is required.
+ /*
+ * We can only get the message upon calling pcre2_error_message.
+ * so an additional variable is required.
+ */
int pcre2_err_code;
- unsigned char pcre2_error[128];
- int pcre2_error_offset;
+ char pcre2_error[128];
+ size_t pcre2_error_offset;
#elif defined(HAVE_PCRE_H)
const char *pcre_error;
int pcre_error_offset;
@@ -1019,10 +1017,14 @@ _parse_include_if_config(const char *token, char *cptr)
goto err;
}
#if defined(HAVE_PCRE2_H)
- if_new->regex_ptr = pcre2_compile(if_new->name, PCRE2_ZERO_TERMINATED, 0,
- &pcre2_err_code, &pcre2_error_offset, NULL);
+ if_new->regex_ptr = pcre2_compile((const unsigned char *)if_new->name,
+ PCRE2_ZERO_TERMINATED, 0,
+ &pcre2_err_code, &pcre2_error_offset,
+ NULL);
if (!if_new->regex_ptr) {
- pcre2_get_error_message(pcre2_err_code, pcre2_error, 128);
+ pcre2_get_error_message(pcre2_err_code,
+ (unsigned char *)pcre2_error,
+ sizeof(pcre2_error));
config_perror(pcre2_error);
goto err;
}
diff --git a/agent/mibgroup/ucd-snmp/proc.c b/agent/mibgroup/ucd-snmp/proc.c
index f819122bc2..d10e428ecd 100644
--- a/agent/mibgroup/ucd-snmp/proc.c
+++ b/agent/mibgroup/ucd-snmp/proc.c
@@ -226,15 +226,17 @@ proc_parse_config(const char *token, char *cptr)
#if defined(HAVE_PCRE2_H) || defined(HAVE_PCRE_H)
cptr = skip_not_white(cptr);
if ((cptr = skip_white(cptr))) {
- DEBUGMSGTL(("ucd-snmp/regexp_proc", "Loading regex %s\n", cptr));
#ifdef HAVE_PCRE2_H
- unsigned char pcre2_error_msg[128];
+ char pcre2_error_msg[128];
int pcre2_err_code;
- int pcre2_error_offset;
+ size_t pcre2_error_offset;
+ DEBUGMSGTL(("ucd-snmp/regexp_proc", "Loading regex %s\n", cptr));
(*procp)->regexp.regex_ptr =
- pcre2_compile(cptr, PCRE2_ZERO_TERMINATED, 0, &pcre2_err_code, &pcre2_error_offset, NULL);
- pcre2_get_error_message(pcre2_err_code, pcre2_error_msg, 128);
+ pcre2_compile((const unsigned char *)cptr, PCRE2_ZERO_TERMINATED, 0, &pcre2_err_code, &pcre2_error_offset, NULL);
+ pcre2_get_error_message(pcre2_err_code,
+ (unsigned char *)pcre2_error_msg,
+ sizeof(pcre2_error_msg));
if ((*procp)->regexp.regex_ptr == NULL) {
config_perror(pcre2_error_msg);
}
--
2.43.2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Niels Baggesen <nba@users.sourceforge.net>
Date: Mon, 22 May 2023 18:44:36 +0200
Subject: [PATCH 3/3] if-mib/data_access/interface.c: plug a leak with pcre2
(cherry picked from commit e5aadf1e78c624a8e4147d4b70a7795497a50e73)
---
agent/mibgroup/if-mib/data_access/interface.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/agent/mibgroup/if-mib/data_access/interface.c b/agent/mibgroup/if-mib/data_access/interface.c
index eda9a17070..82a77ab37b 100644
--- a/agent/mibgroup/if-mib/data_access/interface.c
+++ b/agent/mibgroup/if-mib/data_access/interface.c
@@ -829,7 +829,7 @@ int netsnmp_access_interface_include(const char *name)
{
netsnmp_include_if_list *if_ptr;
#if defined(HAVE_PCRE2_H)
- pcre2_match_data *ndx_match = pcre2_match_data_create(3, NULL);
+ pcre2_match_data *ndx_match;
#elif defined(HAVE_PCRE_H)
int found_ndx[3];
#endif
@@ -844,6 +844,9 @@ int netsnmp_access_interface_include(const char *name)
*/
return TRUE;
+#if defined(HAVE_PCRE2_H)
+ ndx_match = pcre2_match_data_create(3, NULL);
+#endif
for (if_ptr = include_list; if_ptr; if_ptr = if_ptr->next) {
#if defined(HAVE_PCRE2_H)
--
2.43.2

View File

@ -6,7 +6,7 @@
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=unbound
pkgver=1.19.2
pkgver=1.19.3
pkgrel=01
pkgdesc="Validating, recursive, and caching DNS resolver w/o systemd"
url="https://unbound.net/"
@ -88,12 +88,11 @@ license=(BSD-3-Clause)
validpgpkeys=(EDFAA3F2CA4E6EB05681AF8E9F6F1C2D7E045F8D) # W.C.A. Wijngaards <wouter@nlnetlabs.nl>
sha256sums=(cc560d345734226c1b39e71a769797e7fdde2265cbb77ebce542704bba489e55 # unbound-1.19.2.tar.gz
36db7892c8def44272729694d78b408ea10778eb8c6c371167d948b47a044888 # unbound-1.19.2.tar.gz.asc
sha256sums=(3ae322be7dc2f831603e4b0391435533ad5861c2322e34a76006a9fb65eb56b9 # unbound-1.19.3.tar.gz
c4a08ab0ce2587c723b3a8a35ff99f59ea21511d63eb1bee59d275951ecce4c1 # unbound-1.19.3.tar.gz.asc
8e6e831e87484f8969a79bcd216b08b147935597c303101dad7ea1eb4cf3d326 # unbound-1.14.0-trust_anchor_file.patch
85b8f00881fb93bcce83bdfe3246463a396eb5b352c0d7f5fca32fcb839d22fa # unbound-sysusers.conf
31a573f43287dd7e3678be1680388bfc7d8dee8280eb2443f521a4b349aaa6b6 # unbound-tmpfiles.conf
afb7a0a5e2da327c27c8f666b1ffaf34689121684c301928624221ac1d0c066a) # unbound-trusted-key.hook
## 2fc11934e070c5950ab32f951de2495fe8ff90352be67c2b24b4fc13d1cadb58 unbound-1.19.2-01-x86_64.pkg.tar.lz
## 40b49d7316352144b9382e0816836c8b16a5c059088d05448b216f1f79be7f87 unbound-1.19.3-01-x86_64.pkg.tar.lz

View File

@ -6,7 +6,7 @@
# Contributor: Massimiliano Torromeo <massimiliano DOT torromeo AT google mail service>
pkgname=unbound
pkgver=1.19.2
pkgver=1.19.3
pkgrel=1
pkgdesc="Validating, recursive, and caching DNS resolver"
arch=(x86_64)
@ -44,13 +44,13 @@ source=(
$pkgname-tmpfiles.conf
$pkgname-trusted-key.hook
)
sha512sums=('03183f9d52df5644808d7cbbf2d15458a2cf5bf79bd952bbd4384bcef2e6899631605ce7780700169d7532cec0203c16765bb7706e3717241300904763914350'
sha512sums=('f860614f090a5a081cceff8ca7f4b3d416c00a251ae14ceb6b4159dc8cd022f025592074d3d78aee2f86c3eeae9d1a314713e4740aa91062579143199accd159'
'SKIP'
'9590d3d459d96f99cbc7482fae0f5318dd22a034e45cff18079e4f3c9f9c3c1d7af90cdd5353fb469eac08c535555fd164097b496286b807b2117e8a3a6cd304'
'ef71d4e9b0eb0cc602d66bd0573d9424578fe33ef28a852c582d56f0fd34fdd63046c365ef7aed8b84a461b81254240af7ad3fd539da72f9587817d21bd6c585'
'6b1849ae9d7cf427f6fa6cd0590e8f8c3f06210d2d6795e543b0f325a9e866db0f5db2275a29fa90f688783c0dd16f19c8a49a9817d5f5444e13f8f2df3ff712'
'613826cdf5ab6e77f2805fa2aa65272508dcd11090add1961b3df6dfac3b67db016bc9f45fbcf0ef0de82b2d602c153d5263a488027a6cf13a72680b581b266d')
b2sums=('f8dcee649e5e1dfaab9285964419b4d957f0035e484021e3131784512fed842ee46c25d7b47304aca4f03a0480877b939968bca22e80620434d1d2cb7013c9b6'
b2sums=('5d9cbc26510afc2b92ecce6307cd9924a1b450892f7839f076535177ab35f78059d271e628e2aa995b62f5cf97add2363561a819d6e0181beb6b44421661d8f0'
'SKIP'
'0978ab5c0474ed29de9c0904a46d114413e094dafeadaac4f10cdbc19e4152fcc064d7cdb8c331da7c2531075aa699326b84e21da1a8218a6f00a10f0e107b3d'
'292a3c2e5fde292a03b6c9b2ddabd5089f52e73b50a404c3d9f54c1a43184924b661a21eea61cc521c594c1005a3b40b630fa585a38195c61298f9b24b248b92'

View File

@ -6,18 +6,18 @@
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=vala
pkgver=0.56.15
pkgver=0.56.16
pkgrel=01
pkgdesc='Compiler for the GObject type system'
url='https://wiki.gnome.org/Projects/Vala'
depends=(glib2 gtk-doc graphviz ttf-liberation pkg-config gcc)
depends=(bash glib2 glibc gtk-doc graphviz ttf-liberation pkg-config gcc)
makedepends=(libxslt vala git help2man autoconf-archive)
checkdepends=(dbus libx11 gobject-introspection)
provides=(valadoc libvala{,doc}-${pkgver%.*}.so )
conflicts=(valadoc)
replaces=(valadoc)
#options=(debug) ## uncomment this to have the debug package produced
_commit=e36129c136c1d727b428302e51548b55ec0251bf # tags/0.56.15^0
_commit=b6f944c4601092cad4dbb3d1e3bbbf84fa0ee000 # tags/0.56.16^0
source=("git+https://gitlab.gnome.org/GNOME/vala.git#commit=$_commit")
pkgver() {
@ -55,5 +55,5 @@ license=(LGPL-2.1-or-later)
sha256sums=(SKIP)
## 33878232d01a395e5674c1fe5ac305fea3d4ead7a3bac4b7edca54d508840eeb vala-0.56.15-01-x86_64.pkg.tar.lz
## c5154d92071044c03b17bd903fb5e960e612a9f0ae7e40decd0a84c2764bd574 vala-0.56.16-01-x86_64.pkg.tar.lz

View File

@ -4,15 +4,17 @@
# Contributor: Timm Preetz <timm@preetz.us>
pkgname=vala
pkgver=0.56.15
pkgver=0.56.16
pkgrel=1
pkgdesc='Compiler for the GObject type system'
url='https://wiki.gnome.org/Projects/Vala'
arch=(x86_64)
license=(LGPL-2.1-or-later)
depends=(
bash
gcc
glib2
glibc
graphviz
gtk-doc
pkg-config
@ -36,7 +38,7 @@ provides=(
)
conflicts=(valadoc)
replaces=(valadoc)
_commit=e36129c136c1d727b428302e51548b55ec0251bf # tags/0.56.15^0
_commit=b6f944c4601092cad4dbb3d1e3bbbf84fa0ee000 # tags/0.56.16^0
source=("git+https://gitlab.gnome.org/GNOME/vala.git#commit=$_commit")
b2sums=('SKIP')

View File

@ -16,6 +16,6 @@ gettext
byacc
graphite
rav1e
dbus