diff options
Diffstat (limited to 'src/sssd/LMI_SSSDResponderProvider.c')
-rw-r--r-- | src/sssd/LMI_SSSDResponderProvider.c | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/src/sssd/LMI_SSSDResponderProvider.c b/src/sssd/LMI_SSSDResponderProvider.c new file mode 100644 index 0000000..d826a72 --- /dev/null +++ b/src/sssd/LMI_SSSDResponderProvider.c @@ -0,0 +1,223 @@ +/* + Authors: + Pavel Březina <pbrezina@redhat.com> + + Copyright (C) 2014 Red Hat + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <konkret/konkret.h> +#include "LMI_SSSDResponder.h" +#include "LMI_SSSD_utils.h" + +static const CMPIBroker* _cb = NULL; + +static void LMI_SSSDResponderInitialize(const CMPIContext *ctx) +{ + lmi_init(PROVIDER_NAME, _cb, ctx, NULL); +} + +static CMPIStatus LMI_SSSDResponderCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_SSSDResponderEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + return KDefaultEnumerateInstanceNames( + _cb, mi, cc, cr, cop); +} + +static CMPIStatus LMI_SSSDResponderEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + LMI_SSSDResponder lmi_responder; + const char *namespace = KNameSpace(cop); + const char *responders[] = {"nss", "pam", "sudo", "ssh", "autofs", + "pac", "ifp", NULL}; + int i; + + for (i = 0; responders[i] != NULL; i++) { + LMI_SSSDResponder_Init(&lmi_responder, _cb, namespace); + + /* Set keys */ + LMI_SSSDResponder_Set_Name(&lmi_responder, responders[i]); + + /* Set values */ + LMI_SSSDResponder_Set_DebugLevel(&lmi_responder, 0x3ff0); + LMI_SSSDResponder_Set_IsEnabled(&lmi_responder, true); + LMI_SSSDResponder_Set_Description(&lmi_responder, "SSSD Responder"); + + KReturnInstance(cr, lmi_responder); + } + + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_SSSDResponderGetInstance( + 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_SSSDResponderCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_SSSDResponderModifyInstance( + 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_SSSDResponderDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_SSSDResponderExecQuery( + 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_SSSDResponder, + LMI_SSSDResponder, + _cb, + LMI_SSSDResponderInitialize(ctx)) + +static CMPIStatus LMI_SSSDResponderMethodCleanup( + CMPIMethodMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_SSSDResponderInvokeMethod( + CMPIMethodMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* meth, + const CMPIArgs* in, + CMPIArgs* out) +{ + return LMI_SSSDResponder_DispatchMethod( + _cb, mi, cc, cr, cop, meth, in, out); +} + +CMMethodMIStub( + LMI_SSSDResponder, + LMI_SSSDResponder, + _cb, + LMI_SSSDResponderInitialize(ctx)) + +KUint32 LMI_SSSDResponder_SetDebugLevelPermanently( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_SSSDResponderRef* self, + const KUint16* debug_level, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_SSSDResponder_SetDebugLevelTemporarily( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_SSSDResponderRef* self, + const KUint16* debug_level, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_SSSDResponder_Enable( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_SSSDResponderRef* self, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_SSSDResponder_Disable( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_SSSDResponderRef* self, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_SSSDResponder", + "LMI_SSSDResponder", + "instance method") |