[sr-dev] git:kamailio_3.0: snmpstats: fix param type checking

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 5 18:31:10 CET 2010


Module: sip-router
Branch: kamailio_3.0
Commit: 9cf36478222aaf573a6cd7b65e6a4fd6227eb8cd
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9cf36478222aaf573a6cd7b65e6a4fd6227eb8cd

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Jan  5 18:27:46 2010 +0100

snmpstats: fix param type checking

- parameter type is given from definition of params not from modparam
  value type, resulting in mismatches for parameters that have
  USE_FUNC_PARAM flag set
- reported by Santiago Gimeno

---

 modules_k/snmpstats/snmpObjects.c |    2 +-
 modules_k/snmpstats/utilities.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules_k/snmpstats/snmpObjects.c b/modules_k/snmpstats/snmpObjects.c
index b797317..b9b36af 100644
--- a/modules_k/snmpstats/snmpObjects.c
+++ b/modules_k/snmpstats/snmpObjects.c
@@ -611,7 +611,7 @@ static int set_if_valid_threshold(modparam_t type, void *val, char *varStr,
 		return -1;
 	}
 
-	if (type != INT_PARAM) {
+	if (PARAM_TYPE_MASK(type) != INT_PARAM) {
 		LM_ERR("%s called with type %d instead of %d!\n",
 				varStr, type, INT_PARAM);
 		return -1;
diff --git a/modules_k/snmpstats/utilities.c b/modules_k/snmpstats/utilities.c
index 2097f88..9b4011d 100644
--- a/modules_k/snmpstats/utilities.c
+++ b/modules_k/snmpstats/utilities.c
@@ -78,7 +78,7 @@ int stringHandlerSanityCheck( modparam_t type, void *val, char *parameterName)
 	char *theString = (char *)val;
 
 	/* Make sure the function was called correctly. */
-	if (type != STR_PARAM) {
+	if (PARAM_TYPE_MASK(type) != STR_PARAM) {
 		LM_ERR("the %s parameter was assigned a type %d instead of %d\n",
 				parameterName, type, STR_PARAM);
 		return 0;




More information about the sr-dev mailing list