krb5: add krb5_store_datalen()

Store a data blob to the storage. The data is stored with an int32 as
length plus the data (not padded).  This function only differs from
krb5_store_data() insofar as it takes a void * and a length as parameters.

Patch from Roland C. Dowdeswell <elric@imrryr.org>
This commit is contained in:
Luke Howard
2021-08-06 19:21:12 +10:00
parent 8330e45444
commit 4e359bd5ce
3 changed files with 24 additions and 0 deletions

View File

@@ -660,6 +660,7 @@ EXPORTS
krb5_store_creds
krb5_store_creds_tag
krb5_store_data
krb5_store_datalen
krb5_store_int16
krb5_store_int32
krb5_store_int64

View File

@@ -785,6 +785,28 @@ krb5_store_data(krb5_storage *sp,
return 0;
}
/**
* Store a data blob to the storage. The data is stored with an int32 as
* length plus the data (not padded). This function only differs from
* krb5_store_data() insofar as it takes a void * and a length as parameters.
*
* @param sp the storage buffer to write to
* @param s the string to store.
* @param len length of the string to be stored.
*
* @return 0 on success, a Kerberos 5 error code on failure.
*
* @ingroup krb5_storage
*/
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_store_datalen(krb5_storage *sp, void *d, size_t len)
{
krb5_data data;
data.length = len;
data.data = d;
return krb5_store_data(sp, data);
}
/**
* Parse a data from the storage.
*

View File

@@ -653,6 +653,7 @@ HEIMDAL_KRB5_2.0 {
krb5_store_creds;
krb5_store_creds_tag;
krb5_store_data;
krb5_store_datalen;
krb5_store_int16;
krb5_store_int32;
krb5_store_int64;