[sr-dev] Fwd: [SR-Users] bug in authdb_mod ??

jay binks jaybinks at gmail.com
Thu Feb 6 05:30:03 CET 2014

So I posted this to the user list in December, and got nowhere..

Can someone familiar with db_cassandra review my patch ( possibly clean
this up and commit it )

# git diff dbcassa_base.cpp
diff --git a/modules/db_cassandra/dbcassa_base.cpp
index e9d3a32..155221d 100644
--- a/modules/db_cassandra/dbcassa_base.cpp
+++ b/modules/db_cassandra/dbcassa_base.cpp
@@ -439,6 +439,7 @@ ColumnVecPtr cassa_translate_query(const db1_con_t* _h,
const db_key_t* _k,
        int key_len=0, seckey_len = 0;
        int no_kc, no_sec_kc;
        dbcassa_table_p tbc;
+       char pk[255];

        /** Lock table schema and construct primary and secondary key **/
        if(_k) {
@@ -495,8 +496,12 @@ ColumnVecPtr cassa_translate_query(const db1_con_t*
_h, const db_key_t* _k,
                } else { /* the table doesn't have any secondary key
defined */
                        if(_c) {
                                for(int i=0; i< _nc; i++) {
-                                       sp.column_names.push_back(_c[i]->s);
-                                       LM_DBG("Query col: %s\n", _c[i]->s);
+                                       sprintf(pk, "%.*s", _c[i]->len,
_c[i]->s );
+                                       sp.column_names.push_back( pk);
+                                       LM_DBG("Query col: %s\n", pk );
+                                       //LM_DBG("Query col: %s\n",
 +                                       LM_DBG("JAY Query col: %.*s\n",
_c[i]->len, _c[i]->s);
                                LM_DBG("get %d columns\n", _nc);
                                sp.__isset.column_names = true; // set

yea I know I left crap in there, but it gives you an idea... also...
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.
( unless there is a limit elsewhere I should observe )

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20140206/146a133d/attachment.html>

More information about the sr-dev mailing list