- --- /tmp/removed123.txt 2011-08-03 19:41:27.985825602 +0200
- +++ /tmp/added123.txt 2011-08-03 19:41:28.015840602 +0200
- @@ -1,32 +1,33 @@
- --- a/ssl.c
- - char envname[64];
- - if (verify_get_subject(&subject, cert))
- -#if 0 /* print some debugging info */
- +++ b/ssl.c
- + subject = verify_get_subject(cert);
- + if (!subject)
- + /* enforce character class restrictions in common name */
- + verify_free_subject (subject);
- + tls_clear_error();
- +++ b/ssl_verify_backend.h
- + * The returned string must be freed with \c verify_free_subject()
- + * @return a string containing the subject
- + */
- +char *verify_get_subject (X509 *cert);
- +
- +/*
- + * Free a subjectnumber string as returned by \c verify_get_subject()
- + *
- + * @param subject The subject to be freed.
- +void verify_free_subject (char *subject);
- + * The returned string must be freed with \c verify_free_serial()
- +++ b/ssl_verify_openssl.c
- +char *
- +verify_get_subject (X509 *cert)
- {
- - struct gc_arena gc = gc_new ();
- - msg (M_INFO, "LOCAL OPT[%d]: %s", cert_depth, opt->local_options);
- - msg (M_INFO, "X509[%d]: %s", cert_depth, subject);
- - msg (M_INFO, "SHA1[%d]: %s", cert_depth, format_hex(cert->sha1_hash, SHA_DIGEST_LENGTH, 0, &gc));
- - gc_free (&gc);
- + return X509_NAME_oneline (X509_get_subject_name (cert), NULL, 0);
- }
- -#endif
- - OPENSSL_free (subject);
- - ERR_clear_error ();
- --- a/ssl_verify_backend.h
- - * Memory for subject is allocated in the process, and must be freed.
- - * @param subject Pointer to memory to be allocated for the subject
- - * @return \c 1 on failure, \c 0 on success
- -bool verify_get_subject (char **subject, x509_cert_t *cert);
- - * The returened string must be freed with \c verify_free_serial()
- --- a/ssl_verify_openssl.c
- -int
- -verify_get_subject (char **subject, X509 *cert)
- +void
- +verify_free_subject (char *subject)
- {
- - *subject = X509_NAME_oneline (X509_get_subject_name (cert), NULL, 0);
- - if (!*subject)
- - return 1;
- -
- - return 0;
- + if (subject)
- + OPENSSL_free(subject);
- }
- +