Blame SOURCES/0001-daemon-if-no-local-users-check-if-machine-is-enrolle.patch

c6c770
From 54b207649979475ea7f1fa5eaaea94be31d20935 Mon Sep 17 00:00:00 2001
c6c770
From: Ray Strode <rstrode@redhat.com>
c6c770
Date: Fri, 13 Dec 2019 15:16:06 -0500
c6c770
Subject: [PATCH] daemon: if no local users, check if machine is enrolled in
c6c770
 network
c6c770
c6c770
GDM will show gnome initial-setup if a machine has no local users.
c6c770
But it's totally possible that a machine has only remote users,
c6c770
and shouldn't have a local user.
c6c770
c6c770
This commit detects that case, and avoids setting the HasNoUsers
c6c770
property.
c6c770
---
c6c770
 data/org.freedesktop.realmd.xml | 730 ++++++++++++++++++++++++++++++++
c6c770
 src/daemon.c                    |  63 ++-
c6c770
 src/meson.build                 |   1 +
c6c770
 src/org.freedesktop.realmd.xml  | 730 ++++++++++++++++++++++++++++++++
c6c770
 4 files changed, 1520 insertions(+), 4 deletions(-)
c6c770
 create mode 100644 data/org.freedesktop.realmd.xml
c6c770
 create mode 100644 src/org.freedesktop.realmd.xml
c6c770
c6c770
diff --git a/data/org.freedesktop.realmd.xml b/data/org.freedesktop.realmd.xml
c6c770
new file mode 100644
c6c770
index 0000000..c34a47a
c6c770
--- /dev/null
c6c770
+++ b/data/org.freedesktop.realmd.xml
c6c770
@@ -0,0 +1,730 @@
c6c770
+
c6c770
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
c6c770
+<node name="/">
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.Provider:
c6c770
+	  @short_description: a realm provider
c6c770
+
c6c770
+	  Various realm providers represent different software implementations
c6c770
+	  that provide access to realms or domains.
c6c770
+
c6c770
+	  This interface is implemented by individual providers, but is
c6c770
+	  aggregated globally at the system bus name
c6c770
+	  <literal>org.freedesktop.realmd</literal>
c6c770
+	  with the object path <literal>/org/freedesktop/realmd</literal>
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.Provider">
c6c770
+
c6c770
+		
c6c770
+		  Name: the name of the provider
c6c770
+
c6c770
+		  The name of the provider. This is not normally displayed
c6c770
+		  to the user, but may be useful for diagnostics or debugging.
c6c770
+		-->
c6c770
+		<property name="Name" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Version: the version of the provider
c6c770
+
c6c770
+		  The version of the provider. This is not normally used in
c6c770
+		  logic, but may be useful for diagnostics or debugging.
c6c770
+		-->
c6c770
+		<property name="Version" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Realms: a list of realms
c6c770
+
c6c770
+		  A list of known, enrolled or discovered realms. All realms
c6c770
+		  that this provider knows about are listed here. As realms
c6c770
+		  are discovered they are added to this list.
c6c770
+
c6c770
+		  Each realm is represented by the DBus object path of the
c6c770
+		  realm object.
c6c770
+		-->
c6c770
+		<property name="Realms" type="ao" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Discover:
c6c770
+		  @string: an input string to discover realms for
c6c770
+		  @options: options for the discovery operation
c6c770
+		  @relevance: the relevance of the returned results
c6c770
+		  @realm: a list of realms discovered
c6c770
+
c6c770
+		  Discover realms for the given string. The input @string is
c6c770
+		  usually a domain or realm name, perhaps typed by a user. If
c6c770
+		  an empty string is provided, the realm provider should try to
c6c770
+		  discover a default realm, if possible (e.g. from DHCP).
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		    <listitem><para><literal>client-software</literal>: a string
c6c770
+		      containing the client software identifier that the returned
c6c770
+		      realms should match.</para></listitem>
c6c770
+		    <listitem><para><literal>server-software</literal>: a string
c6c770
+		      containing the client software identifier that the returned
c6c770
+		      realms should match.</para></listitem>
c6c770
+		    <listitem><para><literal>membership-software</literal>: a string
c6c770
+		      containing the membership software identifier that the returned
c6c770
+		      realms should match.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  The @relevance returned can be used to rank results from
c6c770
+		  different discover calls to different providers. Implementors
c6c770
+		  should return a positive number if the provider highly
c6c770
+		  recommends that the realms be handled by this provider,
c6c770
+		  or a zero if it can possibly handle the realms. Negative numbers
c6c770
+		  should be returned if no realms are found.
c6c770
+
c6c770
+		  This method does not return an error when no realms are
c6c770
+		  discovered. It simply returns an empty @realm list.
c6c770
+
c6c770
+		  To see diagnostic information about the discovery process,
c6c770
+		  connect to the org.freedesktop.realmd.Service::Diagnostics
c6c770
+		  signal.
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.discover-realm</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may
c6c770
+		  return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the discovery could not be run for some reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to perform a discovery
c6c770
+		      operation.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="Discover">
c6c770
+			<arg name="string" type="s" direction="in"/>
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+			<arg name="relevance" type="i" direction="out"/>
c6c770
+			<arg name="realm" type="ao" direction="out"/>
c6c770
+		</method>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.Service:
c6c770
+	  @short_description: the realmd service
c6c770
+
c6c770
+	  Global calls for managing the realmd service. Usually you'll want
c6c770
+	  to use #org.freedesktop.realmd.Provider instead.
c6c770
+
c6c770
+	  This interface is implemented by the realmd service, and is always
c6c770
+	  available at the object path <literal>/org/freedesktop/realmd</literal>
c6c770
+
c6c770
+	  The service also implements the
c6c770
+	  <literal>org.freedesktop.DBus.ObjectManager</literal> interface which
c6c770
+	  makes it easy to retrieve all realmd objects and properties in one go.
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.Service">
c6c770
+
c6c770
+		
c6c770
+		  Cancel:
c6c770
+		  @operation: the operation to cancel
c6c770
+
c6c770
+		  Cancel a realmd operation. To be able to cancel an operation,
c6c770
+		  pass a uniquely chosen <literal>operation</literal> string
c6c770
+		  identifier as an option in the method's <literal>options</literal>
c6c770
+		  argument.
c6c770
+
c6c770
+		  These operation string identifiers should be unique per client
c6c770
+		  calling the realmd service.
c6c770
+
c6c770
+		  It is not guaranteed that the service can or will cancel the
c6c770
+		  operation. For example, the operation may have already completed
c6c770
+		  by the time this method is handled. The caller of the operation
c6c770
+		  method will receive a
c6c770
+		  <literal>org.freedesktop.realmd.Error.Cancelled</literal>
c6c770
+		  if the operation was cancelled.
c6c770
+		-->
c6c770
+		<method name="Cancel">
c6c770
+			<arg name="operation" type="s" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+		
c6c770
+		  SetLocale:
c6c770
+		  @locale: the locale for the client
c6c770
+
c6c770
+		  Set the language @locale for the client. This locale is used
c6c770
+		  for error messages. The locale is used until the next time
c6c770
+		  this method is called, the client disconnects, or the client
c6c770
+		  calls #org.freedesktop.realmd.Service.Release().
c6c770
+		-->
c6c770
+		<method name="SetLocale">
c6c770
+			<arg name="locale" type="s" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+		
c6c770
+		  Diagnostics:
c6c770
+		  @data: diagnostic data
c6c770
+		  @operation: the operation this data resulted from
c6c770
+
c6c770
+		  This signal is fired when diagnostics result from an operation
c6c770
+		  in the provider or one of its realms.
c6c770
+
c6c770
+		  It is not guaranteed that this signal is emitted once per line.
c6c770
+		  More than one line may be contained in @data, or a partial
c6c770
+		  line. New line characters are embedded in @data.
c6c770
+
c6c770
+		  This signal is sent explicitly to the client which invoked an
c6c770
+		  operation method. In order to tell which operation this
c6c770
+		  diagnostic data results from, pass a unique
c6c770
+		  <literal>operation</literal> string identifier in the
c6c770
+		  <literal>options</literal> argument of the operation method.
c6c770
+		  That same identifier will be passed back via the @operation
c6c770
+		  argument of this signal.
c6c770
+		-->
c6c770
+		<signal name="Diagnostics">
c6c770
+			<arg name="data" type="s"/>
c6c770
+			<arg name="operation" type="s"/>
c6c770
+		</signal>
c6c770
+
c6c770
+		
c6c770
+		  Release:
c6c770
+
c6c770
+		  Normally, realmd waits until all clients have disconnected
c6c770
+		  before exiting itself sometime later. Long lived clients
c6c770
+		  can call this method to allow the realmd service to quit.
c6c770
+		  This is an optimization. The daemon will not exit immediately.
c6c770
+		  It is safe to call this multiple times.
c6c770
+		-->
c6c770
+		<method name="Release">
c6c770
+			
c6c770
+		</method>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.Realm:
c6c770
+	  @short_description: a realm
c6c770
+
c6c770
+	  Represents one realm.
c6c770
+
c6c770
+	  Contains generic information about a realm, and useful properties for
c6c770
+	  introspecting what kind of realm this is and how to work with
c6c770
+	  the realm.
c6c770
+
c6c770
+	  Use #org.freedesktop.realmd.Provider:Realms or
c6c770
+	  #org.freedesktop.realmd.Provider.Discover() to get access to some
c6c770
+	  kerberos realm objects.
c6c770
+
c6c770
+	  Realms will always implement additional interfaces, such as
c6c770
+	  #org.freedesktop.realmd.Kerberos.  Do not assume that all realms
c6c770
+	  implement that kerberos interface. Use the
c6c770
+	  #org.freedesktop.realmd.Realm:SupportedInterfaces property to see
c6c770
+	  which interfaces are supported.
c6c770
+
c6c770
+	  Different realms support various ways to configure them on the
c6c770
+	  system. Use the #org.freedesktop.realmd.Realm:Configured property
c6c770
+	  to determine if a realm is configured. If it is configured, the
c6c770
+	  property will be set to the interface of the mechanism that was
c6c770
+	  used to configure it.
c6c770
+
c6c770
+	  To configure a realm, look in the
c6c770
+	  #org.freedesktop.realmd.Realm:SupportedInterfaces property for a
c6c770
+	  recognized purpose-specific interface that can be used for
c6c770
+	  configuration, such as the
c6c770
+	  #org.freedesktop.realmd.KerberosMembership interface and its
c6c770
+	  #org.freedesktop.realmd.KerberosMembership.Join() method.
c6c770
+
c6c770
+	  To deconfigure a realm from the current system, you can use the
c6c770
+	  #org.freedesktop.realmd.Realm.Deconfigure() method. In addition, some
c6c770
+	  of the configuration specific interfaces provide methods to
c6c770
+	  deconfigure a realm in a specific way, such as the
c6c770
+	  #org.freedesktop.realmd.KerberosMembership.Leave() method.
c6c770
+
c6c770
+	  The various properties are guaranteed to have been updated before
c6c770
+	  the operation methods return, if they change state.
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.Realm">
c6c770
+
c6c770
+		
c6c770
+		  Name: the realm name
c6c770
+
c6c770
+		  This is the name of the realm, appropriate for display to
c6c770
+		  end users where necessary.
c6c770
+		-->
c6c770
+		<property name="Name" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Configured: whether this domain is configured and how
c6c770
+
c6c770
+		  If this property is an empty string, then the realm is not
c6c770
+		  configured. Otherwise the realm is configured, and contains
c6c770
+		  a string which is the interface that represents how it was
c6c770
+		  configured, for example #org.freedesktop.realmd.KerberosMembership.
c6c770
+		-->
c6c770
+		<property name="Configured" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Deconfigure: deconfigure this realm
c6c770
+
c6c770
+		  Deconfigure this realm from the local machine with standard
c6c770
+		  default behavior.
c6c770
+
c6c770
+		  The behavior of this method depends on the which configuration
c6c770
+		  interface is present in the
c6c770
+		  #org.freedesktop.realmd.Realm.Configured property. It does not
c6c770
+		  always delete membership accounts in the realm, but just
c6c770
+		  reconfigures the local machine so it no longer is configured
c6c770
+		  for the given realm. In some cases the implementation may try
c6c770
+		  to update membership accounts, but this is not guaranteed.
c6c770
+
c6c770
+		  Various configuration interfaces may support more specific ways
c6c770
+		  to deconfigure a realm in a specific way, such as the
c6c770
+		  #org.freedesktop.realmd.KerberosMembership.Leave() method.
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.deconfigure-realm</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the deconfigure failed for a generic reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to deconfigure a
c6c770
+		      realm.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotConfigured</literal>:
c6c770
+		      returned if this realm is not configured on the machine.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Busy</literal>:
c6c770
+		      returned if the service is currently performing another operation like
c6c770
+		      join or leave.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="Deconfigure">
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+		
c6c770
+		  SupportedInterfaces:
c6c770
+
c6c770
+		  Additional supported interfaces of this realm. This includes
c6c770
+		  interfaces that contain more information about the realm,
c6c770
+		  such as #org.freedesktop.realmd.Kerberos and interfaces
c6c770
+		  which contain methods for configuring a realm, such as
c6c770
+		  #org.freedesktop.realmd.KerberosMembership.
c6c770
+		-->
c6c770
+		<property name="SupportedInterfaces" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Details: informational details about the realm
c6c770
+
c6c770
+		  Informational details about the realm. The following values
c6c770
+		  should be present:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>server-software</literal>:
c6c770
+		      identifier of the software running on the server (e.g.
c6c770
+		      <literal>active-directory</literal>).</para></listitem>
c6c770
+		    <listitem><para><literal>client-software</literal>:
c6c770
+		      identifier of the software running on the client (e.g.
c6c770
+		      <literal>sssd</literal>).</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<property name="Details" type="a(ss)" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  RequiredPackages: prerequisite software
c6c770
+
c6c770
+		  Software packages that are required in order for a join to
c6c770
+		  succeed. These are either simple strings like <literal>sssd</literal>,
c6c770
+		  or strings with an operator and version number like
c6c770
+		  <literal>sssd >= 1.9.0</literal>
c6c770
+
c6c770
+		  These values are specific to the packaging system that is
c6c770
+		  being run.
c6c770
+		-->
c6c770
+		<property name="RequiredPackages" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  LoginFormats: supported formats for login names
c6c770
+
c6c770
+		  Supported formats for login to this realm. This is only
c6c770
+		  relevant once the realm has been enrolled. The formats
c6c770
+		  will contain a <literal>%U</literal> in the string, which
c6c770
+		  indicate where the user name should be placed. The formats
c6c770
+		  may contain a <literal>%D</literal> in the string which
c6c770
+		  indicate where a domain name should be placed.
c6c770
+
c6c770
+		  The first format in the list is the preferred format for
c6c770
+		  login names.
c6c770
+		-->
c6c770
+		<property name="LoginFormats" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  LoginPolicy: the policy for logins using this realm
c6c770
+
c6c770
+		  The policy for logging into this computer using this realm.
c6c770
+
c6c770
+		  The policy can be changed using the
c6c770
+		  #org.freedesktop.realmd.Realm.ChangeLoginPolicy() method.
c6c770
+
c6c770
+		  The following policies are predefined. Not all providers
c6c770
+		  support all these policies and there may be provider specific
c6c770
+		  policies or multiple policies represented in the string:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>allow-any-login</literal>: allow
c6c770
+		      login by any authenticated user present in this
c6c770
+		      realm.</para></listitem>
c6c770
+		    <listitem><para><literal>allow-realm-logins</literal>: allow
c6c770
+		      logins according to the realm or domain policy for logins
c6c770
+		      on this machine. This usually defaults to allowing any realm
c6c770
+		      user to log in.</para></listitem>
c6c770
+		    <listitem><para><literal>allow-permitted-logins</literal>:
c6c770
+		      only allow the logins permitted in the
c6c770
+		      #org.freedesktop.realmd.Realm:PermittedLogins
c6c770
+		      property.</para></listitem>
c6c770
+		    <listitem><para><literal>deny-any-login</literal>:
c6c770
+		      don't allow any logins via authenticated users of this
c6c770
+		      realm.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<property name="LoginPolicy" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  PermittedLogins: the permitted login names
c6c770
+
c6c770
+		  The list of permitted authenticated users allowed to login
c6c770
+		  into this computer. This is only relevant if the
c6c770
+		  #org.freedesktop.realmd.Realm:LoginPolicy property
c6c770
+		  contains the <literal>allow-permitted-logins</literal>
c6c770
+		  string.
c6c770
+		-->
c6c770
+		<property name="PermittedLogins" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  PermittedGroups: the permitted group names
c6c770
+
c6c770
+		  The list of groups which users need to be in to be allowed
c6c770
+		  to log into this computer. This is only relevant if the
c6c770
+		  #org.freedesktop.realmd.Realm:LoginPolicy property
c6c770
+		  contains the <literal>allow-permitted-logins</literal>
c6c770
+		  string.
c6c770
+		-->
c6c770
+		<property name="PermittedGroups" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  ChangeLoginPolicy:
c6c770
+		  @login_policy: the new login policy, or an empty string
c6c770
+		  @permitted_add: a list of logins to permit
c6c770
+		  @permitted_remove: a list of logins to not permit
c6c770
+		  @options: options for this operation
c6c770
+
c6c770
+		  Change the login policy and/or permitted logins for this realm.
c6c770
+
c6c770
+		  Not all realms support all the various login policies. An
c6c770
+		  error will be returned if the new login policy is not supported.
c6c770
+		  You may specify an empty string for the @login_policy argument
c6c770
+		  which will cause no change in the policy itself. If the policy
c6c770
+		  is changed, it will be reflected in the
c6c770
+		  #org.freedesktop.realmd.Realm:LoginPolicy property.
c6c770
+
c6c770
+		  The @permitted_add and @permitted_remove arguments represent
c6c770
+		  lists of login names that should be added and removed from
c6c770
+		  the #org.freedesktop.realmd.Kerberos:PermittedLogins property.
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		    <listitem><para><literal>groups</literal>: boolean which if
c6c770
+		    set to <literal>TRUE</literal> means that the names in
c6c770
+		    @permitted_add and @permitted_remove are group names instead
c6c770
+		    of login names.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.login-policy</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the policy change failed for a generic reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to change login policy
c6c770
+		      operation.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotConfigured</literal>:
c6c770
+		      returned if the realm is not configured.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Busy</literal>:
c6c770
+		      returned if the service is currently performing another operation like
c6c770
+		      join or leave.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="ChangeLoginPolicy">
c6c770
+			<arg name="login_policy" type="s" direction="in"/>
c6c770
+			<arg name="permitted_add" type="as" direction="in"/>
c6c770
+			<arg name="permitted_remove" type="as" direction="in"/>
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.Kerberos:
c6c770
+	  @short_description: a kerberos realm
c6c770
+
c6c770
+	  An interface that describes a kerberos realm in more detail. This
c6c770
+	  is always implemented on an DBus object path that also implements
c6c770
+	  the #org.freedesktop.realmd.Realm interface.
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.Kerberos">
c6c770
+
c6c770
+		
c6c770
+		  RealmName: the kerberos realm name
c6c770
+
c6c770
+		  The kerberos name for this realm. This is usually in upper
c6c770
+		  case.
c6c770
+		-->
c6c770
+		<property name="RealmName" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  DomainName: the DNS domain name
c6c770
+
c6c770
+		  The DNS domain name for this realm.
c6c770
+		-->
c6c770
+		<property name="DomainName" type="s" access="read"/>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.KerberosMembership:
c6c770
+
c6c770
+	  An interface used to configure this machine by joining a realm.
c6c770
+
c6c770
+	  It sets up a computer/host account in the realm for this machine
c6c770
+	  and a keytab to track the credentials for that account.
c6c770
+
c6c770
+	  The various properties are guaranteed to have been updated before
c6c770
+	  the operation methods return, if they change state.
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.KerberosMembership">
c6c770
+
c6c770
+		
c6c770
+		  SuggestedAdministrator: common administrator name
c6c770
+
c6c770
+		  The common administrator name for this type of realm. This
c6c770
+		  can be used by clients as a hint when prompting the user for
c6c770
+		  administrative authentication.
c6c770
+		-->
c6c770
+		<property name="SuggestedAdministrator" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  SupportedJoinCredentials: credentials supported for joining
c6c770
+
c6c770
+		  Various kinds of credentials that are supported when calling the
c6c770
+		  #org.freedesktop.realmd.Kerberos.Join() method.
c6c770
+
c6c770
+		  Each credential is represented by a type and an owner. The type
c6c770
+		  denotes which kind of credential is passed to the method. The
c6c770
+		  owner indicates to the client how to prompt the user or obtain
c6c770
+		  the credential, and to the service how to use the credential.
c6c770
+
c6c770
+		  The various types are:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>ccache</literal>:
c6c770
+		      the credentials should contain an array of bytes as a
c6c770
+		      <literal>ay</literal> containing the data from a kerberos
c6c770
+		      credential cache file.</para></listitem>
c6c770
+		    <listitem><para><literal>password</literal>:
c6c770
+		      the credentials should contain a pair of strings as a
c6c770
+		      <literal>(ss)</literal> representing a name and
c6c770
+		      password. The name may contain a realm in the standard
c6c770
+		      kerberos format. If a realm is missing, it will default
c6c770
+		      to this realm. </para></listitem>
c6c770
+		    <listitem><para><literal>secret</literal>:
c6c770
+		      the credentials should contain a string secret as an
c6c770
+		      <literal>ay</literal> array of bytes. This is usually used
c6c770
+		      for one time passwords. To pass a string here, encode it
c6c770
+		      in UTF-8, and place the resulting bytes in the
c6c770
+		      value.</para></listitem>
c6c770
+		    <listitem><para><literal>automatic</literal>:
c6c770
+		      the credentials should contain an empty string as a
c6c770
+		      <literal>s</literal>. Using <literal>automatic</literal>
c6c770
+		      indicates that default or system credentials are to be
c6c770
+		      used.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  The various owners are:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>administrator</literal>:
c6c770
+		      the credentials belong to a kerberos administrator principal.
c6c770
+		      The caller may use this as a hint to prompt the user
c6c770
+		      for administrative credentials.</para></listitem>
c6c770
+		    <listitem><para><literal>user</literal>:
c6c770
+		      the credentials belong to a kerberos user principal.
c6c770
+		      The caller may use this as a hint to prompt the user
c6c770
+		      for his (possibly non-administrative)
c6c770
+		      credentials.</para></listitem>
c6c770
+		    <listitem><para><literal>computer</literal>:
c6c770
+		      the credentials belong to a computer account.</para></listitem>
c6c770
+		    <listitem><para><literal>none</literal>:
c6c770
+		      the credentials have an unspecified owner, such as a one
c6c770
+		      time password.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<property name="SupportedJoinCredentials" type="a(ss)" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  SupportedLeaveCredentials: credentials supported for leaving
c6c770
+
c6c770
+		  Various kinds of credentials that are supported when calling the
c6c770
+		  #org.freedesktop.realmd.Kerberos.Leave() method.
c6c770
+
c6c770
+		  See #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials for
c6c770
+		  a discussion of what the values represent.
c6c770
+		-->
c6c770
+		<property name="SupportedLeaveCredentials" type="a(ss)" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Join:
c6c770
+
c6c770
+		  Join this machine to the realm and enroll the machine.
c6c770
+
c6c770
+		  If this method returns successfully, then the machine will be
c6c770
+		  joined to the realm. It is not necessary to restart services or the
c6c770
+		  machine afterward. Relevant properties on the realm will be updated
c6c770
+		  before the method returns.
c6c770
+
c6c770
+		  The @credentials should be set according to one of the
c6c770
+		  supported credentials returned by
c6c770
+		  #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials.
c6c770
+		  The first string in the tuple is the type, the second string
c6c770
+		  is the owner, and the variant contains the credential contents
c6c770
+		  See the discussion at
c6c770
+		  #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials
c6c770
+		  for more information.
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+                    <listitem><para><literal>automatic-id-mapping</literal>: a boolean
c6c770
+                      value whether to turn on automatic UID/GID mapping. If not
c6c770
+		      specified the default will come from realmd.conf
c6c770
+                      configuration.</para></listitem>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		    <listitem><para><literal>computer-ou</literal>: a string
c6c770
+		      containing an LDAP DN for an organizational unit where the
c6c770
+		      computer account should be created</para></listitem>
c6c770
+		    <listitem><para><literal>user-principal</literal>: a string
c6c770
+		      containing an kerberos user principal name to be set on the
c6c770
+		      computer account</para></listitem>
c6c770
+		    <listitem><para><literal>membership-software</literal>: a string
c6c770
+		      containing the membership software identifier that the returned
c6c770
+		      realms should match.</para></listitem>
c6c770
+		    <listitem><para><literal>manage-system</literal>: a boolean
c6c770
+		      which controls whether this machine should be managed by
c6c770
+		      the realm or domain or not. Defaults to true.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.configure-realm</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the join failed for a generic reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to perform a join
c6c770
+		      operation.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.AuthenticationFailed</literal>:
c6c770
+		      returned if the credentials passed did not authenticate against the realm
c6c770
+		      correctly. It is appropriate to prompt the user again.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.AlreadyEnrolled</literal>:
c6c770
+		      returned if already enrolled in this realm, or if already enrolled in another realm
c6c770
+		      (if enrolling in multiple realms is not supported).</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.BadHostname</literal>:
c6c770
+		      returned if the machine has a hostname that is not usable for a join
c6c770
+		      or is in conflict with those in the domain.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Busy</literal>:
c6c770
+		      returned if the service is currently performing another operation like
c6c770
+		      join or leave.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="Join">
c6c770
+			<arg name="credentials" type="(ssv)" direction="in"/>
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+		
c6c770
+		  Leave:
c6c770
+
c6c770
+		  Leave the realm and unenroll the machine.
c6c770
+
c6c770
+		  If this method returns successfully, then the machine will have
c6c770
+		  left the domain and been unenrolled. It is not necessary to restart
c6c770
+		  services or the machine afterward. Relevant properties on the realm
c6c770
+		  will be updated before the method returns.
c6c770
+
c6c770
+		  The @credentials should be set according to one of the
c6c770
+		  supported credentials returned by
c6c770
+		  #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials.
c6c770
+		  The first string in the tuple is the type, the second string
c6c770
+		  is the owner, and the variant contains the credential contents
c6c770
+		  See the discussion at
c6c770
+		  #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials
c6c770
+		  for more information.
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.deconfigure-realm</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the unenroll failed for a generic reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to perform an unenroll
c6c770
+		      operation.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.AuthenticationFailed</literal>:
c6c770
+		      returned if the credentials passed did not authenticate against the realm
c6c770
+		      correctly. It is appropriate to prompt the user again.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotEnrolled</literal>:
c6c770
+		      returned if not enrolled in this realm.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Busy</literal>:
c6c770
+		      returned if the service is currently performing another operation like
c6c770
+		      join or leave.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="Leave">
c6c770
+			<arg name="credentials" type="(ssv)" direction="in"/>
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+</node>
c6c770
diff --git a/src/daemon.c b/src/daemon.c
c6c770
index c52bda3..5ce0216 100644
c6c770
--- a/src/daemon.c
c6c770
+++ b/src/daemon.c
c6c770
@@ -20,60 +20,61 @@
c6c770
  * Written by: Matthias Clasen <mclasen@redhat.com>
c6c770
  */
c6c770
 
c6c770
 #include "config.h"
c6c770
 
c6c770
 #include <stdlib.h>
c6c770
 #include <stdio.h>
c6c770
 #include <sys/types.h>
c6c770
 #include <sys/stat.h>
c6c770
 #include <fcntl.h>
c6c770
 #include <sys/wait.h>
c6c770
 #include <pwd.h>
c6c770
 #ifdef HAVE_SHADOW_H
c6c770
 #include <shadow.h>
c6c770
 #endif
c6c770
 #include <unistd.h>
c6c770
 #include <errno.h>
c6c770
 #include <sys/types.h>
c6c770
 
c6c770
 #include <glib.h>
c6c770
 #include <glib/gi18n.h>
c6c770
 #include <glib-object.h>
c6c770
 #include <glib/gstdio.h>
c6c770
 #include <gio/gio.h>
c6c770
 #include <polkit/polkit.h>
c6c770
 
c6c770
 #include "user-classify.h"
c6c770
 #include "wtmp-helper.h"
c6c770
 #include "daemon.h"
c6c770
 #include "util.h"
c6c770
+#include "realmd-generated.h"
c6c770
 
c6c770
 #define PATH_PASSWD "/etc/passwd"
c6c770
 #define PATH_SHADOW "/etc/shadow"
c6c770
 #define PATH_GROUP "/etc/group"
c6c770
 
c6c770
 enum {
c6c770
         PROP_0,
c6c770
         PROP_DAEMON_VERSION
c6c770
 };
c6c770
 
c6c770
 typedef struct {
c6c770
         GDBusConnection *bus_connection;
c6c770
 
c6c770
         GHashTable *users;
c6c770
         gsize number_of_normal_users;
c6c770
         GList *explicitly_requested_users;
c6c770
 
c6c770
         User *autologin;
c6c770
 
c6c770
         GFileMonitor *passwd_monitor;
c6c770
         GFileMonitor *shadow_monitor;
c6c770
         GFileMonitor *group_monitor;
c6c770
         GFileMonitor *gdm_monitor;
c6c770
         GFileMonitor *wtmp_monitor;
c6c770
 
c6c770
         GQueue *pending_list_cached_users;
c6c770
 
c6c770
         guint reload_id;
c6c770
         guint autologin_id;
c6c770
 
c6c770
@@ -425,110 +426,167 @@ load_entries (Daemon             *daemon,
c6c770
                         } else {
c6c770
                                 g_object_ref (user);
c6c770
                         }
c6c770
 
c6c770
                         /* freeze & update users not already in the new list */
c6c770
                         g_object_freeze_notify (G_OBJECT (user));
c6c770
                         user_update_from_pwent (user, pwent, spent);
c6c770
 
c6c770
                         g_hash_table_insert (users, g_strdup (user_get_user_name (user)), user);
c6c770
                         g_debug ("loaded user: %s", user_get_user_name (user));
c6c770
                 }
c6c770
 
c6c770
                 if (!explicitly_requested) {
c6c770
                         user_set_cached (user, TRUE);
c6c770
                 }
c6c770
         }
c6c770
 
c6c770
         /* Generator should have cleaned up */
c6c770
         g_assert (generator_state == NULL);
c6c770
 }
c6c770
 
c6c770
 static GHashTable *
c6c770
 create_users_hash_table (void)
c6c770
 {
c6c770
         return g_hash_table_new_full (g_str_hash,
c6c770
                                       g_str_equal,
c6c770
                                       g_free,
c6c770
                                       g_object_unref);
c6c770
 }
c6c770
 
c6c770
+static gboolean
c6c770
+ensure_bus_connection (Daemon *daemon)
c6c770
+{
c6c770
+        DaemonPrivate *priv = daemon_get_instance_private (daemon);
c6c770
+        g_autoptr (GError) error = NULL;
c6c770
+
c6c770
+        if (priv->bus_connection != NULL)
c6c770
+                return TRUE;
c6c770
+
c6c770
+        priv->bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
c6c770
+        if (priv->bus_connection == NULL) {
c6c770
+                if (error != NULL)
c6c770
+                        g_critical ("error getting system bus: %s", error->message);
c6c770
+                return FALSE;
c6c770
+        }
c6c770
+
c6c770
+        return TRUE;
c6c770
+}
c6c770
+
c6c770
+static gboolean
c6c770
+has_network_realms (Daemon *daemon)
c6c770
+{
c6c770
+        DaemonPrivate *priv = daemon_get_instance_private (daemon);
c6c770
+        g_autoptr (AccountsRealmdProvider) realmd_provider = NULL;
c6c770
+        g_autoptr (GError) error = NULL;
c6c770
+        const char *const *realms = NULL;
c6c770
+
c6c770
+        if (!ensure_bus_connection (daemon)) {
c6c770
+                return FALSE;
c6c770
+        }
c6c770
+
c6c770
+        realmd_provider = accounts_realmd_provider_proxy_new_sync (priv->bus_connection,
c6c770
+                                                                   G_DBUS_PROXY_FLAGS_NONE,
c6c770
+                                                                   "org.freedesktop.realmd",
c6c770
+                                                                   "/org/freedesktop/realmd",
c6c770
+                                                                   NULL,
c6c770
+                                                                   &error);
c6c770
+        if (realmd_provider == NULL) {
c6c770
+                g_debug ("failed to contact realmd: %s", error->message);
c6c770
+                return FALSE;
c6c770
+        }
c6c770
+
c6c770
+        realms = accounts_realmd_provider_get_realms (realmd_provider);
c6c770
+
c6c770
+        if (!realms) {
c6c770
+                g_debug("realmd provider 'Realms' property is unset");
c6c770
+                return FALSE;
c6c770
+        }
c6c770
+
c6c770
+        return realms[0] != NULL;
c6c770
+}
c6c770
+
c6c770
 static void
c6c770
 reload_users (Daemon *daemon)
c6c770
 {
c6c770
         DaemonPrivate *priv = daemon_get_instance_private (daemon);
c6c770
         AccountsAccounts *accounts = ACCOUNTS_ACCOUNTS (daemon);
c6c770
         gboolean had_no_users, has_no_users, had_multiple_users, has_multiple_users;
c6c770
         GHashTable *users;
c6c770
         GHashTable *old_users;
c6c770
         GHashTable *local;
c6c770
         GHashTableIter iter;
c6c770
         gsize number_of_normal_users = 0;
c6c770
         gpointer name, value;
c6c770
 
c6c770
         /* Track the users that we saw during our (re)load */
c6c770
         users = create_users_hash_table ();
c6c770
 
c6c770
         /*
c6c770
          * NOTE: As we load data from all the sources, notifies are
c6c770
          * frozen in load_entries() and then thawed as we process
c6c770
          * them below.
c6c770
          */
c6c770
 
c6c770
         /* Load the local users into our hash table */
c6c770
         load_entries (daemon, users, FALSE, entry_generator_fgetpwent);
c6c770
         local = g_hash_table_new (g_str_hash, g_str_equal);
c6c770
         g_hash_table_iter_init (&iter, users);
c6c770
         while (g_hash_table_iter_next (&iter, &name, NULL))
c6c770
                 g_hash_table_add (local, name);
c6c770
 
c6c770
         /* and add users to hash table that were explicitly requested  */
c6c770
         load_entries (daemon, users, TRUE, entry_generator_requested_users);
c6c770
 
c6c770
         /* Now add/update users from other sources, possibly non-local */
c6c770
         load_entries (daemon, users, FALSE, entry_generator_cachedir);
c6c770
 
c6c770
         wtmp_helper_update_login_frequencies (users);
c6c770
 
c6c770
         /* Count the non-system users. Mark which users are local, which are not. */
c6c770
         g_hash_table_iter_init (&iter, users);
c6c770
         while (g_hash_table_iter_next (&iter, &name, &value)) {
c6c770
                 User *user = value;
c6c770
                 if (!user_get_system_account (user))
c6c770
                         number_of_normal_users++;
c6c770
                 user_update_local_account_property (user, g_hash_table_lookup (local, name) != NULL);
c6c770
         }
c6c770
         g_hash_table_destroy (local);
c6c770
 
c6c770
         had_no_users = accounts_accounts_get_has_no_users (accounts);
c6c770
         has_no_users = number_of_normal_users == 0;
c6c770
 
c6c770
+        if (has_no_users && has_network_realms (daemon)) {
c6c770
+                g_debug ("No local users, but network realms detected, presuming there are remote users");
c6c770
+                has_no_users = FALSE;
c6c770
+        }
c6c770
+
c6c770
         if (had_no_users != has_no_users)
c6c770
                 accounts_accounts_set_has_no_users (accounts, has_no_users);
c6c770
 
c6c770
         had_multiple_users = accounts_accounts_get_has_multiple_users (accounts);
c6c770
         has_multiple_users = number_of_normal_users > 1;
c6c770
 
c6c770
         if (had_multiple_users != has_multiple_users)
c6c770
                 accounts_accounts_set_has_multiple_users (accounts, has_multiple_users);
c6c770
 
c6c770
         /* Swap out the users */
c6c770
         old_users = priv->users;
c6c770
         priv->users = users;
c6c770
 
c6c770
         /* Remove all the old users */
c6c770
         g_hash_table_iter_init (&iter, old_users);
c6c770
         while (g_hash_table_iter_next (&iter, &name, &value)) {
c6c770
                 User *user = value;
c6c770
                 User *refreshed_user;
c6c770
 
c6c770
                 refreshed_user = g_hash_table_lookup (users, name);
c6c770
 
c6c770
                 if (!refreshed_user || (user_get_cached (user) && !user_get_cached (refreshed_user))) {
c6c770
                         accounts_accounts_emit_user_deleted (ACCOUNTS_ACCOUNTS (daemon),
c6c770
                                                              user_get_object_path (user));
c6c770
                         user_unregister (user);
c6c770
                 }
c6c770
         }
c6c770
 
c6c770
         /* Register all the new users */
c6c770
         g_hash_table_iter_init (&iter, users);
c6c770
@@ -766,64 +824,61 @@ daemon_finalize (GObject *object)
c6c770
         priv = daemon_get_instance_private (daemon);
c6c770
 
c6c770
         if (priv->bus_connection != NULL)
c6c770
                 g_object_unref (priv->bus_connection);
c6c770
 
c6c770
         g_queue_free_full (priv->pending_list_cached_users,
c6c770
                            (GDestroyNotify) list_user_data_free);
c6c770
 
c6c770
         g_list_free_full (priv->explicitly_requested_users, g_free);
c6c770
 
c6c770
         g_hash_table_destroy (priv->users);
c6c770
 
c6c770
         g_hash_table_unref (priv->extension_ifaces);
c6c770
 
c6c770
         G_OBJECT_CLASS (daemon_parent_class)->finalize (object);
c6c770
 }
c6c770
 
c6c770
 static gboolean
c6c770
 register_accounts_daemon (Daemon *daemon)
c6c770
 {
c6c770
         DaemonPrivate *priv = daemon_get_instance_private (daemon);
c6c770
         g_autoptr(GError) error = NULL;
c6c770
 
c6c770
         priv->authority = polkit_authority_get_sync (NULL, &error);
c6c770
         if (priv->authority == NULL) {
c6c770
                 if (error != NULL)
c6c770
                         g_critical ("error getting polkit authority: %s", error->message);
c6c770
                 return FALSE;
c6c770
         }
c6c770
 
c6c770
-        priv->bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
c6c770
-        if (priv->bus_connection == NULL) {
c6c770
-                if (error != NULL)
c6c770
-                        g_critical ("error getting system bus: %s", error->message);
c6c770
+        if (!ensure_bus_connection (daemon)) {
c6c770
                 return FALSE;
c6c770
         }
c6c770
 
c6c770
         if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (daemon),
c6c770
                                                priv->bus_connection,
c6c770
                                                "/org/freedesktop/Accounts",
c6c770
                                                &error)) {
c6c770
                 if (error != NULL)
c6c770
                         g_critical ("error exporting interface: %s", error->message);
c6c770
                 return FALSE;
c6c770
         }
c6c770
 
c6c770
         return TRUE;
c6c770
 }
c6c770
 
c6c770
 Daemon *
c6c770
 daemon_new (void)
c6c770
 {
c6c770
         g_autoptr(Daemon) daemon = NULL;
c6c770
 
c6c770
         daemon = DAEMON (g_object_new (TYPE_DAEMON, NULL));
c6c770
 
c6c770
         if (!register_accounts_daemon (DAEMON (daemon))) {
c6c770
                 return NULL;
c6c770
         }
c6c770
 
c6c770
         return g_steal_pointer (&daemon);
c6c770
 }
c6c770
 
c6c770
 static void
c6c770
diff --git a/src/meson.build b/src/meson.build
c6c770
index 20d5276..3970749 100644
c6c770
--- a/src/meson.build
c6c770
+++ b/src/meson.build
c6c770
@@ -1,37 +1,38 @@
c6c770
 sources = []
c6c770
 
c6c770
 gdbus_headers = []
c6c770
 
c6c770
 ifaces = [
c6c770
   ['accounts-generated', 'org.freedesktop.', 'Accounts'],
c6c770
   ['accounts-user-generated', act_namespace + '.', 'User'],
c6c770
+  ['realmd-generated', 'org.freedesktop.', 'realmd'],
c6c770
 ]
c6c770
 
c6c770
 foreach iface: ifaces
c6c770
   gdbus_sources = gnome.gdbus_codegen(
c6c770
     iface[0],
c6c770
     join_paths(data_dir, iface[1] + iface[2] + '.xml'),
c6c770
     interface_prefix: iface[1],
c6c770
     namespace: 'Accounts',
c6c770
   )
c6c770
   sources += gdbus_sources
c6c770
   gdbus_headers += gdbus_sources[1]
c6c770
 endforeach
c6c770
 
c6c770
 deps = [
c6c770
   gio_dep,
c6c770
   gio_unix_dep,
c6c770
 ]
c6c770
 
c6c770
 cflags = [
c6c770
   '-DLOCALSTATEDIR="@0@"'.format(act_localstatedir),
c6c770
   '-DDATADIR="@0@"'.format(act_datadir),
c6c770
   '-DICONDIR="@0@"'.format(join_paths(act_localstatedir, 'lib', 'AccountsService', 'icons')),
c6c770
   '-DUSERDIR="@0@"'.format(join_paths(act_localstatedir, 'lib', 'AccountsService', 'users')),
c6c770
 ]
c6c770
 
c6c770
 libaccounts_generated = static_library(
c6c770
   'accounts-generated',
c6c770
   sources: sources,
c6c770
   include_directories: top_inc,
c6c770
   dependencies: deps,
c6c770
diff --git a/src/org.freedesktop.realmd.xml b/src/org.freedesktop.realmd.xml
c6c770
new file mode 100644
c6c770
index 0000000..c34a47a
c6c770
--- /dev/null
c6c770
+++ b/src/org.freedesktop.realmd.xml
c6c770
@@ -0,0 +1,730 @@
c6c770
+
c6c770
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
c6c770
+<node name="/">
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.Provider:
c6c770
+	  @short_description: a realm provider
c6c770
+
c6c770
+	  Various realm providers represent different software implementations
c6c770
+	  that provide access to realms or domains.
c6c770
+
c6c770
+	  This interface is implemented by individual providers, but is
c6c770
+	  aggregated globally at the system bus name
c6c770
+	  <literal>org.freedesktop.realmd</literal>
c6c770
+	  with the object path <literal>/org/freedesktop/realmd</literal>
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.Provider">
c6c770
+
c6c770
+		
c6c770
+		  Name: the name of the provider
c6c770
+
c6c770
+		  The name of the provider. This is not normally displayed
c6c770
+		  to the user, but may be useful for diagnostics or debugging.
c6c770
+		-->
c6c770
+		<property name="Name" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Version: the version of the provider
c6c770
+
c6c770
+		  The version of the provider. This is not normally used in
c6c770
+		  logic, but may be useful for diagnostics or debugging.
c6c770
+		-->
c6c770
+		<property name="Version" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Realms: a list of realms
c6c770
+
c6c770
+		  A list of known, enrolled or discovered realms. All realms
c6c770
+		  that this provider knows about are listed here. As realms
c6c770
+		  are discovered they are added to this list.
c6c770
+
c6c770
+		  Each realm is represented by the DBus object path of the
c6c770
+		  realm object.
c6c770
+		-->
c6c770
+		<property name="Realms" type="ao" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Discover:
c6c770
+		  @string: an input string to discover realms for
c6c770
+		  @options: options for the discovery operation
c6c770
+		  @relevance: the relevance of the returned results
c6c770
+		  @realm: a list of realms discovered
c6c770
+
c6c770
+		  Discover realms for the given string. The input @string is
c6c770
+		  usually a domain or realm name, perhaps typed by a user. If
c6c770
+		  an empty string is provided, the realm provider should try to
c6c770
+		  discover a default realm, if possible (e.g. from DHCP).
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		    <listitem><para><literal>client-software</literal>: a string
c6c770
+		      containing the client software identifier that the returned
c6c770
+		      realms should match.</para></listitem>
c6c770
+		    <listitem><para><literal>server-software</literal>: a string
c6c770
+		      containing the client software identifier that the returned
c6c770
+		      realms should match.</para></listitem>
c6c770
+		    <listitem><para><literal>membership-software</literal>: a string
c6c770
+		      containing the membership software identifier that the returned
c6c770
+		      realms should match.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  The @relevance returned can be used to rank results from
c6c770
+		  different discover calls to different providers. Implementors
c6c770
+		  should return a positive number if the provider highly
c6c770
+		  recommends that the realms be handled by this provider,
c6c770
+		  or a zero if it can possibly handle the realms. Negative numbers
c6c770
+		  should be returned if no realms are found.
c6c770
+
c6c770
+		  This method does not return an error when no realms are
c6c770
+		  discovered. It simply returns an empty @realm list.
c6c770
+
c6c770
+		  To see diagnostic information about the discovery process,
c6c770
+		  connect to the org.freedesktop.realmd.Service::Diagnostics
c6c770
+		  signal.
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.discover-realm</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may
c6c770
+		  return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the discovery could not be run for some reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to perform a discovery
c6c770
+		      operation.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="Discover">
c6c770
+			<arg name="string" type="s" direction="in"/>
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+			<arg name="relevance" type="i" direction="out"/>
c6c770
+			<arg name="realm" type="ao" direction="out"/>
c6c770
+		</method>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.Service:
c6c770
+	  @short_description: the realmd service
c6c770
+
c6c770
+	  Global calls for managing the realmd service. Usually you'll want
c6c770
+	  to use #org.freedesktop.realmd.Provider instead.
c6c770
+
c6c770
+	  This interface is implemented by the realmd service, and is always
c6c770
+	  available at the object path <literal>/org/freedesktop/realmd</literal>
c6c770
+
c6c770
+	  The service also implements the
c6c770
+	  <literal>org.freedesktop.DBus.ObjectManager</literal> interface which
c6c770
+	  makes it easy to retrieve all realmd objects and properties in one go.
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.Service">
c6c770
+
c6c770
+		
c6c770
+		  Cancel:
c6c770
+		  @operation: the operation to cancel
c6c770
+
c6c770
+		  Cancel a realmd operation. To be able to cancel an operation,
c6c770
+		  pass a uniquely chosen <literal>operation</literal> string
c6c770
+		  identifier as an option in the method's <literal>options</literal>
c6c770
+		  argument.
c6c770
+
c6c770
+		  These operation string identifiers should be unique per client
c6c770
+		  calling the realmd service.
c6c770
+
c6c770
+		  It is not guaranteed that the service can or will cancel the
c6c770
+		  operation. For example, the operation may have already completed
c6c770
+		  by the time this method is handled. The caller of the operation
c6c770
+		  method will receive a
c6c770
+		  <literal>org.freedesktop.realmd.Error.Cancelled</literal>
c6c770
+		  if the operation was cancelled.
c6c770
+		-->
c6c770
+		<method name="Cancel">
c6c770
+			<arg name="operation" type="s" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+		
c6c770
+		  SetLocale:
c6c770
+		  @locale: the locale for the client
c6c770
+
c6c770
+		  Set the language @locale for the client. This locale is used
c6c770
+		  for error messages. The locale is used until the next time
c6c770
+		  this method is called, the client disconnects, or the client
c6c770
+		  calls #org.freedesktop.realmd.Service.Release().
c6c770
+		-->
c6c770
+		<method name="SetLocale">
c6c770
+			<arg name="locale" type="s" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+		
c6c770
+		  Diagnostics:
c6c770
+		  @data: diagnostic data
c6c770
+		  @operation: the operation this data resulted from
c6c770
+
c6c770
+		  This signal is fired when diagnostics result from an operation
c6c770
+		  in the provider or one of its realms.
c6c770
+
c6c770
+		  It is not guaranteed that this signal is emitted once per line.
c6c770
+		  More than one line may be contained in @data, or a partial
c6c770
+		  line. New line characters are embedded in @data.
c6c770
+
c6c770
+		  This signal is sent explicitly to the client which invoked an
c6c770
+		  operation method. In order to tell which operation this
c6c770
+		  diagnostic data results from, pass a unique
c6c770
+		  <literal>operation</literal> string identifier in the
c6c770
+		  <literal>options</literal> argument of the operation method.
c6c770
+		  That same identifier will be passed back via the @operation
c6c770
+		  argument of this signal.
c6c770
+		-->
c6c770
+		<signal name="Diagnostics">
c6c770
+			<arg name="data" type="s"/>
c6c770
+			<arg name="operation" type="s"/>
c6c770
+		</signal>
c6c770
+
c6c770
+		
c6c770
+		  Release:
c6c770
+
c6c770
+		  Normally, realmd waits until all clients have disconnected
c6c770
+		  before exiting itself sometime later. Long lived clients
c6c770
+		  can call this method to allow the realmd service to quit.
c6c770
+		  This is an optimization. The daemon will not exit immediately.
c6c770
+		  It is safe to call this multiple times.
c6c770
+		-->
c6c770
+		<method name="Release">
c6c770
+			
c6c770
+		</method>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.Realm:
c6c770
+	  @short_description: a realm
c6c770
+
c6c770
+	  Represents one realm.
c6c770
+
c6c770
+	  Contains generic information about a realm, and useful properties for
c6c770
+	  introspecting what kind of realm this is and how to work with
c6c770
+	  the realm.
c6c770
+
c6c770
+	  Use #org.freedesktop.realmd.Provider:Realms or
c6c770
+	  #org.freedesktop.realmd.Provider.Discover() to get access to some
c6c770
+	  kerberos realm objects.
c6c770
+
c6c770
+	  Realms will always implement additional interfaces, such as
c6c770
+	  #org.freedesktop.realmd.Kerberos.  Do not assume that all realms
c6c770
+	  implement that kerberos interface. Use the
c6c770
+	  #org.freedesktop.realmd.Realm:SupportedInterfaces property to see
c6c770
+	  which interfaces are supported.
c6c770
+
c6c770
+	  Different realms support various ways to configure them on the
c6c770
+	  system. Use the #org.freedesktop.realmd.Realm:Configured property
c6c770
+	  to determine if a realm is configured. If it is configured, the
c6c770
+	  property will be set to the interface of the mechanism that was
c6c770
+	  used to configure it.
c6c770
+
c6c770
+	  To configure a realm, look in the
c6c770
+	  #org.freedesktop.realmd.Realm:SupportedInterfaces property for a
c6c770
+	  recognized purpose-specific interface that can be used for
c6c770
+	  configuration, such as the
c6c770
+	  #org.freedesktop.realmd.KerberosMembership interface and its
c6c770
+	  #org.freedesktop.realmd.KerberosMembership.Join() method.
c6c770
+
c6c770
+	  To deconfigure a realm from the current system, you can use the
c6c770
+	  #org.freedesktop.realmd.Realm.Deconfigure() method. In addition, some
c6c770
+	  of the configuration specific interfaces provide methods to
c6c770
+	  deconfigure a realm in a specific way, such as the
c6c770
+	  #org.freedesktop.realmd.KerberosMembership.Leave() method.
c6c770
+
c6c770
+	  The various properties are guaranteed to have been updated before
c6c770
+	  the operation methods return, if they change state.
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.Realm">
c6c770
+
c6c770
+		
c6c770
+		  Name: the realm name
c6c770
+
c6c770
+		  This is the name of the realm, appropriate for display to
c6c770
+		  end users where necessary.
c6c770
+		-->
c6c770
+		<property name="Name" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Configured: whether this domain is configured and how
c6c770
+
c6c770
+		  If this property is an empty string, then the realm is not
c6c770
+		  configured. Otherwise the realm is configured, and contains
c6c770
+		  a string which is the interface that represents how it was
c6c770
+		  configured, for example #org.freedesktop.realmd.KerberosMembership.
c6c770
+		-->
c6c770
+		<property name="Configured" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Deconfigure: deconfigure this realm
c6c770
+
c6c770
+		  Deconfigure this realm from the local machine with standard
c6c770
+		  default behavior.
c6c770
+
c6c770
+		  The behavior of this method depends on the which configuration
c6c770
+		  interface is present in the
c6c770
+		  #org.freedesktop.realmd.Realm.Configured property. It does not
c6c770
+		  always delete membership accounts in the realm, but just
c6c770
+		  reconfigures the local machine so it no longer is configured
c6c770
+		  for the given realm. In some cases the implementation may try
c6c770
+		  to update membership accounts, but this is not guaranteed.
c6c770
+
c6c770
+		  Various configuration interfaces may support more specific ways
c6c770
+		  to deconfigure a realm in a specific way, such as the
c6c770
+		  #org.freedesktop.realmd.KerberosMembership.Leave() method.
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.deconfigure-realm</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the deconfigure failed for a generic reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to deconfigure a
c6c770
+		      realm.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotConfigured</literal>:
c6c770
+		      returned if this realm is not configured on the machine.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Busy</literal>:
c6c770
+		      returned if the service is currently performing another operation like
c6c770
+		      join or leave.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="Deconfigure">
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+		
c6c770
+		  SupportedInterfaces:
c6c770
+
c6c770
+		  Additional supported interfaces of this realm. This includes
c6c770
+		  interfaces that contain more information about the realm,
c6c770
+		  such as #org.freedesktop.realmd.Kerberos and interfaces
c6c770
+		  which contain methods for configuring a realm, such as
c6c770
+		  #org.freedesktop.realmd.KerberosMembership.
c6c770
+		-->
c6c770
+		<property name="SupportedInterfaces" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Details: informational details about the realm
c6c770
+
c6c770
+		  Informational details about the realm. The following values
c6c770
+		  should be present:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>server-software</literal>:
c6c770
+		      identifier of the software running on the server (e.g.
c6c770
+		      <literal>active-directory</literal>).</para></listitem>
c6c770
+		    <listitem><para><literal>client-software</literal>:
c6c770
+		      identifier of the software running on the client (e.g.
c6c770
+		      <literal>sssd</literal>).</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<property name="Details" type="a(ss)" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  RequiredPackages: prerequisite software
c6c770
+
c6c770
+		  Software packages that are required in order for a join to
c6c770
+		  succeed. These are either simple strings like <literal>sssd</literal>,
c6c770
+		  or strings with an operator and version number like
c6c770
+		  <literal>sssd >= 1.9.0</literal>
c6c770
+
c6c770
+		  These values are specific to the packaging system that is
c6c770
+		  being run.
c6c770
+		-->
c6c770
+		<property name="RequiredPackages" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  LoginFormats: supported formats for login names
c6c770
+
c6c770
+		  Supported formats for login to this realm. This is only
c6c770
+		  relevant once the realm has been enrolled. The formats
c6c770
+		  will contain a <literal>%U</literal> in the string, which
c6c770
+		  indicate where the user name should be placed. The formats
c6c770
+		  may contain a <literal>%D</literal> in the string which
c6c770
+		  indicate where a domain name should be placed.
c6c770
+
c6c770
+		  The first format in the list is the preferred format for
c6c770
+		  login names.
c6c770
+		-->
c6c770
+		<property name="LoginFormats" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  LoginPolicy: the policy for logins using this realm
c6c770
+
c6c770
+		  The policy for logging into this computer using this realm.
c6c770
+
c6c770
+		  The policy can be changed using the
c6c770
+		  #org.freedesktop.realmd.Realm.ChangeLoginPolicy() method.
c6c770
+
c6c770
+		  The following policies are predefined. Not all providers
c6c770
+		  support all these policies and there may be provider specific
c6c770
+		  policies or multiple policies represented in the string:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>allow-any-login</literal>: allow
c6c770
+		      login by any authenticated user present in this
c6c770
+		      realm.</para></listitem>
c6c770
+		    <listitem><para><literal>allow-realm-logins</literal>: allow
c6c770
+		      logins according to the realm or domain policy for logins
c6c770
+		      on this machine. This usually defaults to allowing any realm
c6c770
+		      user to log in.</para></listitem>
c6c770
+		    <listitem><para><literal>allow-permitted-logins</literal>:
c6c770
+		      only allow the logins permitted in the
c6c770
+		      #org.freedesktop.realmd.Realm:PermittedLogins
c6c770
+		      property.</para></listitem>
c6c770
+		    <listitem><para><literal>deny-any-login</literal>:
c6c770
+		      don't allow any logins via authenticated users of this
c6c770
+		      realm.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<property name="LoginPolicy" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  PermittedLogins: the permitted login names
c6c770
+
c6c770
+		  The list of permitted authenticated users allowed to login
c6c770
+		  into this computer. This is only relevant if the
c6c770
+		  #org.freedesktop.realmd.Realm:LoginPolicy property
c6c770
+		  contains the <literal>allow-permitted-logins</literal>
c6c770
+		  string.
c6c770
+		-->
c6c770
+		<property name="PermittedLogins" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  PermittedGroups: the permitted group names
c6c770
+
c6c770
+		  The list of groups which users need to be in to be allowed
c6c770
+		  to log into this computer. This is only relevant if the
c6c770
+		  #org.freedesktop.realmd.Realm:LoginPolicy property
c6c770
+		  contains the <literal>allow-permitted-logins</literal>
c6c770
+		  string.
c6c770
+		-->
c6c770
+		<property name="PermittedGroups" type="as" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  ChangeLoginPolicy:
c6c770
+		  @login_policy: the new login policy, or an empty string
c6c770
+		  @permitted_add: a list of logins to permit
c6c770
+		  @permitted_remove: a list of logins to not permit
c6c770
+		  @options: options for this operation
c6c770
+
c6c770
+		  Change the login policy and/or permitted logins for this realm.
c6c770
+
c6c770
+		  Not all realms support all the various login policies. An
c6c770
+		  error will be returned if the new login policy is not supported.
c6c770
+		  You may specify an empty string for the @login_policy argument
c6c770
+		  which will cause no change in the policy itself. If the policy
c6c770
+		  is changed, it will be reflected in the
c6c770
+		  #org.freedesktop.realmd.Realm:LoginPolicy property.
c6c770
+
c6c770
+		  The @permitted_add and @permitted_remove arguments represent
c6c770
+		  lists of login names that should be added and removed from
c6c770
+		  the #org.freedesktop.realmd.Kerberos:PermittedLogins property.
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		    <listitem><para><literal>groups</literal>: boolean which if
c6c770
+		    set to <literal>TRUE</literal> means that the names in
c6c770
+		    @permitted_add and @permitted_remove are group names instead
c6c770
+		    of login names.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.login-policy</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the policy change failed for a generic reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to change login policy
c6c770
+		      operation.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotConfigured</literal>:
c6c770
+		      returned if the realm is not configured.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Busy</literal>:
c6c770
+		      returned if the service is currently performing another operation like
c6c770
+		      join or leave.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="ChangeLoginPolicy">
c6c770
+			<arg name="login_policy" type="s" direction="in"/>
c6c770
+			<arg name="permitted_add" type="as" direction="in"/>
c6c770
+			<arg name="permitted_remove" type="as" direction="in"/>
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.Kerberos:
c6c770
+	  @short_description: a kerberos realm
c6c770
+
c6c770
+	  An interface that describes a kerberos realm in more detail. This
c6c770
+	  is always implemented on an DBus object path that also implements
c6c770
+	  the #org.freedesktop.realmd.Realm interface.
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.Kerberos">
c6c770
+
c6c770
+		
c6c770
+		  RealmName: the kerberos realm name
c6c770
+
c6c770
+		  The kerberos name for this realm. This is usually in upper
c6c770
+		  case.
c6c770
+		-->
c6c770
+		<property name="RealmName" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  DomainName: the DNS domain name
c6c770
+
c6c770
+		  The DNS domain name for this realm.
c6c770
+		-->
c6c770
+		<property name="DomainName" type="s" access="read"/>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+	
c6c770
+	  org.freedesktop.realmd.KerberosMembership:
c6c770
+
c6c770
+	  An interface used to configure this machine by joining a realm.
c6c770
+
c6c770
+	  It sets up a computer/host account in the realm for this machine
c6c770
+	  and a keytab to track the credentials for that account.
c6c770
+
c6c770
+	  The various properties are guaranteed to have been updated before
c6c770
+	  the operation methods return, if they change state.
c6c770
+	-->
c6c770
+	<interface name="org.freedesktop.realmd.KerberosMembership">
c6c770
+
c6c770
+		
c6c770
+		  SuggestedAdministrator: common administrator name
c6c770
+
c6c770
+		  The common administrator name for this type of realm. This
c6c770
+		  can be used by clients as a hint when prompting the user for
c6c770
+		  administrative authentication.
c6c770
+		-->
c6c770
+		<property name="SuggestedAdministrator" type="s" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  SupportedJoinCredentials: credentials supported for joining
c6c770
+
c6c770
+		  Various kinds of credentials that are supported when calling the
c6c770
+		  #org.freedesktop.realmd.Kerberos.Join() method.
c6c770
+
c6c770
+		  Each credential is represented by a type and an owner. The type
c6c770
+		  denotes which kind of credential is passed to the method. The
c6c770
+		  owner indicates to the client how to prompt the user or obtain
c6c770
+		  the credential, and to the service how to use the credential.
c6c770
+
c6c770
+		  The various types are:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>ccache</literal>:
c6c770
+		      the credentials should contain an array of bytes as a
c6c770
+		      <literal>ay</literal> containing the data from a kerberos
c6c770
+		      credential cache file.</para></listitem>
c6c770
+		    <listitem><para><literal>password</literal>:
c6c770
+		      the credentials should contain a pair of strings as a
c6c770
+		      <literal>(ss)</literal> representing a name and
c6c770
+		      password. The name may contain a realm in the standard
c6c770
+		      kerberos format. If a realm is missing, it will default
c6c770
+		      to this realm. </para></listitem>
c6c770
+		    <listitem><para><literal>secret</literal>:
c6c770
+		      the credentials should contain a string secret as an
c6c770
+		      <literal>ay</literal> array of bytes. This is usually used
c6c770
+		      for one time passwords. To pass a string here, encode it
c6c770
+		      in UTF-8, and place the resulting bytes in the
c6c770
+		      value.</para></listitem>
c6c770
+		    <listitem><para><literal>automatic</literal>:
c6c770
+		      the credentials should contain an empty string as a
c6c770
+		      <literal>s</literal>. Using <literal>automatic</literal>
c6c770
+		      indicates that default or system credentials are to be
c6c770
+		      used.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  The various owners are:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>administrator</literal>:
c6c770
+		      the credentials belong to a kerberos administrator principal.
c6c770
+		      The caller may use this as a hint to prompt the user
c6c770
+		      for administrative credentials.</para></listitem>
c6c770
+		    <listitem><para><literal>user</literal>:
c6c770
+		      the credentials belong to a kerberos user principal.
c6c770
+		      The caller may use this as a hint to prompt the user
c6c770
+		      for his (possibly non-administrative)
c6c770
+		      credentials.</para></listitem>
c6c770
+		    <listitem><para><literal>computer</literal>:
c6c770
+		      the credentials belong to a computer account.</para></listitem>
c6c770
+		    <listitem><para><literal>none</literal>:
c6c770
+		      the credentials have an unspecified owner, such as a one
c6c770
+		      time password.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<property name="SupportedJoinCredentials" type="a(ss)" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  SupportedLeaveCredentials: credentials supported for leaving
c6c770
+
c6c770
+		  Various kinds of credentials that are supported when calling the
c6c770
+		  #org.freedesktop.realmd.Kerberos.Leave() method.
c6c770
+
c6c770
+		  See #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials for
c6c770
+		  a discussion of what the values represent.
c6c770
+		-->
c6c770
+		<property name="SupportedLeaveCredentials" type="a(ss)" access="read"/>
c6c770
+
c6c770
+		
c6c770
+		  Join:
c6c770
+
c6c770
+		  Join this machine to the realm and enroll the machine.
c6c770
+
c6c770
+		  If this method returns successfully, then the machine will be
c6c770
+		  joined to the realm. It is not necessary to restart services or the
c6c770
+		  machine afterward. Relevant properties on the realm will be updated
c6c770
+		  before the method returns.
c6c770
+
c6c770
+		  The @credentials should be set according to one of the
c6c770
+		  supported credentials returned by
c6c770
+		  #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials.
c6c770
+		  The first string in the tuple is the type, the second string
c6c770
+		  is the owner, and the variant contains the credential contents
c6c770
+		  See the discussion at
c6c770
+		  #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials
c6c770
+		  for more information.
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+                    <listitem><para><literal>automatic-id-mapping</literal>: a boolean
c6c770
+                      value whether to turn on automatic UID/GID mapping. If not
c6c770
+		      specified the default will come from realmd.conf
c6c770
+                      configuration.</para></listitem>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		    <listitem><para><literal>computer-ou</literal>: a string
c6c770
+		      containing an LDAP DN for an organizational unit where the
c6c770
+		      computer account should be created</para></listitem>
c6c770
+		    <listitem><para><literal>user-principal</literal>: a string
c6c770
+		      containing an kerberos user principal name to be set on the
c6c770
+		      computer account</para></listitem>
c6c770
+		    <listitem><para><literal>membership-software</literal>: a string
c6c770
+		      containing the membership software identifier that the returned
c6c770
+		      realms should match.</para></listitem>
c6c770
+		    <listitem><para><literal>manage-system</literal>: a boolean
c6c770
+		      which controls whether this machine should be managed by
c6c770
+		      the realm or domain or not. Defaults to true.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.configure-realm</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the join failed for a generic reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to perform a join
c6c770
+		      operation.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.AuthenticationFailed</literal>:
c6c770
+		      returned if the credentials passed did not authenticate against the realm
c6c770
+		      correctly. It is appropriate to prompt the user again.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.AlreadyEnrolled</literal>:
c6c770
+		      returned if already enrolled in this realm, or if already enrolled in another realm
c6c770
+		      (if enrolling in multiple realms is not supported).</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.BadHostname</literal>:
c6c770
+		      returned if the machine has a hostname that is not usable for a join
c6c770
+		      or is in conflict with those in the domain.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Busy</literal>:
c6c770
+		      returned if the service is currently performing another operation like
c6c770
+		      join or leave.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="Join">
c6c770
+			<arg name="credentials" type="(ssv)" direction="in"/>
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+		
c6c770
+		  Leave:
c6c770
+
c6c770
+		  Leave the realm and unenroll the machine.
c6c770
+
c6c770
+		  If this method returns successfully, then the machine will have
c6c770
+		  left the domain and been unenrolled. It is not necessary to restart
c6c770
+		  services or the machine afterward. Relevant properties on the realm
c6c770
+		  will be updated before the method returns.
c6c770
+
c6c770
+		  The @credentials should be set according to one of the
c6c770
+		  supported credentials returned by
c6c770
+		  #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials.
c6c770
+		  The first string in the tuple is the type, the second string
c6c770
+		  is the owner, and the variant contains the credential contents
c6c770
+		  See the discussion at
c6c770
+		  #org.freedesktop.realmd.Kerberos:SupportedJoinCredentials
c6c770
+		  for more information.
c6c770
+
c6c770
+		  @options can contain, but is not limited to, the following values:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>operation</literal>: a string
c6c770
+		      identifier chosen by the client, which can then later be
c6c770
+		      passed to org.freedesktop.realmd.Service.Cancel() in order
c6c770
+		      to cancel the operation</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+
c6c770
+		  This method requires authorization for the PolicyKit action
c6c770
+		  called <literal>org.freedesktop.realmd.deconfigure-realm</literal>.
c6c770
+
c6c770
+		  In addition to common DBus error results, this method may return:
c6c770
+		  <itemizedlist>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Failed</literal>:
c6c770
+		      may be returned if the unenroll failed for a generic reason.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Cancelled</literal>:
c6c770
+		      returned if the operation was cancelled.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotAuthorized</literal>:
c6c770
+		      returned if the calling client is not permitted to perform an unenroll
c6c770
+		      operation.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.AuthenticationFailed</literal>:
c6c770
+		      returned if the credentials passed did not authenticate against the realm
c6c770
+		      correctly. It is appropriate to prompt the user again.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.NotEnrolled</literal>:
c6c770
+		      returned if not enrolled in this realm.</para></listitem>
c6c770
+		    <listitem><para><literal>org.freedesktop.realmd.Error.Busy</literal>:
c6c770
+		      returned if the service is currently performing another operation like
c6c770
+		      join or leave.</para></listitem>
c6c770
+		  </itemizedlist>
c6c770
+		-->
c6c770
+		<method name="Leave">
c6c770
+			<arg name="credentials" type="(ssv)" direction="in"/>
c6c770
+			<arg name="options" type="a{sv}" direction="in"/>
c6c770
+		</method>
c6c770
+
c6c770
+	</interface>
c6c770
+
c6c770
+</node>
c6c770
-- 
c6c770
2.27.0
c6c770