<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    To conclude this thread, the discussion was restarted on sr-dev
    mailing list and a reworked patch is now in master branch.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 09/12/13 13:23, jay binks wrote:<br>
    </div>
    <blockquote
cite="mid:CAO47HpekwBO6StF0-ScMNnqVw6Df6ygtK5U7ovzFEp4KgotW6w@mail.gmail.com"
      type="cite">
      <div dir="ltr">Ok so... yea I should have waited another 10 min
        before posting to the list..
        <div><br>
        </div>
        <div>I did the patch...  it works for me.</div>
        <div>if someone familiar with db_cassandra can clean this up and
          commit it, I would be quite grateful.</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div># git diff dbcassa_base.cpp </div>
          <div>diff --git a/modules/db_cassandra/dbcassa_base.cpp
            b/modules/db_cassandra/dbcassa_base.cpp</div>
          <div>index e9d3a32..155221d 100644</div>
          <div>
            --- a/modules/db_cassandra/dbcassa_base.cpp</div>
          <div>+++ b/modules/db_cassandra/dbcassa_base.cpp</div>
          <div>@@ -439,6 +439,7 @@ ColumnVecPtr
            cassa_translate_query(const db1_con_t* _h, const db_key_t*
            _k,</div>
          <div>        int key_len=0, seckey_len = 0;</div>
          <div>        int no_kc, no_sec_kc;</div>
          <div>        dbcassa_table_p tbc;</div>
          <div>+       char pk[255];</div>
          <div> </div>
          <div>        /** Lock table schema and construct primary and
            secondary key **/</div>
          <div>        if(_k) {</div>
          <div>@@ -495,8 +496,12 @@ ColumnVecPtr
            cassa_translate_query(const db1_con_t* _h, const db_key_t*
            _k,</div>
          <div>                } else { /* the table doesn't have any
            secondary key defined */</div>
          <div>                        if(_c) {</div>
          <div>                                for(int i=0; i< _nc;
            i++) {</div>
          <div>-                                      
            sp.column_names.push_back(_c[i]->s);</div>
          <div>-                                       LM_DBG("Query
            col: %s\n", _c[i]->s);</div>
          <div>+                                       sprintf(pk,
            "%.*s", _c[i]->len, _c[i]->s );</div>
          <div>+                                      
            sp.column_names.push_back( pk);</div>
          <div>+                                      
            //sp.column_names.push_back(_c[i]->s);</div>
          <div>+                                       LM_DBG("Query
            col: %s\n", pk );</div>
          <div>+                                       //LM_DBG("Query
            col: %s\n", _c[i]->s);</div>
          <div>+                                       LM_DBG("JAY Query
            col: %.*s\n", _c[i]->len, _c[i]->s);</div>
          <div>                                }</div>
          <div>                                LM_DBG("get %d
            columns\n", _nc);</div>
          <div>                                sp.__isset.column_names =
            true; // set</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>yea I know I left crap in there, but it give syou an
          idea... also...</div>
        <div>yea pk is a crap name... copy paste... and I havnt given
          any thought to the size 255 ,  but thats probably fairly safe
          and anything smaller might not be so safe.</div>
        <div>( unless there is a limit elsewhere I should observe )</div>
        <div><br>
        </div>
        <div>Jay</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On 9 December 2013 22:14, jay binks <span
            dir="ltr"><<a moz-do-not-send="true"
              href="mailto:jaybinks@gmail.com" target="_blank">jaybinks@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Ok my latest makes me think this is an issue
              in db_cassandra.
              <div><br>
              </div>
              <div>when I add the following debug line it displays as
                expected.</div>
              <div><br>
              </div>
              <div>
                <div> 496       if(_c) {</div>
                <div> 497         for(int i=0; i< _nc; i++) {</div>
                <div> 498          
                  sp.column_names.push_back(_c[i]->s);</div>
                <div> 499           LM_DBG("Query col: %s\n",
                  _c[i]->s);</div>
                <div> 500           LM_DBG("JAY Query col: %.*s\n",
                  _c[i]->len, _c[i]->s);</div>
                <div> 501         }</div>
                <div> 502         LM_DBG("get %d columns\n", _nc);</div>
                <div> 503         sp.__isset.column_names = true; // set</div>
              </div>
              <div><br>
              </div>
              <div>so _c[i]->s is just going to the end of the
                string, instead of respecting _c[i]->len </div>
              <div><br>
              </div>
              <div><br>
              </div>
              While I COULD work out a fix for this using sprintf or
              similar,  it would probably not be in keeping with kamaiio
              convention.<br>
              ( since im not experienced with kamailio code )<br>
              Also, im not sure what other places I would miss.<br>
              <br>
              can someone more experienced with kamailio take a look and
              propose a patch for me to test.
              <div><br>
              </div>
              <div><br>
              </div>
              <div>Thanks</div>
              <div><br>
              </div>
              <div>Jay</div>
              <div><br>
              </div>
              <div><br>
              </div>
            </div>
            <div class="gmail_extra">
              <div>
                <div class="h5">
                  <br>
                  <br>
                  <div class="gmail_quote">On 9 December 2013 21:34, jay
                    binks <span dir="ltr"><<a moz-do-not-send="true"
                        href="mailto:jaybinks@gmail.com" target="_blank">jaybinks@gmail.com</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div dir="ltr">
                        <div>kamailio -v</div>
                        <div>version: kamailio 4.2.0</div>
                        <div><br>
                        </div>
                        <div>im still digging, but my current hunch is
                          that my prior diagnosis may be wrong, and this
                          might be in db_cassandra ...</div>
                        <div>still digging, but I will update the list
                          with my findings if they are of interest.</div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                      </div>
                      <div class="gmail_extra">
                        <div>
                          <div><br>
                            <br>
                            <div class="gmail_quote">On 9 December 2013
                              21:26, Daniel-Constantin Mierla <span
                                dir="ltr"><<a moz-do-not-send="true"
                                  href="mailto:miconda@gmail.com"
                                  target="_blank">miconda@gmail.com</a>></span>
                              wrote:<br>
                              <blockquote class="gmail_quote"
                                style="margin:0 0 0 .8ex;border-left:1px
                                #ccc solid;padding-left:1ex">
                                <div bgcolor="#FFFFFF" text="#000000">
                                  What version are you using?<br>
                                  <br>
                                  Daniel
                                  <div>
                                    <div><br>
                                      <br>
                                      <div>On 09/12/13 12:17, jay binks
                                        wrote:<br>
                                      </div>
                                    </div>
                                  </div>
                                  <blockquote type="cite">
                                    <div>
                                      <div>
                                        <div dir="ltr"><br clear="all">
                                          <div>So when Im trying to
                                            use is_subscriber & <span
style="text-align:justify;font-size:12px;font-family:Helvetica,Arial">load_credentials

                                              together, It seems I have
                                              either hit a bug or just a
                                              bad config ( but I dont
                                              think its the latter )</span></div>
                                          <div><span
                                              style="text-align:justify;font-size:12px;font-family:Helvetica,Arial"><br>
                                            </span></div>
                                          <div><span
                                              style="text-align:justify;font-size:12px;font-family:Helvetica,Arial">My

                                              symptom is that only the
                                              field on the far right of
                                              "load_credentials" ever
                                              returns the correct value,
                                              the other fields are
                                              always null.</span></div>
                                          <div><span
                                              style="text-align:justify;font-size:12px;font-family:Helvetica,Arial"><br>
                                            </span></div>
                                          <div><span
style="text-align:justify;font-size:12.222222328186035px;font-family:Helvetica,Arial">My

                                              config has this setting :</span><br>
                                          </div>
                                          <div
                                            style="text-align:justify"><font
                                              face="Helvetica, Arial"
                                              color="#000000"><span
                                                style="font-size:12.222222328186035px"> modparam("auth_db",

                                                "load_credentials",
                                                "field1;field2")</span></font></div>
                                          <div
                                            style="text-align:justify"><font
                                              face="Helvetica, Arial"
                                              color="#000000"><span
                                                style="font-size:12.222222328186035px"><br>
                                              </span></font></div>
                                          <div
                                            style="text-align:justify"><font
                                              face="Helvetica, Arial"
                                              color="#000000"><span
                                                style="font-size:12.222222328186035px">and
                                                I can see the following
                                                debug when
                                                running kamailio -ddddd</span></font></div>
                                          <div><br>
                                          </div>
                                          <div>
                                            <div> 0(14174) DEBUG:
                                              auth_db
                                              [authdb_mod.c:291]:
                                              w_is_subscriber(): uri
                                              [sip: <a
                                                moz-do-not-send="true"
                                                href="mailto:1112@192.168.173.5"
                                                target="_blank">1112@192.168.173.5</a>]
                                              table [subscriber] flags
                                              [1]</div>
                                            <div> 0(14174) DEBUG:
                                              db_cassandra
                                              [dbcassa_base.cpp:807]:
                                              db_cassa_query(): query
                                              table=subscriber</div>
                                            <div> 0(14174) DEBUG:
                                              db_cassandra
                                              [dbcassa_table.c:461]:
                                              dbcassa_db_get_table():
                                              found dbname=kamailio,
                                              table=subscriber</div>
                                            <div> 0(14174) DEBUG:
                                              db_cassandra
                                              [dbcassa_base.cpp:351]:
                                              cassa_constr_key(): query
                                              col = username</div>
                                            <div> 0(14174) DEBUG:
                                              db_cassandra
                                              [dbcassa_base.cpp:351]:
                                              cassa_constr_key(): query
                                              col = domain</div>
                                            <div> 0(14174) DEBUG:
                                              db_cassandra
                                              [dbcassa_base.cpp:376]:
                                              cassa_constr_key(): key =
                                              1112 192.168.173.5</div>
                                            <div> 0(14174) DEBUG:
                                              db_cassandra
                                              [dbcassa_base.cpp:499]:
                                              cassa_translate_query():
                                              Query col: <span
style="text-align:justify;font-size:12.222222328186035px;font-family:Helvetica,Arial">field2</span></div>
                                            <div> 0(14174) DEBUG:
                                              db_cassandra
                                              [dbcassa_base.cpp:499]:
                                              cassa_translate_query():
                                              Query col: <span
style="text-align:justify;font-size:12.222222328186035px;font-family:Helvetica,Arial">field1</span>;<span
style="text-align:justify;font-size:12.222222328186035px;font-family:Helvetica,Arial"> field2</span></div>
                                            <div> 0(14174) DEBUG:
                                              db_cassandra
                                              [dbcassa_base.cpp:501]:
                                              cassa_translate_query():
                                              get 2 columns</div>
                                            <div> 0(14174) DEBUG:
                                              <core>
                                              [db_res.c:118]:
                                              db_new_result(): allocate
                                              56 bytes for result set at
                                              0x7fc6ce770e78</div>
                                          </div>
                                          <div><br>
                                          </div>
                                          <div>if I had to put money on
                                            where the bug is, I would
                                            look in <span
                                              style="white-space:pre-wrap">parse_aaa_pvs

                                              in </span><font
                                              color="#000000"><span
                                                style="white-space:pre-wrap">authdb_mod.c
                                              </span></font></div>
                                          <div><font color="#000000"><span
style="white-space:pre-wrap">however, an initial glance revealed nothing
                                                glaring, also this file
                                                was last changed in </span></font><i
style="font-size:13px;background-color:rgb(246,246,240);font-family:sans-serif">2013-01-20

                                              ( and that was only a move
                                              from modules_k )</i></div>
                                          <div><br>
                                          </div>
                                          <div>SURELY I cant be the only
                                            person wanting to use this
                                            for more than one field ?</div>
                                          <div>This code looks like its
                                            almost the same as when
                                            first committed in August
                                            2011 ....</div>
                                          <div><br>
                                          </div>
                                          <div>Id love someone to see if
                                            they can confirm this and
                                            point me in the right
                                            direction ( if this is my
                                            fault ) or lets get this
                                            fixed, if its a bug :)</div>
                                          <div><br>
                                          </div>
                                          <div>--  </div>
                                          Sincerely<br>
                                          <br>
                                          Jay </div>
                                        <br>
                                        <fieldset></fieldset>
                                        <br>
                                      </div>
                                    </div>
                                    <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span><font color="#888888">
</font></span></pre>
                                    <span><font color="#888888"> </font></span></blockquote>
                                  <span><font color="#888888"> <br>
                                      <pre cols="72">-- 
Daniel-Constantin Mierla - <a moz-do-not-send="true" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a moz-do-not-send="true" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
                                    </font></span></div>
                                <br>
_______________________________________________<br>
                                SIP Express Router (SER) and Kamailio
                                (OpenSER) - sr-users mailing list<br>
                                <a moz-do-not-send="true"
                                  href="mailto:sr-users@lists.sip-router.org"
                                  target="_blank">sr-users@lists.sip-router.org</a><br>
                                <a moz-do-not-send="true"
                                  href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                                  target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                <br>
                              </blockquote>
                            </div>
                            <br>
                            <br clear="all">
                            <div><br>
                            </div>
                            -- <br>
                          </div>
                        </div>
                        Sincerely<span><font color="#888888"><br>
                            <br>
                            Jay
                          </font></span></div>
                    </blockquote>
                  </div>
                  <br>
                  <br clear="all">
                  <div><br>
                  </div>
                </div>
              </div>
              <span class="HOEnZb"><font color="#888888">-- <br>
                  Sincerely<br>
                  <br>
                  Jay
                </font></span></div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        Sincerely<br>
        <br>
        Jay
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
  </body>
</html>