[reSIProcate] Negative nonce value

alt alt at kaluga.ru
Mon Apr 25 12:15:01 CDT 2005


Hi All

 

During testing authentication I have found problem with "nonce" value within
challenge response returned by ServerAuthManager

 

The problem is:

 

We use next code to generate "nonce":

---8<-----------------------------------------------------------------------
----------

Helper::makeProxyChallenge(const SipMessage& request, const Data& realm,
bool useAuth, bool stale)

{

   Auth auth;

   auth.scheme() = "Digest";

   Data timestamp((int)(Timer::getTimeMs()/1000));

   auth.param(p_nonce) = makeNonce(request, timestamp);

   .

---8<-----------------------------------------------------------------------
----------

because of timestamp is too big (in my case) when casted to int I get
negative value.

But later we check is the first char of "nonce" digit.

 

Using next code solves the problem:

  Data timestamp((unsigned int)(Timer::getTimeMs()/1000));

 

 

But it's not only place when we use this construction (cast to int).

 

Must we change the way how we generate "now" nonce (in second) everywhere?

 

Regards,

Alex

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20050425/9e00b9d7/attachment.htm>


More information about the resiprocate-devel mailing list