Ignore:
Timestamp:
Feb 25, 2010 11:58:19 AM (14 years ago)
Author:
nanang
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ssl_sock_dump.c

    r3106 r3110  
    2828#define THIS_FILE       "ssl_sock_dump.c" 
    2929 
    30 #define CHECK_BUF_LEN()                                                 \ 
    31     if ((len < 0) || ((p+=len) >= end)) {                               \ 
    32         *(p-1) = '\0';                                                  \ 
    33         return PJ_ETOOSMALL;                                            \ 
    34     } 
     30#define CHECK_BUF_LEN()                                         \ 
     31    if ((len < 0) || (len >= end-p)) {                          \ 
     32        *p = '\0';                                              \ 
     33        return -1;                                              \ 
     34    }                                                           \ 
     35    p += len; 
    3536 
    36 PJ_DEF(pj_status_t) pj_ssl_cert_info_dump(const pj_ssl_cert_info *ci, 
    37                                           const char *prefix, 
    38                                           char *buf, 
    39                                           pj_size_t buf_size) 
     37PJ_DEF(pj_ssize_t) pj_ssl_cert_info_dump(const pj_ssl_cert_info *ci, 
     38                                         const char *indent, 
     39                                         char *buf, 
     40                                         pj_size_t buf_size) 
    4041{ 
    4142    const char *wdays[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; 
     
    5455    /* Version */ 
    5556    len = pj_ansi_snprintf(p, end-p, "%sVersion    : v%d\n",  
    56                            prefix, ci->version); 
     57                           indent, ci->version); 
    5758    CHECK_BUF_LEN(); 
    5859     
    5960    /* Serial number */ 
    60     len = pj_ansi_snprintf(p, end-p, "%sSerial     : ", prefix); 
     61    len = pj_ansi_snprintf(p, end-p, "%sSerial     : ", indent); 
    6162    CHECK_BUF_LEN(); 
    6263 
     
    6970     
    7071    /* Subject */ 
    71     len = pj_ansi_snprintf( p, end-p, "%sSubject    : %.*s\n", prefix, 
     72    len = pj_ansi_snprintf( p, end-p, "%sSubject    : %.*s\n", indent, 
    7273                            ci->subject.cn.slen,  
    7374                            ci->subject.cn.ptr); 
    7475    CHECK_BUF_LEN(); 
    75     len = pj_ansi_snprintf( p, end-p, "%s             %.*s\n", prefix, 
     76    len = pj_ansi_snprintf( p, end-p, "%s             %.*s\n", indent, 
    7677                            ci->subject.info.slen, 
    7778                            ci->subject.info.ptr); 
     
    7980 
    8081    /* Issuer */ 
    81     len = pj_ansi_snprintf( p, end-p, "%sIssuer     : %.*s\n", prefix, 
     82    len = pj_ansi_snprintf( p, end-p, "%sIssuer     : %.*s\n", indent, 
    8283                            ci->issuer.cn.slen, 
    8384                            ci->issuer.cn.ptr); 
    8485    CHECK_BUF_LEN(); 
    85     len = pj_ansi_snprintf( p, end-p, "%s             %.*s\n", prefix, 
     86    len = pj_ansi_snprintf( p, end-p, "%s             %.*s\n", indent, 
    8687                            ci->issuer.info.slen, 
    8788                            ci->issuer.info.ptr); 
     
    9091    /* Validity period */ 
    9192    len = pj_ansi_snprintf( p, end-p, "%sValid from : %s %4d-%02d-%02d " 
    92                             "%02d:%02d:%02d.%03d %s\n", prefix, 
     93                            "%02d:%02d:%02d.%03d %s\n", indent, 
    9394                            wdays[pt1.wday], pt1.year, pt1.mon+1, pt1.day, 
    9495                            pt1.hour, pt1.min, pt1.sec, pt1.msec, 
     
    9798 
    9899    len = pj_ansi_snprintf( p, end-p, "%sValid to   : %s %4d-%02d-%02d " 
    99                             "%02d:%02d:%02d.%03d %s\n", prefix, 
     100                            "%02d:%02d:%02d.%03d %s\n", indent, 
    100101                            wdays[pt2.wday], pt2.year, pt2.mon+1, pt2.day, 
    101102                            pt2.hour, pt2.min, pt2.sec, pt2.msec, 
     
    108109 
    109110        len = pj_ansi_snprintf(p, end-p, "%ssubjectAltName extension\n",  
    110                                prefix); 
     111                               indent); 
    111112        CHECK_BUF_LEN(); 
    112113 
     
    131132            } 
    132133            if (type) { 
    133                 len = pj_ansi_snprintf( p, end-p, "%s      %s : %.*s\n", prefix,  
     134                len = pj_ansi_snprintf( p, end-p, "%s      %s : %.*s\n", indent,  
    134135                                        type,  
    135136                                        ci->subj_alt_name.entry[i].name.slen,  
     
    140141    } 
    141142 
    142     return PJ_SUCCESS; 
     143    return (p-buf); 
    143144} 
    144145 
Note: See TracChangeset for help on using the changeset viewer.