use HX509_UNSUPPORTED_OPERATION and some more documentation.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22330 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -164,6 +164,20 @@ hx509_certs_init(hx509_context context,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the certificate store to stable storage.
|
||||||
|
*
|
||||||
|
* @param context A hx509 context.
|
||||||
|
* @param certs a certificate store to store.
|
||||||
|
* @param flags
|
||||||
|
* @param lock
|
||||||
|
*
|
||||||
|
* @return HX509_UNSUPPORTED_OPERATION if the certificate store
|
||||||
|
* doesn't support the store operation.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_certs_store(hx509_context context,
|
hx509_certs_store(hx509_context context,
|
||||||
hx509_certs certs,
|
hx509_certs certs,
|
||||||
@@ -171,11 +185,11 @@ hx509_certs_store(hx509_context context,
|
|||||||
hx509_lock lock)
|
hx509_lock lock)
|
||||||
{
|
{
|
||||||
if (certs->ops->store == NULL) {
|
if (certs->ops->store == NULL) {
|
||||||
hx509_set_error_string(context, 0, EINVAL,
|
hx509_set_error_string(context, 0, HX509_UNSUPPORTED_OPERATION,
|
||||||
"keystore if type %s doesn't support "
|
"keystore if type %s doesn't support "
|
||||||
"store operation",
|
"store operation",
|
||||||
certs->ops->name);
|
certs->ops->name);
|
||||||
return EINVAL;
|
return HX509_UNSUPPORTED_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*certs->ops->store)(context, certs, certs->ops_data, flags, lock);
|
return (*certs->ops->store)(context, certs, certs->ops_data, flags, lock);
|
||||||
@@ -195,6 +209,14 @@ _hx509_certs_ref(hx509_certs certs)
|
|||||||
return certs;
|
return certs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free a certificate store.
|
||||||
|
*
|
||||||
|
* @param certs certificate store to free.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
hx509_certs_free(hx509_certs *certs)
|
hx509_certs_free(hx509_certs *certs)
|
||||||
{
|
{
|
||||||
@@ -210,6 +232,20 @@ hx509_certs_free(hx509_certs *certs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the integration
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param certs certificate store to iterate over
|
||||||
|
* @param cursor cursor that will keep trac of progress.
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code. HX509_UNSUPPORTED_OPERATION is
|
||||||
|
* returned f the certifcate store doesn't support the interation
|
||||||
|
* function.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_certs_start_seq(hx509_context context,
|
hx509_certs_start_seq(hx509_context context,
|
||||||
hx509_certs certs,
|
hx509_certs certs,
|
||||||
@@ -218,10 +254,10 @@ hx509_certs_start_seq(hx509_context context,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (certs->ops->iter_start == NULL) {
|
if (certs->ops->iter_start == NULL) {
|
||||||
hx509_set_error_string(context, 0, ENOENT,
|
hx509_set_error_string(context, 0, HX509_UNSUPPORTED_OPERATION,
|
||||||
"Keyset type %s doesn't support iteration",
|
"Keyset type %s doesn't support iteration",
|
||||||
certs->ops->name);
|
certs->ops->name);
|
||||||
return ENOENT;
|
return HX509_UNSUPPORTED_OPERATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = (*certs->ops->iter_start)(context, certs, certs->ops_data, cursor);
|
ret = (*certs->ops->iter_start)(context, certs, certs->ops_data, cursor);
|
||||||
@@ -231,6 +267,19 @@ hx509_certs_start_seq(hx509_context context,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param certs
|
||||||
|
* @param cursor
|
||||||
|
* @param cert
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_certs_next_cert(hx509_context context,
|
hx509_certs_next_cert(hx509_context context,
|
||||||
hx509_certs certs,
|
hx509_certs certs,
|
||||||
@@ -241,6 +290,18 @@ hx509_certs_next_cert(hx509_context context,
|
|||||||
return (*certs->ops->iter)(context, certs, certs->ops_data, cursor, cert);
|
return (*certs->ops->iter)(context, certs, certs->ops_data, cursor, cert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param certs
|
||||||
|
* @param cursor
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_certs_end_seq(hx509_context context,
|
hx509_certs_end_seq(hx509_context context,
|
||||||
hx509_certs certs,
|
hx509_certs certs,
|
||||||
@@ -250,6 +311,18 @@ hx509_certs_end_seq(hx509_context context,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param certs
|
||||||
|
* @param fn
|
||||||
|
* @param ctx
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_certs_iter(hx509_context context,
|
hx509_certs_iter(hx509_context context,
|
||||||
@@ -284,6 +357,19 @@ hx509_certs_iter(hx509_context context,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param ctx
|
||||||
|
* @param c
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_ci_print_names(hx509_context context, void *ctx, hx509_cert c)
|
hx509_ci_print_names(hx509_context context, void *ctx, hx509_cert c)
|
||||||
{
|
{
|
||||||
@@ -305,10 +391,18 @@ hx509_ci_print_names(hx509_context context, void *ctx, hx509_cert c)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* The receiving keyset `certs<74> will either increase reference counter
|
* The receiving keyset `certs<74> will either increase reference counter
|
||||||
* of the `cert<72> or make a deep copy, either way, the caller needs to
|
* of the `cert<72> or make a deep copy, either way, the caller needs to
|
||||||
* free the `cert<72> itself.
|
* free the `cert<72> itself.
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param certs
|
||||||
|
* @param cert
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -324,6 +418,19 @@ hx509_certs_add(hx509_context context, hx509_certs certs, hx509_cert cert)
|
|||||||
return (*certs->ops->add)(context, certs, certs->ops_data, cert);
|
return (*certs->ops->add)(context, certs, certs->ops_data, cert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param certs
|
||||||
|
* @param q
|
||||||
|
* @param r
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_certs_find(hx509_context context,
|
hx509_certs_find(hx509_context context,
|
||||||
hx509_certs certs,
|
hx509_certs certs,
|
||||||
@@ -376,6 +483,19 @@ certs_merge_func(hx509_context context, void *ctx, hx509_cert c)
|
|||||||
return hx509_certs_add(context, (hx509_certs)ctx, c);
|
return hx509_certs_add(context, (hx509_certs)ctx, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param to
|
||||||
|
* @param from
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_certs_merge(hx509_context context, hx509_certs to, hx509_certs from)
|
hx509_certs_merge(hx509_context context, hx509_certs to, hx509_certs from)
|
||||||
{
|
{
|
||||||
@@ -384,6 +504,19 @@ hx509_certs_merge(hx509_context context, hx509_certs to, hx509_certs from)
|
|||||||
return hx509_certs_iter(context, from, certs_merge_func, to);
|
return hx509_certs_iter(context, from, certs_merge_func, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param to
|
||||||
|
* @param lock
|
||||||
|
* @param name
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_certs_append(hx509_context context,
|
hx509_certs_append(hx509_context context,
|
||||||
hx509_certs to,
|
hx509_certs to,
|
||||||
@@ -401,6 +534,18 @@ hx509_certs_append(hx509_context context,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param certs
|
||||||
|
* @param c
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_get_one_cert(hx509_context context, hx509_certs certs, hx509_cert *c)
|
hx509_get_one_cert(hx509_context context, hx509_certs certs, hx509_cert *c)
|
||||||
{
|
{
|
||||||
@@ -429,6 +574,19 @@ certs_info_stdio(void *ctx, const char *str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param context a hx509 context.
|
||||||
|
* @param certs
|
||||||
|
* @param func
|
||||||
|
* @param ctx
|
||||||
|
*
|
||||||
|
* @return Returns an hx509 error code.
|
||||||
|
*
|
||||||
|
* @ingroup hx509_keyset
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
hx509_certs_info(hx509_context context,
|
hx509_certs_info(hx509_context context,
|
||||||
hx509_certs certs,
|
hx509_certs certs,
|
||||||
|
Reference in New Issue
Block a user