diff --git a/daemons/configure.ac b/daemons/configure.ac index e81aa60e3..a62897e96 100644 --- a/daemons/configure.ac +++ b/daemons/configure.ac @@ -170,12 +170,24 @@ PKG_CHECK_MODULES([SAMBAUTIL], [samba-util]) SAMBA40EXTRA_LIBPATH="-L`$PKG_CONFIG --variable=libdir samba-util`/samba -Wl,-rpath=`$PKG_CONFIG --variable=libdir samba-util`/samba" AC_SUBST(SAMBA40EXTRA_LIBPATH) -AC_CHECK_LIB([pdb], +LIBPDB_NAME="" +AC_CHECK_LIB([samba-passdb], [make_pdb_method], - [HAVE_LIBPDB=1], - [AC_MSG_ERROR([libpdb does not have make_pdb_method])], + [LIBPDB_NAME="samba-passdb"; HAVE_LIBPDB=1], + [LIBPDB_NAME="pdb"], [$SAMBA40EXTRA_LIBPATH]) -AC_CHECK_LIB([pdb],[pdb_enum_upn_suffixes], + +if test "x$LIB_PDB_NAME" = "xpdb" ; then + AC_CHECK_LIB([$LIBPDB_NAME], + [make_pdb_method], + [HAVE_LIBPDB=1], + [AC_MSG_ERROR([Neither libpdb nor libsamba-passdb does have make_pdb_method])], + [$SAMBA40EXTRA_LIBPATH]) +fi + +AC_SUBST(LIBPDB_NAME) + +AC_CHECK_LIB([$LIBPDB_NAME],[pdb_enum_upn_suffixes], [AC_DEFINE([HAVE_PDB_ENUM_UPN_SUFFIXES], [1], [Ability to enumerate UPN suffixes])], [AC_MSG_WARN([libpdb does not have pdb_enum_upn_suffixes, no support for realm domains in ipasam])], [$SAMBA40EXTRA_LIBPATH]) diff --git a/daemons/ipa-sam/Makefile.am b/daemons/ipa-sam/Makefile.am index d55a18770..46c813af5 100644 --- a/daemons/ipa-sam/Makefile.am +++ b/daemons/ipa-sam/Makefile.am @@ -1,7 +1,8 @@ NULL = +LIBPDB_NAME = @LIBPDB_NAME@ SAMBA40EXTRA_LIBS = $(SAMBA40EXTRA_LIBPATH) \ -lsmbldap \ - -lpdb \ + -l$(LIBPDB_NAME) \ -lsmbconf \ $(NULL) 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;