[Devel] tw_append should not append non-existing values

Juha Heinanen jh at tutpro.com
Sat Jun 10 15:07:51 CEST 2006


if i have defined

   modparam( "tm", "tw_append", "test_avps:Test-Header=$avp(i:100)")

and if avp i:100 is not set when

   t_write_unix("/tmp/sock", "test/test_avps"))

is called, tw_appends appends header

Test-Header: <null>

in my opinion tw_append should test if AVP is set and if not, not append
the header.

the patch below should do the trick.

-- juha

*** /usr/src/orig/openser/HEAD/sip-server/modules/tm/t_fifo.c   2006-04-26 19:09:29.000000000 +0300
--- modules/tm/t_fifo.c 2006-06-10 15:59:37.000000000 +0300
***************
*** 458,470 ****
                                elem->name.len,elem->name.s);
                }

!               /* write the value into the buffer */
!               buf = add2buf( buf, end, &elem->name, &value.rs);
!               if (!buf)
!               {
                        LOG(L_ERR,"ERROR:tm:append2buf: overflow -> append "
!                               "exceeded %d len\n",len);
                        return 0;
                }

                elem = elem->next;
--- 458,471 ----
                                elem->name.len,elem->name.s);
                }

!               /* write non-null value into the buffer */
!               if (value.flags != XL_VAL_NULL) {
!                   buf = add2buf( buf, end, &elem->name, &value.rs);
!                   if (!buf) {
                        LOG(L_ERR,"ERROR:tm:append2buf: overflow -> append "
!                           "exceeded %d len\n",len);
                        return 0;
+                   }
                }

                elem = elem->next;






More information about the Devel mailing list