changeset 1254:b469d38e20fd

Merge changes from proposed branch
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 28 Jan 2014 01:38:25 +0100
parents 5c6e94202c64 (diff) 3734341ad03b (current diff)
children c6a4bda62ccc
files
diffstat 2 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libfdproto/dictionary.c	Mon Jan 27 15:49:18 2014 +0100
+++ b/libfdproto/dictionary.c	Tue Jan 28 01:38:25 2014 +0100
@@ -1510,8 +1510,21 @@
 	
 	FD_DUMP_HANDLE_OFFSET();
 	
-	/* Check the parameters are correct */
-	CHECK_PARAMS_DO( avp_value && verify_object(model) && (model->type == DICT_AVP), return NULL );
+	/* Handle invalid parameters */
+	if (!avp_value) {
+		CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "(avp value not set)"), return NULL);
+		return *buf;
+	}
+
+	if (!model) {
+		CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "(model not set)"), return NULL);
+		return *buf;
+	}
+	
+	if (! (	verify_object(model) && (model->type == DICT_AVP) )) {
+		CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "(invalid model)"), return NULL);
+		return *buf;
+	}
 	
 	/* Get the type definition of this AVP */
 	type = model->parent;
--- a/tests/testmesg.c	Mon Jan 27 15:49:18 2014 +0100
+++ b/tests/testmesg.c	Tue Jan 28 01:38:25 2014 +0100
@@ -1013,6 +1013,12 @@
 					CHECK(1, got_h2);
 				}
 				
+				/* Now test the behavior of fd_msg_rescode_set with a grouped AVP */
+				CHECK( 0, fd_msg_rescode_set(msg, "DIAMETER_AVP_OCCURS_TOO_MANY_TIMES", NULL, pi1, 1) );
+				
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1));
+				
+				TODO("Check the Failed-AVP is as expected");
 			}
 			
 		}
"Welcome to our mercurial repository"