Changeset 1342

Show
Ignore:
Timestamp:
03/29/09 22:00:12 (17 months ago)
Author:
ahu
Message:

sqlite2 and sqlite3 backends used MySQL-style escaping, leading to SQL
errors in some cases. Discovered by Sten Spans.

--This line, and those below, will be ignored--

M modules/gsqlitebackend/gsqlitebackend.cc
M modules/gsqlitebackend/gsqlitebackend.hh
M modules/gsqlite3backend/gsqlite3backend.hh
M modules/gsqlite3backend/gsqlite3backend.cc
M pdns/backends/gsql/gsqlbackend.hh

Location:
trunk/pdns
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/modules/gsqlite3backend/gsqlite3backend.cc

    r942 r1342  
    2020#include "ssqlite3.hh" 
    2121#include "gsqlite3backend.hh" 
    22  
     22#include <boost/algorithm/string.hpp> 
    2323 
    2424// Connects to the database. 
     
    101101}; 
    102102 
     103string gSQLite3Backend::sqlEscape(const string &name) 
     104{ 
     105  return boost::replace_all_copy(name, "'", "''"); 
     106} 
     107 
    103108 
    104109//! Reports the backendloader to the UeberBackend. 
  • trunk/pdns/modules/gsqlite3backend/gsqlite3backend.hh

    r942 r1342  
    1919  //! Constructs the backend, throws an exception if it failed.. 
    2020  gSQLite3Backend( const std::string & mode, const std::string & suffix ); 
    21  
     21  virtual string sqlEscape(const string &name); 
    2222}; 
    2323 
  • trunk/pdns/modules/gsqlitebackend/gsqlitebackend.cc

    r255 r1342  
    2020#include "ssqlite.hh" 
    2121#include "gsqlitebackend.hh" 
    22  
     22#include <boost/algorithm/string.hpp> 
    2323 
    2424// Connects to the database. 
     
    101101}; 
    102102 
     103string gSQLiteBackend::sqlEscape(const string &name) 
     104{ 
     105  return boost::replace_all_copy(name, "'", "''"); 
     106} 
     107 
    103108 
    104109//! Reports the backendloader to the UeberBackend. 
  • trunk/pdns/modules/gsqlitebackend/gsqlitebackend.hh

    r187 r1342  
    1919  //! Constructs the backend, throws an exception if it failed.. 
    2020  gSQLiteBackend( const std::string & mode, const std::string & suffix ); 
    21  
     21  virtual string sqlEscape(const string &name); 
    2222}; 
    2323 
  • trunk/pdns/pdns/backends/gsql/gsqlbackend.hh

    r477 r1342  
    2222  } 
    2323   
    24   string sqlEscape(const string &name); 
     24  virtual string sqlEscape(const string &name); 
    2525  void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1); 
    2626  bool list(const string &target, int domain_id);