Skip to content
Snippets Groups Projects
  • Richard Mudgett's avatar
    6f15500c
    res_pjsip_authenticator_digest.c: Fix sorcery's immutable contract violation. · 6f15500c
    Richard Mudgett authored
    The inbound authentication object is supposed to be immutable when it is
    stored in sorcery.  However, the immutable property is violated if the
    authentication object does not have a realm set.
    
    The immutable contract violation has a different effect depending upon
    what sorcery back end is used.  If it is the config file back end you
    would get the same object back until res_pjsip is reloaded.  If it is the
    real-time or AstDB back end you would get a new object on each query.  If
    it is cached you would get the same object back until it is refreshed from
    the database.
    
    Once an inbound authentication object has its realm set it may or may not
    get updated again if the default_realm changes.
    
    If the same authentication object is used for inbound and outbound
    authentication then the immutable violation can make it very hard to
    determine why the outbound authentication now fails.  The only diagnostic
    message is a complaint about no realms matching when it had worked
    earlier.  It fails because of the difference in behaviour for an empty
    realm setting between inbound and outbound authentication objects.
    
    * Fixed the sorcery object immutable violation by creating a new object
    and setting the default_realm on it instead.  The new object is a shallow
    copy for speed.
    
    * The auth_store thread storage no longer holds an auth ref.  It
    interferes with the shallow copy and never needed a ref anyway.
    
    ASTERISK-26799 #close
    
    Change-Id: I2328a52f61b78ed5fbba38180b7f183ee7e08956
    6f15500c
    History
    res_pjsip_authenticator_digest.c: Fix sorcery's immutable contract violation.
    Richard Mudgett authored
    The inbound authentication object is supposed to be immutable when it is
    stored in sorcery.  However, the immutable property is violated if the
    authentication object does not have a realm set.
    
    The immutable contract violation has a different effect depending upon
    what sorcery back end is used.  If it is the config file back end you
    would get the same object back until res_pjsip is reloaded.  If it is the
    real-time or AstDB back end you would get a new object on each query.  If
    it is cached you would get the same object back until it is refreshed from
    the database.
    
    Once an inbound authentication object has its realm set it may or may not
    get updated again if the default_realm changes.
    
    If the same authentication object is used for inbound and outbound
    authentication then the immutable violation can make it very hard to
    determine why the outbound authentication now fails.  The only diagnostic
    message is a complaint about no realms matching when it had worked
    earlier.  It fails because of the difference in behaviour for an empty
    realm setting between inbound and outbound authentication objects.
    
    * Fixed the sorcery object immutable violation by creating a new object
    and setting the default_realm on it instead.  The new object is a shallow
    copy for speed.
    
    * The auth_store thread storage no longer holds an auth ref.  It
    interferes with the shallow copy and never needed a ref anyway.
    
    ASTERISK-26799 #close
    
    Change-Id: I2328a52f61b78ed5fbba38180b7f183ee7e08956