More ticket #1032:
- Updated transport state notification callback to return void.
- Updated transport state enum to only contain connected and disconnected, no more bitmask value.
- Added direction field to SIP transport.
- Removed remote hostname hash from transport key.
- Updated cert info dump to return -1 when buffer is insufficient.
- Added new error code PJSIP_TLS_ECERTVERIF.
- Updated get_cert_name() in ssl_sock_symbian.c to use heap buffer instead of stack.
- Minors, e.g: added prefix PJ in cipher types, docs.
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3110 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pj/ssl_sock_symbian.cpp b/pjlib/src/pj/ssl_sock_symbian.cpp
index ab808f6..65916d7 100644
--- a/pjlib/src/pj/ssl_sock_symbian.cpp
+++ b/pjlib/src/pj/ssl_sock_symbian.cpp
@@ -444,13 +444,12 @@
};
-static pj_str_t get_cert_name(pj_pool_t *pool,
+static pj_str_t get_cert_name(char *buf, unsigned buf_len,
const CX500DistinguishedName &name)
{
TInt i;
- char buf[1024];
TUint8 *p;
- TInt l = sizeof(buf);
+ TInt l = buf_len;
p = (TUint8*)buf;
for(i = 0; i < name.Count(); ++i) {
@@ -479,11 +478,10 @@
if (0 >= --l) break;
}
- pj_str_t src, res;
- pj_strset(&src, buf, sizeof(buf) - l);
- pj_strdup(pool, &res, &src);
+ pj_str_t src;
+ pj_strset(&src, buf, buf_len - l);
- return res;
+ return src;
}
/* Get certificate info from CX509Certificate.
@@ -491,10 +489,14 @@
static void get_cert_info(pj_pool_t *pool, pj_ssl_cert_info *ci,
const CX509Certificate *x)
{
+ enum { tmp_buf_len = 512 };
+ char *tmp_buf;
unsigned len;
pj_assert(pool && ci && x);
+ /* Init */
+ tmp_buf = new char[tmp_buf_len];
pj_bzero(ci, sizeof(*ci));
/* Version */
@@ -518,7 +520,9 @@
ptr8.Copy(ptr16);
pj_strset(&ci->subject.cn, (char*)ptr8.Ptr(), ptr8.Length());
}
- ci->subject.info = get_cert_name(pool, x->SubjectName());
+ pj_str_t tmp = get_cert_name(tmp_buf, tmp_buf_len,
+ x->SubjectName());
+ pj_strdup(pool, &ci->subject.info, &tmp);
}
/* Issuer */
@@ -532,7 +536,9 @@
ptr8.Copy(ptr16);
pj_strset(&ci->issuer.cn, (char*)ptr8.Ptr(), ptr8.Length());
}
- ci->issuer.info = get_cert_name(pool, x->IssuerName());
+ pj_str_t tmp = get_cert_name(tmp_buf, tmp_buf_len,
+ x->IssuerName());
+ pj_strdup(pool, &ci->issuer.info, &tmp);
}
/* Validity */
@@ -543,6 +549,9 @@
ci->validity.start.sec = tmp_sec.Int();
valid_period.Finish().SecondsFrom(base_time, tmp_sec);
ci->validity.end.sec = tmp_sec.Int();
+
+ /* Deinit */
+ delete [] tmp_buf;
}