[sr-dev] git:master:4344a7fa: Merge pull request #755 from kelchy/master

GitHub noreply at github.com
Mon Aug 22 09:37:19 CEST 2016


Module: kamailio
Branch: master
Commit: 4344a7fa68ac0ce95f5e0d5d5f8df398a6d7586c
URL: https://github.com/kamailio/kamailio/commit/4344a7fa68ac0ce95f5e0d5d5f8df398a6d7586c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: GitHub <noreply at github.com>
Date: 2016-08-22T09:37:13+02:00

Merge pull request #755 from kelchy/master

permissions: fixed rpc array

---

Modified: modules/permissions/hash.c
Modified: modules/permissions/permissions.c

---

Diff:  https://github.com/kamailio/kamailio/commit/4344a7fa68ac0ce95f5e0d5d5f8df398a6d7586c.diff
Patch: https://github.com/kamailio/kamailio/commit/4344a7fa68ac0ce95f5e0d5d5f8df398a6d7586c.patch

---

diff --git a/modules/permissions/hash.c b/modules/permissions/hash.c
index 9f90bac..e8824f2 100644
--- a/modules/permissions/hash.c
+++ b/modules/permissions/hash.c
@@ -612,15 +612,15 @@ int addr_hash_table_rpc_print(struct addr_list** table, rpc_t* rpc, void* c)
 	struct addr_list *np;
 
 
-	if (rpc->add(c, "{", &th) < 0)
-	{
-		rpc->fault(c, 500, "Internal error creating rpc");
-		return -1;
-	}
-
 	for (i = 0; i < PERM_HASH_SIZE; i++) {
 		np = table[i];
 		while (np) {
+			if (rpc->add(c, "{", &th) < 0)
+			{
+				rpc->fault(c, 500, "Internal error creating rpc");
+				return -1;
+			}
+
 			if(rpc->struct_add(th, "dd{",
 						"table", i,
 						"group", np->grp,
@@ -847,13 +847,13 @@ int subnet_table_rpc_print(struct subnet* table, rpc_t* rpc, void* c)
 
 	count = table[PERM_MAX_SUBNETS].grp;
 
-	if (rpc->add(c, "{", &th) < 0)
-	{
-		rpc->fault(c, 500, "Internal error creating rpc");
-		return -1;
-	}
-
 	for (i = 0; i < count; i++) {
+		if (rpc->add(c, "{", &th) < 0)
+		{
+			rpc->fault(c, 500, "Internal error creating rpc");
+			return -1;
+		}
+
 		if(rpc->struct_add(th, "dd{",
 					"id", i,
 					"group", table[i].grp,
diff --git a/modules/permissions/permissions.c b/modules/permissions/permissions.c
index b935e37..0445fbb 100644
--- a/modules/permissions/permissions.c
+++ b/modules/permissions/permissions.c
@@ -1016,8 +1016,8 @@ rpc_export_t permissions_rpc[] = {
 	{"permissions.trustedReload", rpc_trusted_reload, rpc_trusted_reload_doc, 0},
 	{"permissions.addressReload", rpc_address_reload, rpc_address_reload_doc, 0},
 	{"permissions.trustedDump", rpc_trusted_dump, rpc_trusted_dump_doc, 0},
-	{"permissions.addressDump", rpc_address_dump, rpc_address_dump_doc, 0},
-	{"permissions.subnetDump", rpc_subnet_dump, rpc_subnet_dump_doc, 0},
+	{"permissions.addressDump", rpc_address_dump, rpc_address_dump_doc, RET_ARRAY},
+	{"permissions.subnetDump", rpc_subnet_dump, rpc_subnet_dump_doc, RET_ARRAY},
 	{"permissions.domainDump", rpc_domain_name_dump, rpc_domain_name_dump_doc, 0},
 	{"permissions.testUri", rpc_test_uri, rpc_test_uri_doc, 0},
 	{0, 0, 0, 0}




More information about the sr-dev mailing list