]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_authenticator_digest.c: Fix sorcery's immutable contract violation. 87/4987/3
authorRichard Mudgett <rmudgett@digium.com>
Mon, 9 Jan 2017 02:32:17 +0000 (20:32 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 21 Feb 2017 04:20:54 +0000 (22:20 -0600)
commit3b606093d337bfeff31c7b2c6387f96d322e516a
treecbe0fb781710b94f0515941d6da13e93c219c737
parent6208962b000ad2660b592d91023e64759819faed
res_pjsip_authenticator_digest.c: Fix sorcery's immutable contract violation.

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
res/res_pjsip_authenticator_digest.c