nsswitch: Add LDAP lookup in passwd, group and shadow maps
The Name Service Switch (NSS) configuration file (nsswitch.conf),
is used by the GNU C Library to determine the sources from which
to obtain name-service information in a range of categories, and in what order
With the introduction of LDAP we have to add the LDAP as a source for the
name service info for the various maps/database(passwd, group, shadow).
Change-Id: I01367aa4edf0ca84fc39884a472c54958cd4d6af
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/recipes-core/base-files/base-files/nsswitch_ldap.conf b/recipes-core/base-files/base-files/nsswitch_ldap.conf
new file mode 100644
index 0000000..78141f6
--- /dev/null
+++ b/recipes-core/base-files/base-files/nsswitch_ldap.conf
@@ -0,0 +1,20 @@
+# /etc/nsswitch.conf
+#
+# Example configuration of GNU Name Service Switch functionality.
+# If you have the `glibc-doc' and `info' packages installed, try:
+# `info libc "Name Service Switch"' for information about this file.
+
+passwd: files ldap
+group: files ldap
+shadow: files ldap
+
+hosts: files dns
+networks: files
+
+protocols: db files
+services: db files
+ethers: db files
+rpc: db files
+
+netgroup: nis
+
diff --git a/recipes-core/base-files/base-files_%.bbappend b/recipes-core/base-files/base-files_%.bbappend
index 5da4025..1dd38a4 100644
--- a/recipes-core/base-files/base-files_%.bbappend
+++ b/recipes-core/base-files/base-files_%.bbappend
@@ -1,7 +1,17 @@
FILESEXTRAPATHS_prepend_df-obmc-ubi-fs := "${THISDIR}/${PN}/df-ubi:"
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
RDEPENDS_${PN}_append_df-obmc-ubi-fs = " preinit-mounts"
+SRC_URI += " \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'ldap', 'file://nsswitch_ldap.conf', '', d)}"
+
do_install_append() {
+
install -d ${D}/srv
+
+ if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ldap', d)}" ]; then
+ install -D -m 600 ${WORKDIR}/nsswitch_ldap.conf ${D}/${sysconfdir}/
+ fi
}