Changeset 78b8401 for lib/ssl_gnutls.c


Ignore:
Timestamp:
2011-12-19T17:22:37Z (12 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
af5764e
Parents:
486ddb5
Message:

Move conversion of status codes to status messages into SSL libs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/ssl_gnutls.c

    r486ddb5 r78b8401  
    193193
    194194        return verifyret;
     195}
     196
     197char *ssl_verify_strerror( int code )
     198{
     199        GString *ret = g_string_new( "" );
     200       
     201        if( code & VERIFY_CERT_REVOKED )
     202                g_string_append( ret, "certificate has been revoked, " );
     203        if( code & VERIFY_CERT_SIGNER_NOT_FOUND )
     204                g_string_append( ret, "certificate hasn't got a known issuer, " );
     205        if( code & VERIFY_CERT_SIGNER_NOT_CA )
     206                g_string_append( ret, "certificate's issuer is not a CA, " );
     207        if( code & VERIFY_CERT_INSECURE_ALGORITHM )
     208                g_string_append( ret, "certificate uses an insecure algorithm, " );
     209        if( code & VERIFY_CERT_NOT_ACTIVATED )
     210                g_string_append( ret, "certificate has not been activated, " );
     211        if( code & VERIFY_CERT_EXPIRED )
     212                g_string_append( ret, "certificate has expired, " );
     213        if( code & VERIFY_CERT_WRONG_HOSTNAME )
     214                g_string_append( ret, "certificate hostname mismatch, " );
     215       
     216        if( ret->len == 0 )
     217        {
     218                g_string_free( ret, TRUE );
     219                return NULL;
     220        }
     221        else
     222        {
     223                g_string_truncate( ret, ret->len - 2 );
     224                return g_string_free( ret, FALSE );
     225        }
    195226}
    196227
Note: See TracChangeset for help on using the changeset viewer.