[sr-dev] git:master:95e82d91: cfg_rcp: allow getting 0 values in rpc cfg.get

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 23 17:35:02 CET 2018


Module: kamailio
Branch: master
Commit: 95e82d9135180be519192029d3f6edcf56eddb59
URL: https://github.com/kamailio/kamailio/commit/95e82d9135180be519192029d3f6edcf56eddb59

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-01-23T17:32:23+01:00

cfg_rcp: allow getting 0 values in rpc cfg.get

- issue introduced in previous commit
- log message for dynamic values to be skipped

---

Modified: src/modules/cfg_rpc/cfg_rpc.c

---

Diff:  https://github.com/kamailio/kamailio/commit/95e82d9135180be519192029d3f6edcf56eddb59.diff
Patch: https://github.com/kamailio/kamailio/commit/95e82d9135180be519192029d3f6edcf56eddb59.patch

---

diff --git a/src/modules/cfg_rpc/cfg_rpc.c b/src/modules/cfg_rpc/cfg_rpc.c
index a2d44e3acc..d865eae561 100644
--- a/src/modules/cfg_rpc/cfg_rpc.c
+++ b/src/modules/cfg_rpc/cfg_rpc.c
@@ -381,18 +381,20 @@ static void rpc_get(rpc_t* rpc, void* c)
 				for (i=0; def[i].name; i++) {
 					var.s = def[i].name;
 					var.len = (int)strlen(def[i].name);
-					LM_DBG("getting value for variable: %.*s.%.*s\n", group.len, group.s,
-							var.len, var.s);
+					LM_DBG("getting value for variable: %.*s.%.*s\n",
+							group.len, group.s, var.len, var.s);
 					val = NULL;
 					ret = cfg_get_by_name(ctx, &group, group_id, &var,
 							&val, &val_type);
 					if (ret < 0) {
 						rpc->fault(c, 400, "Failed to get the variable");
 						return;
-					} else if (ret > 0 || val==NULL) {
+					} else if (ret > 0) {
+						LM_DBG("skipping dynamic (callback) value for variable:"
+								" %.*s.%.*s (%p/%d)\n",
+								group.len, group.s, var.len, var.s, val, ret);
 						continue;
 					}
-					LM_DBG("type: %d value: %p\n", val_type, val);
 					switch (val_type) {
 						case CFG_VAR_INT:
 							rpc->struct_add(rh, "d", var.s, (int)(long)val);




More information about the sr-dev mailing list