--- qemud/remote_dispatch_args.h | 6 ++ qemud/remote_dispatch_prototypes.h | 56 +++++++++++++++++++ qemud/remote_dispatch_ret.h | 5 ++ qemud/remote_dispatch_table.h | 40 +++++++++++++ qemud/remote_protocol.c | 107 ++++++++++++++++++++++++++++++++++++ qemud/remote_protocol.h | 98 +++++++++++++++++++++++++++++++++ qemud/remote_protocol.x | 67 ++++++++++++++++++++++- 7 files changed, 378 insertions(+), 1 deletions(-) diff --git a/qemud/remote_dispatch_args.h b/qemud/remote_dispatch_args.h index 9dacfb8..37d7f48 100644 --- a/qemud/remote_dispatch_args.h +++ b/qemud/remote_dispatch_args.h @@ -117,3 +117,9 @@ remote_domain_xml_from_native_args val_remote_domain_xml_from_native_args; remote_domain_xml_to_native_args val_remote_domain_xml_to_native_args; remote_list_defined_interfaces_args val_remote_list_defined_interfaces_args; + remote_secret_set_xml_args val_remote_secret_set_xml_args; + remote_secret_get_xml_args val_remote_secret_get_xml_args; + remote_secret_set_value_args val_remote_secret_set_value_args; + remote_secret_get_value_args val_remote_secret_get_value_args; + remote_secret_delete_args val_remote_secret_delete_args; + remote_secret_list_secrets_args val_remote_secret_list_secrets_args; diff --git a/qemud/remote_dispatch_prototypes.h b/qemud/remote_dispatch_prototypes.h index d9f6aad..dbb23ea 100644 --- a/qemud/remote_dispatch_prototypes.h +++ b/qemud/remote_dispatch_prototypes.h @@ -772,6 +772,62 @@ static int remoteDispatchOpen( remote_error *err, remote_open_args *args, void *ret); +static int remoteDispatchSecretAllocateId( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_error *err, + void *args, + remote_secret_allocate_id_ret *ret); +static int remoteDispatchSecretDelete( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_error *err, + remote_secret_delete_args *args, + void *ret); +static int remoteDispatchSecretGetValue( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_error *err, + remote_secret_get_value_args *args, + remote_secret_get_value_ret *ret); +static int remoteDispatchSecretGetXml( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_error *err, + remote_secret_get_xml_args *args, + remote_secret_get_xml_ret *ret); +static int remoteDispatchSecretListSecrets( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_error *err, + remote_secret_list_secrets_args *args, + remote_secret_list_secrets_ret *ret); +static int remoteDispatchSecretNumOfSecrets( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_error *err, + void *args, + remote_secret_num_of_secrets_ret *ret); +static int remoteDispatchSecretSetValue( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_error *err, + remote_secret_set_value_args *args, + void *ret); +static int remoteDispatchSecretSetXml( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_error *err, + remote_secret_set_xml_args *args, + void *ret); static int remoteDispatchStoragePoolBuild( struct qemud_server *server, struct qemud_client *client, diff --git a/qemud/remote_dispatch_ret.h b/qemud/remote_dispatch_ret.h index 5376960..d28f445 100644 --- a/qemud/remote_dispatch_ret.h +++ b/qemud/remote_dispatch_ret.h @@ -99,3 +99,8 @@ remote_domain_xml_to_native_ret val_remote_domain_xml_to_native_ret; remote_num_of_defined_interfaces_ret val_remote_num_of_defined_interfaces_ret; remote_list_defined_interfaces_ret val_remote_list_defined_interfaces_ret; + remote_secret_allocate_id_ret val_remote_secret_allocate_id_ret; + remote_secret_get_xml_ret val_remote_secret_get_xml_ret; + remote_secret_get_value_ret val_remote_secret_get_value_ret; + remote_secret_num_of_secrets_ret val_remote_secret_num_of_secrets_ret; + remote_secret_list_secrets_ret val_remote_secret_list_secrets_ret; diff --git a/qemud/remote_dispatch_table.h b/qemud/remote_dispatch_table.h index 449786d..aad9b41 100644 --- a/qemud/remote_dispatch_table.h +++ b/qemud/remote_dispatch_table.h @@ -697,3 +697,43 @@ .args_filter = (xdrproc_t) xdr_remote_list_defined_interfaces_args, .ret_filter = (xdrproc_t) xdr_remote_list_defined_interfaces_ret, }, +{ /* SecretAllocateId => 139 */ + .fn = (dispatch_fn) remoteDispatchSecretAllocateId, + .args_filter = (xdrproc_t) xdr_void, + .ret_filter = (xdrproc_t) xdr_remote_secret_allocate_id_ret, +}, +{ /* SecretSetXml => 140 */ + .fn = (dispatch_fn) remoteDispatchSecretSetXml, + .args_filter = (xdrproc_t) xdr_remote_secret_set_xml_args, + .ret_filter = (xdrproc_t) xdr_void, +}, +{ /* SecretGetXml => 141 */ + .fn = (dispatch_fn) remoteDispatchSecretGetXml, + .args_filter = (xdrproc_t) xdr_remote_secret_get_xml_args, + .ret_filter = (xdrproc_t) xdr_remote_secret_get_xml_ret, +}, +{ /* SecretSetValue => 142 */ + .fn = (dispatch_fn) remoteDispatchSecretSetValue, + .args_filter = (xdrproc_t) xdr_remote_secret_set_value_args, + .ret_filter = (xdrproc_t) xdr_void, +}, +{ /* SecretGetValue => 143 */ + .fn = (dispatch_fn) remoteDispatchSecretGetValue, + .args_filter = (xdrproc_t) xdr_remote_secret_get_value_args, + .ret_filter = (xdrproc_t) xdr_remote_secret_get_value_ret, +}, +{ /* SecretDelete => 144 */ + .fn = (dispatch_fn) remoteDispatchSecretDelete, + .args_filter = (xdrproc_t) xdr_remote_secret_delete_args, + .ret_filter = (xdrproc_t) xdr_void, +}, +{ /* SecretNumOfSecrets => 145 */ + .fn = (dispatch_fn) remoteDispatchSecretNumOfSecrets, + .args_filter = (xdrproc_t) xdr_void, + .ret_filter = (xdrproc_t) xdr_remote_secret_num_of_secrets_ret, +}, +{ /* SecretListSecrets => 146 */ + .fn = (dispatch_fn) remoteDispatchSecretListSecrets, + .args_filter = (xdrproc_t) xdr_remote_secret_list_secrets_args, + .ret_filter = (xdrproc_t) xdr_remote_secret_list_secrets_ret, +}, diff --git a/qemud/remote_protocol.c b/qemud/remote_protocol.c index 7b46096..519f4f2 100644 --- a/qemud/remote_protocol.c +++ b/qemud/remote_protocol.c @@ -2534,6 +2534,113 @@ xdr_remote_domain_xml_to_native_ret (XDR *xdrs, remote_domain_xml_to_native_ret } bool_t +xdr_remote_secret_allocate_id_ret (XDR *xdrs, remote_secret_allocate_id_ret *objp) +{ + + if (!xdr_remote_nonnull_string (xdrs, &objp->secretID)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_set_xml_args (XDR *xdrs, remote_secret_set_xml_args *objp) +{ + + if (!xdr_remote_nonnull_string (xdrs, &objp->secretID)) + return FALSE; + if (!xdr_remote_nonnull_string (xdrs, &objp->xml)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_get_xml_args (XDR *xdrs, remote_secret_get_xml_args *objp) +{ + + if (!xdr_remote_nonnull_string (xdrs, &objp->secretID)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_get_xml_ret (XDR *xdrs, remote_secret_get_xml_ret *objp) +{ + + if (!xdr_remote_nonnull_string (xdrs, &objp->xml)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_set_value_args (XDR *xdrs, remote_secret_set_value_args *objp) +{ + char **objp_cpp0 = (char **) (void *) &objp->value.value_val; + + if (!xdr_remote_nonnull_string (xdrs, &objp->secretID)) + return FALSE; + if (!xdr_bytes (xdrs, objp_cpp0, (u_int *) &objp->value.value_len, REMOTE_SECRET_VALUE_MAX)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_get_value_args (XDR *xdrs, remote_secret_get_value_args *objp) +{ + + if (!xdr_remote_nonnull_string (xdrs, &objp->secretID)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_get_value_ret (XDR *xdrs, remote_secret_get_value_ret *objp) +{ + char **objp_cpp0 = (char **) (void *) &objp->value.value_val; + + if (!xdr_bytes (xdrs, objp_cpp0, (u_int *) &objp->value.value_len, REMOTE_SECRET_VALUE_MAX)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_delete_args (XDR *xdrs, remote_secret_delete_args *objp) +{ + + if (!xdr_remote_nonnull_string (xdrs, &objp->secretID)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_num_of_secrets_ret (XDR *xdrs, remote_secret_num_of_secrets_ret *objp) +{ + + if (!xdr_int (xdrs, &objp->num)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_list_secrets_args (XDR *xdrs, remote_secret_list_secrets_args *objp) +{ + + if (!xdr_int (xdrs, &objp->maxids)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_secret_list_secrets_ret (XDR *xdrs, remote_secret_list_secrets_ret *objp) +{ + char **objp_cpp0 = (char **) (void *) &objp->ids.ids_val; + + if (!xdr_array (xdrs, objp_cpp0, (u_int *) &objp->ids.ids_len, REMOTE_SECRET_ID_LIST_MAX, + sizeof (remote_nonnull_string), (xdrproc_t) xdr_remote_nonnull_string)) + return FALSE; + return TRUE; +} + +bool_t xdr_remote_procedure (XDR *xdrs, remote_procedure *objp) { diff --git a/qemud/remote_protocol.h b/qemud/remote_protocol.h index 2e5bc81..621a991 100644 --- a/qemud/remote_protocol.h +++ b/qemud/remote_protocol.h @@ -43,6 +43,8 @@ typedef remote_nonnull_string *remote_string; #define REMOTE_SECURITY_MODEL_MAX VIR_SECURITY_MODEL_BUFLEN #define REMOTE_SECURITY_LABEL_MAX VIR_SECURITY_LABEL_BUFLEN #define REMOTE_SECURITY_DOI_MAX VIR_SECURITY_DOI_BUFLEN +#define REMOTE_SECRET_VALUE_MAX 65536 +#define REMOTE_SECRET_ID_LIST_MAX 16384 typedef char remote_uuid[VIR_UUID_BUFLEN]; @@ -1427,6 +1429,72 @@ struct remote_domain_xml_to_native_ret { remote_nonnull_string nativeConfig; }; typedef struct remote_domain_xml_to_native_ret remote_domain_xml_to_native_ret; + +struct remote_secret_allocate_id_ret { + remote_nonnull_string secretID; +}; +typedef struct remote_secret_allocate_id_ret remote_secret_allocate_id_ret; + +struct remote_secret_set_xml_args { + remote_nonnull_string secretID; + remote_nonnull_string xml; +}; +typedef struct remote_secret_set_xml_args remote_secret_set_xml_args; + +struct remote_secret_get_xml_args { + remote_nonnull_string secretID; +}; +typedef struct remote_secret_get_xml_args remote_secret_get_xml_args; + +struct remote_secret_get_xml_ret { + remote_nonnull_string xml; +}; +typedef struct remote_secret_get_xml_ret remote_secret_get_xml_ret; + +struct remote_secret_set_value_args { + remote_nonnull_string secretID; + struct { + u_int value_len; + char *value_val; + } value; +}; +typedef struct remote_secret_set_value_args remote_secret_set_value_args; + +struct remote_secret_get_value_args { + remote_nonnull_string secretID; +}; +typedef struct remote_secret_get_value_args remote_secret_get_value_args; + +struct remote_secret_get_value_ret { + struct { + u_int value_len; + char *value_val; + } value; +}; +typedef struct remote_secret_get_value_ret remote_secret_get_value_ret; + +struct remote_secret_delete_args { + remote_nonnull_string secretID; +}; +typedef struct remote_secret_delete_args remote_secret_delete_args; + +struct remote_secret_num_of_secrets_ret { + int num; +}; +typedef struct remote_secret_num_of_secrets_ret remote_secret_num_of_secrets_ret; + +struct remote_secret_list_secrets_args { + int maxids; +}; +typedef struct remote_secret_list_secrets_args remote_secret_list_secrets_args; + +struct remote_secret_list_secrets_ret { + struct { + u_int ids_len; + remote_nonnull_string *ids_val; + } ids; +}; +typedef struct remote_secret_list_secrets_ret remote_secret_list_secrets_ret; #define REMOTE_PROGRAM 0x20008086 #define REMOTE_PROTOCOL_VERSION 1 @@ -1569,6 +1637,14 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_XML_TO_NATIVE = 136, REMOTE_PROC_NUM_OF_DEFINED_INTERFACES = 137, REMOTE_PROC_LIST_DEFINED_INTERFACES = 138, + REMOTE_PROC_SECRET_ALLOCATE_ID = 139, + REMOTE_PROC_SECRET_SET_XML = 140, + REMOTE_PROC_SECRET_GET_XML = 141, + REMOTE_PROC_SECRET_SET_VALUE = 142, + REMOTE_PROC_SECRET_GET_VALUE = 143, + REMOTE_PROC_SECRET_DELETE = 144, + REMOTE_PROC_SECRET_NUM_OF_SECRETS = 145, + REMOTE_PROC_SECRET_LIST_SECRETS = 146, }; typedef enum remote_procedure remote_procedure; @@ -1831,6 +1907,17 @@ extern bool_t xdr_remote_domain_xml_from_native_args (XDR *, remote_domain_xml_ extern bool_t xdr_remote_domain_xml_from_native_ret (XDR *, remote_domain_xml_from_native_ret*); extern bool_t xdr_remote_domain_xml_to_native_args (XDR *, remote_domain_xml_to_native_args*); extern bool_t xdr_remote_domain_xml_to_native_ret (XDR *, remote_domain_xml_to_native_ret*); +extern bool_t xdr_remote_secret_allocate_id_ret (XDR *, remote_secret_allocate_id_ret*); +extern bool_t xdr_remote_secret_set_xml_args (XDR *, remote_secret_set_xml_args*); +extern bool_t xdr_remote_secret_get_xml_args (XDR *, remote_secret_get_xml_args*); +extern bool_t xdr_remote_secret_get_xml_ret (XDR *, remote_secret_get_xml_ret*); +extern bool_t xdr_remote_secret_set_value_args (XDR *, remote_secret_set_value_args*); +extern bool_t xdr_remote_secret_get_value_args (XDR *, remote_secret_get_value_args*); +extern bool_t xdr_remote_secret_get_value_ret (XDR *, remote_secret_get_value_ret*); +extern bool_t xdr_remote_secret_delete_args (XDR *, remote_secret_delete_args*); +extern bool_t xdr_remote_secret_num_of_secrets_ret (XDR *, remote_secret_num_of_secrets_ret*); +extern bool_t xdr_remote_secret_list_secrets_args (XDR *, remote_secret_list_secrets_args*); +extern bool_t xdr_remote_secret_list_secrets_ret (XDR *, remote_secret_list_secrets_ret*); extern bool_t xdr_remote_procedure (XDR *, remote_procedure*); extern bool_t xdr_remote_message_type (XDR *, remote_message_type*); extern bool_t xdr_remote_message_status (XDR *, remote_message_status*); @@ -2069,6 +2156,17 @@ extern bool_t xdr_remote_domain_xml_from_native_args (); extern bool_t xdr_remote_domain_xml_from_native_ret (); extern bool_t xdr_remote_domain_xml_to_native_args (); extern bool_t xdr_remote_domain_xml_to_native_ret (); +extern bool_t xdr_remote_secret_allocate_id_ret (); +extern bool_t xdr_remote_secret_set_xml_args (); +extern bool_t xdr_remote_secret_get_xml_args (); +extern bool_t xdr_remote_secret_get_xml_ret (); +extern bool_t xdr_remote_secret_set_value_args (); +extern bool_t xdr_remote_secret_get_value_args (); +extern bool_t xdr_remote_secret_get_value_ret (); +extern bool_t xdr_remote_secret_delete_args (); +extern bool_t xdr_remote_secret_num_of_secrets_ret (); +extern bool_t xdr_remote_secret_list_secrets_args (); +extern bool_t xdr_remote_secret_list_secrets_ret (); extern bool_t xdr_remote_procedure (); extern bool_t xdr_remote_message_type (); extern bool_t xdr_remote_message_status (); diff --git a/qemud/remote_protocol.x b/qemud/remote_protocol.x index 8f9b6db..268a8b4 100644 --- a/qemud/remote_protocol.x +++ b/qemud/remote_protocol.x @@ -136,6 +136,16 @@ const REMOTE_SECURITY_LABEL_MAX = VIR_SECURITY_LABEL_BUFLEN; */ const REMOTE_SECURITY_DOI_MAX = VIR_SECURITY_DOI_BUFLEN; +/* + * Maximum size of a secret value. + */ +const REMOTE_SECRET_VALUE_MAX = 65536; + +/* + * Upper limit on list of secrets. + */ +const REMOTE_SECRET_ID_LIST_MAX = 16384; + /* UUID. VIR_UUID_BUFLEN definition comes from libvirt.h */ typedef opaque remote_uuid[VIR_UUID_BUFLEN]; @@ -1266,6 +1276,52 @@ struct remote_domain_xml_to_native_ret { }; +struct remote_secret_allocate_id_ret { + remote_nonnull_string secretID; +}; + +struct remote_secret_set_xml_args { + remote_nonnull_string secretID; + remote_nonnull_string xml; +}; + +struct remote_secret_get_xml_args { + remote_nonnull_string secretID; +}; + +struct remote_secret_get_xml_ret { + remote_nonnull_string xml; +}; + +struct remote_secret_set_value_args { + remote_nonnull_string secretID; + opaque value<REMOTE_SECRET_VALUE_MAX>; +}; + +struct remote_secret_get_value_args { + remote_nonnull_string secretID; +}; + +struct remote_secret_get_value_ret { + opaque value<REMOTE_SECRET_VALUE_MAX>; +}; + +struct remote_secret_delete_args { + remote_nonnull_string secretID; +}; + +struct remote_secret_num_of_secrets_ret { + int num; +}; + +struct remote_secret_list_secrets_args { + int maxids; +}; + +struct remote_secret_list_secrets_ret { + remote_nonnull_string ids<REMOTE_SECRET_ID_LIST_MAX>; +}; + /*----- Protocol. -----*/ /* Define the program number, protocol version and procedure numbers here. */ @@ -1424,7 +1480,16 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_XML_TO_NATIVE = 136, REMOTE_PROC_NUM_OF_DEFINED_INTERFACES = 137, - REMOTE_PROC_LIST_DEFINED_INTERFACES = 138 + REMOTE_PROC_LIST_DEFINED_INTERFACES = 138, + + REMOTE_PROC_SECRET_ALLOCATE_ID = 139, + REMOTE_PROC_SECRET_SET_XML = 140, + REMOTE_PROC_SECRET_GET_XML = 141, + REMOTE_PROC_SECRET_SET_VALUE = 142, + REMOTE_PROC_SECRET_GET_VALUE = 143, + REMOTE_PROC_SECRET_DELETE = 144, + REMOTE_PROC_SECRET_NUM_OF_SECRETS = 145, + REMOTE_PROC_SECRET_LIST_SECRETS = 146 }; -- 1.6.2.5 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list