|
Packit Service |
99d1c0 |
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
Packit Service |
99d1c0 |
/*
|
|
Packit Service |
99d1c0 |
* Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* $Header$
|
|
Packit Service |
99d1c0 |
*/
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
#include <gssrpc/rpc.h>
|
|
Packit Service |
99d1c0 |
#include <kadm5/admin.h>
|
|
Packit Service |
99d1c0 |
#include <kadm5/kadm_rpc.h>
|
|
Packit Service |
99d1c0 |
#ifdef HAVE_MEMORY_H
|
|
Packit Service |
99d1c0 |
#include <memory.h>
|
|
Packit Service |
99d1c0 |
#endif
|
|
Packit Service |
99d1c0 |
#include <string.h>
|
|
Packit Service |
99d1c0 |
#include <errno.h>
|
|
Packit Service |
99d1c0 |
#include "client_internal.h"
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
#ifdef DEBUG
|
|
Packit Service |
99d1c0 |
#define eret() do { clnt_perror(handle->clnt, "null ret"); return KADM5_RPC_ERROR; } while (0)
|
|
Packit Service |
99d1c0 |
#else
|
|
Packit Service |
99d1c0 |
#define eret() do { return KADM5_RPC_ERROR; } while (0)
|
|
Packit Service |
99d1c0 |
#endif
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_create_principal(void *server_handle,
|
|
Packit Service |
99d1c0 |
kadm5_principal_ent_t princ, long mask,
|
|
Packit Service |
99d1c0 |
char *pw)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
cprinc_arg arg;
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
memset(&arg, 0, sizeof(arg));
|
|
Packit Service |
99d1c0 |
arg.mask = mask;
|
|
Packit Service |
99d1c0 |
arg.passwd = pw;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princ == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
memcpy(&arg.rec, princ, sizeof(kadm5_principal_ent_rec));
|
|
Packit Service |
99d1c0 |
arg.rec.mod_name = NULL;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(!(mask & KADM5_POLICY))
|
|
Packit Service |
99d1c0 |
arg.rec.policy = NULL;
|
|
Packit Service |
99d1c0 |
if (! (mask & KADM5_KEY_DATA)) {
|
|
Packit Service |
99d1c0 |
arg.rec.n_key_data = 0;
|
|
Packit Service |
99d1c0 |
arg.rec.key_data = NULL;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
if (! (mask & KADM5_TL_DATA)) {
|
|
Packit Service |
99d1c0 |
arg.rec.n_tl_data = 0;
|
|
Packit Service |
99d1c0 |
arg.rec.tl_data = NULL;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if (create_principal_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_create_principal_3(void *server_handle,
|
|
Packit Service |
99d1c0 |
kadm5_principal_ent_t princ, long mask,
|
|
Packit Service |
99d1c0 |
int n_ks_tuple,
|
|
Packit Service |
99d1c0 |
krb5_key_salt_tuple *ks_tuple,
|
|
Packit Service |
99d1c0 |
char *pw)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
cprinc3_arg arg;
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
memset(&arg, 0, sizeof(arg));
|
|
Packit Service |
99d1c0 |
arg.mask = mask;
|
|
Packit Service |
99d1c0 |
arg.passwd = pw;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
arg.n_ks_tuple = n_ks_tuple;
|
|
Packit Service |
99d1c0 |
arg.ks_tuple = ks_tuple;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princ == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
memcpy(&arg.rec, princ, sizeof(kadm5_principal_ent_rec));
|
|
Packit Service |
99d1c0 |
arg.rec.mod_name = NULL;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(!(mask & KADM5_POLICY))
|
|
Packit Service |
99d1c0 |
arg.rec.policy = NULL;
|
|
Packit Service |
99d1c0 |
if (! (mask & KADM5_KEY_DATA)) {
|
|
Packit Service |
99d1c0 |
arg.rec.n_key_data = 0;
|
|
Packit Service |
99d1c0 |
arg.rec.key_data = NULL;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
if (! (mask & KADM5_TL_DATA)) {
|
|
Packit Service |
99d1c0 |
arg.rec.n_tl_data = 0;
|
|
Packit Service |
99d1c0 |
arg.rec.tl_data = NULL;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if (create_principal3_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_delete_principal(void *server_handle, krb5_principal principal)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
dprinc_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(principal == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
arg.princ = principal;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
if (delete_principal_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_modify_principal(void *server_handle,
|
|
Packit Service |
99d1c0 |
kadm5_principal_ent_t princ, long mask)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
mprinc_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
memset(&arg, 0, sizeof(arg));
|
|
Packit Service |
99d1c0 |
arg.mask = mask;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
if(princ == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
memcpy(&arg.rec, princ, sizeof(kadm5_principal_ent_rec));
|
|
Packit Service |
99d1c0 |
if(!(mask & KADM5_POLICY))
|
|
Packit Service |
99d1c0 |
arg.rec.policy = NULL;
|
|
Packit Service |
99d1c0 |
if (! (mask & KADM5_KEY_DATA)) {
|
|
Packit Service |
99d1c0 |
arg.rec.n_key_data = 0;
|
|
Packit Service |
99d1c0 |
arg.rec.key_data = NULL;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
if (! (mask & KADM5_TL_DATA)) {
|
|
Packit Service |
99d1c0 |
arg.rec.n_tl_data = 0;
|
|
Packit Service |
99d1c0 |
arg.rec.tl_data = NULL;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.rec.mod_name = NULL;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if (modify_principal_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_get_principal(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal princ, kadm5_principal_ent_t ent,
|
|
Packit Service |
99d1c0 |
long mask)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
gprinc_arg arg;
|
|
Packit Service |
99d1c0 |
gprinc_ret r;
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princ == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.mask = mask;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
memset(&r, 0, sizeof(gprinc_ret));
|
|
Packit Service |
99d1c0 |
if (get_principal_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
if (r.code == 0)
|
|
Packit Service |
99d1c0 |
memcpy(ent, &r.rec, sizeof(r.rec));
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_get_principals(void *server_handle,
|
|
Packit Service |
99d1c0 |
char *exp, char ***princs, int *count)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
gprincs_arg arg;
|
|
Packit Service |
99d1c0 |
gprincs_ret r;
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princs == NULL || count == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
arg.exp = exp;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
memset(&r, 0, sizeof(gprincs_ret));
|
|
Packit Service |
99d1c0 |
if (get_princs_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
if (r.code == 0) {
|
|
Packit Service |
99d1c0 |
*count = r.count;
|
|
Packit Service |
99d1c0 |
*princs = r.princs;
|
|
Packit Service |
99d1c0 |
} else {
|
|
Packit Service |
99d1c0 |
*count = 0;
|
|
Packit Service |
99d1c0 |
*princs = NULL;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_rename_principal(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal source, krb5_principal dest)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
rprinc_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.src = source;
|
|
Packit Service |
99d1c0 |
arg.dest = dest;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
if (source == NULL || dest == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
if (rename_principal_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_chpass_principal(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal princ, char *password)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
chpass_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.pass = password;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princ == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
if (chpass_principal_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_chpass_principal_3(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal princ, krb5_boolean keepold,
|
|
Packit Service |
99d1c0 |
int n_ks_tuple, krb5_key_salt_tuple *ks_tuple,
|
|
Packit Service |
99d1c0 |
char *password)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
chpass3_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.pass = password;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
arg.keepold = keepold;
|
|
Packit Service |
99d1c0 |
arg.n_ks_tuple = n_ks_tuple;
|
|
Packit Service |
99d1c0 |
arg.ks_tuple = ks_tuple;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princ == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
if (chpass_principal3_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_setkey_principal(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal princ,
|
|
Packit Service |
99d1c0 |
krb5_keyblock *keyblocks,
|
|
Packit Service |
99d1c0 |
int n_keys)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
setkey_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.keyblocks = keyblocks;
|
|
Packit Service |
99d1c0 |
arg.n_keys = n_keys;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princ == NULL || keyblocks == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
if (setkey_principal_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_setkey_principal_3(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal princ,
|
|
Packit Service |
99d1c0 |
krb5_boolean keepold, int n_ks_tuple,
|
|
Packit Service |
99d1c0 |
krb5_key_salt_tuple *ks_tuple,
|
|
Packit Service |
99d1c0 |
krb5_keyblock *keyblocks,
|
|
Packit Service |
99d1c0 |
int n_keys)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
setkey3_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.keyblocks = keyblocks;
|
|
Packit Service |
99d1c0 |
arg.n_keys = n_keys;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
arg.keepold = keepold;
|
|
Packit Service |
99d1c0 |
arg.n_ks_tuple = n_ks_tuple;
|
|
Packit Service |
99d1c0 |
arg.ks_tuple = ks_tuple;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princ == NULL || keyblocks == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
if (setkey_principal3_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_setkey_principal_4(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal princ,
|
|
Packit Service |
99d1c0 |
krb5_boolean keepold,
|
|
Packit Service |
99d1c0 |
kadm5_key_data *key_data,
|
|
Packit Service |
99d1c0 |
int n_key_data)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
setkey4_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.keepold = keepold;
|
|
Packit Service |
99d1c0 |
arg.key_data = key_data;
|
|
Packit Service |
99d1c0 |
arg.n_key_data = n_key_data;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if (princ == NULL || key_data == NULL || n_key_data == 0)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
if (setkey_principal4_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_randkey_principal_3(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal princ,
|
|
Packit Service |
99d1c0 |
krb5_boolean keepold, int n_ks_tuple,
|
|
Packit Service |
99d1c0 |
krb5_key_salt_tuple *ks_tuple,
|
|
Packit Service |
99d1c0 |
krb5_keyblock **key, int *n_keys)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
chrand3_arg arg;
|
|
Packit Service |
99d1c0 |
chrand_ret r;
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
int i;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
arg.keepold = keepold;
|
|
Packit Service |
99d1c0 |
arg.n_ks_tuple = n_ks_tuple;
|
|
Packit Service |
99d1c0 |
arg.ks_tuple = ks_tuple;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princ == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
memset(&r, 0, sizeof(chrand_ret));
|
|
Packit Service |
99d1c0 |
if (chrand_principal3_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
if (n_keys)
|
|
Packit Service |
99d1c0 |
*n_keys = r.n_keys;
|
|
Packit Service |
99d1c0 |
if (key) {
|
|
Packit Service |
99d1c0 |
*key = r.keys;
|
|
Packit Service |
99d1c0 |
} else {
|
|
Packit Service |
99d1c0 |
for (i = 0; i < r.n_keys; i++)
|
|
Packit Service |
99d1c0 |
krb5_free_keyblock_contents(handle->context, &r.keys[i]);
|
|
Packit Service |
99d1c0 |
free(r.keys);
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_randkey_principal(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal princ,
|
|
Packit Service |
99d1c0 |
krb5_keyblock **key, int *n_keys)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
chrand_arg arg;
|
|
Packit Service |
99d1c0 |
chrand_ret r;
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
int i;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if(princ == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
memset(&r, 0, sizeof(chrand_ret));
|
|
Packit Service |
99d1c0 |
if (chrand_principal_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
if (n_keys)
|
|
Packit Service |
99d1c0 |
*n_keys = r.n_keys;
|
|
Packit Service |
99d1c0 |
if (key) {
|
|
Packit Service |
99d1c0 |
*key = r.keys;
|
|
Packit Service |
99d1c0 |
} else {
|
|
Packit Service |
99d1c0 |
for (i = 0; i < r.n_keys; i++)
|
|
Packit Service |
99d1c0 |
krb5_free_keyblock_contents(handle->context, &r.keys[i]);
|
|
Packit Service |
99d1c0 |
free(r.keys);
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
/* not supported on client side */
|
|
Packit Service |
99d1c0 |
kadm5_ret_t kadm5_decrypt_key(void *server_handle,
|
|
Packit Service |
99d1c0 |
kadm5_principal_ent_t entry, krb5_int32
|
|
Packit Service |
99d1c0 |
ktype, krb5_int32 stype, krb5_int32
|
|
Packit Service |
99d1c0 |
kvno, krb5_keyblock *keyblock,
|
|
Packit Service |
99d1c0 |
krb5_keysalt *keysalt, int *kvnop)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_purgekeys(void *server_handle,
|
|
Packit Service |
99d1c0 |
krb5_principal princ,
|
|
Packit Service |
99d1c0 |
int keepkvno)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
purgekeys_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.keepkvno = keepkvno;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if (princ == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
if (purgekeys_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_get_strings(void *server_handle, krb5_principal principal,
|
|
Packit Service |
99d1c0 |
krb5_string_attr **strings_out, int *count_out)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
gstrings_arg arg;
|
|
Packit Service |
99d1c0 |
gstrings_ret r;
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
*strings_out = NULL;
|
|
Packit Service |
99d1c0 |
*count_out = 0;
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
if (principal == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.princ = principal;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
memset(&r, 0, sizeof(gstrings_ret));
|
|
Packit Service |
99d1c0 |
if (get_strings_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
if (r.code == 0) {
|
|
Packit Service |
99d1c0 |
*strings_out = r.strings;
|
|
Packit Service |
99d1c0 |
*count_out = r.count;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_set_string(void *server_handle, krb5_principal principal,
|
|
Packit Service |
99d1c0 |
const char *key, const char *value)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
sstring_arg arg;
|
|
Packit Service |
99d1c0 |
generic_ret r = { 0, 0 };
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
if (principal == NULL || key == NULL)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.princ = principal;
|
|
Packit Service |
99d1c0 |
arg.key = (char *)key;
|
|
Packit Service |
99d1c0 |
arg.value = (char *)value;
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
if (set_string_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
kadm5_ret_t
|
|
Packit Service |
99d1c0 |
kadm5_get_principal_keys(void *server_handle, krb5_principal princ,
|
|
Packit Service |
99d1c0 |
krb5_kvno kvno, kadm5_key_data **key_data,
|
|
Packit Service |
99d1c0 |
int *n_key_data)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
getpkeys_arg arg;
|
|
Packit Service |
99d1c0 |
getpkeys_ret r;
|
|
Packit Service |
99d1c0 |
kadm5_server_handle_t handle = server_handle;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
CHECK_HANDLE(server_handle);
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
arg.api_version = handle->api_version;
|
|
Packit Service |
99d1c0 |
arg.princ = princ;
|
|
Packit Service |
99d1c0 |
arg.kvno = kvno;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
if (princ == NULL || key_data == NULL || n_key_data == 0)
|
|
Packit Service |
99d1c0 |
return EINVAL;
|
|
Packit Service |
99d1c0 |
memset(&r, 0, sizeof(getpkeys_ret));
|
|
Packit Service |
99d1c0 |
if (get_principal_keys_2(&arg, &r, handle->clnt))
|
|
Packit Service |
99d1c0 |
eret();
|
|
Packit Service |
99d1c0 |
if (r.code == 0) {
|
|
Packit Service |
99d1c0 |
*key_data = r.key_data;
|
|
Packit Service |
99d1c0 |
*n_key_data = r.n_key_data;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
return r.code;
|
|
Packit Service |
99d1c0 |
}
|