HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
206 HP-UX C SIP Stack Programmer’s Guide
Server Authentication Implementation
/*----------------------------------------------------------------------------------
g_strSrvAuthNonce and g_strSrvAuthRealm are global parameters, holding the
application's nonce and realm values.
-----------------------------------------------------------------------------------*/
if(strcmp(strNonce, g_strSrvAuthNonce)!=0)
{
printf("incorrect nonce %s. call %x, continue with loop\n", strNonce, hCallLeg);
toSkip = RV_TRUE;
}
if(strcmp(strRealm, g_strSrvAuthRealm)!=0)
{
printf("unknown realm %s. call %x, continue with loop\n", strRealm, hCallLeg);
toSkip = RV_TRUE;
}
/*-----------------------------------------------------------------------------------
Searches the application's users database to find if this user exists. If the user
exists, takes the password.
---------------------------------------------------------------------------------*/
else if(GetUserFromSrvAuthDB(strName, strPW) != RV_OK)
{
printf("unknown username %s. call %x, continue with loop", strName, hCallLeg);
toSkip = RV_TRUE;
}
}
/*---------------------------------------------------------------------------------------
Proceeds with the loop using the “toSkip” decision that was made.
-------------------------------------------------------------------------------------*/
if(toSkip == RV_FALSE) /*Finds the correct user and password*/
{
rv = RvSipCallLegAuthProceed(
hCallLeg,
hTransc,
RVSIP_TRANSC_AUTH_ACTION_USE_PASSWORD,
hAuthorization,
strPW);
}
else
{
rv = RvSipCallLegAuthProceed(