]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_authenticator_digest.c: Fix sorcery's immutable contract violation. 90/4990/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:23:15 +0000 (22:23 -0600)
commit7ada4265fd70897ad21888519502a9df984e5efa
tree8c1d506fca1d9daf67b1d0a3ae3aca9a81136613
parentd158cf96c0665c01717d92fdd01c0ce0f8fa98f2
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