- fixes some signedness warnings
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
0.7.1
|
||||
=====
|
||||
22-Jul-2008: - fixes some signedness warnings
|
||||
17-May-2008: - plugin_fix_bogus_via: fixes broken VIA headers on
|
||||
incoming SIP messages (inspired by Ralph Babel, see
|
||||
http://babel.de/art20080317a.html for more info)
|
||||
|
||||
+1
-1
@@ -301,7 +301,7 @@
|
||||
/* type osip_MD5_CTX */
|
||||
#undef osip_MD5_CTX
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* typedef socklen_t available */
|
||||
|
||||
+33
-26
@@ -220,7 +220,7 @@ static int auth_check(osip_proxy_authorization_t *proxy_auth) {
|
||||
|
||||
DEBUGC(DBCLASS_BABBLE,"calculated Response=\"%s\"", Lcl_Response);
|
||||
|
||||
if (strcmp(Lcl_Response, Response)==0) {
|
||||
if (strcmp((char*)Lcl_Response, Response)==0) {
|
||||
DEBUGC(DBCLASS_AUTH,"Authentication succeeded");
|
||||
sts = STS_SUCCESS;
|
||||
} else {
|
||||
@@ -371,20 +371,25 @@ void DigestCalcHA1(
|
||||
HASH HA1;
|
||||
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
if (pszUserName) osip_MD5Update(&Md5Ctx, pszUserName, strlen(pszUserName));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszRealm) osip_MD5Update(&Md5Ctx, pszRealm, strlen(pszRealm));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszPassword) osip_MD5Update(&Md5Ctx, pszPassword, strlen(pszPassword));
|
||||
if (pszUserName) osip_MD5Update(&Md5Ctx, (unsigned char*)pszUserName,
|
||||
strlen(pszUserName));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszRealm) osip_MD5Update(&Md5Ctx, (unsigned char*)pszRealm,
|
||||
strlen(pszRealm));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszPassword) osip_MD5Update(&Md5Ctx, (unsigned char*)pszPassword,
|
||||
strlen(pszPassword));
|
||||
osip_MD5Final(HA1, &Md5Ctx);
|
||||
|
||||
if ((pszAlg!=NULL) && (osip_strcasecmp(pszAlg, "md5-sess") == 0)) {
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, HA1, HASHLEN);
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonce) osip_MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszCNonce) osip_MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszNonce) osip_MD5Update(&Md5Ctx, (unsigned char*)pszNonce,
|
||||
strlen(pszNonce));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszCNonce) osip_MD5Update(&Md5Ctx, (unsigned char*)pszCNonce,
|
||||
strlen(pszCNonce));
|
||||
osip_MD5Final(HA1, &Md5Ctx);
|
||||
};
|
||||
CvtHex(HA1, SessionKey);
|
||||
@@ -410,9 +415,11 @@ void DigestCalcResponse(
|
||||
|
||||
/* calculate H(A2) */
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
if (pszMethod) osip_MD5Update(&Md5Ctx, pszMethod, strlen(pszMethod));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszDigestUri) osip_MD5Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri));
|
||||
if (pszMethod) osip_MD5Update(&Md5Ctx, (unsigned char*)pszMethod,
|
||||
strlen(pszMethod));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszDigestUri) osip_MD5Update(&Md5Ctx, (unsigned char*)pszDigestUri,
|
||||
strlen(pszDigestUri));
|
||||
|
||||
if (pszQop!=NULL) {
|
||||
goto auth_withqop;
|
||||
@@ -425,15 +432,15 @@ void DigestCalcResponse(
|
||||
/* calculate response */
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, HA1, HASHHEXLEN);
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonce) osip_MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszNonce) osip_MD5Update(&Md5Ctx, (unsigned char*)pszNonce, strlen(pszNonce));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
|
||||
goto end;
|
||||
|
||||
auth_withqop:
|
||||
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
osip_MD5Update(&Md5Ctx, HEntity, HASHHEXLEN);
|
||||
osip_MD5Final(HA2, &Md5Ctx);
|
||||
CvtHex(HA2, HA2Hex);
|
||||
@@ -441,15 +448,15 @@ void DigestCalcResponse(
|
||||
/* calculate response */
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, HA1, HASHHEXLEN);
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonce) osip_MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonceCount)osip_MD5Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszCNonce) osip_MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszQop) osip_MD5Update(&Md5Ctx, pszQop, strlen(pszQop));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszNonce) osip_MD5Update(&Md5Ctx, (unsigned char*)pszNonce, strlen(pszNonce));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszNonceCount)osip_MD5Update(&Md5Ctx, (unsigned char*)pszNonceCount, strlen(pszNonceCount));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszCNonce) osip_MD5Update(&Md5Ctx, (unsigned char*)pszCNonce, strlen(pszCNonce));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
if (pszQop) osip_MD5Update(&Md5Ctx, (unsigned char*)pszQop, strlen(pszQop));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)":", 1);
|
||||
|
||||
end:
|
||||
osip_MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN);
|
||||
|
||||
+2
-2
@@ -7,9 +7,9 @@
|
||||
#define _DIGCALC_H_
|
||||
|
||||
#define HASHLEN 16
|
||||
typedef char HASH[HASHLEN];
|
||||
typedef unsigned char HASH[HASHLEN];
|
||||
#define HASHHEXLEN 32
|
||||
typedef char HASHHEX[HASHHEXLEN+1];
|
||||
typedef unsigned char HASHHEX[HASHHEXLEN+1];
|
||||
#define IN
|
||||
#define OUT
|
||||
|
||||
|
||||
+11
-9
@@ -777,8 +777,8 @@ int sip_calculate_branch_id (sip_ticket_t *ticket, char *id) {
|
||||
HASH HA1;
|
||||
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, param->gvalue,
|
||||
strlen(param->gvalue));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)param->gvalue,
|
||||
strlen(param->gvalue));
|
||||
osip_MD5Final(HA1, &Md5Ctx);
|
||||
CvtHex(HA1, hashstring);
|
||||
|
||||
@@ -808,40 +808,42 @@ int sip_calculate_branch_id (sip_ticket_t *ticket, char *id) {
|
||||
/* topmost via */
|
||||
osip_via_to_str(via, &tmp);
|
||||
if (tmp) {
|
||||
osip_MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)tmp, strlen(tmp));
|
||||
osip_free(tmp);
|
||||
}
|
||||
|
||||
/* Tag in To header */
|
||||
osip_to_get_tag(sip_msg->to, ¶m);
|
||||
if (param && param->gvalue) {
|
||||
osip_MD5Update(&Md5Ctx, param->gvalue, strlen(param->gvalue));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)param->gvalue,
|
||||
strlen(param->gvalue));
|
||||
}
|
||||
|
||||
/* Tag in From header */
|
||||
osip_from_get_tag(sip_msg->from, ¶m);
|
||||
if (param && param->gvalue) {
|
||||
osip_MD5Update(&Md5Ctx, param->gvalue, strlen(param->gvalue));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)param->gvalue,
|
||||
strlen(param->gvalue));
|
||||
}
|
||||
|
||||
/* Call-ID */
|
||||
call_id = osip_message_get_call_id(sip_msg);
|
||||
osip_call_id_to_str(call_id, &tmp);
|
||||
if (tmp) {
|
||||
osip_MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)tmp, strlen(tmp));
|
||||
osip_free(tmp);
|
||||
}
|
||||
|
||||
/* CSeq number (but not method) */
|
||||
tmp = osip_cseq_get_number(sip_msg->cseq);
|
||||
if (tmp) {
|
||||
osip_MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)tmp, strlen(tmp));
|
||||
}
|
||||
|
||||
/* Request URI */
|
||||
osip_uri_to_str(sip_msg->req_uri, &tmp);
|
||||
if (tmp) {
|
||||
osip_MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_MD5Update(&Md5Ctx, (unsigned char*)tmp, strlen(tmp));
|
||||
osip_free(tmp);
|
||||
}
|
||||
|
||||
@@ -1151,7 +1153,7 @@ int sip_find_direction(sip_ticket_t *ticket, int *urlidx) {
|
||||
* RETURNS
|
||||
* STS_SUCCESS on success
|
||||
*/
|
||||
int sip_fixup_asterisk(char *buff, int *buflen) {
|
||||
int sip_fixup_asterisk(char *buff, size_t *buflen) {
|
||||
char *alert_info_ptr=NULL;
|
||||
/*
|
||||
* Check for Asterisk UA string
|
||||
|
||||
+2
-2
@@ -206,7 +206,7 @@ int sip_calculate_branch_id (sip_ticket_t *ticket, char *id); /*X*/
|
||||
int sip_find_outbound_proxy(sip_ticket_t *ticket, struct in_addr *addr,
|
||||
int *port); /*X*/
|
||||
int sip_find_direction(sip_ticket_t *ticket, int *urlidx); /*X*/
|
||||
int sip_fixup_asterisk(char *buff, int *buflen); /*X*/
|
||||
int sip_fixup_asterisk(char *buff, size_t *buflen); /*X*/
|
||||
int sip_obscure_callid(sip_ticket_t *ticket); /*X*/
|
||||
|
||||
/* readconf.c */
|
||||
@@ -233,7 +233,7 @@ int security_check_sip(sip_ticket_t *ticket); /*X*/
|
||||
/* auth.c */
|
||||
int authenticate_proxy(osip_message_t *sipmsg); /*X*/
|
||||
int auth_include_authrq(osip_message_t *sipmsg); /*X*/
|
||||
void CvtHex(char *hash, char *hashstring);
|
||||
void CvtHex(unsigned char *hash, unsigned char *hashstring);
|
||||
|
||||
/* fwapi.c */
|
||||
int fwapi_start_rtp(int rtp_direction,
|
||||
|
||||
Reference in New Issue
Block a user