### API removals
+### Breaking API changes
+
+* `git_cert` descendent types now have a proper `parent` member
+
v0.23
------
* Hostkey information taken from libssh2
*/
typedef struct {
+ git_cert parent;
+
/**
- * Type of certificate. Here to share the header with
- * `git_cert`.
+ * A hostkey type from libssh2, either
+ * `GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1`
*/
- git_cert_t cert_type;
- /**
- * A hostkey type from libssh2, either
- * `GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1`
- */
git_cert_ssh_t type;
- /**
- * Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will
- * have the MD5 hash of the hostkey.
- */
+ /**
+ * Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will
+ * have the MD5 hash of the hostkey.
+ */
unsigned char hash_md5[16];
- /**
- * Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will
- * have the SHA-1 hash of the hostkey.
- */
- unsigned char hash_sha1[20];
+ /**
+ * Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will
+ * have the SHA-1 hash of the hostkey.
+ */
+ unsigned char hash_sha1[20];
} git_cert_hostkey;
/**
* X.509 certificate information
*/
typedef struct {
- /**
- * Type of certificate. Here to share the header with
- * `git_cert`.
- */
- git_cert_t cert_type;
+ git_cert parent;
/**
* Pointer to the X.509 certificate data
*/
/* No information is available, can happen with SecureTransport */
if (certinfo->num_of_certs == 0) {
- s->cert_info.cert_type = GIT_CERT_NONE;
- s->cert_info.data = NULL;
- s->cert_info.len = 0;
+ s->cert_info.parent.cert_type = GIT_CERT_NONE;
+ s->cert_info.data = NULL;
+ s->cert_info.len = 0;
return 0;
}
s->cert_info_strings.strings = (char **) strings.contents;
s->cert_info_strings.count = strings.length;
- s->cert_info.cert_type = GIT_CERT_STRARRAY;
- s->cert_info.data = &s->cert_info_strings;
- s->cert_info.len = strings.length;
+ s->cert_info.parent.cert_type = GIT_CERT_STRARRAY;
+ s->cert_info.data = &s->cert_info_strings;
+ s->cert_info.len = strings.length;
- *out = (git_cert *) &s->cert_info;
+ *out = &s->cert_info.parent;
return 0;
}
return -1;
}
- st->cert_info.cert_type = GIT_CERT_X509;
+ st->cert_info.parent.cert_type = GIT_CERT_X509;
st->cert_info.data = encoded_cert;
st->cert_info.len = len;
- *out = (git_cert *)&st->cert_info;
+ *out = &st->cert_info.parent;
+
return 0;
}
return -1;
}
- st->cert_info.cert_type = GIT_CERT_X509;
+ st->cert_info.parent.cert_type = GIT_CERT_X509;
st->cert_info.data = (void *) CFDataGetBytePtr(st->der_data);
st->cert_info.len = CFDataGetLength(st->der_data);
goto done;
if (t->owner->certificate_check_cb != NULL) {
- git_cert_hostkey cert = { 0 }, *cert_ptr;
+ git_cert_hostkey cert = {{ 0 }}, *cert_ptr;
const char *key;
- cert.cert_type = GIT_CERT_HOSTKEY_LIBSSH2;
+ cert.parent.cert_type = GIT_CERT_HOSTKEY_LIBSSH2;
key = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
if (key != NULL) {
}
giterr_clear();
- cert.cert_type = GIT_CERT_X509;
+ cert.parent.cert_type = GIT_CERT_X509;
cert.data = cert_ctx->pbCertEncoded;
cert.len = cert_ctx->cbCertEncoded;
error = t->owner->certificate_check_cb((git_cert *) &cert, valid, t->connection_data.host, t->owner->cred_acquire_payload);