~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/src/sip/sipaccount.cpp

  • Committer: Package Import Robot
  • Author(s): Jean-Louis Dupond, Jean-Louis Dupond, Ryan Murray
  • Date: 2015-10-07 11:09:44 UTC
  • Revision ID: package-import@ubuntu.com-20151007110944-eveqvkhv4fh8l26z
Tags: 1.4.1-0.2ubuntu2
[ Jean-Louis Dupond ]
* Fix building on new Cmake 

[ Ryan Murray ]
* d/patches/fixed_upstream-gcc5-auth-fix.patch: fix SIP authentication (LP:
  #1497871).
  .
  With gcc 5.x, valgrind indicates that the SIP password is pointing at
  a value on the stack in a different function.  The use of the temporary
  std::string on the stack causes the cred_[i].data assignment to point to
  a stack address, that isn't be valid by the time the password is needed
  to do auth.  This fixes the password pointer to be like the other auth
  strings set in this function, and fixes SIP auth.
  .
  Not forwarded upstream: already refactored in upstream ring code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1453
1453
 
1454
1454
    for (const auto &item : credentials_) {
1455
1455
        map<string, string>::const_iterator val = item.find(CONFIG_ACCOUNT_PASSWORD);
1456
 
        const std::string password = val != item.end() ? val->second : "";
1457
 
        int dataType = (md5HashingEnabled and password.length() == 32)
 
1456
        int dataType = (md5HashingEnabled and val->second.length() == 32)
1458
1457
                       ? PJSIP_CRED_DATA_DIGEST
1459
1458
                       : PJSIP_CRED_DATA_PLAIN_PASSWD;
1460
1459
 
 
1460
        cred_[i].data = pj_str((char*) (val != item.end() ? val->second.c_str() : ""));
 
1461
 
1461
1462
        val = item.find(CONFIG_ACCOUNT_USERNAME);
1462
1463
 
1463
1464
        if (val != item.end())
1464
1465
            cred_[i].username = pj_str((char*) val->second.c_str());
1465
1466
 
1466
 
        cred_[i].data = pj_str((char*) password.c_str());
1467
 
 
1468
1467
        val = item.find(CONFIG_ACCOUNT_REALM);
1469
1468
 
1470
1469
        if (val != item.end())