summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/realmd/CMakeLists.txt3
-rw-r--r--src/realmd/LMI_RealmdKerberosRealmProvider.c627
-rw-r--r--src/realmd/LMI_RealmdRealmProvider.c326
-rw-r--r--src/realmd/LMI_RealmdServiceProvider.c131
-rw-r--r--src/realmd/LMI_ServiceAffectsRealmdRealmProvider.c252
-rw-r--r--src/realmd/doc/class_diagram.svg105
-rwxr-xr-x[-rw-r--r--]src/realmd/doc/examples/realmd-cim92
-rw-r--r--src/realmd/rdcp_realmdrealm.h310
8 files changed, 36 insertions, 1810 deletions
diff --git a/src/realmd/CMakeLists.txt b/src/realmd/CMakeLists.txt
index cd6f6c8..7a03f49 100644
--- a/src/realmd/CMakeLists.txt
+++ b/src/realmd/CMakeLists.txt
@@ -8,10 +8,7 @@ set(MOF 60_LMI_Realmd.mof)
set(provider_SRCS
LMI_HostedRealmdServiceProvider.c
- LMI_RealmdKerberosRealmProvider.c
- LMI_RealmdRealmProvider.c
LMI_RealmdServiceProvider.c
- LMI_ServiceAffectsRealmdRealmProvider.c
rdcp_dbus.c
rdcp_error.c
rdcp_util.c
diff --git a/src/realmd/LMI_RealmdKerberosRealmProvider.c b/src/realmd/LMI_RealmdKerberosRealmProvider.c
deleted file mode 100644
index aa43ba1..0000000
--- a/src/realmd/LMI_RealmdKerberosRealmProvider.c
+++ /dev/null
@@ -1,627 +0,0 @@
-#include <konkret/konkret.h>
-#include "LMI_RealmdKerberosRealm.h"
-#include "globals.h"
-#include "rdcp_error.h"
-#include "rdcp_dbus.h"
-#include "rdcp_util.h"
-#include "rdcp_realmdrealm.h"
-
-static const CMPIBroker* _cb = NULL;
-
-CMPIStatus LMI_RealmdKerberosRealmRef_InitFromDBusPath(
- LMI_RealmdKerberosRealmRef* self,
- const CMPIBroker* cb,
- const char* ns,
- const char* dbus_path)
-{
- CMPIStatus status;
-
- CMSetStatus(&status, CMPI_RC_OK);
-
- LMI_RealmdRealmInitKeys(LMI_RealmdKerberosRealmRef, self, dbus_path);
-
- return status;
-}
-
-CMPIStatus LMI_RealmdKerberosRealm_InitFromDBusPath(
- LMI_RealmdKerberosRealm* self,
- const CMPIBroker* cb,
- const char* ns,
- const char* dbus_path)
-{
- CMPIStatus status;
- GError *g_error = NULL;
- GVariant *realm_props = NULL;
- GVariant *kerberos_props = NULL;
- GVariant *kerberos_membership_props = NULL;
-
- CMSetStatus(&status, CMPI_RC_OK);
-
- if (!rdcp_dbus_initialize(&g_error)) {
- return handle_g_error(&g_error, _cb, &status, CMPI_RC_ERR_FAILED, "rdcp_dbus_initialize failed");
- }
-
- GET_DBUS_PROPERIES_OR_EXIT(realm_props, dbus_path,
- REALM_DBUS_REALM_INTERFACE, &status);
- GET_DBUS_PROPERIES_OR_EXIT(kerberos_props, dbus_path,
- REALM_DBUS_KERBEROS_INTERFACE, &status);
-
- LMI_RealmdRealmInitKeys(LMI_RealmdKerberosRealm, self, dbus_path);
- LMI_InitFromDBusRealmProps(LMI_RealmdKerberosRealm, self, realm_props);
- LMI_InitFromDBusKerberosRealmProps(LMI_RealmdKerberosRealm, self, kerberos_props);
-
- if (SupportsDBusInterface(realm_props, REALM_DBUS_KERBEROS_MEMBERSHIP_INTERFACE)) {
- GET_DBUS_PROPERIES_OR_EXIT(kerberos_membership_props, dbus_path,
- REALM_DBUS_KERBEROS_MEMBERSHIP_INTERFACE, &status);
-
- LMI_InitFromDBusKerberosMembershipProps(LMI_RealmdKerberosRealm, self,
- kerberos_membership_props);
- }
-
- exit:
- G_VARIANT_FREE(realm_props);
- G_VARIANT_FREE(kerberos_props);
- G_VARIANT_FREE(kerberos_membership_props);
-
- return status;
-}
-
-
-static void LMI_RealmdKerberosRealmInitialize()
-{
-}
-
-static CMPIStatus LMI_RealmdKerberosRealmCleanup(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- CMPIBoolean term)
-{
- CMReturn(CMPI_RC_OK);
-}
-
-static CMPIStatus LMI_RealmdKerberosRealmEnumInstanceNames(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop)
-{
- return KDefaultEnumerateInstanceNames(
- _cb, mi, cc, cr, cop);
-}
-
-static CMPIStatus LMI_RealmdKerberosRealmEnumInstances(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char** properties)
-{
- CMPIStatus status;
- GError *g_error = NULL;
- GVariant *provider_props = NULL;
- GVariant *realm_props = NULL;
- GVariantIter *iter = NULL;
- gchar *realm_obj_path;
- const char *name_space = KNameSpace(cop);
-
- CMSetStatus(&status, CMPI_RC_OK);
-
- if (!rdcp_dbus_initialize(&g_error)) {
- return handle_g_error(&g_error, _cb, &status, CMPI_RC_ERR_FAILED,
- "rdcp_dbus_initialize failed");
- }
-
- GET_DBUS_PROPERIES_OR_EXIT(provider_props, REALM_DBUS_SERVICE_PATH,
- REALM_DBUS_PROVIDER_INTERFACE, &status);
-
- g_variant_lookup(provider_props, "Realms", "ao", &iter);
- while (g_variant_iter_next(iter, "&o", &realm_obj_path)) {
- LMI_RealmdKerberosRealm realmd_realm;
-
- GET_DBUS_PROPERIES_OR_EXIT(realm_props, realm_obj_path,
- REALM_DBUS_REALM_INTERFACE, &status);
- if (!SupportsDBusInterface(realm_props, REALM_DBUS_KERBEROS_INTERFACE)) {
- G_VARIANT_FREE(realm_props);
- continue;
- }
- G_VARIANT_FREE(realm_props);
-
- status = LMI_RealmdKerberosRealm_InitFromDBusPath(&realmd_realm, _cb,
- name_space, realm_obj_path);
- if (status.rc != CMPI_RC_OK) {
- goto exit;
- }
-
- KReturnInstance(cr, realmd_realm);
- }
-
- exit:
- G_VARIANT_ITER_FREE(iter);
- G_VARIANT_FREE(provider_props);
- G_VARIANT_FREE(realm_props);
-
- return status;
-}
-
-static CMPIStatus LMI_RealmdKerberosRealmGetInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char** properties)
-{
- return KDefaultGetInstance(
- _cb, mi, cc, cr, cop, properties);
-}
-
-static CMPIStatus LMI_RealmdKerberosRealmCreateInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const CMPIInstance* ci)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_RealmdKerberosRealmModifyInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const CMPIInstance* ci,
- const char** properties)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_RealmdKerberosRealmDeleteInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_RealmdKerberosRealmExecQuery(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char* lang,
- const char* query)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-CMInstanceMIStub(
- LMI_RealmdKerberosRealm,
- LMI_RealmdKerberosRealm,
- _cb,
- LMI_RealmdKerberosRealmInitialize())
-
-static CMPIStatus LMI_RealmdKerberosRealmMethodCleanup(
- CMPIMethodMI* mi,
- const CMPIContext* cc,
- CMPIBoolean term)
-{
- CMReturn(CMPI_RC_OK);
-}
-
-static CMPIStatus LMI_RealmdKerberosRealmInvokeMethod(
- CMPIMethodMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char* meth,
- const CMPIArgs* in,
- CMPIArgs* out)
-{
- return LMI_RealmdKerberosRealm_DispatchMethod(
- _cb, mi, cc, cr, cop, meth, in, out);
-}
-
-CMMethodMIStub(
- LMI_RealmdKerberosRealm,
- LMI_RealmdKerberosRealm,
- _cb,
- LMI_RealmdKerberosRealmInitialize())
-
-KUint32 LMI_RealmdKerberosRealm_ChangeLoginPolicy(
- const CMPIBroker* cb,
- CMPIMethodMI* mi,
- const CMPIContext* context,
- const LMI_RealmdKerberosRealmRef* self,
- const KString* LoginPolicy,
- const KStringA* PermittedAdd,
- const KStringA* PermittedRemove,
- CMPIStatus* status)
-{
- KUint32 result = KUINT32_INIT;
-
- KSetStatus(status, ERR_NOT_SUPPORTED);
- return result;
-}
-
-KUint32 LMI_RealmdKerberosRealm_Deconfigure(
- const CMPIBroker* cb,
- CMPIMethodMI* mi,
- const CMPIContext* context,
- const LMI_RealmdKerberosRealmRef* self,
- CMPIStatus* status)
-{
- KUint32 result = KUINT32_INIT;
-
- KSetStatus(status, ERR_NOT_SUPPORTED);
- return result;
-}
-
-KEXTERN KUint32 LMI_RealmdKerberosRealm_Join(
- const CMPIBroker* cb,
- CMPIMethodMI* mi,
- const CMPIContext* context,
- const LMI_RealmdKerberosRealmRef* self,
- const KUint32* Type,
- const KUint32* Owner,
- const KString* Name,
- const KString* Password,
- const KUint8A* Data,
- const KStringA* OptionNames,
- const KStringA* OptionValues,
- CMPIStatus* status)
-{
- GError *g_error = NULL;
- KUint32 result = KUINT32_INIT;
- const char *cred_type = NULL;
- const char *cred_owner = NULL;
- gchar *data = NULL;
- gsize data_len;
- gchar *dbus_path = NULL;
- GVariant *credentials = NULL;
- GVariant *data_variant = NULL;
- GVariant *options = NULL;
-
- KUint32_Set(&result, LMI_REALMD_RESULT_SUCCESS);
- CMSetStatus(status, CMPI_RC_OK);
-
- if (!rdcp_dbus_initialize(&g_error)) {
- handle_g_error(&g_error, _cb, status, CMPI_RC_ERR_FAILED, "rdcp_dbus_initialize failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!Type->exists || Type->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "Type parameter absent");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!Owner->exists || Owner->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "Owner parameter absent");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!dbus_path_from_instance_id(self->InstanceID.chars, &dbus_path, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED,
- "dbus_path_from_instance_id() failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- switch(Owner->value) {
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_administrator:
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_user:
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_computer:
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_none:
- break;
- default:
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "Invalid Owner parameter");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- cred_type = SupportedJoinCredentialTypes_enum_to_name(Type->value);
- cred_owner = SupportedJoinCredentialOwners_enum_to_name(Owner->value);
-
- switch(Type->value) {
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_ccache:
- if ((Name->exists && !Name->null) || (Password->exists && !Password->null)) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Name & Password parameters must be NULL when Type is ccache");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- if (!Data->exists || Data->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Data parameter must be provided when Type is ccache");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if ((data = get_data_from_KUint8A(Data, &data_len)) == NULL) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_FAILED,
- "unabled to allocate memory");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- data_variant = g_variant_new_from_data(G_VARIANT_TYPE ("ay"),
- data, data_len,
- TRUE, g_free, (gpointer) data);
-
- credentials = g_variant_new("(ssv)", cred_type, cred_owner, data_variant);
- break;
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_password:
- if (!Name->exists || Name->null || !Password->exists || Password->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Name & Password parameters must be provided when Type is password");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- if (Data->exists && !Data->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Data parameter must be NULL when Type is password");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- credentials = g_variant_new("(ssv)", cred_type, cred_owner,
- g_variant_new("(ss)", Name->chars, Password->chars));
-
- break;
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_secrect:
- if ((Name->exists && !Name->null) || (Password->exists && !Password->null)) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Name & Password parameters must be NULL when Type is secret");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- if (!Data->exists || Data->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Data parameter must be provided when Type is secret");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if ((data = get_data_from_KUint8A(Data, &data_len)) == NULL) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_FAILED,
- "unabled to allocate memory");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- credentials = g_variant_new("(ssv)", cred_type, cred_owner,
- g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE,
- data, data_len, 1));
- break;
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_automatic:
- if ((Name->exists && !Name->null) || (Password->exists && !Password->null) ||
- (Data->exists && !Data->null)) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Name, Password & Data parameters must be NULL when Type is secret");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- credentials = g_variant_new ("(ssv)", cred_type, cred_owner,
- g_variant_new_string (""));
-
- break;
- default:
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "Invalid Type parameter");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
-
- if (!build_g_variant_options_from_KStringA(OptionNames, OptionValues, &options, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED,
- "failed to convert options to gvariant");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!dbus_join_call(system_bus, dbus_path, credentials, options, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED, "dbus_join_call() failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
-
- exit:
-
- g_free(data);
- G_VARIANT_FREE(credentials);
- G_VARIANT_FREE(data_variant);
- G_VARIANT_FREE(options);
-
- return result;
-}
-
-KEXTERN KUint32 LMI_RealmdKerberosRealm_Leave(
- const CMPIBroker* cb,
- CMPIMethodMI* mi,
- const CMPIContext* context,
- const LMI_RealmdKerberosRealmRef* self,
- const KUint32* Type,
- const KUint32* Owner,
- const KString* Name,
- const KString* Password,
- const KUint8A* Data,
- const KStringA* OptionNames,
- const KStringA* OptionValues,
- CMPIStatus* status)
-{
- GError *g_error = NULL;
- KUint32 result = KUINT32_INIT;
- const char *cred_type = NULL;
- const char *cred_owner = NULL;
- gchar *data = NULL;
- gsize data_len;
- gchar *dbus_path = NULL;
- GVariant *credentials = NULL;
- GVariant *data_variant = NULL;
- GVariant *options = NULL;
-
- KUint32_Set(&result, LMI_REALMD_RESULT_SUCCESS);
- CMSetStatus(status, CMPI_RC_OK);
-
- if (!rdcp_dbus_initialize(&g_error)) {
- handle_g_error(&g_error, _cb, status, CMPI_RC_ERR_FAILED, "rdcp_dbus_initialize failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!Type->exists || Type->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "Type parameter absent");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!Owner->exists || Owner->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "Owner parameter absent");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!dbus_path_from_instance_id(self->InstanceID.chars, &dbus_path, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED,
- "dbus_path_from_instance_id() failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- switch(Owner->value) {
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_administrator:
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_user:
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_computer:
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_none:
- break;
- default:
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "Invalid Owner parameter");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- cred_type = SupportedLeaveCredentialTypes_enum_to_name(Type->value);
- cred_owner = SupportedLeaveCredentialOwners_enum_to_name(Owner->value);
-
- switch(Type->value) {
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_ccache:
- if ((Name->exists && !Name->null) || (Password->exists && !Password->null)) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Name & Password parameters must be NULL when Type is ccache");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- if (!Data->exists || Data->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Data parameter must be provided when Type is ccache");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if ((data = get_data_from_KUint8A(Data, &data_len)) == NULL) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_FAILED,
- "unabled to allocate memory");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- data_variant = g_variant_new_from_data(G_VARIANT_TYPE ("ay"),
- data, data_len,
- TRUE, g_free, (gpointer) data);
-
- credentials = g_variant_new("(ssv)", cred_type, cred_owner, data_variant);
- break;
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_password:
- if (!Name->exists || Name->null || !Password->exists || Password->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Name & Password parameters must be provided when Type is password");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- if (Data->exists && !Data->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Data parameter must be NULL when Type is password");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- credentials = g_variant_new("(ssv)", cred_type, cred_owner,
- g_variant_new("(ss)", Name->chars, Password->chars));
-
- break;
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_secrect:
- if ((Name->exists && !Name->null) || (Password->exists && !Password->null)) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Name & Password parameters must be NULL when Type is secret");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- if (!Data->exists || Data->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Data parameter must be provided when Type is secret");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if ((data = get_data_from_KUint8A(Data, &data_len)) == NULL) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_FAILED,
- "unabled to allocate memory");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- credentials = g_variant_new("(ssv)", cred_type, cred_owner,
- g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE,
- data, data_len, 1));
- break;
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_automatic:
- if ((Name->exists && !Name->null) || (Password->exists && !Password->null) ||
- (Data->exists && !Data->null)) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER,
- "Name, Password & Data parameters must be NULL when Type is secret");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- credentials = g_variant_new ("(ssv)", cred_type, cred_owner,
- g_variant_new_string (""));
-
- break;
- default:
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "Invalid Type parameter");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
-
- if (!build_g_variant_options_from_KStringA(OptionNames, OptionValues, &options, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED,
- "failed to convert options to gvariant");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!dbus_leave_call(system_bus, dbus_path, credentials, options, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED, "dbus_leave_call() failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
-
- exit:
-
- g_free(data);
- G_VARIANT_FREE(credentials);
- G_VARIANT_FREE(data_variant);
- G_VARIANT_FREE(options);
-
- return result;
-}
-
-
-KONKRET_REGISTRATION(
- "root/cimv2",
- "LMI_RealmdKerberosRealm",
- "LMI_RealmdKerberosRealm",
- "instance method")
diff --git a/src/realmd/LMI_RealmdRealmProvider.c b/src/realmd/LMI_RealmdRealmProvider.c
deleted file mode 100644
index 13e0471..0000000
--- a/src/realmd/LMI_RealmdRealmProvider.c
+++ /dev/null
@@ -1,326 +0,0 @@
-#include <konkret/konkret.h>
-#include <string.h>
-#include "LMI_RealmdRealm.h"
-#include "globals.h"
-#include "rdcp_error.h"
-#include "rdcp_dbus.h"
-#include "rdcp_util.h"
-#include "rdcp_realmdrealm.h"
-
-static const CMPIBroker* _cb = NULL;
-
-CMPIStatus LMI_RealmdRealmRef_InitFromDBusPath(
- LMI_RealmdRealmRef* self,
- const CMPIBroker* cb,
- const char* ns,
- const char* dbus_path)
-{
- CMPIStatus status;
-
- CMSetStatus(&status, CMPI_RC_OK);
-
- LMI_RealmdRealmInitKeys(LMI_RealmdRealmRef, self, dbus_path);
-
- return status;
-}
-
-CMPIStatus LMI_RealmdRealm_InitFromDBusPath(
- LMI_RealmdRealm* self,
- const CMPIBroker* cb,
- const char* ns,
- const char* dbus_path)
-{
- CMPIStatus status;
- GError *g_error = NULL;
- GVariant *realm_props = NULL;
-
- CMSetStatus(&status, CMPI_RC_OK);
-
- if (!rdcp_dbus_initialize(&g_error)) {
- return handle_g_error(&g_error, _cb, &status, CMPI_RC_ERR_FAILED, "rdcp_dbus_initialize failed");
- }
-
- GET_DBUS_PROPERIES_OR_EXIT(realm_props, dbus_path,
- REALM_DBUS_REALM_INTERFACE, &status);
-
- LMI_RealmdRealmInitKeys(LMI_RealmdRealm, self, dbus_path);
- LMI_InitFromDBusRealmProps(LMI_RealmdRealm, self, realm_props);
-
- exit:
- G_VARIANT_FREE(realm_props);
-
- return status;
-}
-
-static void LMI_RealmdRealmInitialize()
-{
-}
-
-static CMPIStatus LMI_RealmdRealmCleanup(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- CMPIBoolean term)
-{
- CMReturn(CMPI_RC_OK);
-}
-
-static CMPIStatus LMI_RealmdRealmEnumInstanceNames(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop)
-{
- return KDefaultEnumerateInstanceNames(
- _cb, mi, cc, cr, cop);
-}
-
-static CMPIStatus LMI_RealmdRealmEnumInstances(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char** properties)
-{
- CMPIStatus status;
- GError *g_error = NULL;
- GVariant *provider_props = NULL;
- GVariantIter *iter = NULL;
- gchar *realm_obj_path;
- const char *name_space = KNameSpace(cop);
-
- CMSetStatus(&status, CMPI_RC_OK);
-
- if (!rdcp_dbus_initialize(&g_error)) {
- return handle_g_error(&g_error, _cb, &status, CMPI_RC_ERR_FAILED, "rdcp_dbus_initialize failed");
- }
-
- GET_DBUS_PROPERIES_OR_EXIT(provider_props, REALM_DBUS_SERVICE_PATH,
- REALM_DBUS_PROVIDER_INTERFACE, &status);
-
- g_variant_lookup(provider_props, "Realms", "ao", &iter);
- while (g_variant_iter_next(iter, "&o", &realm_obj_path)) {
- LMI_RealmdRealm realmd_realm;
-
- status = LMI_RealmdRealm_InitFromDBusPath(&realmd_realm, _cb,
- name_space, realm_obj_path);
- if (status.rc != CMPI_RC_OK) {
- goto exit;
- }
- KReturnInstance(cr, realmd_realm);
- }
-
- exit:
- G_VARIANT_ITER_FREE(iter);
- G_VARIANT_FREE(provider_props);
-
- return status;
-}
-
-static CMPIStatus LMI_RealmdRealmGetInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char** properties)
-{
- CMPIStatus status;
- GError *g_error = NULL;
- LMI_RealmdRealmRef realmdrealm_ref;
- gchar *dbus_path = NULL;
- LMI_RealmdRealm realmd_realm;
-
- CMSetStatus(&status, CMPI_RC_OK);
-
- KReturnIf(LMI_RealmdRealmRef_InitFromObjectPath(&realmdrealm_ref, _cb, cop));
-
- if (!dbus_path_from_instance_id(realmdrealm_ref.InstanceID.chars, &dbus_path, &g_error)) {
- return handle_g_error(&g_error, _cb, &status, CMPI_RC_ERR_FAILED,
- "dbus_path_from_instance_id() failed");
- }
-
- KReturnIf(LMI_RealmdRealm_InitFromDBusPath(&realmd_realm, _cb, KNameSpace(cop), dbus_path));
-
- KReturnInstance(cr, realmd_realm);
-
- return status;
-}
-
-static CMPIStatus LMI_RealmdRealmCreateInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const CMPIInstance* ci)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_RealmdRealmModifyInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const CMPIInstance* ci,
- const char** properties)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_RealmdRealmDeleteInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_RealmdRealmExecQuery(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char* lang,
- const char* query)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-CMInstanceMIStub(
- LMI_RealmdRealm,
- LMI_RealmdRealm,
- _cb,
- LMI_RealmdRealmInitialize())
-
-static CMPIStatus LMI_RealmdRealmMethodCleanup(
- CMPIMethodMI* mi,
- const CMPIContext* cc,
- CMPIBoolean term)
-{
- CMReturn(CMPI_RC_OK);
-}
-
-static CMPIStatus LMI_RealmdRealmInvokeMethod(
- CMPIMethodMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char* meth,
- const CMPIArgs* in,
- CMPIArgs* out)
-{
- return LMI_RealmdRealm_DispatchMethod(
- _cb, mi, cc, cr, cop, meth, in, out);
-}
-
-CMMethodMIStub(
- LMI_RealmdRealm,
- LMI_RealmdRealm,
- _cb,
- LMI_RealmdRealmInitialize())
-
-KUint32 LMI_RealmdRealm_ChangeLoginPolicy(
- const CMPIBroker* cb,
- CMPIMethodMI* mi,
- const CMPIContext* context,
- const LMI_RealmdRealmRef* self,
- const KString* LoginPolicy,
- const KStringA* PermittedAdd,
- const KStringA* PermittedRemove,
- CMPIStatus* status)
-{
- GError *g_error = NULL;
- KUint32 result = KUINT32_INIT;
- gchar *dbus_path = NULL;
- const gchar *login_policy = NULL;
- GVariant *permitted_add = NULL;
- GVariant *permitted_remove = NULL;
- GVariant *options = NULL;
-
- KUint32_Set(&result, LMI_REALMD_RESULT_SUCCESS);
- CMSetStatus(status, CMPI_RC_OK);
-
- if (!rdcp_dbus_initialize(&g_error)) {
- handle_g_error(&g_error, _cb, status, CMPI_RC_ERR_FAILED, "rdcp_dbus_initialize failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!LoginPolicy->exists || LoginPolicy->null) {
- login_policy = "";
- } else {
- login_policy = LoginPolicy->chars;
- }
-
- if (!PermittedAdd->exists || PermittedAdd->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "PermittedAdd parameter absent");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!PermittedRemove->exists || PermittedRemove->null) {
- CMSetStatusWithChars(cb, status, CMPI_RC_ERR_INVALID_PARAMETER, "PermittedRemove parameter absent");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!dbus_path_from_instance_id(self->InstanceID.chars, &dbus_path, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED,
- "dbus_path_from_instance_id() failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!build_g_variant_string_array_from_KStringA(PermittedAdd, &permitted_add, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED,
- "failed to convert PermittedAdd to gvariant array");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!build_g_variant_string_array_from_KStringA(PermittedRemove, &permitted_remove, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED,
- "failed to convert PermittedRemove to gvariant array");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- /* For now we don't pass any options so just create an empty dictionary */
- options = g_variant_new_array(G_VARIANT_TYPE ("{sv}"), NULL, 0);
-
- if (!dbus_change_login_policy_call(system_bus, dbus_path, login_policy,
- permitted_add, permitted_remove,
- options, &g_error)) {
- handle_g_error(&g_error, cb, status, CMPI_RC_ERR_FAILED, "dbus_change_login_policy_call() failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
-
- exit:
-
- G_VARIANT_FREE(permitted_add);
- G_VARIANT_FREE(permitted_remove);
- G_VARIANT_FREE(options);
-
- return result;
-}
-
-KUint32 LMI_RealmdRealm_Deconfigure(
- const CMPIBroker* cb,
- CMPIMethodMI* mi,
- const CMPIContext* context,
- const LMI_RealmdRealmRef* self,
- CMPIStatus* status)
-{
- KUint32 result = KUINT32_INIT;
-
- KSetStatus(status, ERR_NOT_SUPPORTED);
- return result;
-}
-
-KONKRET_REGISTRATION(
- "root/cimv2",
- "LMI_RealmdRealm",
- "LMI_RealmdRealm",
- "instance method")
diff --git a/src/realmd/LMI_RealmdServiceProvider.c b/src/realmd/LMI_RealmdServiceProvider.c
index 8bc1b79..fa4f834 100644
--- a/src/realmd/LMI_RealmdServiceProvider.c
+++ b/src/realmd/LMI_RealmdServiceProvider.c
@@ -1,10 +1,9 @@
#include <konkret/konkret.h>
#include "LMI_RealmdService.h"
+#include "rdcp_util.h"
#include "globals.h"
#include "rdcp_error.h"
#include "rdcp_dbus.h"
-#include "rdcp_util.h"
-#include "rdcp_realmdrealm.h"
static const CMPIBroker* _cb = NULL;
@@ -94,13 +93,7 @@ static CMPIStatus LMI_RealmdServiceEnumInstances(
LMI_RealmdService lmi_realmd_service;
const char *name_space = KNameSpace(cop);
const char *host_name = get_system_name();
- CMPICount i;
GVariant *provider_props = NULL;
- GVariantIter *iter;
- gsize n_items;
- gchar *realm_obj_path;
- gchar *name = NULL;
- gchar *version = NULL;
gchar *joined_domain = NULL;
CMSetStatus(&status, CMPI_RC_OK);
@@ -114,24 +107,6 @@ static CMPIStatus LMI_RealmdServiceEnumInstances(
GET_DBUS_PROPERIES_OR_EXIT(provider_props, REALM_DBUS_SERVICE_PATH,
REALM_DBUS_PROVIDER_INTERFACE, &status);
- g_variant_lookup(provider_props, "Realms", "ao", &iter);
- n_items = g_variant_iter_n_children(iter);
- LMI_RealmdService_Init_Realms(&lmi_realmd_service, n_items);
- for (i = 0; g_variant_iter_next(iter, "&o", &realm_obj_path); i++) {
-#ifdef RDCP_DEBUG
- printf("path[%d]=%s\n", i, realm_obj_path);
-#endif
- LMI_RealmdService_Set_Realms(&lmi_realmd_service, i, realm_obj_path);
- }
-
- if (g_variant_lookup(provider_props, "Name", "&s", &name)) {
- LMI_RealmdService_Set_RealmdName(&lmi_realmd_service, name);
- }
-
- if (g_variant_lookup(provider_props, "Version", "&s", &version)) {
- LMI_RealmdService_Set_RealmdVersion(&lmi_realmd_service, version);
- }
-
if ((joined_domain = get_joined_domain(provider_props))) {
LMI_RealmdService_Set_Domain(&lmi_realmd_service, joined_domain);
}
@@ -139,7 +114,6 @@ static CMPIStatus LMI_RealmdServiceEnumInstances(
KReturnInstance(cr, lmi_realmd_service);
exit:
- G_VARIANT_ITER_FREE(iter);
G_VARIANT_FREE(provider_props);
g_free(joined_domain);
@@ -289,88 +263,6 @@ KUint32 LMI_RealmdService_ChangeAffectedElementsAssignedSequence(
return result;
}
-KUint32 LMI_RealmdService_Discover(
- const CMPIBroker* cb,
- CMPIMethodMI* mi,
- const CMPIContext* context,
- const LMI_RealmdServiceRef* self,
- const KString* Target,
- const KStringA* OptionNames,
- const KStringA* OptionValues,
- KRefA* DiscoveredRealms,
- CMPIStatus* status)
-{
- GError *g_error = NULL;
- KUint32 result = KUINT32_INIT;
- GVariant *options = NULL;
- gint32 relevance = 0;
- gchar **paths = NULL;
- gchar *path, **pp;
- CMPICount i, n_paths;
-
- KUint32_Set(&result, LMI_REALMD_RESULT_SUCCESS);
- CMSetStatus(status, CMPI_RC_OK);
-
- if (!rdcp_dbus_initialize(&g_error)) {
- handle_g_error(&g_error, _cb, status, CMPI_RC_ERR_FAILED, "rdcp_dbus_initialize failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!build_g_variant_options_from_KStringA(OptionNames, OptionValues, &options, &g_error)) {
- handle_g_error(&g_error, _cb, status, CMPI_RC_ERR_FAILED,
- "failed to convert options to gvariant");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if (!dbus_discover_call(system_bus, Target->chars, options,
- &relevance, &paths, &g_error)) {
- handle_g_error(&g_error, _cb, status, CMPI_RC_ERR_FAILED, "dbus_discover_call() failed");
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
-#ifdef RDCP_DEBUG
- print_paths(paths, "%s: target=%s, paths:", __FUNCTION__, Target->chars);
-#endif
-
- for (pp = paths, path = *pp++, n_paths = 0; path; path = *pp++, n_paths++);
-
- if (!KRefA_Init(DiscoveredRealms, cb, n_paths)) {
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- for (pp = paths, path = *pp++, i = 0; path; path = *pp++, i++) {
- LMI_RealmdRealmRef realmdrealm_ref;
- CMPIObjectPath *realmdrealm_op;
-
-
- *status = LMI_RealmdRealmRef_InitFromDBusPath(&realmdrealm_ref, cb,
- LMI_RealmdServiceRef_NameSpace((LMI_RealmdServiceRef*)self), path);
- if (status->rc != CMPI_RC_OK) {
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
-
- if ((realmdrealm_op = LMI_RealmdRealmRef_ToObjectPath(&realmdrealm_ref, status)) == NULL) {
- goto exit;
- }
- if (!KRefA_Set(DiscoveredRealms, i, realmdrealm_op)) {
- KUint32_Set(&result, LMI_REALMD_RESULT_FAILED);
- goto exit;
- }
- }
-
- exit:
-
- G_VARIANT_FREE(options);
- g_strfreev(paths);
-
- return result;
-}
-
// FIXME
static gboolean
get_credential_supported_owner(GVariant *supported, const gchar *cred_type, const gchar **cred_owner_return)
@@ -408,6 +300,25 @@ is_credential_supported (GVariant *supported, const gchar *cred_type, const gcha
return FALSE;
}
+static gboolean
+supports_dbus_interface(GVariant *dbus_props, const char *dbus_interface)
+{
+ gboolean result = FALSE;
+ GVariantIter *iter = NULL;
+ gchar *value;
+
+ if (g_variant_lookup(dbus_props, "SupportedInterfaces", "as", &iter)) {
+ while (g_variant_iter_next(iter, "&s", &value)) {
+ if (strcmp(value, dbus_interface) == 0) {
+ result = TRUE;
+ break;
+ }
+ }
+ G_VARIANT_ITER_FREE(iter);
+ }
+ return result;
+}
+
KUint32 LMI_RealmdService_Join_Leave_Domain(
bool join,
const CMPIBroker* cb,
@@ -487,7 +398,7 @@ KUint32 LMI_RealmdService_Join_Leave_Domain(
/* Lookup the realm properties so we can determine the supported DBus interfaces */
GET_DBUS_PROPERIES_OR_EXIT(realm_props, dbus_path,
REALM_DBUS_REALM_INTERFACE, status);
- if (!SupportsDBusInterface(realm_props, REALM_DBUS_KERBEROS_MEMBERSHIP_INTERFACE)) {
+ if (!supports_dbus_interface(realm_props, REALM_DBUS_KERBEROS_MEMBERSHIP_INTERFACE)) {
SetCMPIStatus(cb, status, CMPI_RC_ERR_FAILED, "Domain (%s) does not support joining or leaving",
Domain->chars);
KUint32_Set(&result, LMI_REALMD_RESULT_DOMAIN_DOES_NOT_SUPPORT_JOINING);
diff --git a/src/realmd/LMI_ServiceAffectsRealmdRealmProvider.c b/src/realmd/LMI_ServiceAffectsRealmdRealmProvider.c
deleted file mode 100644
index a80ab01..0000000
--- a/src/realmd/LMI_ServiceAffectsRealmdRealmProvider.c
+++ /dev/null
@@ -1,252 +0,0 @@
-#include <konkret/konkret.h>
-#include "LMI_ServiceAffectsRealmdRealm.h"
-#include "rdcp_util.h"
-#include "globals.h"
-#include "rdcp_error.h"
-#include "rdcp_dbus.h"
-#include "rdcp_util.h"
-#include "rdcp_realmdrealm.h"
-
-static const CMPIBroker* _cb;
-
-static void LMI_ServiceAffectsRealmdRealmInitialize()
-{
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmCleanup(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- CMPIBoolean term)
-{
- CMReturn(CMPI_RC_OK);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmEnumInstanceNames(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop)
-{
- return KDefaultEnumerateInstanceNames(
- _cb, mi, cc, cr, cop);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmEnumInstances(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char** properties)
-{
- CMPIStatus status;
- GError *g_error = NULL;
- GVariant *provider_props = NULL;
- GVariantIter *iter = NULL;
- gchar *realm_obj_path;
- LMI_RealmdServiceRef realmd_service_ref;
- LMI_ServiceAffectsRealmdRealm service_affects;
- const char *name_space = KNameSpace(cop);
- const char *host_name = get_system_name();
-
- CMSetStatus(&status, CMPI_RC_OK);
-
- LMI_InitRealmdServiceKeys(LMI_RealmdServiceRef, &realmd_service_ref, name_space, host_name);
-
- if (!rdcp_dbus_initialize(&g_error)) {
- return handle_g_error(&g_error, _cb, &status, CMPI_RC_ERR_FAILED, "rdcp_dbus_initialize failed");
- }
-
- GET_DBUS_PROPERIES_OR_EXIT(provider_props, REALM_DBUS_SERVICE_PATH,
- REALM_DBUS_PROVIDER_INTERFACE, &status);
-
- g_variant_lookup(provider_props, "Realms", "ao", &iter);
- while (g_variant_iter_next(iter, "&o", &realm_obj_path)) {
- LMI_RealmdRealmRef realmd_realm_ref;
-
- status = LMI_RealmdRealmRef_InitFromDBusPath(&realmd_realm_ref, _cb, name_space, realm_obj_path);
- if (status.rc != CMPI_RC_OK) {
- goto exit;
- }
-
- LMI_ServiceAffectsRealmdRealm_Init(&service_affects, _cb, name_space);
- LMI_ServiceAffectsRealmdRealm_Set_AffectedElement(&service_affects, &realmd_realm_ref);
- LMI_ServiceAffectsRealmdRealm_Set_AffectingElement(&service_affects, &realmd_service_ref);
- LMI_ServiceAffectsRealmdRealm_Init_ElementEffects(&service_affects, 1);
- LMI_ServiceAffectsRealmdRealm_Set_ElementEffects(&service_affects, 0,
- LMI_ServiceAffectsRealmdRealm_ElementEffects_Manages);
-
- KReturnInstance(cr, service_affects);
- }
-
- exit:
- G_VARIANT_ITER_FREE(iter);
- G_VARIANT_FREE(provider_props);
-
- return status;
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmGetInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char** properties)
-{
- return KDefaultGetInstance(
- _cb, mi, cc, cr, cop, properties);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmCreateInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const CMPIInstance* ci)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmModifyInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const CMPIInstance* ci,
- const char**properties)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmDeleteInstance(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmExecQuery(
- CMPIInstanceMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char* lang,
- const char* query)
-{
- CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmAssociationCleanup(
- CMPIAssociationMI* mi,
- const CMPIContext* cc,
- CMPIBoolean term)
-{
- CMReturn(CMPI_RC_OK);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmAssociators(
- CMPIAssociationMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char* assocClass,
- const char* resultClass,
- const char* role,
- const char* resultRole,
- const char** properties)
-{
- return KDefaultAssociators(
- _cb,
- mi,
- cc,
- cr,
- cop,
- LMI_ServiceAffectsRealmdRealm_ClassName,
- assocClass,
- resultClass,
- role,
- resultRole,
- properties);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmAssociatorNames(
- CMPIAssociationMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char* assocClass,
- const char* resultClass,
- const char* role,
- const char* resultRole)
-{
- return KDefaultAssociatorNames(
- _cb,
- mi,
- cc,
- cr,
- cop,
- LMI_ServiceAffectsRealmdRealm_ClassName,
- assocClass,
- resultClass,
- role,
- resultRole);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmReferences(
- CMPIAssociationMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char* assocClass,
- const char* role,
- const char** properties)
-{
- return KDefaultReferences(
- _cb,
- mi,
- cc,
- cr,
- cop,
- LMI_ServiceAffectsRealmdRealm_ClassName,
- assocClass,
- role,
- properties);
-}
-
-static CMPIStatus LMI_ServiceAffectsRealmdRealmReferenceNames(
- CMPIAssociationMI* mi,
- const CMPIContext* cc,
- const CMPIResult* cr,
- const CMPIObjectPath* cop,
- const char* assocClass,
- const char* role)
-{
- return KDefaultReferenceNames(
- _cb,
- mi,
- cc,
- cr,
- cop,
- LMI_ServiceAffectsRealmdRealm_ClassName,
- assocClass,
- role);
-}
-
-CMInstanceMIStub(
- LMI_ServiceAffectsRealmdRealm,
- LMI_ServiceAffectsRealmdRealm,
- _cb,
- LMI_ServiceAffectsRealmdRealmInitialize())
-
-CMAssociationMIStub(
- LMI_ServiceAffectsRealmdRealm,
- LMI_ServiceAffectsRealmdRealm,
- _cb,
- LMI_ServiceAffectsRealmdRealmInitialize())
-
-KONKRET_REGISTRATION(
- "root/cimv2",
- "LMI_ServiceAffectsRealmdRealm",
- "LMI_ServiceAffectsRealmdRealm",
- "instance association")
diff --git a/src/realmd/doc/class_diagram.svg b/src/realmd/doc/class_diagram.svg
index 1b962d3..8cf2243 100644
--- a/src/realmd/doc/class_diagram.svg
+++ b/src/realmd/doc/class_diagram.svg
@@ -52,15 +52,15 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
- inkscape:cx="235.3264"
+ inkscape:cx="236.5764"
inkscape:cy="611.39239"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1920"
- inkscape:window-height="1002"
- inkscape:window-x="0"
- inkscape:window-y="27"
+ inkscape:window-height="1051"
+ inkscape:window-x="1680"
+ inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:snap-grids="true"
inkscape:snap-bbox="true">
@@ -172,102 +172,5 @@
id="tspan3865"
x="270.92188"
y="412.43054">HostedService</tspan></text>
- <g
- id="g3018"
- transform="translate(-0.3488455,69.844081)">
- <g
- transform="translate(-221,2e-6)"
- id="g3030-5-6">
- <g
- id="g3022-6-4"
- transform="matrix(1,0,0,0.97395887,0,10.489247)">
- <rect
- y="402.36218"
- x="350.39706"
- height="25"
- width="120"
- id="rect3008-5-7"
- style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.41732287;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- </g>
- <path
- style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 350.39707,417.36218 120,0"
- id="path3014-2-0"
- inkscape:connector-curvature="0" />
- </g>
- <text
- sodipodi:linespacing="125%"
- id="text3010-2-2"
- y="412.41025"
- x="189.21738"
- style="font-size:8px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
- xml:space="preserve"><tspan
- y="412.41025"
- x="189.21738"
- id="tspan3012-9-8"
- sodipodi:role="line">RealmdRealm</tspan></text>
- </g>
- <g
- id="g3062"
- transform="translate(-0.3488455,139.68809)">
- <g
- transform="translate(-221,2e-6)"
- id="g3030-5-6-3">
- <g
- id="g3022-6-4-4"
- transform="matrix(1,0,0,0.97395887,0,10.489247)">
- <rect
- y="402.36218"
- x="350.39706"
- height="25"
- width="120"
- id="rect3008-5-7-3"
- style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.41732287;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- </g>
- <path
- style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 350.39707,417.36218 120,0"
- id="path3014-2-0-8"
- inkscape:connector-curvature="0" />
- </g>
- <text
- sodipodi:linespacing="125%"
- id="text3010-2-2-5"
- y="412.41025"
- x="189.21738"
- style="font-size:8px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
- xml:space="preserve"><tspan
- y="412.41025"
- x="189.21738"
- id="tspan3012-9-8-4"
- sodipodi:role="line">RealmdKerberosRealm</tspan></text>
- </g>
- <text
- xml:space="preserve"
- style="font-size:8px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
- x="199.47266"
- y="447.2489"
- id="text3961"
- sodipodi:linespacing="125%"><tspan
- sodipodi:role="line"
- id="tspan3963"
- x="199.47266"
- y="447.2489">ServiceAffectsElement</tspan></text>
- <path
- style="fill:none;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 189.04822,470.39873 0,-43.67629"
- id="path4498"
- inkscape:connector-type="polyline"
- inkscape:connector-curvature="3"
- inkscape:connection-start="#g3018"
- inkscape:connection-start-point="d4"
- inkscape:connection-end="#g3085"
- inkscape:connection-end-point="d4" />
- <path
- style="fill:none;stroke:#0000ff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
- d="m 189.04822,542.42392 0,-43.67622"
- id="path4500"
- inkscape:connector-type="polyline"
- inkscape:connector-curvature="3" />
</g>
</svg>
diff --git a/src/realmd/doc/examples/realmd-cim b/src/realmd/doc/examples/realmd-cim
index 90ae9d5..eb3f9be 100644..100755
--- a/src/realmd/doc/examples/realmd-cim
+++ b/src/realmd/doc/examples/realmd-cim
@@ -8,43 +8,16 @@ import pywbem
#----------------------------------------------------------------------
-def do_list(conn, options, args):
- realms = conn.EnumerateInstances('LMI_RealmdKerberosRealm')
-
- print "%d realms" % (len(realms))
-
- for realm in realms:
- if options.verbose > 1:
- # Very verbose, dump all properties
- property_names = sorted(realm.keys())
- for name in property_names:
- value = realm[name]
- print " %s: %s" % (name, value)
-
- print realm['RealmName']
- print " type: kerberos"
- print " realm-name: %s" % realm['RealmName']
- print " domain-name: %s" % realm['DomainName']
-
- is_configured = True
- configured = realm['Configured']
- if not configured:
- configured = "no"
- is_configured = False
- elif configured == "KerberosMembership":
- configured = "kerberos-member"
-
- print " configured: %s" % configured
-
- for detail in zip(realm['DetailNames'], realm['DetailValues']):
- print " %s: %s" % (detail[0], detail[1])
-
- if is_configured:
- print " login-formats: %s" % ", ".join(realm['LoginFormats'])
- print " login-policy: %s" % realm['LoginPolicy']
- print " permitted-logins: %s" % ", ".join(realm['PermittedLogins'])
+def do_status(conn, options, args):
+ try:
+ realmd_service = conn.EnumerateInstances('LMI_RealmdService')[0]
+ except Exception, e:
+ raise ValueError("could not obtain realmd service")
- print
+ if realmd_service["Domain"]:
+ print "Joined to the domain: %s" % realmd_service["Domain"]
+ else:
+ print "Not joined to a domain"
def do_join(conn, options, args):
# Validate arguments
@@ -94,53 +67,11 @@ def do_leave(conn, options, args):
except Exception, e:
raise ValueError("Leave failed (%s)" % (e))
-
-
-def do_discover(conn, options, args):
- # Validate arguments
- if len(args) != 1:
- raise ValueError("You must supply exactly 1 domain.")
-
- domain = args[0]
-
- if (options.verbose):
- print "Discovering domain: %s" % domain
-
- try:
- realmd_service_instance_name = conn.EnumerateInstanceNames('LMI_RealmdService')[0]
- except Exception, e:
- raise ValueError("could not obtain realmd service")
-
- try:
- retval, outparams = conn.InvokeMethod("Discover", realmd_service_instance_name,
- Target=domain)
- except Exception, e:
- raise ValueError("Join failed (%s)" % (e))
-
- realm_refs = outparams['DiscoveredRealms']
-
- print "%d Discovered" % len(realm_refs)
- for realm_ref in realm_refs:
- #print realm_ref
- realm = conn.GetInstance(realm_ref)
- print realm['RealmName']
- print " Name: %s" % realm['RealmName']
- print " Configured: %s" % realm['Configured']
- print " Supported Interfaces: %s" % ", ".join(realm['SupportedInterfaces'])
- for detail in zip(realm['DetailNames'], realm['DetailValues']):
- print " %s: %s" % (detail[0], detail[1])
- print " login-formats: %s" % ", ".join(realm['LoginFormats'])
- print " login-policy: %s" % realm['LoginPolicy']
- print " permitted-logins: %s" % ", ".join(realm['PermittedLogins'])
-
-
-
#----------------------------------------------------------------------
def main():
- actions = {'list': do_list,
- 'discover': do_discover,
+ actions = {'status': do_status,
'join': do_join,
'leave': do_leave,
}
@@ -148,8 +79,7 @@ def main():
usage ='''
%%prog [options] <action> <arg> ...
- %%prog [options] list
- %%prog [options] discover domain
+ %%prog [options] status
%%prog [options] join user password domain
%%prog [options] leave user password domain
diff --git a/src/realmd/rdcp_realmdrealm.h b/src/realmd/rdcp_realmdrealm.h
deleted file mode 100644
index 491bc73..0000000
--- a/src/realmd/rdcp_realmdrealm.h
+++ /dev/null
@@ -1,310 +0,0 @@
-#ifndef __RDCP_REALMDREALM_H__
-#define __RDCP_REALMDREALM_H__
-
-#include <strings.h>
-#include "LMI_RealmdRealm.h"
-#include "LMI_RealmdKerberosRealm.h"
-
-
-KINLINE LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_Enum
-SupportedJoinCredentialTypes_name_to_enum(const char *name)
-{
- if (strcasecmp(name, "ccache"))
- return LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_ccache;
- if (strcasecmp(name, "password"))
- return LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_password;
- if (strcasecmp(name, "secrect"))
- return LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_secrect;
- if (strcasecmp(name, "automatic"))
- return LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_automatic;
- return 0;
-}
-
-KINLINE const char *
-SupportedJoinCredentialTypes_enum_to_name(LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_Enum value)
-{
- switch(value) {
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_ccache:
- return "ccache";
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_password:
- return "password";
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_secrect:
- return "secrect";
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialTypes_automatic:
- return "automatic";
- default:
- return NULL;
- }
-}
-
-KINLINE LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_Enum
-SupportedJoinCredentialOwners_name_to_enum(const char *name)
-{
- if (strcasecmp(name, "administrator"))
- return LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_administrator;
- if (strcasecmp(name, "user"))
- return LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_user;
- if (strcasecmp(name, "computer"))
- return LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_computer;
- if (strcasecmp(name, "none"))
- return LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_none;
- return 0;
-}
-
-KINLINE const char *
-SupportedJoinCredentialOwners_enum_to_name(LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_Enum value)
-{
- switch(value) {
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_administrator:
- return "administrator";
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_user:
- return "user";
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_computer:
- return "computer";
- case LMI_RealmdKerberosRealm_SupportedJoinCredentialOwners_none:
- return "none";
- default:
- return NULL;
- }
-}
-
-KINLINE LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_Enum
-SupportedLeaveCredentialTypes_name_to_enum(const char *name)
-{
- if (strcasecmp(name, "ccache"))
- return LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_ccache;
- if (strcasecmp(name, "password"))
- return LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_password;
- if (strcasecmp(name, "secrect"))
- return LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_secrect;
- if (strcasecmp(name, "automatic"))
- return LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_automatic;
- return 0;
-}
-
-KINLINE const char *SupportedLeaveCredentialTypes_enum_to_name(LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_Enum value)
-{
- switch(value) {
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_ccache:
- return "ccache";
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_password:
- return "password";
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_secrect:
- return "secrect";
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialTypes_automatic:
- return "automatic";
- default:
- return NULL;
- }
-}
-
-KINLINE LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_Enum
-SupportedLeaveCredentialOwners_name_to_enum(const char *name)
-{
- if (strcasecmp(name, "administrator"))
- return LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_administrator;
- if (strcasecmp(name, "user"))
- return LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_user;
- if (strcasecmp(name, "computer"))
- return LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_computer;
- if (strcasecmp(name, "none"))
- return LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_none;
- return 0;
-}
-
-KINLINE const char *
-SupportedLeaveCredentialOwners_enum_to_name(LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_Enum value)
-{
- switch(value) {
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_administrator:
- return "administrator";
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_user:
- return "user";
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_computer:
- return "computer";
- case LMI_RealmdKerberosRealm_SupportedLeaveCredentialOwners_none:
- return "none";
- default:
- return NULL;
- }
-}
-
-#define LMI_RealmdRealmInitKeys(klass, obj, dbus_path) \
-{ \
- gchar *instance_id = NULL; \
- const char *host_name = get_system_name(); \
- \
- klass##_Init(obj, cb, ns); \
- \
- instance_id = instance_id_from_dbus_path(dbus_path); \
- klass##_Set_InstanceID(obj, instance_id); \
- g_free(instance_id); \
- \
- klass##_Set_SystemCreationClassName(obj, get_system_creation_class_name()); \
- klass##_Set_SystemName(obj, host_name); \
-}
-
-KINLINE bool SupportsDBusInterface(GVariant *dbus_props, const char *dbus_interface)
-{
- bool result = false;
- GVariantIter *iter = NULL;
- gchar *value;
-
- if (g_variant_lookup(dbus_props, "SupportedInterfaces", "as", &iter)) {
- while (g_variant_iter_next(iter, "&s", &value)) {
- if (strcmp(value, dbus_interface) == 0) {
- result = true;
- break;
- }
- }
- G_VARIANT_ITER_FREE(iter);
- }
- return result;
-}
-
-#define LMI_InitFromDBusRealmProps(klass, obj, dbus_props) \
-{ \
- gchar *value = NULL; \
- gchar *name = NULL; \
- gsize n_items; \
- GVariantIter *iter; \
- CMPICount i; \
- \
- if (g_variant_lookup(dbus_props, "Name", "&s", &value)) { \
- klass##_Set_RealmName(obj, value); \
- } \
- \
- if (g_variant_lookup(dbus_props, "Configured", "&s", &value)) { \
- if (strlen(value) == 0) { \
- klass##_Null_Configured(obj); \
- } else { \
- char *interface_name = get_short_dbus_interface_name(value); \
- klass##_Set_Configured(obj, interface_name); \
- g_free(interface_name); \
- } \
- } \
- \
- if (g_variant_lookup(dbus_props, "SupportedInterfaces", "as", &iter)) { \
- n_items = g_variant_iter_n_children(iter); \
- klass##_Init_SupportedInterfaces(obj, n_items); \
- for (i = 0; g_variant_iter_next(iter, "&s", &value); i++) { \
- char *interface_name = get_short_dbus_interface_name(value); \
- klass##_Set_SupportedInterfaces(obj, i, interface_name); \
- g_free(interface_name); \
- } \
- G_VARIANT_ITER_FREE(iter); \
- } \
- \
- if (g_variant_lookup(dbus_props, "Details", "a(ss)", &iter)) { \
- n_items = g_variant_iter_n_children(iter); \
- klass##_Init_DetailNames(obj, n_items); \
- klass##_Init_DetailValues(obj, n_items); \
- for (i = 0; g_variant_iter_next(iter, "(&s&s)", &name, &value); i++) { \
- klass##_Set_DetailNames(obj, i, name); \
- klass##_Set_DetailValues(obj, i, value); \
- } \
- G_VARIANT_ITER_FREE(iter); \
- } \
- \
- if (g_variant_lookup(dbus_props, "LoginFormats", "as", &iter)) { \
- n_items = g_variant_iter_n_children(iter); \
- klass##_Init_LoginFormats(obj, n_items); \
- for (i = 0; g_variant_iter_next(iter, "&s", &value); i++) { \
- klass##_Set_LoginFormats(obj, i, value); \
- } \
- G_VARIANT_ITER_FREE(iter); \
- } \
- \
- if (g_variant_lookup(dbus_props, "LoginPolicy", "&s", &value)) { \
- klass##_Set_LoginPolicy(obj, value); \
- } \
- \
- if (g_variant_lookup(dbus_props, "PermittedLogins", "as", &iter)) { \
- n_items = g_variant_iter_n_children(iter); \
- klass##_Init_PermittedLogins(obj, n_items); \
- for (i = 0; g_variant_iter_next(iter, "&s", &value); i++) { \
- klass##_Set_PermittedLogins(obj, i, value); \
- } \
- G_VARIANT_ITER_FREE(iter); \
- } \
-}
-
-#define LMI_InitFromDBusKerberosRealmProps(klass, obj, dbus_props) \
-{ \
- gchar *value = NULL; \
- \
- if (g_variant_lookup(dbus_props, "RealmName", "&s", &value)) { \
- klass##_Set_RealmName(obj, value); \
- } \
- \
- if (g_variant_lookup(dbus_props, "DomainName", "&s", &value)) { \
- klass##_Set_DomainName(obj, value); \
- } \
-}
-
-#define LMI_InitFromDBusKerberosMembershipProps(klass, obj, dbus_props) \
-{ \
- gchar *value = NULL; \
- gchar *type = NULL; \
- gchar *owner = NULL; \
- gsize n_items; \
- GVariantIter *iter; \
- CMPICount i; \
- \
- if (g_variant_lookup(dbus_props, "SuggestedAdministrator", "&s", &value)) { \
- klass##_Set_SuggestedAdministrator(obj, value); \
- } \
- \
- if (g_variant_lookup(dbus_props, "SupportedJoinCredentials", "a(ss)", &iter)) { \
- n_items = g_variant_iter_n_children(iter); \
- klass##_Init_SupportedJoinCredentialTypes(obj, n_items); \
- klass##_Init_SupportedJoinCredentialOwners(obj, n_items); \
- for (i = 0; g_variant_iter_next(iter, "(&s&s)", &type, &owner); i++) { \
- klass##_Set_SupportedJoinCredentialTypes(obj, i, \
- SupportedJoinCredentialTypes_name_to_enum(type)); \
- klass##_Set_SupportedJoinCredentialOwners(obj, i, \
- SupportedJoinCredentialOwners_name_to_enum(owner)); \
- } \
- G_VARIANT_ITER_FREE(iter); \
- } \
- \
- if (g_variant_lookup(dbus_props, "SupportedLeaveCredentials", "a(ss)", &iter)) { \
- n_items = g_variant_iter_n_children(iter); \
- klass##_Init_SupportedLeaveCredentialTypes(obj, n_items); \
- klass##_Init_SupportedLeaveCredentialOwners(obj, n_items); \
- for (i = 0; g_variant_iter_next(iter, "(&s&s)", &type, &owner); i++) { \
- klass##_Set_SupportedLeaveCredentialTypes(obj, i, \
- SupportedLeaveCredentialTypes_name_to_enum(type)); \
- klass##_Set_SupportedLeaveCredentialOwners(obj, i, \
- SupportedLeaveCredentialOwners_name_to_enum(owner)); \
- } \
- G_VARIANT_ITER_FREE(iter); \
- } \
-}
-
-CMPIStatus LMI_RealmdRealmRef_InitFromDBusPath(
- LMI_RealmdRealmRef* self,
- const CMPIBroker* cb,
- const char* ns,
- const char* dbus_path);
-
-
-CMPIStatus LMI_RealmdRealm_InitFromDBusPath(
- LMI_RealmdRealm* self,
- const CMPIBroker* cb,
- const char* ns,
- const char* dbus_path);
-
-CMPIStatus LMI_RealmdKerberosRealmRef_InitFromDBusPath(
- LMI_RealmdKerberosRealmRef* self,
- const CMPIBroker* cb,
- const char* ns,
- const char* dbus_path);
-
-CMPIStatus LMI_RealmdKerberosRealm_InitFromDBusPath(
- LMI_RealmdKerberosRealm* self,
- const CMPIBroker* cb,
- const char* ns,
- const char* dbus_path);
-
-#endif /* __RDCP_REALMDREALM_H__ */