summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-sam/ipa_sam.c
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2015-01-12 13:36:36 +0200
committerMartin Kosek <mkosek@redhat.com>2015-01-19 10:21:48 +0100
commitd57efb74bb6ad91b029fffff39ed4e482c41f8ba (patch)
tree761e445d321f7c85ad7a408dc4a0783f97714515 /daemons/ipa-sam/ipa_sam.c
parent9af8fa9dd59970a27630545b1fec32de5e100c51 (diff)
downloadfreeipa-d57efb74bb6ad91b029fffff39ed4e482c41f8ba.tar.gz
freeipa-d57efb74bb6ad91b029fffff39ed4e482c41f8ba.tar.xz
freeipa-d57efb74bb6ad91b029fffff39ed4e482c41f8ba.zip
Support Samba PASSDB 0.2.0 aka interface version 24
1. Samba project renamed libpdb to libsamba-passdb https://bugzilla.samba.org/show_bug.cgi?id=10355 2. With interface version 24, Samba removed uid_to_sid()/gid_to_sid() from the PASSDB interface and united them as id_to_sid(). Make sure FreeIPA ipa_sam code supports new and old versions of the PASSDB API. https://fedorahosted.org/freeipa/ticket/4778 Reviewed-By: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'daemons/ipa-sam/ipa_sam.c')
-rw-r--r--daemons/ipa-sam/ipa_sam.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/daemons/ipa-sam/ipa_sam.c b/daemons/ipa-sam/ipa_sam.c
index e71129901..07249fd27 100644
--- a/daemons/ipa-sam/ipa_sam.c
+++ b/daemons/ipa-sam/ipa_sam.c
@@ -1007,6 +1007,22 @@ done:
return ret;
}
+#if PASSDB_INTERFACE_VERSION >= 24
+/* Since version 24, uid_to_sid() and gid_to_sid() were removed in favor of id_to_sid() */
+static bool ipasam_id_to_sid(struct pdb_methods *methods, struct unixid *id, struct dom_sid *sid)
+{
+ bool result = false;
+
+ if (id->type != ID_TYPE_GID) {
+ result = ldapsam_uid_to_sid(methods, id->id, sid);
+ }
+ if (!result && id->type != ID_TYPE_UID) {
+ result = ldapsam_gid_to_sid(methods, id->id, sid);
+ }
+
+ return result;
+}
+#endif
static char *get_ldap_filter(TALLOC_CTX *mem_ctx, const char *username)
{
@@ -4579,8 +4595,13 @@ static NTSTATUS pdb_init_ipasam(struct pdb_methods **pdb_method,
(*pdb_method)->search_aliases = ldapsam_search_aliases;
(*pdb_method)->lookup_rids = ldapsam_lookup_rids;
(*pdb_method)->sid_to_id = ldapsam_sid_to_id;
+#if PASSDB_INTERFACE_VERSION >= 24
+/* Since version 24, uid_to_sid() and gid_to_sid() were removed in favor of id_to_sid() */
+ (*pdb_method)->id_to_sid = ipasam_id_to_sid;
+#else
(*pdb_method)->uid_to_sid = ldapsam_uid_to_sid;
(*pdb_method)->gid_to_sid = ldapsam_gid_to_sid;
+#endif
(*pdb_method)->capabilities = pdb_ipasam_capabilities;
(*pdb_method)->get_domain_info = pdb_ipasam_get_domain_info;