Add a server side implementation of kadm5_create_principal_3().

This commit is contained in:
Roland C. Dowdeswell
2012-02-24 17:39:54 +00:00
parent 800a4e5c94
commit 12b24ad876
6 changed files with 41 additions and 4 deletions

View File

@@ -572,6 +572,8 @@ static kadm5_ret_t
kadm5_ad_create_principal(void *server_handle, kadm5_ad_create_principal(void *server_handle,
kadm5_principal_ent_t entry, kadm5_principal_ent_t entry,
uint32_t mask, uint32_t mask,
int n_ks_tuple,
krb5_key_salt_tuple *ks_tuple,
const char *password) const char *password)
{ {
kadm5_ad_context *context = server_handle; kadm5_ad_context *context = server_handle;
@@ -597,6 +599,14 @@ kadm5_ad_create_principal(void *server_handle,
if ((mask & KADM5_PRINCIPAL) == 0) if ((mask & KADM5_PRINCIPAL) == 0)
return KADM5_BAD_MASK; return KADM5_BAD_MASK;
/*
* We should get around to implementing this... At the moment, the
* the server side API is implemented but the wire protocol has not
* been updated.
*/
if (n_ks_tuple > 0)
return KADM5_KS_TUPLE_NOSUPP;
for (i = 0; i < sizeof(rattrs)/sizeof(rattrs[0]); i++) for (i = 0; i < sizeof(rattrs)/sizeof(rattrs[0]); i++)
attrs[i] = &rattrs[i]; attrs[i] = &rattrs[i];
attrs[i] = NULL; attrs[i] = NULL;

View File

@@ -79,13 +79,26 @@ kadm5_chpass_principal_with_key_3(void *server_handle,
(server_handle, princ, keepold, n_key_data, key_data)); (server_handle, princ, keepold, n_key_data, key_data));
} }
kadm5_ret_t
kadm5_create_principal_3(void *server_handle,
kadm5_principal_ent_t princ,
uint32_t mask,
int n_ks_tuple,
krb5_key_salt_tuple *ks_tuple,
char *password)
{
return __CALL(create_principal,
(server_handle, princ, mask, n_ks_tuple, ks_tuple, password));
}
kadm5_ret_t kadm5_ret_t
kadm5_create_principal(void *server_handle, kadm5_create_principal(void *server_handle,
kadm5_principal_ent_t princ, kadm5_principal_ent_t princ,
uint32_t mask, uint32_t mask,
const char *password) const char *password)
{ {
return __CALL(create_principal, (server_handle, princ, mask, password)); return __CALL(create_principal,
(server_handle, princ, mask, 0, NULL, password));
} }
kadm5_ret_t kadm5_ret_t

View File

@@ -39,6 +39,8 @@ kadm5_ret_t
kadm5_c_create_principal(void *server_handle, kadm5_c_create_principal(void *server_handle,
kadm5_principal_ent_t princ, kadm5_principal_ent_t princ,
uint32_t mask, uint32_t mask,
int n_ks_tuple,
krb5_key_salt_tuple *ks_tuple,
const char *password) const char *password)
{ {
kadm5_client_context *context = server_handle; kadm5_client_context *context = server_handle;
@@ -48,6 +50,14 @@ kadm5_c_create_principal(void *server_handle,
int32_t tmp; int32_t tmp;
krb5_data reply; krb5_data reply;
/*
* We should get around to implementing this... At the moment, the
* the server side API is implemented but the wire protocol has not
* been updated.
*/
if (n_ks_tuple > 0)
return KADM5_KS_TUPLE_NOSUPP;
ret = _kadm5_connect(server_handle); ret = _kadm5_connect(server_handle);
if(ret) if(ret)
return ret; return ret;

View File

@@ -153,6 +153,8 @@ kadm5_ret_t
kadm5_s_create_principal(void *server_handle, kadm5_s_create_principal(void *server_handle,
kadm5_principal_ent_t princ, kadm5_principal_ent_t princ,
uint32_t mask, uint32_t mask,
int n_ks_tuple,
krb5_key_salt_tuple *ks_tuple,
const char *password) const char *password)
{ {
kadm5_ret_t ret; kadm5_ret_t ret;
@@ -178,7 +180,7 @@ kadm5_s_create_principal(void *server_handle,
ent.entry.keys.len = 0; ent.entry.keys.len = 0;
ent.entry.keys.val = NULL; ent.entry.keys.val = NULL;
ret = _kadm5_set_keys(context, &ent.entry, 0, NULL, password); ret = _kadm5_set_keys(context, &ent.entry, n_ks_tuple, ks_tuple, password);
if (ret) if (ret)
goto out; goto out;

View File

@@ -39,8 +39,9 @@
struct kadm_func { struct kadm_func {
kadm5_ret_t (*chpass_principal) (void *, krb5_principal, int, kadm5_ret_t (*chpass_principal) (void *, krb5_principal, int,
int, krb5_key_salt_tuple*, const char*); int, krb5_key_salt_tuple*, const char*);
kadm5_ret_t (*create_principal) (void*, kadm5_principal_ent_t, kadm5_ret_t (*create_principal) (void*, kadm5_principal_ent_t, uint32_t,
uint32_t, const char*); int, krb5_key_salt_tuple *,
const char*);
kadm5_ret_t (*delete_principal) (void*, krb5_principal); kadm5_ret_t (*delete_principal) (void*, krb5_principal);
kadm5_ret_t (*destroy) (void*); kadm5_ret_t (*destroy) (void*);
kadm5_ret_t (*flush) (void*); kadm5_ret_t (*flush) (void*);

View File

@@ -12,6 +12,7 @@ HEIMDAL_KAMD5_SERVER_1.0 {
kadm5_chpass_principal_with_key_3; kadm5_chpass_principal_with_key_3;
kadm5_create_policy; kadm5_create_policy;
kadm5_create_principal; kadm5_create_principal;
kadm5_create_principal_3;
kadm5_delete_principal; kadm5_delete_principal;
kadm5_destroy; kadm5_destroy;
kadm5_decrypt_key; kadm5_decrypt_key;