/[anubis]/anubis/src/tls.c
ViewVC logotype

Diff of /anubis/src/tls.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by gray, Sun Apr 6 20:37:59 2003 UTC revision 1.4 by gray, Sat May 10 09:02:30 2003 UTC
# Line 135  start_ssl_client(int sd_server) Line 135  start_ssl_client(int sd_server)
135          gnutls_mac_set_priority(session, mac_priority);          gnutls_mac_set_priority(session, mac_priority);
136    
137          gnutls_certificate_allocate_credentials(&xcred);          gnutls_certificate_allocate_credentials(&xcred);
138          if (secure.cafile)          if (secure.cafile) {
139                  gnutls_certificate_set_x509_trust_file(xcred,                  rs = gnutls_certificate_set_x509_trust_file(xcred,
140                                                         secure.cafile,                                                              secure.cafile,
141                                                         GNUTLS_X509_FMT_PEM);                                                              GNUTLS_X509_FMT_PEM);
142                    if (rs < 0) {
143                            anubis_error(HARD, _("TLS Error reading `%s': %s"),
144                                         secure.cafile,
145                                         gnutls_strerror(rs));
146                            return 0;
147                    }
148            }
149            
150          gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);          gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
151          atexit(_tls_cleanup_xcred);          atexit(_tls_cleanup_xcred);
152          gnutls_transport_set_ptr(session, sd_server);          gnutls_transport_set_ptr(session, sd_server);
# Line 146  start_ssl_client(int sd_server) Line 154  start_ssl_client(int sd_server)
154          rs = gnutls_handshake(session);          rs = gnutls_handshake(session);
155          if (rs < 0) {          if (rs < 0) {
156                  gnutls_deinit(session);                  gnutls_deinit(session);
157                  anubis_error(HARD, _("TLS/SSL handshake failed!"));                  anubis_error(HARD, _("TLS/SSL handshake failed: %s"),
158                  gnutls_perror(rs);                               gnutls_strerror(rs));
159                  return 0;                  return 0;
160          }          }
161    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26