summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2024-05-14 23:01:20 +0200
committerUros Majstorovic <majstor@majstor.org>2024-05-14 23:01:20 +0200
commit5e5a5d426e2a26ca0f3370a5efd80e2f8e371cbf (patch)
tree0ccfe8f70674327f307b4ef1e43fa77e90abe4ce
parent5903b0819664f473d1279de57e8b00d60d76ae0e (diff)
improved acl diagnostics
-rw-r--r--ecp/server/acl.c20
-rw-r--r--ecp/server/acl.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/ecp/server/acl.c b/ecp/server/acl.c
index 7561af8..826b292 100644
--- a/ecp/server/acl.c
+++ b/ecp/server/acl.c
@@ -127,6 +127,16 @@ int acl_inlist(ecp_ecdh_public_t *public) {
return (item != NULL);
}
+unsigned int acl_count(void) {
+ unsigned int r = 0;
+
+ pthread_rwlock_rdlock(&acl_ht_rwlock);
+ if (acl_keys) r = ecp_ht_count(acl_keys);
+ pthread_rwlock_unlock(&acl_ht_rwlock);
+
+ return r;
+}
+
int acl_dir_inlist(ecp_ecdh_public_t *public) {
void *item = NULL;
@@ -137,6 +147,16 @@ int acl_dir_inlist(ecp_ecdh_public_t *public) {
return (item != NULL);
}
+unsigned int acl_dir_count(void) {
+ unsigned int r = 0;
+
+ pthread_rwlock_rdlock(&acl_ht_rwlock);
+ if (acl_keys) r = ecp_ht_count(acl_keys_dir);
+ pthread_rwlock_unlock(&acl_ht_rwlock);
+
+ return r;
+}
+
int acl_reset_ht(void) {
int rv = ECP_OK;
diff --git a/ecp/server/acl.h b/ecp/server/acl.h
index 5e3f83c..3724970 100644
--- a/ecp/server/acl.h
+++ b/ecp/server/acl.h
@@ -12,7 +12,9 @@ void acl_destroy_list(ACLItem *head);
int acl_add_key(ECPDirItem *dir_item);
int acl_inlist(ecp_ecdh_public_t *public);
+unsigned int acl_count(void);
int acl_dir_inlist(ecp_ecdh_public_t *public);
+unsigned int acl_dir_count(void);
int acl_reset_ht(void);
int acl_load_ht(void);