diff options
-rw-r--r-- | mof/60_LMI_PowerManagement.mof | 5 | ||||
-rw-r--r-- | mof/60_LMI_Realmd.mof | 438 | ||||
-rw-r--r-- | src/python/openlmi/common/IndicationManager.py | 36 | ||||
-rw-r--r-- | src/python/openlmi/common/JobManager.py | 95 | ||||
-rw-r--r-- | src/python/openlmi/common/TimerManager.py | 29 | ||||
-rw-r--r-- | src/realmd/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/realmd/LMI_RealmdKerberosRealmProvider.c | 627 | ||||
-rw-r--r-- | src/realmd/LMI_RealmdRealmProvider.c | 326 | ||||
-rw-r--r-- | src/realmd/LMI_RealmdServiceProvider.c | 131 | ||||
-rw-r--r-- | src/realmd/LMI_ServiceAffectsRealmdRealmProvider.c | 252 | ||||
-rw-r--r-- | src/realmd/doc/class_diagram.svg | 105 | ||||
-rwxr-xr-x[-rw-r--r--] | src/realmd/doc/examples/realmd-cim | 92 | ||||
-rw-r--r-- | src/realmd/rdcp_realmdrealm.h | 310 |
13 files changed, 165 insertions, 2284 deletions
diff --git a/mof/60_LMI_PowerManagement.mof b/mof/60_LMI_PowerManagement.mof index c285f79..7657818 100644 --- a/mof/60_LMI_PowerManagement.mof +++ b/mof/60_LMI_PowerManagement.mof @@ -55,11 +55,6 @@ class LMI_HostedPowerManagementService: CIM_HostedService }; [ Provider("cmpi:cmpiLMI_PowerManagement") ] -class LMI_ConcreteJob: CIM_ConcreteJob -{ -}; - -[ Provider("cmpi:cmpiLMI_PowerManagement") ] class LMI_ElementCapabilities: CIM_ElementCapabilities { [ Key, Min(1), Description("The managed element.") ] diff --git a/mof/60_LMI_Realmd.mof b/mof/60_LMI_Realmd.mof index 2063fc6..696a1e6 100644 --- a/mof/60_LMI_Realmd.mof +++ b/mof/60_LMI_Realmd.mof @@ -5,69 +5,6 @@ Provider("cmpi:cmpiLMI_Realmd") ] class LMI_RealmdService : CIM_Service { - [Description ( - "The name of the provider. This is not normally displayed " - "to the user, but may be useful for diagnostics or debugging.")] - string RealmdName; - - [Description ( - "The version of the provider. This is not normally used in " - "logic, but may be useful for diagnostics or debugging.")] - string RealmdVersion; - - [Description ( - "The locale used for messages.")] - // FIXME: we should support CIM_LocalizationCapabilities but there is no way query supported locales. - string Locale; - - [Description ( - "A list of known, enrolled or discovered realms. All realms " - "that this provider knows about are listed here. As realms " - "are discovered they are added to this list.")] - string Realms[]; - - [Description ( - - "Discover realms for the given target. The input target is " - "usually a domain or realm name, perhaps typed by a user. If an " - "empty target string is provided the realm provider should try " - "to discover a default realm if possible (eg: from DHCP).\n " - "\n" - "The behavior of the method may be modified via optional " - "<name,value> pairs called \"options\" passed an array of " - "option names and option values. The <name,value> pair is " - "formed by indexing into the name array and finding it's value " - "at the same index in the value array.\n " - "\n" - "The currently defined options are:\n " - "\n" - "\"client-software\": a string containing the client software " - "identifier that the returned realms should match.\n" - "\n" - "\"server-software\": a string containing the client software " - "identifier that the returned realms should match.\n" - )] - - uint32 Discover( - [In, Description ( - "What realms to discover")] - string Target, - [In, ArrayType ( "Indexed" ), Description ( - "This array is correlated with the OptionValues array. " - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (name,value) tuple " - "can be constructed.")] - string OptionNames[], - [In, ArrayType ( "Indexed" ), Description ( - "This array is correlated with the OptionNames array. " - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (name,value) tuple " - "can be constructed.")] - string OptionValues[], - [In ( false ), Out, Description ( - "Array of references to discovered realms")] - LMI_RealmdRealm REF DiscoveredRealms[]); - // Proof of concept simplfied API starts here [Description ( @@ -130,368 +67,6 @@ class LMI_RealmdService : CIM_Service string OptionValues[]); }; -[ Description ( - "Represents one realm. " - - "Contains generic information about a realm, and useful properties " - "for introspecting what kind of realm this is and how to work with " - "the realm. " - - "Use LMI_RealmdService.Discover() to get access to help populate the " - "LMI_RealmdService.Realms property. " - - "Different realms support various ways to configure them on the " - "system. LMI_RealmdRealm.Configured property to determine if a realm " - "is configured. If it is configured the property will be set to class " - "used to configure it. " - - "To configure a realm use the method on the LMIRealmdRealm subclass " - "designed for that purpose, for example the " - "LMI_RealmdKerberosRealm.Join() method. " - - "To deconfigure a realm from the current system, you can use the " - "Deconfigure() method. "), - Provider("cmpi:cmpiLMI_Realmd") ] -class LMI_RealmdRealm : CIM_LogicalElement -{ - - [Key, Override ( "InstanceID" ), - Description ( - "Within the scope of the instantiating Namespace, " - "InstanceID opaquely and uniquely identifies an instance " - "of this class. In order to ensure uniqueness within the " - "NameSpace, the value of InstanceID shall be constructed " - "using the following \'preferred\' algorithm: \n" - "<OrgID>:<LocalID> \n" - "<LocalID> will be DBus object path correlated to this instance.")] - string InstanceID; - - [Key, Description ( "The scoping System\'s CCN." ), - MaxLen ( 256 ), - Propagated ( "CIM_System.CreationClassName" )] - string SystemCreationClassName; - - [Key, Description ( "The scoping System\'s Name." ), - MaxLen ( 256 ), - Propagated ( "CIM_System.Name" )] - string SystemName; - - [Description ( - "Name of the realm, " - "appropriate for display to end users where necessary.")] - string RealmName; - - [Description ( - "If this property is NULL then the realm is not configured." - "Otherwise the realm is configured and the property contains " - "a string which is the interface that represents how it was " - "configured, e.g. \"KerberosMembership\".")] - string Configured; - - [Description ( - "Indicates the types of operations this realm is capable of." - "Current possible values are: \"Kerberos\", \"KerberosMembership\".")] - string SupportedInterfaces[]; - - [Description ( - "Extra detail information expressed as (name,value) pairs. " - "This array is correlated with the DetailValues array. " - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (name,value) tuple " - "can be constructed."), - ArrayType ( "Indexed" )] - string DetailNames[]; - [Description ( - "Extra detail information expressed as (name,value) pairs. " - "This array is correlated with the DetailNames array. " - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (name,value) tuple " - "can be constructed."), - ArrayType ( "Indexed" )] - string DetailValues[]; - - [Description ( - "Software packages that are required in order for a join to " - "succeed. These are either simple strings like \"sssd\" " - "or strings with an operator and version number like \"sssd >= 1.9.0\" " - "These values are specific to the packaging system that is being run.")] - string RequiredPackages[]; - - [Description ( - "Supported formats for login to this realm. This is only " - "relevant once the realm has been enrolled. The formats " - "will contain a \"%U\" in the string, which indicates where the " - "user name should be placed. The formats may contain a \"%D\" in " - "the string which indicates where a domain name should be placed. " - "The first format in the list is the preferred format for login names.")] - string LoginFormats[]; - - [Description ( - "The policy for logging into this computer using this realm. " - "The policy can be changed using the ChangeLoginPolicy() method. " - "The following policies are predefined. Not all providers support " - "all these policies and there may be provider specific policies or " - "multiple policies represented in the string: " - "\"allow-any-login\": allow login by any authenticated user present in this realm. " - "\"allow-permitted-logins\": only allow the logins permitted in the PermittedLogins property. " - "\"deny-any-login\": don't allow any logins via authenticated users of this realm.")] - string LoginPolicy; - - [Description ( - "The list of permitted authenticated users allowed to login " - "into this computer. This is only relevant if the LoginPolicy property " - "contains the \"allow-permitted-logins\" string.")] - string PermittedLogins[]; - - [Description ( - "Change the login policy and/or permitted logins for this realm. " - "Not all realms support the all the various login policies. An " - "error will be returned if the new login policy is not supported. " - "You may specify a NULL value for the login_policy argument which " - "will cause no change in the policy itself. If the policy is changed, " - "it will be reflected in the LoginPolicy property. " - "The permitted_add and permitted_remove arguments represent lists of " - "login names that should be added and removed from the PermittedLogins property.")] - uint32 ChangeLoginPolicy( - [In, Description ( - "the new login policy or NULL")] - string LoginPolicy, - [In, Description ( - "a list of logins to permit")] - string PermittedAdd[], - [In, Description ( - "a list of logins to not permit")] - string PermittedRemove[]); - - [Description ( - "Deconfigure: deconfigure this realm" - "\n" - "Deconfigure this realm from the local machine with standard " - "default behavior. " - "\n" - "The behavior of this method depends on the which configuration " - "interface is present in the Configured property. It does not " - "always delete membership accounts in the realm, but just " - "reconfigures the local machine so it no longer is configured " - "for the given realm. In some cases the implementation may try " - "to update membership accounts, but this is not guaranteed." - "\n" - "Various configuration interfaces may support more specific ways " - "to deconfigure a realm in a specific way, such as the " - "KerberosMembership.Leave() method.")] - uint32 Deconfigure(); - -}; - - -[ Description ( - "Credentials supported for joining. " - "\n" - "Various kinds of credentials that are supported when calling the " - "Join() method. " - "\n" - "Each credential is represented by a type, and an owner. The type " - "denotes which kind of credential is passed to the method. The " - "owner indicates to the client how to prompt the user or obtain " - "the credential, and to the service how to use the credential. " - "\n" - - "The various types are: " - "\"ccache\": " - "The credentials should contain an array of octets containing" - "the data from a kerberos credential cache file. " - "The data must be passed in the Data parameter, the Name & Password parameters must be NULL. " - "\n" - "\"password\": " - "The credentials should contain a pair of strings representing " - "a name and password. The name may contain a realm in the " - "standard kerberos format. If a realm is missing, it will " - "default to this realm. " - "The name must be passed in the Name parameter, the password must be passed " - "in the Password parameter, the Data parameter must be NULL. " - "\n" - "\"secret\": " - "The credentials should contain a string secret. This is " - "usually used for one time passwords. " - "The data must be passed in the Data parameter, the Name & Password parameters must be NULL. " - "\n" - "\"automatic\": " - "The credentials should contain an empty string. Using " - "\"automatic\" indicates that default or system credentials are " - "to be used. " - "The Name, Password & Data parameters must be NULL. " - "\n" - "The various owners are: " - "\n" - "\"administrator\": " - "The credentials belong to a kerberos user principal. " - "The caller may use this as a hint to prompt the user " - "for administrative credentials. " - "\n" - "\"user\": " - "The credentials belong to a kerberos user principal. The " - "caller may use this as a hint to prompt the user for his " - "(possibly non-administrative) credentials. " - "\n" - "\"computer\": " - "The credentials belong to a computer account. " - "\n" - "\"none\": " - "The credentials have an unspecified owner, such as a one time " - "secret."), - Provider("cmpi:cmpiLMI_Realmd") ] -class LMI_RealmdKerberosRealm : LMI_RealmdRealm -{ - [Description ( - "The kerberos name for this realm. This is usually in upper " - "case.")] - string RealmName; - - [Description ( - "The DNS domain name for this realm.")] - string DomainName; - - [Description ( - "The common administrator name for this type of realm. This " - "can be used by clients as a hint when prompting the user for " - "administrative authentication.")] - string SuggestedAdministrator; - - [Description ( - "This array is correlated with the SupportedJoinCredentialOwners array. " - - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (type,owner) tuple " - "can be constructed. The set of tuples formed by correlating " - "the two arrays define the supported combinations for the Join " - "method."), - ValueMap { "1", "2", "3", "4"}, - Values { "ccache", "password", "secrect", "automatic" }, - ArrayType ( "Indexed" )] - uint32 SupportedJoinCredentialTypes[]; - - [Description ( - "This array is correlated with the SupportedJoinCredentialTypes array. " - - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (type,owner) tuple " - "can be constructed. The set of tuples formed by correlating " - "the two arrays define the supported combinations for the Join " - "method."), - ValueMap { "1", "2", "3", "4"}, - Values { "administrator", "user", "computer", "none" }, - ArrayType ( "Indexed" )] - uint32 SupportedJoinCredentialOwners[]; - - [Description ( - "This array is correlated with the SupportedLeaveCredentialOwners array. " - - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (type,owner) tuple " - "can be constructed. The set of tuples formed by correlating " - "the two arrays define the supported combinations for the Leave " - "method."), - ValueMap { "1", "2", "3", "4"}, - Values { "ccache", "password", "secrect", "automatic" }, - ArrayType ( "Indexed" )] - uint32 SupportedLeaveCredentialTypes[]; - - [Description ( - "This array is correlated with the SupportedLeaveCredentialTypes array. " - - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (type,owner) tuple " - "can be constructed. The set of tuples formed by correlating " - "the two arrays define the supported combinations for the Leave " - "method."), - ValueMap { "1", "2", "3", "4"}, - Values { "administrator", "user", "computer", "none" }, - ArrayType ( "Indexed" )] - uint32 SupportedLeaveCredentialOwners[]; - - // FIXME - The Data parameter should be uint8 array with the octetstring qualifier - // but the octetstring qualier doesn't seem to do anything and you end up with - // an array of CMPIValue's with one octet in each, this is highly inefficent and awkward. - - [Description ( - "")] - uint32 Join( - [In, Description ( - "Credential type, see LMI_RealmdKerberosRealm description"), - ValueMap { "1", "2", "3", "4"}, - Values { "ccache", "password", "secrect", "automatic" }] - uint32 Type, - [In, Description ( - "Credential owner, see LMI_RealmdKerberosRealm description"), - ValueMap { "1", "2", "3", "4"}, - Values { "administrator", "user", "computer", "none" }] - uint32 Owner, - [In, Description ( - "The name may contain a realm in the standard kerberos format. " - "If a realm is missing, it will default to this realm. " - "Used when the Type is password.")] - string Name, - [In, Description ( - "Authentication password. " - "Used when the Type is password.")] - string Password, - [In, Description ( - "Binary data when the Type is ccache or secret"), - OctetString] - uint8 Data[], - [In, ArrayType ( "Indexed" ), Description ( - "This array is correlated with the OptionValues array. " - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (name,value) tuple " - "can be constructed.")] - string OptionNames[], - [In, ArrayType ( "Indexed" ), Description ( - "This array is correlated with the OptionNames array. " - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (name,value) tuple " - "can be constructed.")] - string OptionValues[]); - - [Description ( - "")] - uint32 Leave( - [In, Description ( - "Credential type, see LMI_RealmdKerberosRealm description"), - ValueMap { "1", "2", "3", "4"}, - Values { "ccache", "password", "secrect", "automatic" }] - uint32 Type, - [In, Description ( - "Credential owner, see LMI_RealmdKerberosRealm description"), - ValueMap { "1", "2", "3", "4"}, - Values { "administrator", "user", "computer", "none" }] - uint32 Owner, - [In, Description ( - "The name may contain a realm in the standard kerberos format. " - "If a realm is missing, it will default to this realm. " - "Used when the Type is password.")] - string Name, - [In, Description ( - "Authentication password. " - "Used when the Type is password.")] - string Password, - [In, Description ( - "Binary data when the Type is ccache or secret"), - OctetString] - uint8 Data[], - [In, ArrayType ( "Indexed" ), Description ( - "This array is correlated with the OptionValues array. " - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (name,value) tuple " - "can be constructed.")] - string OptionNames[], - [In, ArrayType ( "Indexed" ), Description ( - "This array is correlated with the OptionNames array. " - "Each entry is related to the entries in the other array " - "located at the same index. In this way a (name,value) tuple " - "can be constructed.")] - string OptionValues[]); -}; - [ Association, Provider("cmpi:cmpiLMI_Realmd") ] class LMI_HostedRealmdService: CIM_HostedService @@ -504,16 +79,3 @@ class LMI_HostedRealmdService: CIM_HostedService Description("The Central Instance of realm management") ] LMI_RealmdService REF Dependent; }; - -[ Association, - Provider("cmpi:cmpiLMI_Realmd") ] -class LMI_ServiceAffectsRealmdRealm: CIM_ServiceAffectsElement -{ - [ Override("AffectingElement"), - Description("The Central Instance of realm management") ] - LMI_RealmdService REF AffectingElement; - - [ Override("AffectedElement"), - Description("The managed Identity") ] - LMI_RealmdRealm REF AffectedElement; -}; diff --git a/src/python/openlmi/common/IndicationManager.py b/src/python/openlmi/common/IndicationManager.py index a17703f..f9a1655 100644 --- a/src/python/openlmi/common/IndicationManager.py +++ b/src/python/openlmi/common/IndicationManager.py @@ -253,6 +253,8 @@ class IndicationManager(singletonmixin.Singleton): """ SEVERITY_INFO = pywbem.Uint16(2) # CIM_Indication.PerceivedSeverity + COMMAND_STOP = 1 # Command to the IndicationManager thread to stop. + @cmpi_logging.trace_method def __init__(self, env, nameprefix, namespace, ns_interop=None, queue=None): @@ -295,7 +297,7 @@ class IndicationManager(singletonmixin.Singleton): new_broker = ch.PrepareAttachThread() self._indication_sender = threading.Thread( target=self._send_indications_loop, args=(new_broker,)) - self._indication_sender.daemon = True + self._indication_sender.daemon = False self._indication_sender.start() @property @@ -714,7 +716,7 @@ class IndicationManager(singletonmixin.Singleton): :param fltr_id: (``string``) ID of the filter to check. """ with self._access_lock: - return ( class_name in self._filters + return (class_name in self._filters and fltr_id in self._filters[class_name]) def _send_indications_loop(self, broker): @@ -726,9 +728,31 @@ class IndicationManager(singletonmixin.Singleton): """ broker.AttachThread() while True: - indication = self._queue.get() - cmpi_logging.logger.trace_info("Delivering indication %s" % - (str(indication.path))) - broker.DeliverIndication(self.namespace, indication) + command = self._queue.get() + + if isinstance(command, pywbem.CIMInstance) : + indication = command + cmpi_logging.logger.trace_info("Delivering indication %s" % + (str(indication.path))) + broker.DeliverIndication(self.namespace, indication) + + elif isinstance(command, int): + cmpi_logging.logger.trace_info("Received command %d", command) + if command == self.COMMAND_STOP: + if hasattr(self._queue, "task_done"): + self._queue.task_done() + break + if hasattr(self._queue, "task_done"): self._queue.task_done() + + cmpi_logging.logger.info("Stopped Indication thread.") + + @cmpi_logging.trace_method + def shutdown(self): + """ + Stop the thread. This method blocks until the thread is safely + destroyed. + """ + self._queue.put(self.COMMAND_STOP) + self._indication_sender.join() diff --git a/src/python/openlmi/common/JobManager.py b/src/python/openlmi/common/JobManager.py index fc12d7e..9f977c9 100644 --- a/src/python/openlmi/common/JobManager.py +++ b/src/python/openlmi/common/JobManager.py @@ -650,6 +650,8 @@ class JobManager(object): timeout. """ + COMMAND_STOP = 1 + IND_JOB_PERCENT_UPDATED = "PercentUpdated" IND_JOB_SUCCEEDED = "Succeeded" IND_JOB_FAILED = "Failed" @@ -723,7 +725,7 @@ class JobManager(object): # Start the worker thread (don't forget to register it at CIMOM) self.worker = threading.Thread(target=self._worker_main) - self.worker.daemon = True + self.worker.daemon = False self.worker.start() # Various classnames for job-related classes, with correct infixes. @@ -855,30 +857,40 @@ class JobManager(object): This is the main loop of the job queue. It just processes enqueued jobs and never ends. """ + cmpi_logging.logger.info("Started Job thread.") while True: - job = self.queue.get() - # we need to protect from changes between checking state and - # setting new state - job.lock() - if job.job_state == Job.STATE_QUEUED: - # the job was not cancelled - job.change_state(Job.STATE_RUNNING) - job.unlock() - cmpi_logging.logger.info("Starting job %s: '%s'" % - (job.the_id, job.job_name)) - - job.execute() - if job.error: - cmpi_logging.logger.warn("Job %s: '%s' finished with error:" - " %s" % (job.the_id, job.job_name, str(job.error))) - else: - cmpi_logging.logger.info("Job %s: '%s' finished OK" % + command = self.queue.get() + if isinstance(command, Job): + # we need to protect from changes between checking state and + # setting new state + job = command + job.lock() + if job.job_state == Job.STATE_QUEUED: + # the job was not cancelled + job.change_state(Job.STATE_RUNNING) + job.unlock() + cmpi_logging.logger.info("Starting job %s: '%s'" % (job.the_id, job.job_name)) - else: - # just skip suspended and terminated jobs - job.unlock() + + job.execute() + if job.error: + cmpi_logging.logger.warn("Job %s: '%s' finished with error:" + " %s" % (job.the_id, job.job_name, str(job.error))) + else: + cmpi_logging.logger.info("Job %s: '%s' finished OK" % + (job.the_id, job.job_name)) + else: + # just skip suspended and terminated jobs + job.unlock() + + elif isinstance(command, int): + self.queue.task_done() + break + self.queue.task_done() + cmpi_logging.logger.info("Stopped Job thread.") + @cmpi_logging.trace_method def get_next_id(self): """ @@ -906,6 +918,47 @@ class JobManager(object): inst['InstanceID'] = job.get_instance_id() return self.job_provider.get_instance(None, inst) + @cmpi_logging.trace_method + def shutdown(self, timeout=1): + """ + Stop the thread. If a job is running, it may leave the job process + (mkfs, resize2fs, ...) and the worker thread (waiting for the process to + finish) still running. + + JobManager still needs Indication Manager and TimeManager working at + this point! + + :param timeout: Nr. of seconds to wait for the current job. Afterwards + the thread is abandoned, leaving the process still running. + """ + # Empty the queue, we don't want the worker to proceed with any other + # queued job. + while not self.queue.empty(): + queue.get(False) + queue.task_done() + + self.queue.put(self.COMMAND_STOP) + self.worker.join(timeout) + + # Cancel all running/suspended/queued jobs. + # This will send indications. + for job in self.jobs.itervalues(): + if job.state in (Job.STATE_QUEUED, Job.STATE_SUSPENDED, + Job.STATE_RUNNING): + job.cancel() + + if self.worker.isAlive(): + # There is no way, how to stop the thread in Python, so abandon it. + self.worker.daemon = True + self.indication_manager = None + self.timer_manager = None + + def can_shutdown(self): + """ + Return True, if there is no running Job. + """ + return self.queue.empty() + class LMI_ConcreteJob(CIMProvider2): """ diff --git a/src/python/openlmi/common/TimerManager.py b/src/python/openlmi/common/TimerManager.py index 5eb39ae..42d48cd 100644 --- a/src/python/openlmi/common/TimerManager.py +++ b/src/python/openlmi/common/TimerManager.py @@ -94,6 +94,7 @@ class Timer(object): A class representing a timer. A timer has a timeout and after the timeout, given callback is called and the timer is deleted. """ + @cmpi_logging.trace_method def __init__(self, timer_manager, name, callback=None, *args, **kwargs): """ @@ -193,6 +194,10 @@ class TimerManager(singletonmixin.Singleton): you provider initialization. """ + # Commands to the timer thread + COMMAND_STOP = 1 + COMMAND_RESCHEDULE = 2 + @cmpi_logging.trace_method def __init__(self, env=None): """ @@ -215,7 +220,7 @@ class TimerManager(singletonmixin.Singleton): self._timer_thread = threading.Thread( target=self._timer_loop, args=(new_broker,)) - self._timer_thread.daemon = True + self._timer_thread.daemon = False self._timer_thread.start() def create_timer(self, name, callback=None, *args, **kwargs): @@ -239,17 +244,22 @@ class TimerManager(singletonmixin.Singleton): """ if broker: broker.AttachThread() + cmpi_logging.logger.info("Started Timer thread.") while True: self._handle_expired() timeout = self._find_timeout() if timeout != 0: # Wait for the timeout or any change in timers. try: - self._queue.get(timeout=timeout) + command = self._queue.get(timeout=timeout) self._queue.task_done() + if command == self.COMMAND_STOP: + break # stop the thread + # process COMMAND_RESCHEDULE in next loop except Queue.Empty: # Timeout has happened, ignore the exception. pass + cmpi_logging.logger.info("Stopped Timer thread.") @cmpi_logging.trace_method def _handle_expired(self): @@ -320,7 +330,7 @@ class TimerManager(singletonmixin.Singleton): with self._lock: self._timers.append(timer) # Wake up the timer manager thread. - self._queue.put("") + self._queue.put(self.COMMAND_RESCHEDULE) cmpi_logging.logger.trace_info("Timer: Timer %s added" % (timer._name)) @cmpi_logging.trace_method @@ -336,7 +346,7 @@ class TimerManager(singletonmixin.Singleton): except ValueError: pass # Wake up the timer manager thread. - self._queue.put("") + self._queue.put(self.COMMAND_RESCHEDULE) cmpi_logging.logger.trace_info("Timer: Timer %s removed" % (timer._name)) @@ -350,6 +360,15 @@ class TimerManager(singletonmixin.Singleton): """ return self._clock.now() + @cmpi_logging.trace_method + def shutdown(self): + """ + Stop the thread. This method blocks until the thread is safely + destroyed. + """ + self._queue.put(self.COMMAND_STOP) + self._timer_thread.join() + if __name__ == "__main__": cmpi_logging.logger = cmpi_logging.CMPILogger("") import time @@ -398,3 +417,5 @@ if __name__ == "__main__": t15.start(1.5) time.sleep(4) + + mgr.stop_thread() 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__ */ |