Merge pull request #1630 from sergey-safarov/master
authorDaniel-Constantin Mierla <miconda@gmail.com>
Wed, 5 Sep 2018 17:13:45 +0000 (19:13 +0200)
committerGitHub <noreply@github.com>
Wed, 5 Sep 2018 17:13:45 +0000 (19:13 +0200)
pkg/docker: Updated subproject

39 files changed:
src/core/msg_translator.c
src/core/msg_translator.h
src/core/parser/parse_via.c
src/core/tcp_read.c
src/core/xavp.c
src/lib/srdb1/schema/subscriber.xml
src/modules/app_jsdt/app_jsdt_api.c
src/modules/dispatcher/dispatch.c
src/modules/htable/README
src/modules/htable/doc/htable_admin.xml
src/modules/htable/ht_api.c
src/modules/htable/ht_api.h
src/modules/htable/htable.c
src/modules/pv/pv_trans.c
src/modules/pv/pv_trans.h
src/modules/rr/README
src/modules/rr/doc/rr_admin.xml
src/modules/rr/record.c
src/modules/rr/rr_mod.c
src/modules/tcpops/tcpops.c
src/modules/textopsx/textopsx.c
src/modules/tls/tls_cfg.c
src/modules/tls/tls_cfg.h
src/modules/tls/tls_config.c
src/modules/tls/tls_domain.c
src/modules/tls/tls_domain.h
src/modules/tls/tls_mod.c
utils/kamctl/db_berkeley/kamailio/subscriber
utils/kamctl/db_redis/kamailio/location
utils/kamctl/db_redis/kamailio/subscriber
utils/kamctl/db_sqlite/auth_db-create.sql
utils/kamctl/dbtext/kamailio/subscriber
utils/kamctl/mongodb/kamailio/subscriber.json
utils/kamctl/mysql/auth_db-create.sql
utils/kamctl/oracle/auth_db-create.sql
utils/kamctl/postgres/auth_db-create.sql
utils/kamctl/xhttp_pi/auth_db-mod
utils/kamctl/xhttp_pi/auth_db-table
utils/kamctl/xhttp_pi/pi_framework.xml

index f82d72c..6929b22 100644 (file)
@@ -3176,3 +3176,106 @@ int build_sip_msg_from_buf(struct sip_msg *msg, char *buf, int len,
        return 0;
 }
 
+/**
+ *
+ */
+int sip_msg_update_buffer(sip_msg_t *msg, str *obuf)
+{
+       sip_msg_t tmp;
+
+       if(obuf==NULL || obuf->s==NULL || obuf->len<=0) {
+               LM_ERR("invalid buffer parameter\n");
+               return -1;
+       }
+
+       if(obuf->len >= BUF_SIZE) {
+               LM_ERR("new buffer is too large (%d)\n", obuf->len);
+               return -1;
+       }
+       /* temporary copy */
+       memcpy(&tmp, msg, sizeof(sip_msg_t));
+
+       /* reset dst uri and path vector to avoid freeing - restored later */
+       if(msg->dst_uri.s != NULL) {
+               msg->dst_uri.s = NULL;
+               msg->dst_uri.len = 0;
+       }
+       if(msg->path_vec.s != NULL) {
+               msg->path_vec.s = NULL;
+               msg->path_vec.len = 0;
+       }
+
+       /* free old msg structure */
+       free_sip_msg(msg);
+       memset(msg, 0, sizeof(sip_msg_t));
+
+       /* restore msg fields */
+       msg->buf = tmp.buf;
+       msg->id = tmp.id;
+       msg->rcv = tmp.rcv;
+       msg->set_global_address = tmp.set_global_address;
+       msg->set_global_port = tmp.set_global_port;
+       msg->flags = tmp.flags;
+       msg->msg_flags = tmp.msg_flags;
+       msg->hash_index = tmp.hash_index;
+       msg->force_send_socket = tmp.force_send_socket;
+       msg->fwd_send_flags = tmp.fwd_send_flags;
+       msg->rpl_send_flags = tmp.rpl_send_flags;
+       msg->dst_uri = tmp.dst_uri;
+       msg->path_vec = tmp.path_vec;
+
+       memcpy(msg->buf, obuf->s, obuf->len);
+       msg->len = obuf->len;
+       msg->buf[msg->len] = '\0';
+
+       /* reparse the message */
+       LM_DBG("SIP message content updated - reparsing\n");
+       if(parse_msg(msg->buf, msg->len, msg) != 0) {
+               LM_ERR("parsing new sip message failed [[%.*s]]\n", msg->len, msg->buf);
+               /* exit config execution - sip_msg_t structure is no longer
+                * valid/safe for config */
+               return 0;
+       }
+
+       return 1;
+}
+
+/**
+ *
+ */
+int sip_msg_apply_changes(sip_msg_t *msg)
+{
+       int ret;
+       dest_info_t dst;
+       str obuf;
+
+       if(msg->first_line.type != SIP_REPLY && get_route_type() != REQUEST_ROUTE) {
+               LM_ERR("invalid usage - not in request route or a reply\n");
+               return -1;
+       }
+
+       init_dest_info(&dst);
+       dst.proto = PROTO_UDP;
+       if(msg->first_line.type == SIP_REPLY) {
+               obuf.s = generate_res_buf_from_sip_res(
+                               msg, (unsigned int *)&obuf.len, BUILD_NO_VIA1_UPDATE);
+       } else {
+               if(msg->msg_flags & FL_RR_ADDED) {
+                       LM_ERR("cannot apply msg changes after adding record-route"
+                                  " header - it breaks conditional 2nd header\n");
+                       return -1;
+               }
+               obuf.s = build_req_buf_from_sip_req(msg, (unsigned int *)&obuf.len,
+                               &dst,
+                               BUILD_NO_PATH | BUILD_NO_LOCAL_VIA | BUILD_NO_VIA1_UPDATE);
+       }
+       if(obuf.s == NULL) {
+               LM_ERR("couldn't update msg buffer content\n");
+               return -1;
+       }
+       ret = sip_msg_update_buffer(msg, &obuf);
+       /* free new buffer - copied in the static buffer from old sip_msg_t */
+       pkg_free(obuf.s);
+
+       return ret;
+}
index d95c89f..b6360ce 100644 (file)
@@ -180,4 +180,15 @@ void process_lumps( struct sip_msg* msg,
                     unsigned int* orig_offs,
                     struct dest_info* send_info,
                     int flag);
+
+/**
+ * set the internal buffer for sip msg with obuf and reparse
+ */
+int sip_msg_update_buffer(sip_msg_t *msg, str *obuf);
+
+/**
+ * apply changes to sip msg buffer and reparse
+ */
+int sip_msg_apply_changes(sip_msg_t *msg);
+
 #endif
index 8c3d54e..318bb8e 100644 (file)
@@ -2073,7 +2073,7 @@ main_via:
                                                break;
                                        case P_HOST:
                                                /*mark end of host*/
-                                               vb->host.len = tmp - vb->host.s;
+                                               if(vb->host.s) vb->host.len = tmp - vb->host.s;
                                                state = L_PORT;
                                                break;
                                        case L_PORT: /*eat the spaces*/
@@ -2081,7 +2081,7 @@ main_via:
                                                break;
                                        case P_PORT:
                                                /*end of port */
-                                               vb->port_str.len = tmp - vb->port_str.s;
+                                               if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s;
                                                state = L_PARAM;
                                                break;
                                        case L_PARAM: /* eat the space */
@@ -2131,13 +2131,13 @@ main_via:
                                                break;
                                        case P_HOST:
                                                /*mark end of host*/
-                                               vb->host.len = tmp - vb->host.s;
+                                               if(vb->host.s) vb->host.len = tmp - vb->host.s;
                                                saved_state = L_PORT;
                                                state = F_LF;
                                                break;
                                        case P_PORT:
                                                /*end of port */
-                                               vb->port_str.len = tmp - vb->port_str.s;
+                                               if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s;
                                                saved_state = L_PARAM;
                                                state = F_LF;
                                                break;
@@ -2176,13 +2176,13 @@ main_via:
                                                break;
                                        case P_HOST:
                                                /*mark end of host*/
-                                               vb->host.len = tmp - vb->host.s;
+                                               if(vb->host.s) vb->host.len = tmp - vb->host.s;
                                                saved_state = L_PORT;
                                                state = F_CR;
                                                break;
                                        case P_PORT:
                                                /*end of port */
-                                               vb->port_str.len = tmp - vb->port_str.s;
+                                               if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s;
                                                saved_state = L_PARAM;
                                                state = F_CR;
                                                break;
@@ -2212,7 +2212,7 @@ main_via:
                                                break;
                                        case P_HOST:
                                                /*mark  end of host*/
-                                               vb->host.len = tmp - vb->host.s;
+                                               if(vb->host.s) vb->host.len = tmp - vb->host.s;
                                                state = F_PORT;
                                                break;
                                        case L_PORT:
@@ -2257,13 +2257,13 @@ main_via:
                                                LM_ERR("bad ipv6 reference\n");
                                                goto error;
                                        case P_HOST:
-                                               vb->host.len = tmp - vb->host.s;
+                                               if(vb->host.s) vb->host.len = tmp - vb->host.s;
                                                state = F_PARAM;
                                                param_start = tmp + 1;
                                                break;
                                        case P_PORT:
                                                /*mark the end*/
-                                               vb->port_str.len = tmp - vb->port_str.s;
+                                               if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s;
                                        case L_PORT:
                                        case L_PARAM:
                                                state = F_PARAM;
@@ -2313,12 +2313,12 @@ main_via:
                                                goto error;
                                        case P_HOST:
                                                /*mark the end*/
-                                               vb->host.len = tmp - vb->host.s;
+                                               if(vb->host.s) vb->host.len = tmp - vb->host.s;
                                                state = F_VIA;
                                                break;
                                        case P_PORT:
                                                /*mark the end*/
-                                               vb->port_str.len = tmp - vb->port_str.s;
+                                               if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s;
                                                state = F_VIA;
                                                break;
                                        case L_PORT:
@@ -2363,13 +2363,13 @@ main_via:
                                                goto error;
                                        case P_HOST:
                                                /*mark the end*/
-                                               vb->host.len = tmp - vb->host.s;
+                                               if(vb->host.s) vb->host.len = tmp - vb->host.s;
                                                state = F_COMMENT;
                                                c_nest++;
                                                break;
                                        case P_PORT:
                                                /*mark the end*/
-                                               vb->port_str.len = tmp - vb->port_str.s;
+                                               if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s;
                                                state = F_COMMENT;
                                                c_nest++;
                                                break;
@@ -2469,7 +2469,7 @@ main_via:
                                switch(state) {
                                        case P_IP6HOST:
                                                /*mark the end*/
-                                               vb->host.len = (tmp - vb->host.s) + 1; /* include "]" */
+                                               if(vb->host.s) vb->host.len = (tmp - vb->host.s) + 1; /* include "]" */
                                                state = L_PORT;
                                                break;
                                        case F_CRLF:
index 0dc7838..6bb5274 100644 (file)
@@ -356,7 +356,7 @@ int tcp_read(struct tcp_connection *c, int* flags)
        fd=c->fd;
        bytes_free=r->b_size- (int)(r->pos - r->buf);
        
-       if (unlikely(bytes_free==0)){
+       if (unlikely(bytes_free<=0)){
                LM_ERR("buffer overrun, dropping ([%s]:%u -> [%s]:%u)\n",
                                ip_addr2a(&c->rcv.src_ip), c->rcv.src_port,
                                ip_addr2a(&c->rcv.dst_ip), c->rcv.dst_port);
index e1cf394..66797f9 100644 (file)
@@ -540,11 +540,11 @@ void xavp_print_list_content(sr_xavp_t **head, int level)
                start = *head;
        else
                start=*_xavp_list_crt;
-       LM_INFO("+++++ start XAVP list: %p (level=%d)\n", start, level);
+       LM_INFO("+++++ start XAVP list: %p (%p) (level=%d)\n", start, head, level);
        avp = start;
        while(avp)
        {
-               LM_INFO("     *** XAVP name: %s\n", avp->name.s);
+               LM_INFO("     *** (l:%d - %p) XAVP name: %s\n", level, avp, avp->name.s);
                LM_INFO("     XAVP id: %u\n", avp->id);
                LM_INFO("     XAVP value type: %d\n", avp->val.type);
                switch(avp->val.type) {
@@ -552,20 +552,20 @@ void xavp_print_list_content(sr_xavp_t **head, int level)
                                LM_INFO("     XAVP value: <null>\n");
                        break;
                        case SR_XTYPE_INT:
-                               LM_INFO("     XAVP value: %d\n", avp->val.v.i);
+                               LM_INFO("     XAVP value (int): %d\n", avp->val.v.i);
                        break;
                        case SR_XTYPE_STR:
-                               LM_INFO("     XAVP value: %s\n", avp->val.v.s.s);
+                               LM_INFO("     XAVP value (str): %s\n", avp->val.v.s.s);
                        break;
                        case SR_XTYPE_TIME:
-                               LM_INFO("     XAVP value: %lu\n",
+                               LM_INFO("     XAVP value (time): %lu\n",
                                                (long unsigned int)avp->val.v.t);
                        break;
                        case SR_XTYPE_LONG:
-                               LM_INFO("     XAVP value: %ld\n", avp->val.v.l);
+                               LM_INFO("     XAVP value (long): %ld\n", avp->val.v.l);
                        break;
                        case SR_XTYPE_LLONG:
-                               LM_INFO("     XAVP value: %lld\n", avp->val.v.ll);
+                               LM_INFO("     XAVP value (llong): %lld\n", avp->val.v.ll);
                        break;
                        case SR_XTYPE_XAVP:
                                LM_INFO("     XAVP value: <xavp:%p>\n", avp->val.v.xavp);
@@ -578,6 +578,7 @@ void xavp_print_list_content(sr_xavp_t **head, int level)
                                LM_INFO("     XAVP value: <data:%p>\n", avp->val.v.data);
                        break;
                }
+               LM_INFO("     *** (l:%d - %p) end\n", level, avp);
                avp = avp->next;
        }
        LM_INFO("----- end XAVP list: %p (level=%d)\n", start, level);
index 3957571..8aaa039 100644 (file)
         <description>md5(username@domain:realm:password)</description>
     </column>
 
-    <column>
-        <name>email_address</name>
-        <type>string</type>
-        <size>&uri_len;</size>
-        <null/>
-        <default><null/></default>
-        <description>Email address</description>
-    </column>
-
-    <column>
-        <name>rpid</name>
-        <type>string</type>
-        <size>&uri_len;</size>
-        <null/>
-        <default><null/></default>
-        <description>The SIP Remote-Party-ID header identifies the calling party and includes user, party, screen and privacy headers that specify how a call is presented and screened.</description>
-    </column>
-
     <index>
         <name>account_idx</name>
         <colref linkend="username"/>
index 9b6dda8..7af7f91 100644 (file)
@@ -242,6 +242,102 @@ static int jsdt_sr_pv_gete(duk_context *J)
 /**
  *
  */
+static int jsdt_sr_pv_push_valx (duk_context *J, int rmode, int vi, str *vs)
+{
+       if(rmode==1) {
+               duk_push_int(J, vi);
+       } else {
+               duk_push_lstring(J, vs->s, vs->len);
+       }
+       return 1;
+}
+
+/**
+ *
+ */
+static int jsdt_sr_pv_get_valx (duk_context *J, int rmode)
+{
+       str pvn;
+       pv_spec_t *pvs;
+       pv_value_t val;
+       sr_jsdt_env_t *env_J;
+       int pl;
+       int xival = 0;
+       str xsval = str_init("");
+       env_J = jsdt_sr_env_get();
+
+       if(duk_get_top(J)<2) {
+               LM_ERR("too few parameters [%d]\n", duk_get_top(J));
+               return jsdt_sr_return_pv_null(J, 0);
+       }
+       if(rmode==1) {
+               if(!duk_is_number(J, 1)) {
+                       LM_ERR("invalid int parameter\n");
+                       return jsdt_sr_return_pv_null(J, 0);
+               }
+               xival = duk_to_int(J, 1);
+       } else {
+               if(!duk_is_string(J, 1)) {
+                       LM_ERR("invalid str parameter\n");
+                       return jsdt_sr_return_pv_null(J, 0);
+               }
+               xsval.s = (char*)duk_to_string(J, 1);
+               xsval.len = strlen(val.rs.s);
+       }
+
+       pvn.s = (char*)duk_to_string(J, 0);
+       if(pvn.s==NULL || env_J->msg==NULL) {
+               return jsdt_sr_pv_push_valx(J, rmode, xival, &xsval);
+       }
+
+       pvn.len = strlen(pvn.s);
+       LM_DBG("pv get: %s\n", pvn.s);
+       pl = pv_locate_name(&pvn);
+       if(pl != pvn.len) {
+               LM_ERR("invalid pv [%s] (%d/%d)\n", pvn.s, pl, pvn.len);
+               return jsdt_sr_pv_push_valx(J, rmode, xival, &xsval);
+       }
+       pvs = pv_cache_get(&pvn);
+       if(pvs==NULL) {
+               LM_ERR("cannot get pv spec for [%s]\n", pvn.s);
+               return jsdt_sr_pv_push_valx(J, rmode, xival, &xsval);
+       }
+
+       memset(&val, 0, sizeof(pv_value_t));
+       if(pv_get_spec_value(env_J->msg, pvs, &val) != 0) {
+               LM_ERR("unable to get pv value for [%s]\n", pvn.s);
+               return jsdt_sr_pv_push_valx(J, rmode, xival, &xsval);
+       }
+       if(val.flags&PV_VAL_NULL) {
+               return jsdt_sr_pv_push_valx(J, rmode, xival, &xsval);
+       }
+       if(val.flags&PV_TYPE_INT) {
+               duk_push_int(J, val.ri);
+               return 1;
+       }
+       duk_push_lstring(J, val.rs.s, val.rs.len);
+       return 1;
+}
+
+/**
+ *
+ */
+static int jsdt_sr_pv_getvs (duk_context *J)
+{
+       return jsdt_sr_pv_get_valx(J, 0);
+}
+
+/**
+ *
+ */
+static int jsdt_sr_pv_getvn (duk_context *J)
+{
+       return jsdt_sr_pv_get_valx(J, 1);
+}
+
+/**
+ *
+ */
 static int jsdt_sr_pv_seti (duk_context *J)
 {
        str pvn;
@@ -431,6 +527,8 @@ const duk_function_list_entry _sr_kemi_pv_J_Map[] = {
        { "get", jsdt_sr_pv_get, 1 /* 1 args */ },
        { "getw", jsdt_sr_pv_getw, 1 /* 1 args */ },
        { "gete", jsdt_sr_pv_gete, 1 /* 1 args */ },
+       { "getvn", jsdt_sr_pv_getvn, 2 /* 2 args */ },
+       { "getvs", jsdt_sr_pv_getvs, 2 /* 2 args */ },
        { "seti", jsdt_sr_pv_seti, 2 /* 2 args */ },
        { "sets", jsdt_sr_pv_sets, 2 /* 2 args */ },
        { "unset", jsdt_sr_pv_unset, 1 /* 1 args */ },
index 7d7105d..cb87392 100644 (file)
@@ -2250,6 +2250,7 @@ int ds_update_dst(struct sip_msg *msg, int upos, int mode)
        sr_xavp_t *rxavp = NULL;
        sr_xavp_t *lxavp = NULL;
 
+       LM_DBG("updating dst\n");
        if(upos == DS_USE_NEXT) {
                if(!(ds_flags & DS_FAILOVER_ON) || ds_xavp_dst.len <= 0) {
                        LM_WARN("failover support disabled\n");
@@ -2264,6 +2265,7 @@ int ds_update_dst(struct sip_msg *msg, int upos, int mode)
        }
 
        if(upos == DS_USE_NEXT) {
+               LM_DBG("updating dst with next record\n");
                /* use next destination - delete the current one and search the next */
                xavp_rm(rxavp, NULL);
 
@@ -2282,7 +2284,7 @@ int ds_update_dst(struct sip_msg *msg, int upos, int mode)
 
        lxavp = xavp_get(&ds_xavp_dst_addr, rxavp);
        if(lxavp==NULL || lxavp->val.type!=SR_XTYPE_STR) {
-               LM_WARN("no xavp uri field in next destination record\n");
+               LM_WARN("no xavp uri field in next destination record (%p)\n", lxavp);
                return -1;
        }
 
index 2d393d8..1fd1fbd 100644 (file)
@@ -68,6 +68,8 @@ Ovidiu Sas
               4.9. sht_iterator_start(iname, hname)
               4.10. sht_iterator_end(iname)
               4.11. sht_iterator_next(iname)
+              4.12. sht_has_name(htable, op, mval)
+              4.13. sht_has_str_value(htable, op, mval)
 
         5. Exported pseudo-variables
         6. RPC Commands
@@ -117,6 +119,8 @@ Ovidiu Sas
    1.27. sht_iterator_start usage
    1.28. sht_iterator_end usage
    1.29. sht_iterator_next usage
+   1.30. sht_has_name usage
+   1.31. sht_has_name usage
 
 Chapter 1. Admin Guide
 
@@ -160,6 +164,8 @@ Chapter 1. Admin Guide
         4.9. sht_iterator_start(iname, hname)
         4.10. sht_iterator_end(iname)
         4.11. sht_iterator_next(iname)
+        4.12. sht_has_name(htable, op, mval)
+        4.13. sht_has_str_value(htable, op, mval)
 
    5. Exported pseudo-variables
    6. RPC Commands
@@ -675,6 +681,8 @@ modparam("htable", "event_callback_mode", 1)
    4.9. sht_iterator_start(iname, hname)
    4.10. sht_iterator_end(iname)
    4.11. sht_iterator_next(iname)
+   4.12. sht_has_name(htable, op, mval)
+   4.13. sht_has_str_value(htable, op, mval)
 
 4.1.  sht_print()
 
@@ -852,6 +860,50 @@ sht_iterator_end("i1");
     sht_iterator_end("i1");
 ...
 
+4.12.  sht_has_name(htable, op, mval)
+
+   Return greater than 0 (true) if the htable has an item that matches the
+   name against the mval parameter.
+
+   The op parameter can be:
+     * eq - match the val parameter as string equal expression.
+     * ne - match the val parameter as string not-equal expression.
+     * re - match the val parameter as regular expression.
+     * sw - match the val parameter as 'starts with' expression.
+
+   All parameters can be static strings or contain variables.
+
+   This function can be used from ANY_ROUTE.
+
+   Example 1.30. sht_has_name usage
+...
+if(sht_has_name("ha", "eq", "alice")) {
+  ...
+}
+...
+
+4.13.  sht_has_str_value(htable, op, mval)
+
+   Return greater than 0 (true) if the htable has an item that matches the
+   string value against the mval parameter.
+
+   The op parameter can be:
+     * eq - match the val parameter as string equal expression.
+     * ne - match the val parameter as string not-equal expression.
+     * re - match the val parameter as regular expression.
+     * sw - match the val parameter as 'starts with' expression.
+
+   All parameters can be static strings or contain variables.
+
+   This function can be used from ANY_ROUTE.
+
+   Example 1.31. sht_has_name usage
+...
+if(sht_has_str_value("ha", "eq", "alice")) {
+  ...
+}
+...
+
 5. Exported pseudo-variables
 
      * $sht(htable=>key)
index 00f7a6e..6a8492a 100644 (file)
@@ -1029,6 +1029,114 @@ sht_iterator_end("i1");
 </programlisting>
                </example>
        </section>
+       <section id="htable.f.sht_has_name">
+               <title>
+               <function moreinfo="none">sht_has_name(htable, op, mval)</function>
+               </title>
+               <para>
+                       Return greater than 0 (true) if the htable has an item that matches
+                       the name against the mval parameter.
+               </para>
+               <para>
+                       The op parameter can be:
+               </para>
+               <itemizedlist>
+               <listitem>
+               <para>
+                       <emphasis>eq</emphasis> - match the val parameter as string equal
+                       expression.
+               </para>
+               </listitem>
+               <listitem>
+               <para>
+                       <emphasis>ne</emphasis> - match the val parameter as string not-equal
+                       expression.
+               </para>
+               </listitem>
+               <listitem>
+               <para>
+                       <emphasis>re</emphasis> - match the val parameter as regular
+                       expression.
+               </para>
+               </listitem>
+               <listitem>
+               <para>
+                       <emphasis>sw</emphasis> - match the val parameter as 'starts
+                       with' expression.
+               </para>
+               </listitem>
+               </itemizedlist>
+               <para>
+                       All parameters can be static strings or contain variables.
+               </para>
+               <para>
+                       This function can be used from ANY_ROUTE.
+               </para>
+               <example>
+               <title><function>sht_has_name</function> usage</title>
+               <programlisting format="linespecific">
+...
+if(sht_has_name("ha", "eq", "alice")) {
+  ...
+}
+...
+</programlisting>
+               </example>
+       </section>
+       <section id="htable.f.sht_has_str_value">
+               <title>
+               <function moreinfo="none">sht_has_str_value(htable, op, mval)</function>
+               </title>
+               <para>
+                       Return greater than 0 (true) if the htable has an item that matches
+                       the string value against the mval parameter.
+               </para>
+               <para>
+                       The op parameter can be:
+               </para>
+               <itemizedlist>
+               <listitem>
+               <para>
+                       <emphasis>eq</emphasis> - match the val parameter as string equal
+                       expression.
+               </para>
+               </listitem>
+               <listitem>
+               <para>
+                       <emphasis>ne</emphasis> - match the val parameter as string not-equal
+                       expression.
+               </para>
+               </listitem>
+               <listitem>
+               <para>
+                       <emphasis>re</emphasis> - match the val parameter as regular
+                       expression.
+               </para>
+               </listitem>
+               <listitem>
+               <para>
+                       <emphasis>sw</emphasis> - match the val parameter as 'starts
+                       with' expression.
+               </para>
+               </listitem>
+               </itemizedlist>
+               <para>
+                       All parameters can be static strings or contain variables.
+               </para>
+               <para>
+                       This function can be used from ANY_ROUTE.
+               </para>
+               <example>
+               <title><function>sht_has_name</function> usage</title>
+               <programlisting format="linespecific">
+...
+if(sht_has_str_value("ha", "eq", "alice")) {
+  ...
+}
+...
+</programlisting>
+               </example>
+       </section>
        </section>
                <section>
                <title>Exported pseudo-variables</title>
index 9d066eb..d2aeeb3 100644 (file)
@@ -1304,6 +1304,94 @@ int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op)
        return 0;
 }
 
+int ht_has_cell_op_str(str *sre, ht_t *ht, int mode, int op)
+{
+       ht_cell_t *it;
+       str sm;
+       int i;
+       int nomatch;
+       regex_t re;
+       regmatch_t pmatch;
+
+       if(sre==NULL || sre->len<=0 || ht==NULL)
+               return -1;
+
+       if(op == HT_RM_OP_RE) {
+               if (regcomp(&re, sre->s, REG_EXTENDED|REG_ICASE|REG_NEWLINE)) {
+                       LM_ERR("bad re %s\n", sre->s);
+                       return -1;
+               }
+       }
+
+       for(i=0; i<ht->htsize; i++) {
+               /* free entries */
+               ht_slot_lock(ht, i);
+               it = ht->entries[i].first;
+               while(it) {
+                       nomatch = 0;
+                       if(mode==0) {
+                               sm = it->name;
+                       } else {
+                               if(it->flags&AVP_VAL_STR) {
+                                       sm = it->value.s;
+                               } else {
+                                       /* no str value - skip matching */
+                                       nomatch = 1;
+                               }
+                       }
+                       if(nomatch==0) {
+                               switch(op) {
+                                       case HT_RM_OP_EQ:
+                                               if(sre->len==sm.len
+                                                                       && strncmp(sm.s, sre->s, sre->len)==0) {
+                                                       goto matched;
+                                               }
+                                       break;
+                                       case HT_RM_OP_NE:
+                                               if(sre->len!=sm.len
+                                                                       || strncmp(sm.s, sre->s, sre->len)!=0) {
+                                                       goto matched;
+                                               }
+                                       break;
+                                       case HT_RM_OP_SW:
+                                               if(sre->len<=sm.len
+                                                                       && strncmp(sm.s, sre->s, sre->len)==0) {
+                                                       goto matched;
+                                               }
+                                       break;
+                                       case HT_RM_OP_RE:
+                                               if (regexec(&re, sm.s, 1, &pmatch, 0)==0) {
+                                                       goto matched;
+                                               }
+                                       break;
+                                       default:
+                                               goto notmatched;
+                               }
+                       }
+                       it = it->next;
+               }
+               ht_slot_unlock(ht, i);
+       }
+       if(op==HT_RM_OP_RE) {
+               regfree(&re);
+       }
+       return -1;
+
+matched:
+       ht_slot_unlock(ht, i);
+       if(op==HT_RM_OP_RE) {
+               regfree(&re);
+       }
+       return 1;
+
+notmatched:
+       ht_slot_unlock(ht, i);
+       if(op==HT_RM_OP_RE) {
+               regfree(&re);
+       }
+       return -1;
+}
+
 int ht_reset_content(ht_t *ht)
 {
        ht_cell_t *it;
index c9bbd68..2c673c7 100644 (file)
@@ -114,8 +114,12 @@ int ht_count_cells_re(str *sre, ht_t *ht, int mode);
 ht_t *ht_get_root(void);
 int ht_reset_content(ht_t *ht);
 
-#define HT_RM_OP_SW    1
+#define HT_RM_OP_EQ    1
+#define HT_RM_OP_NE    2
+#define HT_RM_OP_SW    3
+#define HT_RM_OP_RE    4
 int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op);
+int ht_has_cell_op_str(str *sre, ht_t *ht, int mode, int op);
 
 void ht_iterator_init(void);
 int ht_iterator_start(str *iname, str *hname);
index fbe016e..214b6e3 100644 (file)
@@ -70,6 +70,8 @@ static int ht_rm_name_re(struct sip_msg* msg, char* key, char* foo);
 static int ht_rm_value_re(struct sip_msg* msg, char* key, char* foo);
 static int w_ht_rm_name(struct sip_msg* msg, char* hname, char* op, char *val);
 static int w_ht_rm_value(struct sip_msg* msg, char* hname, char* op, char *val);
+static int w_ht_has_name(struct sip_msg* msg, char* hname, char* op, char *val);
+static int w_ht_has_str_value(struct sip_msg* msg, char* hname, char* op, char *val);
 static int w_ht_slot_lock(struct sip_msg* msg, char* key, char* foo);
 static int w_ht_slot_unlock(struct sip_msg* msg, char* key, char* foo);
 static int ht_reset(struct sip_msg* msg, char* htname, char* foo);
@@ -114,6 +116,10 @@ static cmd_export_t cmds[]={
                ANY_ROUTE},
        {"sht_rm_value", (cmd_function)w_ht_rm_value,  3, fixup_spve_all, 0,
                ANY_ROUTE},
+       {"sht_has_name",  (cmd_function)w_ht_has_name,   3, fixup_spve_all, 0,
+               ANY_ROUTE},
+       {"sht_has_str_value", (cmd_function)w_ht_has_str_value,  3, fixup_spve_all, 0,
+               ANY_ROUTE},
        {"sht_lock",        (cmd_function)w_ht_slot_lock,    1, fixup_ht_key, 0,
                ANY_ROUTE},
        {"sht_unlock",      (cmd_function)w_ht_slot_unlock,  1, fixup_ht_key, 0,
@@ -354,13 +360,49 @@ static int fixup_ht_key(void** param, int param_no)
        return 0;
 }
 
-static int ht_rm_name_re(struct sip_msg* msg, char* key, char* foo)
+/**
+ *
+ */
+static int ht_rm_re_helper(sip_msg_t *msg, ht_t *ht, str *rexp, int rmode)
+{
+       int_str isval;
+
+       if (ht->dmqreplicate>0) {
+               isval.s = *rexp;
+               if (ht_dmq_replicate_action(HT_DMQ_RM_CELL_RE, &ht->name, NULL,
+                               AVP_VAL_STR, &isval, rmode)!=0) {
+                       LM_ERR("dmq relication failed for [%.*s]\n", ht->name.len, ht->name.s);
+               }
+       }
+       if(ht_rm_cell_re(rexp, ht, rmode)<0)
+               return -1;
+       return 1;
+}
+
+/**
+ *
+ */
+static int ki_ht_rm_name_re(sip_msg_t *msg, str *htname, str *rexp)
+{
+       ht_t *ht;
+
+       ht = ht_get_table(htname);
+       if(ht==NULL) {
+               return 1;
+       }
+
+       return ht_rm_re_helper(msg, ht, rexp, 0);
+}
+
+/**
+ *
+ */
+static int ht_rm_name_re(sip_msg_t* msg, char* key, char* foo)
 {
        ht_pv_t *hpv;
        str sre;
        pv_spec_t *sp;
        sp = (pv_spec_t*)key;
-       int_str isval;
 
        hpv = (ht_pv_t*)sp->pvp.pvn.u.dname;
 
@@ -375,24 +417,33 @@ static int ht_rm_name_re(struct sip_msg* msg, char* key, char* foo)
                LM_ERR("cannot get $sht expression\n");
                return -1;
        }
-       if (hpv->ht->dmqreplicate>0) {
-               isval.s = sre;
-               if (ht_dmq_replicate_action(HT_DMQ_RM_CELL_RE, &hpv->htname, NULL, AVP_VAL_STR, &isval, 0)!=0) {
-                       LM_ERR("dmq relication failed\n");
-               }
+       return ht_rm_re_helper(msg, hpv->ht, &sre, 0);
+}
+
+/**
+ *
+ */
+static int ki_ht_rm_value_re(sip_msg_t *msg, str *htname, str *rexp)
+{
+       ht_t *ht;
+
+       ht = ht_get_table(htname);
+       if(ht==NULL) {
+               return 1;
        }
-       if(ht_rm_cell_re(&sre, hpv->ht, 0)<0)
-               return -1;
-       return 1;
+
+       return ht_rm_re_helper(msg, ht, rexp, 1);
 }
 
-static int ht_rm_value_re(struct sip_msg* msg, char* key, char* foo)
+/**
+ *
+ */
+static int ht_rm_value_re(sip_msg_t* msg, char* key, char* foo)
 {
        ht_pv_t *hpv;
        str sre;
        pv_spec_t *sp;
        sp = (pv_spec_t*)key;
-       int_str isval;
 
        hpv = (ht_pv_t*)sp->pvp.pvn.u.dname;
 
@@ -407,16 +458,7 @@ static int ht_rm_value_re(struct sip_msg* msg, char* key, char* foo)
                LM_ERR("cannot get $sht expression\n");
                return -1;
        }
-
-       if (hpv->ht->dmqreplicate>0) {
-               isval.s = sre;
-               if (ht_dmq_replicate_action(HT_DMQ_RM_CELL_RE, &hpv->htname, NULL, AVP_VAL_STR, &isval, 1)!=0) {
-                       LM_ERR("dmq relication failed\n");
-               }
-       }
-       if(ht_rm_cell_re(&sre, hpv->ht, 1)<0)
-               return -1;
-       return 1;
+       return ht_rm_re_helper(msg, hpv->ht, &sre, 1);
 }
 
 static int ht_rm_items(sip_msg_t* msg, str* hname, str* op, str *val,
@@ -447,6 +489,7 @@ static int ht_rm_items(sip_msg_t* msg, str* hname, str* op, str *val,
                                if(ht_rm_cell_op(val, ht, mkey, HT_RM_OP_SW)<0) {
                                        return -1;
                                }
+                               return 1;
                        }
                        LM_WARN("unsupported match operator: %.*s\n", op->len, op->s);
                        break;
@@ -489,6 +532,97 @@ static int w_ht_rm_value(sip_msg_t* msg, char* hname, char* op, char *val)
        return w_ht_rm_items(msg, hname, op, val, 1);
 }
 
+static int ki_ht_rm_name(sip_msg_t* msg, str* sname, str* sop, str *sval)
+{
+       return ht_rm_items(msg, sname, sop, sval, 0);
+
+}
+
+static int ki_ht_rm_value(sip_msg_t* msg, str* sname, str* sop, str *sval)
+{
+       return ht_rm_items(msg, sname, sop, sval, 1);
+}
+
+static int ht_has_str_items(sip_msg_t* msg, str* hname, str* op, str *val,
+               int mkey)
+{
+       ht_t *ht;
+       int vop;
+
+       ht = ht_get_table(hname);
+       if(ht==NULL) {
+               LM_ERR("cannot get hash table [%.*s]\n", hname->len, hname->s);
+               return -1;
+       }
+
+       switch(op->len) {
+               case 2:
+                       if(strncmp(op->s, "eq", 2)==0) {
+                               vop = HT_RM_OP_EQ;
+                       } else if(strncmp(op->s, "ne", 2)==0) {
+                               vop = HT_RM_OP_NE;
+                       } else if(strncmp(op->s, "re", 2)==0) {
+                               vop = HT_RM_OP_RE;
+                       } else if(strncmp(op->s, "sw", 2)==0) {
+                               vop = HT_RM_OP_SW;
+                       } else {
+                               LM_WARN("unsupported match operator: %.*s\n", op->len, op->s);
+                               return -1;
+                       }
+                       if(ht_has_cell_op_str(val, ht, mkey, vop)<0) {
+                               return -1;
+                       }
+                       return 1;
+               default:
+                       LM_WARN("unsupported match operator: %.*s\n", op->len, op->s);
+                       return -1;
+       }
+}
+
+static int w_ht_has_str_items(sip_msg_t* msg, char* hname, char* op, char *val,
+               int mkey)
+{
+       str sname;
+       str sop;
+       str sval;
+
+       if(fixup_get_svalue(msg, (gparam_t*)hname, &sname)<0 || sname.len<=0) {
+               LM_ERR("cannot get the hash table name\n");
+               return -1;
+       }
+       if(fixup_get_svalue(msg, (gparam_t*)op, &sop)<0 || sop.len<=0) {
+               LM_ERR("cannot get the match operation\n");
+               return -1;
+       }
+       if(fixup_get_svalue(msg, (gparam_t*)val, &sval)<0 || sval.len<=0) {
+               LM_ERR("cannot the get match value\n");
+               return -1;
+       }
+
+       return ht_has_str_items(msg, &sname, &sop, &sval, mkey);
+}
+
+static int w_ht_has_name(sip_msg_t* msg, char* hname, char* op, char *val)
+{
+       return w_ht_has_str_items(msg, hname, op, val, 0);
+}
+
+static int w_ht_has_str_value(sip_msg_t* msg, char* hname, char* op, char *val)
+{
+       return w_ht_has_str_items(msg, hname, op, val, 1);
+}
+
+static int ki_ht_has_name(sip_msg_t* msg, str* sname, str* sop, str *sval)
+{
+       return ht_has_str_items(msg, sname, sop, sval, 0);
+
+}
+
+static int ki_ht_has_str_value(sip_msg_t* msg, str* sname, str* sop, str *sval)
+{
+       return ht_has_str_items(msg, sname, sop, sval, 1);
+}
+
 static int ht_reset_by_name(str *hname)
 {
        ht_t *ht;
@@ -1275,6 +1409,36 @@ static sr_kemi_t sr_kemi_htable_exports[] = {
                { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
                        SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
        },
+       { str_init("htable"), str_init("sht_rm_name_re"),
+               SR_KEMIP_INT, ki_ht_rm_name_re,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { str_init("htable"), str_init("sht_rm_value_re"),
+               SR_KEMIP_INT, ki_ht_rm_value_re,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { str_init("htable"), str_init("sht_rm_name"),
+               SR_KEMIP_INT, ki_ht_rm_name,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { str_init("htable"), str_init("sht_rm_value"),
+               SR_KEMIP_INT, ki_ht_rm_value,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { str_init("htable"), str_init("sht_has_name"),
+               SR_KEMIP_INT, ki_ht_has_name,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { str_init("htable"), str_init("sht_has_str_value"),
+               SR_KEMIP_INT, ki_ht_has_str_value,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
 
        { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
 };
index f93a5e3..a515393 100644 (file)
@@ -59,7 +59,7 @@ static param_t* _tr_uri_params = NULL;
 
 /*! transformation buffer size */
 #define TR_BUFFER_SIZE 65536
-#define TR_BUFFER_SLOTS        4
+#define TR_BUFFER_SLOTS        8
 
 /*! transformation buffer */
 static char **_tr_buffer_list = NULL;
@@ -1156,6 +1156,56 @@ int tr_eval_string(struct sip_msg *msg, tr_param_t *tp, int subtype,
                        val->ri = 0;
                        break;
 
+               case TR_S_UNQUOTE:
+                       if(!(val->flags&PV_VAL_STR)) {
+                               val->rs.s = int2str(val->ri, &val->rs.len);
+                               break;
+                       }
+                       if(val->rs.len<2) {
+                               break;
+                       }
+                       if(val->rs.len>TR_BUFFER_SIZE-2) {
+                               LM_ERR("value too large: %d\n", val->rs.len);
+                               return -1;
+                       }
+                       if((val->rs.s[0] == val->rs.s[val->rs.len-1])
+                                       && (val->rs.s[0] == '"' || val->rs.s[0] == '\'')) {
+                               memcpy(_tr_buffer, val->rs.s+1, val->rs.len-2);
+                               val->rs.len -= 2;
+                       } else {
+                               memcpy(_tr_buffer, val->rs.s, val->rs.len);
+                       }
+                       val->flags = PV_VAL_STR;
+                       val->rs.s = _tr_buffer;
+                       val->rs.s[val->rs.len] = '\0';
+                       break;
+
+               case TR_S_UNBRACKET:
+                       if(!(val->flags&PV_VAL_STR)) {
+                               val->rs.s = int2str(val->ri, &val->rs.len);
+                               break;
+                       }
+                       if(val->rs.len<2) {
+                               break;
+                       }
+                       if(val->rs.len>TR_BUFFER_SIZE-2) {
+                               LM_ERR("value too large: %d\n", val->rs.len);
+                               return -1;
+                       }
+                       if((val->rs.s[0] == '(' && val->rs.s[val->rs.len-1] == ')')
+                                       || (val->rs.s[0] == '[' && val->rs.s[val->rs.len-1] == ']')
+                                       || (val->rs.s[0] == '{' && val->rs.s[val->rs.len-1] == '}')
+                                       || (val->rs.s[0] == '<' && val->rs.s[val->rs.len-1] == '>')) {
+                               memcpy(_tr_buffer, val->rs.s+1, val->rs.len-2);
+                               val->rs.len -= 2;
+                       } else {
+                               memcpy(_tr_buffer, val->rs.s, val->rs.len);
+                       }
+                       val->flags = PV_VAL_STR;
+                       val->rs.s = _tr_buffer;
+                       val->rs.s[val->rs.len] = '\0';
+                       break;
+
                default:
                        LM_ERR("unknown subtype %d (cfg line: %d)\n",
                                        subtype, get_cfg_crt_line());
@@ -2508,6 +2558,12 @@ char* tr_parse_string(str* in, trans_t *t)
        } else if(name.len==15 && strncasecmp(name.s, "urldecode.param", 15)==0) {
                t->subtype = TR_S_URLDECODEPARAM;
                goto done;
+       } else if(name.len==7 && strncasecmp(name.s, "unquote", 7)==0) {
+               t->subtype = TR_S_UNQUOTE;
+               goto done;
+       } else if(name.len==9 && strncasecmp(name.s, "unbracket", 9)==0) {
+               t->subtype = TR_S_UNBRACKET;
+               goto done;
        }
 
        LM_ERR("unknown transformation: %.*s/%.*s/%d!\n", in->len, in->s,
index a4bc075..da2cb87 100644 (file)
@@ -41,7 +41,8 @@ enum _tr_s_subtype {
        TR_S_STRIP, TR_S_STRIPTAIL, TR_S_PREFIXES, TR_S_PREFIXES_QUOT, TR_S_REPLACE,
        TR_S_TIMEFORMAT, TR_S_TRIM, TR_S_RTRIM, TR_S_LTRIM, TR_S_RM, TR_S_STRIPTO,
        TR_S_URLENCODEPARAM, TR_S_URLDECODEPARAM, TR_S_NUMERIC, TR_S_ESCAPECSV,
-       TR_S_ENCODEBASE58, TR_S_DECODEBASE58, TR_S_COREHASH
+       TR_S_ENCODEBASE58, TR_S_DECODEBASE58, TR_S_COREHASH, TR_S_UNQUOTE,
+       TR_S_UNBRACKET
 };
 enum _tr_uri_subtype {
        TR_URI_NONE=0, TR_URI_USER, TR_URI_HOST, TR_URI_PASSWD, TR_URI_PORT,
index f1c00d6..9feab35 100644 (file)
@@ -47,6 +47,7 @@ Bogdan-Andrei Iancu
               4.5. enable_socket_mismatch_warning (integer)
               4.6. custom_user_avp (avp string)
               4.7. force_send_socket (int)
+              4.8. ignore_sips (int)
 
         5. Functions
 
@@ -88,15 +89,16 @@ Bogdan-Andrei Iancu
    1.7. enable_socket_mismatch_warning usage
    1.8. custom_user_avp usage
    1.9. Set force_send_socket parameter
-   1.10. loose_route usage
-   1.11. record_route usage
-   1.12. remove_record_route usage
-   1.13. record_route_preset usage
-   1.14. record_route_advertised_address usage
-   1.15. add_rr_param usage
-   1.16. check_route_param usage
-   1.17. is_direction usage
-   1.18. $route_uri
+   1.10. Set ignore_sips parameter
+   1.11. loose_route usage
+   1.12. record_route usage
+   1.13. remove_record_route usage
+   1.14. record_route_preset usage
+   1.15. record_route_advertised_address usage
+   1.16. add_rr_param usage
+   1.17. check_route_param usage
+   1.18. is_direction usage
+   1.19. $route_uri
    2.1. record_route usage
    2.2. record_route_advertised_address usage
    2.3. Loading RR module's API from another module
@@ -121,6 +123,7 @@ Chapter 1. Admin Guide
         4.5. enable_socket_mismatch_warning (integer)
         4.6. custom_user_avp (avp string)
         4.7. force_send_socket (int)
+        4.8. ignore_sips (int)
 
    5. Functions
 
@@ -215,6 +218,7 @@ UAC                       Kamailio PROXY                          UAS
    4.5. enable_socket_mismatch_warning (integer)
    4.6. custom_user_avp (avp string)
    4.7. force_send_socket (int)
+   4.8. ignore_sips (int)
 
 4.1. enable_full_lr (integer)
 
@@ -343,6 +347,18 @@ record_route();
 modparam("rr", "force_send_socket", 1)
 ...
 
+4.8. ignore_sips (int)
+
+   If set to 1, the Record-Route header are build with 'sip' schema
+   always, ignoring the presence of 'sips' schema in request URI.
+
+   Default value is 0 (use 'sips' if present in R-URI).
+
+   Example 1.10. Set ignore_sips parameter
+...
+modparam("rr", "ignore_sips", 1)
+...
+
 5. Functions
 
    5.1. loose_route()
@@ -395,7 +411,7 @@ modparam("rr", "force_send_socket", 1)
 
    This function can be used from REQUEST_ROUTE.
 
-   Example 1.10. loose_route usage
+   Example 1.11. loose_route usage
 ...
 loose_route();
 ...
@@ -418,7 +434,7 @@ loose_route();
    This function can be used from REQUEST_ROUTE, BRANCH_ROUTE and
    FAILURE_ROUTE.
 
-   Example 1.11. record_route usage
+   Example 1.12. record_route usage
 ...
 record_route();
 ...
@@ -432,7 +448,7 @@ record_route();
 
    This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
 
-   Example 1.12. remove_record_route usage
+   Example 1.13. remove_record_route usage
 ...
 remove_record_route();
 ...
@@ -460,7 +476,7 @@ remove_record_route();
    This function can be used from REQUEST_ROUTE, BRANCH_ROUTE and
    FAILURE_ROUTE.
 
-   Example 1.13. record_route_preset usage
+   Example 1.14. record_route_preset usage
 ...
 record_route_preset("1.2.3.4:5090");
 ...
@@ -487,7 +503,7 @@ record_route_preset("1.2.3.4:5090");
    This function can be used from REQUEST_ROUTE, BRANCH_ROUTE and
    FAILURE_ROUTE.
 
-   Example 1.14. record_route_advertised_address usage
+   Example 1.15. record_route_advertised_address usage
 ...
 record_route_advertised_address("1.2.3.4:5080");
 ...
@@ -506,7 +522,7 @@ record_route_advertised_address("1.2.3.4:5080");
    This function can be used from REQUEST_ROUTE, BRANCH_ROUTE and
    FAILURE_ROUTE.
 
-   Example 1.15. add_rr_param usage
+   Example 1.16. add_rr_param usage
 ...
 add_rr_param(";nat=yes");
 ...
@@ -522,7 +538,7 @@ add_rr_param(";nat=yes");
 
    This function can be used from REQUEST_ROUTE.
 
-   Example 1.16. check_route_param usage
+   Example 1.17. check_route_param usage
 ...
 if (check_route_param("nat=yes")) {
     setflag(6);
@@ -549,7 +565,7 @@ if (check_route_param("nat=yes")) {
 
    This function can be used from REQUEST_ROUTE.
 
-   Example 1.17. is_direction usage
+   Example 1.18. is_direction usage
 ...
 if (is_direction("downstream")) {
     xdbg("in-dialog request from caller to callee (downstream) ($rm)\n");
@@ -566,7 +582,7 @@ if (is_direction("downstream")) {
 
    Returns the URI of the top route-header.
 
-   Example 1.18. $route_uri
+   Example 1.19. $route_uri
 ...
     xdbg("Route-URI is: $route_uri\n");
 ...
index f5fe00e..7dd1868 100644 (file)
@@ -293,6 +293,26 @@ modparam("rr", "force_send_socket", 1)
 </programlisting>
       </example>
     </section>
+    <section id="rr.p.ignore_sips">
+      <title><varname>ignore_sips</varname> (int)</title>
+
+         <para>
+                 If set to 1, the Record-Route header are build with 'sip' schema
+                 always, ignoring the presence of 'sips' schema in request URI.
+         </para>
+
+      <para><emphasis>Default value is 0 (use 'sips' if present in R-URI).</emphasis></para>
+
+      <example>
+        <title>Set <varname>ignore_sips</varname> parameter</title>
+
+        <programlisting format="linespecific">
+...
+modparam("rr", "ignore_sips", 1)
+...
+</programlisting>
+      </example>
+    </section>
   </section>
 
   <section>
index 0d042b2..402e6d5 100644 (file)
@@ -69,6 +69,7 @@
 
 #define RR_PARAM_BUF_SIZE 512 /*!< buffer for RR parameter */
 
+extern int rr_ignore_sips;
 
 /*!
  * \brief RR param buffer 
@@ -378,11 +379,11 @@ int record_route(struct sip_msg* _m, str *params)
        str user = {NULL, 0};
        str* tag;
        int use_ob = rr_obb.use_outbound ? rr_obb.use_outbound(_m) : 0;
-       int sips;
+       int sips = 0;
        int ret = 0;
-       
+
        user.len = 0;
-       
+
        if (add_username) {
                /* check if there is a custom user set */
                if (get_custom_user(_m, &user) < 0) {
@@ -428,7 +429,9 @@ int record_route(struct sip_msg* _m, str *params)
                rr_param_buf.len = 0;
        }
 
-       sips = rr_is_sips(_m);
+       if(rr_ignore_sips==0) {
+               sips = rr_is_sips(_m);
+       }
 
        if (enable_double_rr) {
                l = anchor_lump(_m, _m->headers->name.s - _m->buf,0,HDR_RECORDROUTE_T);
@@ -453,7 +456,7 @@ int record_route(struct sip_msg* _m, str *params)
                        goto error;
                }
        }
-       
+
        l = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, HDR_RECORDROUTE_T);
        l2 = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, 0);
        if (!l || !l2) {
@@ -461,7 +464,7 @@ int record_route(struct sip_msg* _m, str *params)
                ret = -3;
                goto error;
        }
-       
+
        if (build_rr(l, l2, &user, tag, params, INBOUND, sips) < 0) {
                LM_ERR("failed to insert inbound Record-Route\n");
                ret = -4;
@@ -499,10 +502,12 @@ int record_route_preset(struct sip_msg* _m, str* _data)
        int use_ob = rr_obb.use_outbound ? rr_obb.use_outbound(_m) : 0;
        char *rr_prefix;
        int rr_prefix_len;
-       int sips;
+       int sips = 0;
        int ret = 0;
 
-       sips = rr_is_sips(_m);
+       if(rr_ignore_sips==0) {
+               sips = rr_is_sips(_m);
+       }
        if(sips==0) {
                rr_prefix = RR_PREFIX_SIP;
                rr_prefix_len = RR_PREFIX_SIP_LEN;
@@ -756,9 +761,9 @@ int record_route_advertised_address(struct sip_msg* _m, str* _data)
        struct lump* l;
        struct lump* l2;
        int use_ob = rr_obb.use_outbound ? rr_obb.use_outbound(_m) : 0;
-       int sips;
+       int sips = 0;
        int ret = 0;
-       
+
        user.len = 0;
        user.s = 0;
 
@@ -799,7 +804,9 @@ int record_route_advertised_address(struct sip_msg* _m, str* _data)
                tag = 0;
        }
 
-       sips = rr_is_sips(_m);
+       if(rr_ignore_sips==0) {
+               sips = rr_is_sips(_m);
+       }
 
        if (enable_double_rr) {
                l = anchor_lump(_m, _m->headers->name.s - _m->buf,0,HDR_RECORDROUTE_T);
@@ -825,7 +832,7 @@ int record_route_advertised_address(struct sip_msg* _m, str* _data)
                        goto error;
                }
        }
-       
+
        l = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, HDR_RECORDROUTE_T);
        l2 = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, 0);
        if (!l || !l2) {
@@ -833,7 +840,7 @@ int record_route_advertised_address(struct sip_msg* _m, str* _data)
                ret = -6;
                goto error;
        }
-       
+
        if (build_advertised_rr(l, l2, _data, &user, tag, INBOUND, sips) < 0) {
                LM_ERR("failed to insert outbound Record-Route\n");
                ret = -7;
index 36b1c04..a3ef5e8 100644 (file)
@@ -61,6 +61,7 @@ int rr_force_send_socket = 0; /*!< control if socket is forced by rr */
 int enable_socket_mismatch_warning = 1; /*!< enable socket mismatch warning */
 static str custom_user_spec = {NULL, 0};
 pv_spec_t custom_user_avp;
+int rr_ignore_sips = 0; /*!< ignore sips schema when building record-route */
 
 ob_api_t rr_obb;
 
@@ -131,6 +132,7 @@ static param_export_t params[] ={
        {"enable_socket_mismatch_warning",INT_PARAM,&enable_socket_mismatch_warning},
        {"custom_user_avp",     PARAM_STR, &custom_user_spec},
        {"force_send_socket",   PARAM_INT, &rr_force_send_socket},
+       {"ignore_sips",         PARAM_INT, &rr_ignore_sips},
        {0, 0, 0 }
 };
 
index 8e5605c..6815bf4 100644 (file)
@@ -204,6 +204,7 @@ static void tcpops_tcp_closed_run_route(tcp_closed_event_info_t *tev)
        sip_msg_t *fmsg;
 
        rt = tcp_closed_routes[tev->reason];
+       LM_DBG("event reason id: %d rt: %d\n", tev->reason, rt);
        if (rt == -1) return;
 
        if (faked_msg_init() < 0)
@@ -229,11 +230,13 @@ int tcpops_handle_tcp_closed(sr_event_param_t *evp)
                LM_WARN("received bad TCP closed event\n");
                return -1;
        }
+       LM_DBG("received TCP closed event\n");
 
        /* run event route if tcp_closed_event == 1 or if the
         * F_CONN_CLOSE_EV flag is explicitly set */
-       if (tcp_closed_event == 1 || (tev->con->flags & F_CONN_CLOSE_EV))
+       if (tcp_closed_event == 1 || (tev->con->flags & F_CONN_CLOSE_EV)) {
                tcpops_tcp_closed_run_route(tev);
+       }
 
        return 0;
 }
index 24bdf0c..cf2fe52 100644 (file)
@@ -145,8 +145,6 @@ static int mod_init(void)
  */
 static int ki_msg_update_buffer(sip_msg_t *msg, str *obuf)
 {
-       sip_msg_t tmp;
-
        if(obuf==NULL || obuf->s==NULL || obuf->len<=0) {
                LM_ERR("invalid buffer parameter\n");
                return -1;
@@ -156,52 +154,8 @@ static int ki_msg_update_buffer(sip_msg_t *msg, str *obuf)
                LM_ERR("new buffer is too large (%d)\n", obuf->len);
                return -1;
        }
-       /* temporary copy */
-       memcpy(&tmp, msg, sizeof(sip_msg_t));
-
-       /* reset dst uri and path vector to avoid freeing - restored later */
-       if(msg->dst_uri.s != NULL) {
-               msg->dst_uri.s = NULL;
-               msg->dst_uri.len = 0;
-       }
-       if(msg->path_vec.s != NULL) {
-               msg->path_vec.s = NULL;
-               msg->path_vec.len = 0;
-       }
-
-       /* free old msg structure */
-       free_sip_msg(msg);
-       memset(msg, 0, sizeof(sip_msg_t));
-
-       /* restore msg fields */
-       msg->buf = tmp.buf;
-       msg->id = tmp.id;
-       msg->rcv = tmp.rcv;
-       msg->set_global_address = tmp.set_global_address;
-       msg->set_global_port = tmp.set_global_port;
-       msg->flags = tmp.flags;
-       msg->msg_flags = tmp.msg_flags;
-       msg->hash_index = tmp.hash_index;
-       msg->force_send_socket = tmp.force_send_socket;
-       msg->fwd_send_flags = tmp.fwd_send_flags;
-       msg->rpl_send_flags = tmp.rpl_send_flags;
-       msg->dst_uri = tmp.dst_uri;
-       msg->path_vec = tmp.path_vec;
-
-       memcpy(msg->buf, obuf->s, obuf->len);
-       msg->len = obuf->len;
-       msg->buf[msg->len] = '\0';
-
-       /* reparse the message */
-       LM_DBG("SIP message content updated - reparsing\n");
-       if(parse_msg(msg->buf, msg->len, msg) != 0) {
-               LM_ERR("parsing new sip message failed [[%.*s]]\n", msg->len, msg->buf);
-               /* exit config execution - sip_msg_t structure is no longer
-                * valid/safe for config */
-               return 0;
-       }
 
-       return 1;
+       return sip_msg_update_buffer(msg, obuf);
 }
 
 /**
@@ -222,39 +176,12 @@ static int ki_msg_set_buffer(sip_msg_t *msg, str *obuf)
  */
 static int ki_msg_apply_changes(sip_msg_t *msg)
 {
-       int ret;
-       dest_info_t dst;
-       str obuf;
-
        if(msg->first_line.type != SIP_REPLY && get_route_type() != REQUEST_ROUTE) {
                LM_ERR("invalid usage - not in request route or a reply\n");
                return -1;
        }
 
-       init_dest_info(&dst);
-       dst.proto = PROTO_UDP;
-       if(msg->first_line.type == SIP_REPLY) {
-               obuf.s = generate_res_buf_from_sip_res(
-                               msg, (unsigned int *)&obuf.len, BUILD_NO_VIA1_UPDATE);
-       } else {
-               if(msg->msg_flags & FL_RR_ADDED) {
-                       LM_ERR("cannot apply msg changes after adding record-route"
-                                  " header - it breaks conditional 2nd header\n");
-                       return -1;
-               }
-               obuf.s = build_req_buf_from_sip_req(msg, (unsigned int *)&obuf.len,
-                               &dst,
-                               BUILD_NO_PATH | BUILD_NO_LOCAL_VIA | BUILD_NO_VIA1_UPDATE);
-       }
-       if(obuf.s == NULL) {
-               LM_ERR("couldn't update msg buffer content\n");
-               return -1;
-       }
-       ret = ki_msg_update_buffer(msg, &obuf);
-       /* free new buffer - copied in the static buffer from old sip_msg_t */
-       pkg_free(obuf.s);
-
-       return ret;
+       return sip_msg_apply_changes(msg);
 }
 
 /**
index e847b95..7bfa75a 100644 (file)
@@ -36,6 +36,7 @@ struct cfg_group_tls default_tls_cfg = {
        0, /* tls_force_run */
        STR_STATIC_INIT("TLSv1"), /* method */
        STR_NULL, /* server name (sni) */
+       0, /* server name (sni) mode */
        STR_NULL, /* server id */
        0, /* verify_certificate */
        9, /* verify_depth */
@@ -143,6 +144,8 @@ cfg_def_t   tls_cfg_def[] = {
                "TLS method used (TLSv1.2, TLSv1.1, TLSv1, SSLv3, SSLv2, SSLv23)"},
        {"server_name",   CFG_VAR_STR | CFG_READONLY, 0, 0, 0, 0,
                "Server name (SNI)"},
+       {"server_name_mode", CFG_VAR_INT | CFG_READONLY, 0, 1, 0, 0,
+               "Server name (SNI) mode" },
        {"server_id",   CFG_VAR_STR | CFG_READONLY, 0, 0, 0, 0,
                "Server id (match tls profile for outgoing connections)"},
        {"verify_certificate", CFG_VAR_INT | CFG_READONLY, 0, 1, 0, 0,
index b164fc1..b4427dd 100644 (file)
@@ -42,6 +42,7 @@ struct cfg_group_tls {
        int force_run;
        str method;
        str server_name;
+       int server_name_mode;
        str server_id;
        int verify_cert;
        int verify_depth;
index fceba47..3889026 100644 (file)
@@ -146,6 +146,12 @@ static cfg_option_t token_default[] = {
        {0}
 };
 
+static cfg_option_t ksr_tls_token_any[] = {
+       {"any"},
+       {"all"},
+       {0}
+};
+
 
 static cfg_option_t options[] = {
        {"method",              .param = methods, .f = cfg_parse_enum_opt},
@@ -164,6 +170,7 @@ static cfg_option_t options[] = {
        {"ca_list",             .f = cfg_parse_str_opt, .flags = CFG_STR_SHMMEM},
        {"crl",                 .f = cfg_parse_str_opt, .flags = CFG_STR_SHMMEM},
        {"server_name",         .f = cfg_parse_str_opt, .flags = CFG_STR_SHMMEM},
+       {"server_name_mode",    .f = cfg_parse_int_opt},
        {"server_id",           .f = cfg_parse_str_opt, .flags = CFG_STR_SHMMEM},
        {0}
 };
@@ -189,11 +196,12 @@ static void update_opt_variables(void)
        options[13].param = &domain->ca_file;
        options[14].param = &domain->crl_file;
        options[15].param = &domain->server_name;
-       options[16].param = &domain->server_id;
+       options[16].param = &domain->server_name_mode;
+       options[17].param = &domain->server_id;
 }
 
 
-static int parse_hostport(int* type, struct ip_addr* ip, unsigned int* port,
+static int ksr_tls_parse_hostport(int* type, struct ip_addr* ip, unsigned int* port,
                cfg_token_t* token, cfg_parser_t* st)
 {
        int ret;
@@ -217,7 +225,14 @@ static int parse_hostport(int* type, struct ip_addr* ip, unsigned int* port,
                        /* Default domain */
                        return 0;
                } else {
-                       if (parse_ipv4(ip, &t, st) < 0) return -1;
+                       opt = cfg_lookup_token(ksr_tls_token_any, &t.val);
+                       if (opt) {
+                               *type = TLS_DOMAIN_ANY;
+                               /* Default domain */
+                               return 0;
+                       } else {
+                               if (parse_ipv4(ip, &t, st) < 0) return -1;
+                       }
                }
        } else {
                LM_ERR("%s:%d:%d: Syntax error, IP address expected\n",
@@ -299,7 +314,7 @@ static int parse_domain(void* param, cfg_parser_t* st, unsigned int flags)
        }
 
        port = 0;
-       if (parse_hostport(&type, &ip, &port, &t, st) < 0) return -1;
+       if (ksr_tls_parse_hostport(&type, &ip, &port, &t, st) < 0) return -1;
 
        ret = cfg_get_token(&t, st, 0);
        if (ret < 0) return -1;
index 161d0d0..af2f03c 100644 (file)
@@ -1498,6 +1498,7 @@ tls_domain_t* tls_lookup_cfg(tls_domains_cfg_t* cfg, int type,
                struct ip_addr* ip, unsigned short port, str *sname, str *srvid)
 {
        tls_domain_t *p;
+       int dotpos;
 
        if (type & TLS_DOMAIN_DEF) {
                if (type & TLS_DOMAIN_SRV) return cfg->srv_default;
@@ -1521,26 +1522,49 @@ tls_domain_t* tls_lookup_cfg(tls_domains_cfg_t* cfg, int type,
 
                }
                if(sname) {
-                       LM_DBG("comparing addr: [%s:%d]  [%s:%d] -- sni: [%.*s] [%.*s]\n",
+                       LM_DBG("comparing addr: l[%s:%d]  r[%s:%d] -- sni: l[%.*s] r[%.*s] %d"
+                               " -- type: %d\n",
                                ip_addr2a(&p->ip), p->port, ip_addr2a(ip), port,
                                p->server_name.len, ZSW(p->server_name.s),
-                               sname->len, ZSW(sname->s));
+                               sname->len, ZSW(sname->s), p->server_name_mode, p->type);
                }
-               if ((p->port==0 || p->port == port) && ip_addr_cmp(&p->ip, ip)) {
-                       if(sname && sname->len>0) {
-                               if(p->server_name.s && p->server_name.len==sname->len
-                                       && strncasecmp(p->server_name.s, sname->s, sname->len)==0) {
-                                       LM_DBG("socket+server_name based TLS server domain found\n");
-                                       return p;
+               if ((p->type & TLS_DOMAIN_ANY)
+                               || ((p->port==0 || p->port == port)
+                                               && ip_addr_cmp(&p->ip, ip))) {
+                       if(sname && sname->s && sname->len>0
+                                               && p->server_name.s && p->server_name.len>0) {
+                               if (p->server_name_mode!=KSR_TLS_SNM_SUBDOM) {
+                                       /* match sni domain */
+                                       if(p->server_name.len==sname->len
+                                                               && strncasecmp(p->server_name.s, sname->s,
+                                                                       sname->len)==0) {
+                                               LM_DBG("socket+server_name based TLS server domain found\n");
+                                               return p;
+                                       }
+                               }
+                               if ((p->server_name_mode==KSR_TLS_SNM_INCDOM
+                                                       || p->server_name_mode==KSR_TLS_SNM_SUBDOM)
+                                               && (p->server_name.len<sname->len)) {
+                                       dotpos = sname->len - p->server_name.len;
+                                       if(sname->s[dotpos] == '.'
+                                                       && strncasecmp(p->server_name.s,
+                                                                       sname->s + dotpos + 1,
+                                                                       p->server_name.len)==0) {
+                                               LM_DBG("socket+server_name based TLS server sub-domain found\n");
+                                               return p;
+                                       }
                                }
                        } else {
-                               return p;
+                               if (!(p->type & TLS_DOMAIN_ANY)) {
+                                       LM_DBG("socket based TLS server domain found\n");
+                                       return p;
+                               }
                        }
                }
                p = p->next;
        }
 
-            /* No matching domain found, return default */
+       /* No matching domain found, return default */
        if (type & TLS_DOMAIN_SRV) return cfg->srv_default;
        else return cfg->cli_default;
 }
@@ -1564,10 +1588,21 @@ static int domain_exists(tls_domains_cfg_t* cfg, tls_domain_t* d)
                else p = cfg->cli_list;
        }
 
+       if(d->type & TLS_DOMAIN_ANY) {
+               /* any address, it must have server_name for SNI */
+               if(d->server_name.len==0) {
+                       LM_WARN("duplicate definition for a tls profile (same address)"
+                                       " and no server name provided\n");
+                       return 1;
+               }
+       } else {
+               return 0;
+       }
+
        while (p) {
                if ((p->port == d->port) && ip_addr_cmp(&p->ip, &d->ip)) {
-                       if(p->server_name.len==0) {
-                               LM_WARN("another tls domain with same address was defined"
+                       if(d->server_name.len==0 || p->server_name.len==0) {
+                               LM_WARN("duplicate definition for a tls profile (same address)"
                                                " and no server name provided\n");
                                return 1;
                        }
index a0e4d7b..334e2a0 100644 (file)
@@ -84,10 +84,13 @@ enum tls_method {
 enum tls_domain_type {
        TLS_DOMAIN_DEF = (1 << 0), /**< Default domain */
        TLS_DOMAIN_SRV = (1 << 1), /**< Server domain */
-       TLS_DOMAIN_CLI = (1 << 2)  /**< Client domain */
+       TLS_DOMAIN_CLI = (1 << 2), /**< Client domain */
+       TLS_DOMAIN_ANY = (1 << 3)  /**< Any address */
 };
 
-
+#define KSR_TLS_SNM_STRICT 0 /**< Match server_name only */
+#define KSR_TLS_SNM_INCDOM 1 /**< Match server_name and subdomains */
+#define KSR_TLS_SNM_SUBDOM 2 /**< Match subdomains only */
 /**
  * separate configuration per ip:port
  */
@@ -106,6 +109,7 @@ typedef struct tls_domain {
        enum tls_method method;
        str crl_file;
        str server_name;
+       int server_name_mode;
        str server_id;
        struct tls_domain* next;
 } tls_domain_t;
index cf77a8b..ac2281b 100644 (file)
@@ -103,6 +103,7 @@ static tls_domain_t mod_params = {
        TLS_USE_TLSv1,    /* TLS method */
        STR_STATIC_INIT(TLS_CRL_FILE), /* Certificate revocation list */
        {0, 0},           /* Server name (SNI) */
+       0,                /* Server name (SNI) mode */
        {0, 0},           /* Server id */
        0                 /* next */
 };
@@ -126,6 +127,7 @@ tls_domain_t srv_defaults = {
        TLS_USE_TLSv1,    /* TLS method */
        STR_STATIC_INIT(TLS_CRL_FILE), /* Certificate revocation list */
        {0, 0},           /* Server name (SNI) */
+       0,                /* Server name (SNI) mode */
        {0, 0},           /* Server id */
        0                 /* next */
 };
@@ -166,6 +168,7 @@ tls_domain_t cli_defaults = {
        TLS_USE_TLSv1,    /* TLS method */
        {0, 0}, /* Certificate revocation list */
        {0, 0},           /* Server name (SNI) */
+       0,                /* Server name (SNI) mode */
        {0, 0},           /* Server id */
        0                 /* next */
 };
index 76fbed3..9289b67 100644 (file)
@@ -1,5 +1,5 @@
 METADATA_COLUMNS
-id(int) username(str) domain(str) password(str) ha1(str) ha1b(str) email_address(str) rpid(str)
+id(int) username(str) domain(str) password(str) ha1(str) ha1b(str)
 METADATA_KEY
 1 2 
 METADATA_READONLY
@@ -7,4 +7,4 @@ METADATA_READONLY
 METADATA_LOGFLAGS
 0
 METADATA_DEFAULTS
-NIL|''|''|''|''|''|NULL|NULL
+NIL|''|''|''|''|''
index 7c0ea2a..9ca18f2 100644 (file)
@@ -1,2 +1,2 @@
-id/int,ruid/string,username/string,domain/string,contact/string,received/string,path/string,expires/time,q/double,callid/string,cseq/int,last_modified/time,flags/int,cflags/int,user_agent/string,socket/string,methods/int,instance/string,reg_id/int,server_id/int,connection_id/int,keepalive/int,partition/int,
+id/int,ruid/string,username/string,domain/string,contact/string,received/string,path/string,expires/int,q/double,callid/string,cseq/int,last_modified/int,flags/int,cflags/int,user_agent/string,socket/string,methods/int,instance/string,reg_id/int,server_id/int,connection_id/int,keepalive/int,partition/int,
 9
index 912a111..28fb698 100644 (file)
@@ -1,2 +1,2 @@
-id/int,username/string,domain/string,password/string,ha1/string,ha1b/string,email_address/string,rpid/string,
+id/int,username/string,domain/string,password/string,ha1/string,ha1b/string,
 7
index 827d865..85fb92d 100644 (file)
@@ -5,8 +5,6 @@ CREATE TABLE subscriber (
     password VARCHAR(64) DEFAULT '' NOT NULL,
     ha1 VARCHAR(128) DEFAULT '' NOT NULL,
     ha1b VARCHAR(128) DEFAULT '' NOT NULL,
-    email_address VARCHAR(128) DEFAULT NULL,
-    rpid VARCHAR(128) DEFAULT NULL,
     CONSTRAINT subscriber_account_idx UNIQUE (username, domain)
 );
 
index b425ad0..f120ad6 100644 (file)
@@ -1 +1 @@
-id(int,auto) username(string) domain(string) password(string) ha1(string) ha1b(string) email_address(string,null) rpid(string,null) 
+id(int,auto) username(string) domain(string) password(string) ha1(string) ha1b(string) 
index 5cfb8d0..d663c65 100644 (file)
       "type": "string",
       "default": "",
       "null": false
-    },
-    "email_address": {
-      "type": "string",
-      "default": null,
-      "null": true
-    },
-    "rpid": {
-      "type": "string",
-      "default": null,
-      "null": true
     }
   ]
 }
\ No newline at end of file
index ecc56a4..32b2378 100644 (file)
@@ -5,8 +5,6 @@ CREATE TABLE `subscriber` (
     `password` VARCHAR(64) DEFAULT '' NOT NULL,
     `ha1` VARCHAR(128) DEFAULT '' NOT NULL,
     `ha1b` VARCHAR(128) DEFAULT '' NOT NULL,
-    `email_address` VARCHAR(128) DEFAULT NULL,
-    `rpid` VARCHAR(128) DEFAULT NULL,
     CONSTRAINT account_idx UNIQUE (`username`, `domain`)
 );
 
index 51cef59..71d9492 100644 (file)
@@ -5,8 +5,6 @@ CREATE TABLE subscriber (
     password VARCHAR2(64) DEFAULT '',
     ha1 VARCHAR2(128) DEFAULT '',
     ha1b VARCHAR2(128) DEFAULT '',
-    email_address VARCHAR2(128) DEFAULT NULL,
-    rpid VARCHAR2(128) DEFAULT NULL,
     CONSTRAINT subscriber_account_idx  UNIQUE (username, domain)
 );
 
index 55dad4b..a953228 100644 (file)
@@ -5,8 +5,6 @@ CREATE TABLE subscriber (
     password VARCHAR(64) DEFAULT '' NOT NULL,
     ha1 VARCHAR(128) DEFAULT '' NOT NULL,
     ha1b VARCHAR(128) DEFAULT '' NOT NULL,
-    email_address VARCHAR(128) DEFAULT NULL,
-    rpid VARCHAR(128) DEFAULT NULL,
     CONSTRAINT subscriber_account_idx UNIQUE (username, domain)
 );
 
index 8b9fc4c..e1b9666 100644 (file)
@@ -10,8 +10,6 @@
                                <col><field>password</field></col>
                                <col><field>ha1</field></col>
                                <col><field>ha1b</field></col>
-                               <col><field>email_address</field></col>
-                               <col><field>rpid</field></col>
                        </query_cols>
                </cmd>
                <cmd><cmd_name>add</cmd_name>
@@ -23,8 +21,6 @@
                                <col><field>password</field></col>
                                <col><field>ha1</field></col>
                                <col><field>ha1b</field></col>
-                               <col><field>email_address</field></col>
-                               <col><field>rpid</field></col>
                        </query_cols>
                </cmd>
                <cmd><cmd_name>update</cmd_name>
@@ -39,8 +35,6 @@
                                <col><field>password</field></col>
                                <col><field>ha1</field></col>
                                <col><field>ha1b</field></col>
-                               <col><field>email_address</field></col>
-                               <col><field>rpid</field></col>
                        </query_cols>
                </cmd>
                <cmd><cmd_name>delete</cmd_name>
index e163f76..c95fdf2 100644 (file)
@@ -8,6 +8,4 @@
                <column><field>password</field><type>DB1_STR</type></column>
                <column><field>ha1</field><type>DB1_STR</type></column>
                <column><field>ha1b</field><type>DB1_STR</type></column>
-               <column><field>email_address</field><type>DB1_STR</type></column>
-               <column><field>rpid</field><type>DB1_STR</type></column>
        </db_table>
index 2987ec8..81cda70 100644 (file)
@@ -84,8 +84,6 @@
                <column><field>password</field><type>DB1_STR</type></column>
                <column><field>ha1</field><type>DB1_STR</type></column>
                <column><field>ha1b</field><type>DB1_STR</type></column>
-               <column><field>email_address</field><type>DB1_STR</type></column>
-               <column><field>rpid</field><type>DB1_STR</type></column>
        </db_table>
        <!-- Declaration of usr_preferences table-->
        <db_table id="usr_preferences">
                                <col><field>password</field></col>
                                <col><field>ha1</field></col>
                                <col><field>ha1b</field></col>
-                               <col><field>email_address</field></col>
-                               <col><field>rpid</field></col>
                        </query_cols>
                </cmd>
                <cmd><cmd_name>add</cmd_name>
                                <col><field>password</field></col>
                                <col><field>ha1</field></col>
                                <col><field>ha1b</field></col>
-                               <col><field>email_address</field></col>
-                               <col><field>rpid</field></col>
                        </query_cols>
                </cmd>
                <cmd><cmd_name>update</cmd_name>
                                <col><field>password</field></col>
                                <col><field>ha1</field></col>
                                <col><field>ha1b</field></col>
-                               <col><field>email_address</field></col>
-                               <col><field>rpid</field></col>
                        </query_cols>
                </cmd>
                <cmd><cmd_name>delete</cmd_name>