Skip to content
Snippets Groups Projects
  1. Feb 21, 2017
    • Sean Bright's avatar
      realtime: Centralize some common realtime backend code · 6e6c96d7
      Sean Bright authored
      All of the realtime backends create artificial ast_categorys to pass
      back into the core as query results. These categories have no filename
      or line number information associated with them and the backends differ
      slightly on how they create them. So create a couple helper macros to
      help make things more consistent.
      
      Also updated the call sites to remove redundant error messages about
      memory allocation failure.
      
      Note that res_config_ldap sets the category filename to the 'table name'
      but that is not read by anything in the core, so I've dropped it.
      
      Change-Id: I3a1fd91e0c807dea1ce3b643b0a6fe5be9002897
      6e6c96d7
  2. Feb 16, 2017
    • Sean Bright's avatar
      realtime: Fix LIKE escaping in SQL backends · e93f2a51
      Sean Bright authored
      The realtime framework allows for components to look up values using a
      LIKE clause with similar syntax to SQL's. pbx_realtime uses this
      functionality to search for pattern matching extensions that start with
      an underscore (_).
      
      When passing an underscore to SQL's LIKE clause, it will be interpreted
      as a wildcard matching a single character and therefore needs to be
      escaped. It is (for better or for worse) the responsibility of the
      component that is querying realtime to escape it with a backslash before
      passing it in. Some RDBMs support escape characters by default, but the
      SQL92 standard explicitly says that there are no escape characters
      unless they are specified with an ESCAPE clause, e.g.
      
      	SELECT * FROM table WHERE column LIKE '\_%' ESCAPE '\'
      
      This patch instructs 3 backends - res_config_mysql, res_config_pgsql,
      and res_config_sqlite3 - to use the ESCAPE clause where appropriate.
      
      Looking through documentation and source tarballs, I was able to
      determine that the ESCAPE clause is supported in:
      
      MySQL 5.0.15   (released 2005-10-22 - earliest version available from
                      archives)
      PostgreSQL 7.1 (released 2001-04-13)
      SQLite 3.1.0   (released 2005-01-21)
      
      The versions of the relevant libraries that we depend on to access MySQL
      and PostgreSQL will not work on versions that old, and I've added an
      explicit check in res_config_sqlite3 to only use the ESCAPE clause when
      we have a sufficiently new version of SQLite3.
      
      res_config_odbc already handles the escape characters appropriately, so
      no changes were required there.
      
      ASTERISK-15858 #close
      Reported by: Humberto Figuera
      
      ASTERISK-26057 #close
      Reported by: Stepan
      
      Change-Id: I93117fbb874189ae819f4a31222df7c82cd20efa
      e93f2a51
  3. Oct 27, 2016
    • Corey Farrell's avatar
      Remove ASTERISK_REGISTER_FILE. · a6e5bae3
      Corey Farrell authored
      ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
      all traces of it.
      
      Previously exported symbols removed:
      * __ast_register_file
      * __ast_unregister_file
      * ast_complete_source_filename
      
      This also removes the mtx_prof static variable that was declared when
      MTX_PROFILE was enabled.  This variable was only used in lock.c so it
      is now initialized in that file only.
      
      ASTERISK-26480 #close
      
      Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
      a6e5bae3
  4. Oct 12, 2016
    • George Joseph's avatar
      res_config_mysql: Fix several issues related to recent table changes · 3b3d0688
      George Joseph authored
      Unlike any of the other database drivers, res_config_mysql checks that
      the table definition matches the requirements for every insert and
      update statement.  Since all requirements are forced to 'char', any
      column that isn't a char, like ps_contacts' expiration_time,
      qualify_timeout, etc., will throw a warning.  It's kinda harmless but
      very misleading.  Since no other driver does those checks on insert
      or update, they've been removed from res_config_mysql.  Also, all
      the logic that actually attempted to ALTER the table to fix the issue
      has been removed.  With the move to alembic, the auto-alter
      functionality is not only unnecessary, it's also dangerous.
      
      The other issue is that res_config_mysql calls the mysql_insert_id
      function inside store_mysql.  Presumably the intention was to return
      the number of rows inserted DESPITE A NOTE IN THE CODE THAT THE VALUE
      IS NON_PORTABLE AND MAY CHANGE.  That value is then returned to
      config realtime as the number of rows inserted.  Guess what?  The value
      changed.  It now only returns the number of rows inserted if there's an
      auto increment column on the table, which ps_contacts doesn't have.
      Otherwise it returns 0.  So now, the insert worked but we tell config
      realtime and sorcery that no rows were inserted.  That call to
      mysql_insert_id was removed and we now always return 1 if the insert
      succeeded.  We're only inserting 1 row at a time anyway.  If the insert
      fails, we still return -1.
      
      ASTERISK-26362 #close
      Reported-by: Carlos Chavez
      
      Change-Id: I83ce633efdb477b03c8399946994ee16fefceaf4
      3b3d0688
  5. Feb 02, 2016
  6. May 13, 2015
  7. May 08, 2015
    • Alexandre Fournier's avatar
      res_config_mysql: Fix broken column type checking · 1503d0c1
      Alexandre Fournier authored
      MySQL configuration engine contains a bug in require_mysql(). This
      function is used for column type checking in tables. This bug only
      affects DATETIME, DATE and FLOAT types.
      
      It came from mixing the first condition (switch-case-like
      if/then/else), to check the expected column type, with the second
      condition, to check the actual column type against the expected column
      type. Both conditions must be checked separately in order to avoid the
      execution of the wrong block.
      
      ASTERISK-18252 #comment This patch might fix the issue
      Reported by: Gareth Blades
      
      ASTERISK-25041 #close
      Reported by: Alexandre Fournier
      Tested by: Alexandre Fournier
      
      Change-Id: I0b8bf7e68ab938be8e6525a249260cb648cb0bfa
      1503d0c1
  8. Apr 13, 2015
    • Matt Jordan's avatar
      git migration: Refactor the ASTERISK_FILE_VERSION macro · 4a582616
      Matt Jordan authored
      Git does not support the ability to replace a token with a version
      string during check-in. While it does have support for replacing a
      token on clone, this is somewhat sub-optimal: the token is replaced
      with the object hash, which is not particularly easy for human
      consumption. What's more, in practice, the source file version was often
      not terribly useful. Generally, when triaging bugs, the overall version
      of Asterisk is far more useful than an individual SVN version of a file. As a
      result, this patch removes Asterisk's support for showing source file
      versions.
      
      Specifically, it does the following:
      
      * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and
        remove passing the version in with the macro. Other facilities
        than 'core show file version' make use of the file names, such as
        setting a debug level only on a specific file. As such, the act of
        registering source files with the Asterisk core still has use. The
        macro rename now reflects the new macro purpose.
      
      * main/asterisk:
        - Refactor the file_version structure to reflect that it no longer
          tracks a version field.
        - Remove the "core show file version" CLI command. Without the file
          version, it is no longer useful.
        - Remove the ast_file_version_find function. The file version is no
          longer tracked.
        - Rename ast_register_file_version/ast_unregister_file_version to
          ast_register_file/ast_unregister_file, respectively.
      
      * main/manager: Remove value from the Version key of the ModuleCheck
        Action. The actual key itself has not been removed, as doing so would
        absolutely constitute a backwards incompatible change. However, since
        the file version is no longer tracked, there is no need to attempt to
        include it in the Version key.
      
      * UPGRADE: Add notes for:
        - Modification to the ModuleCheck AMI Action
        - Removal of the "core show file version" CLI command
      
      Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
      4a582616
  9. Jul 25, 2014
  10. Jan 23, 2014
  11. Apr 27, 2013
  12. Mar 12, 2013
  13. Feb 25, 2013
  14. Nov 27, 2012
  15. Jul 31, 2012
  16. Feb 14, 2012
  17. Nov 29, 2011
  18. Jul 14, 2011
  19. May 05, 2011
  20. May 04, 2011
  21. Jan 06, 2011
  22. Dec 24, 2010
  23. Oct 08, 2010
  24. Aug 27, 2010
  25. Jul 20, 2010
  26. Jul 17, 2010
  27. Dec 08, 2009
  28. Dec 04, 2009
  29. Aug 20, 2009
  30. Aug 18, 2009
  31. Aug 10, 2009
  32. Jul 06, 2009
  33. Jun 30, 2009
Loading