[sr-dev] git:master: auth_db(k): load_credentials is using the cache for pvs

Elena-Ramona Modroiu ramona at rosdev.ro
Wed Sep 26 12:19:46 CEST 2012


Module: sip-router
Branch: master
Commit: 0420d14dc23ae63a043650da0fa82654aab82bb6
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0420d14dc23ae63a043650da0fa82654aab82bb6

Author: Elena-Ramona Modroiu <ramona at asipto.com>
Committer: Elena-Ramona Modroiu <ramona at asipto.com>
Date:   Wed Sep 26 12:10:23 2012 +0200

auth_db(k): load_credentials is using the cache for pvs

- results in less used private memory

---

 modules_k/auth_db/authdb_mod.c |    7 ++-----
 modules_k/auth_db/authorize.c  |    2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/modules_k/auth_db/authdb_mod.c b/modules_k/auth_db/authdb_mod.c
index 5a1e2ef..03d1721 100644
--- a/modules_k/auth_db/authdb_mod.c
+++ b/modules_k/auth_db/authdb_mod.c
@@ -352,11 +352,8 @@ int parse_aaa_pvs(char *definition, pv_elem_t **pv_def, int *cnt)
 
 		/* create a pv spec */
 		LM_DBG("column: %.*s  pv: %.*s\n", pve->text.len, pve->text.s, pv.len, pv.s);
-		if (pv_parse_spec(&pv, &pve->spec) == 0) {
-			LM_ERR("malformed PV definition: %.*s\n", pv.len, pv.s);
-			goto parse_error;;
-		}
-		if(pve->spec.setf == NULL) {
+		pve->spec = pv_spec_lookup(&pv, NULL);
+		if(pve->spec==NULL || pve->spec->setf == NULL) {
 			LM_ERR("PV is not writeable: %.*s\n", pv.len, pv.s);
 			goto parse_error;
 		}
diff --git a/modules_k/auth_db/authorize.c b/modules_k/auth_db/authorize.c
index 909365c..1252687 100644
--- a/modules_k/auth_db/authorize.c
+++ b/modules_k/auth_db/authorize.c
@@ -140,7 +140,7 @@ static int generate_avps(struct sip_msg* msg, db1_res_t* db_res)
 	int i;
 
 	for (cred=credentials, i=1; cred; cred=cred->next, i++) {
-		if (db_val2pv_spec(msg, &RES_ROWS(db_res)[0].values[i], &cred->spec) != 0) {
+		if (db_val2pv_spec(msg, &RES_ROWS(db_res)[0].values[i], cred->spec) != 0) {
 			LM_ERR("Failed to convert value for column %.*s\n",
 					RES_NAMES(db_res)[i]->len, RES_NAMES(db_res)[i]->s);
 			return -1;




More information about the sr-dev mailing list