Skip to contentSkip to conversation

samba: Add support for libnss_win*.so* installation

PATCH Superseded Benoît Thébaudeau 2 participants 6 messages Nov 26, 2014 – Nov 27, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 samba: Add support for libnss_win*.so* installation

The libnss_wins and libnss_winbind libraries are required in order to add support for the wins and winbind sources to the Name Service Switch (NSS), so make it possible to install them. This is useful in order to resolve NetBIOS names or user and group information from a Windows NT server.

These libraries are installed to /lib/ like the standard libnss_* libraries from (E)GLIBC.

---

Changes in v2:
- Make BR2_PACKAGE_SAMBA_LIBNSS_WIN* depend on BR2_TOOLCHAIN_USES_GLIBC and BR2_PACKAGE_SAMBA_WINBINDD.
- Use full path for target in 'install -D'.
- Move the definitions of the hook functions inside the corresponding conditional blocks.

---
 package/samba/Config.in |   19 +++++++++++++++++++
 package/samba/samba.mk  |   18 ++++++++++++++++++
 2 files changed, 37 insertions(+)
package/samba/Config.in +19 -0
index 8dd0bf2..e2cac9e 100644
@@ -240,6 +240,25 @@ config BR2_PACKAGE_SAMBA_LIBSMBCLIENT
 	  standards POSIX functions available for manipulating local
 	  files.
 
+config BR2_PACKAGE_SAMBA_LIBNSS_WINS
+	bool "libnss_wins"
+	default y
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_PACKAGE_SAMBA_WINBINDD
+	help
+	  libnss_wins is a library that permits the Name Service Switch
+	  to resolve NetBIOS names.
+
+config BR2_PACKAGE_SAMBA_LIBNSS_WINBIND
+	bool "libnss_winbind"
+	default y
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_PACKAGE_SAMBA_WINBINDD
+	help
+	  libnss_winbind is a library that permits the Name Service
+	  Switch to resolve user and group information from a Windows
+	  NT server.
+
 endmenu
 
 
package/samba/samba.mk +18 -0
index 1957997..c87b391 100644
@@ -135,6 +135,24 @@ endef
 
 SAMBA_POST_INSTALL_TARGET_HOOKS += SAMBA_REMOVE_UNNEEDED_BINARIES
 
+ifeq ($(BR2_PACKAGE_SAMBA_LIBNSS_WINS),y)
+define SAMBA_INSTALL_LIBNSS_WINS
+	# install libnss_wins
+	$(INSTALL) -m 0755 -D $(@D)/nsswitch/libnss_wins.so $(TARGET_DIR)/lib/libnss_wins.so
+	ln -snf libnss_wins.so $(TARGET_DIR)/lib/libnss_wins.so.2
+endef
+SAMBA_POST_INSTALL_TARGET_HOOKS += SAMBA_INSTALL_LIBNSS_WINS
+endif
+
+ifeq ($(BR2_PACKAGE_SAMBA_LIBNSS_WINBIND),y)
+define SAMBA_INSTALL_LIBNSS_WINBIND
+	# install libnss_winbind
+	$(INSTALL) -m 0755 -D $(@D)/nsswitch/libnss_winbind.so $(TARGET_DIR)/lib/libnss_winbind.so
+	ln -snf libnss_winbind.so $(TARGET_DIR)/lib/libnss_winbind.so.2
+endef
+SAMBA_POST_INSTALL_TARGET_HOOKS += SAMBA_INSTALL_LIBNSS_WINBIND
+endif
+
 define SAMBA_REMOVE_SWAT_DOCUMENTATION
 	# Remove the documentation
 	rm -rf $(TARGET_DIR)/usr/swat/help/manpages
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 1/1 samba: Add support for libnss_win*.so* installation

Quoted 11 lines · Beno?t Th?baudeau

The libnss_wins and libnss_winbind libraries are required in order to add support for the wins and winbind sources to the Name Service Switch (NSS), so make it possible to install them. This is useful in order to resolve NetBIOS names or user and group information from a Windows NT server.

These libraries are installed to /lib/ like the standard libnss_* libraries from (E)GLIBC.

Quoted 8 lines

---

Changes in v2:
- Make BR2_PACKAGE_SAMBA_LIBNSS_WIN* depend on BR2_TOOLCHAIN_USES_GLIBC and BR2_PACKAGE_SAMBA_WINBINDD.
- Use full path for target in 'install -D'.
- Move the definitions of the hook functions inside the corresponding conditional blocks.

Note that the winbindd daemon is still not started by S91smb if BR2_PACKAGE_SAMBA_WINBINDD is set.

Regards,
Beno?t

#2 lore raw

PATCH v2 1/1 samba: Add support for libnss_win*.so* installation

Dear Beno?t Th?baudeau,

Quoted 2 lines · Beno?t Th?baudeau

Note that the winbindd daemon is still not started by S91smb if BR2_PACKAGE_SAMBA_WINBINDD is set.

Patches welcome! It could be a separate init script, though.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v2 1/1 samba: Add support for libnss_win*.so* installation

In reply to Benoît Thébaudeau

Dear Beno?t Th?baudeau,

Quoted 10 lines · Beno?t Th?baudeau

The libnss_wins and libnss_winbind libraries are required in order to add support for the wins and winbind sources to the Name Service Switch (NSS), so make it possible to install them. This is useful in order to resolve NetBIOS names or user and group information from a Windows NT server.

These libraries are installed to /lib/ like the standard libnss_* libraries from (E)GLIBC.

Applied to next. One question, though.

package/samba/samba.mk endef · line 142

Quoted 5 lines
package/samba/samba.mk +5 -0
+ifeq ($(BR2_PACKAGE_SAMBA_LIBNSS_WINS),y)
+define SAMBA_INSTALL_LIBNSS_WINS
+	# install libnss_wins
+	$(INSTALL) -m 0755 -D $(@D)/nsswitch/libnss_wins.so $(TARGET_DIR)/lib/libnss_wins.so
+	ln -snf libnss_wins.so $(TARGET_DIR)/lib/libnss_wins.so.2

This dance is a bit weird. Normally, it's the opposite that is done:
the .so.X is the real file, and the .so is a symbolic link. Any reason to do it the way you did it?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH v2 1/1 samba: Add support for libnss_win*.so* installation

Dear Thomas Petazzoni,

Quoted 4 lines · Thomas Petazzoni

On Wed, 26 Nov 2014 01:00:15 +0100, Beno?t Th?baudeau wrote:
Applied to next. One question, though.

Quoted 9 lines

package/samba/samba.mk endef · line 142

Quoted 5 lines
package/samba/samba.mk +5 -0
+ifeq ($(BR2_PACKAGE_SAMBA_LIBNSS_WINS),y)
+define SAMBA_INSTALL_LIBNSS_WINS
+     # install libnss_wins
+     $(INSTALL) -m 0755 -D $(@D)/nsswitch/libnss_wins.so $(TARGET_DIR)/lib/libnss_wins.so
+     ln -snf libnss_wins.so $(TARGET_DIR)/lib/libnss_wins.so.2

This dance is a bit weird. Normally, it's the opposite that is done:
the .so.X is the real file, and the .so is a symbolic link. Any reason to do it the way you did it?

I had noticed that EGLIBC's libnss files were organized in this unusual way in my cross-toolchain:
/lib/libnss_<service>-<version>.so /lib/libnss_<service>.so.<major> -> /lib/libnss_<service>-<version>.so

That's why I decided to do something similar for winbind and wins for consistency, although these don't have a version in the library filename.

Now that I've had a second look at it, I also see the following:
/usr/lib/libnss_<service>.so -> /lib/libnss_<service>.so.<major>

So I now think that changing my installation function to do the opposite would be better, all the more this is also what is done on a major OS like Ubuntu 14.10:
/lib/x86_64-linux-gnu/libnss_compat-2.19.so /lib/x86_64-linux-gnu/libnss_compat.so.2 -> libnss_compat-2.19.so /lib/x86_64-linux-gnu/libnss_dns-2.19.so /lib/x86_64-linux-gnu/libnss_dns.so.2 -> libnss_dns-2.19.so /lib/x86_64-linux-gnu/libnss_files-2.19.so /lib/x86_64-linux-gnu/libnss_files.so.2 -> libnss_files-2.19.so /lib/x86_64-linux-gnu/libnss_hesiod-2.19.so /lib/x86_64-linux-gnu/libnss_hesiod.so.2 -> libnss_hesiod-2.19.so /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2 /lib/x86_64-linux-gnu/libnss_mdns4.so.2 /lib/x86_64-linux-gnu/libnss_mdns6_minimal.so.2 /lib/x86_64-linux-gnu/libnss_mdns6.so.2 /lib/x86_64-linux-gnu/libnss_mdns_minimal.so.2 /lib/x86_64-linux-gnu/libnss_mdns.so.2 /lib/x86_64-linux-gnu/libnss_nis-2.19.so /lib/x86_64-linux-gnu/libnss_nisplus-2.19.so /lib/x86_64-linux-gnu/libnss_nisplus.so.2 -> libnss_nisplus-2.19.so /lib/x86_64-linux-gnu/libnss_nis.so.2 -> libnss_nis-2.19.so /lib/x86_64-linux-gnu/libnss_winbind.so -> libnss_winbind.so.2 /lib/x86_64-linux-gnu/libnss_winbind.so.2 /lib/x86_64-linux-gnu/libnss_wins.so -> libnss_wins.so.2 /lib/x86_64-linux-gnu/libnss_wins.so.2 /usr/lib/debug/lib/x86_64-linux-gnu/libnss_compat-2.19.so /usr/lib/debug/lib/x86_64-linux-gnu/libnss_dns-2.19.so /usr/lib/debug/lib/x86_64-linux-gnu/libnss_files-2.19.so /usr/lib/debug/lib/x86_64-linux-gnu/libnss_hesiod-2.19.so /usr/lib/debug/lib/x86_64-linux-gnu/libnss_nis-2.19.so /usr/lib/debug/lib/x86_64-linux-gnu/libnss_nisplus-2.19.so /usr/lib/x86_64-linux-gnu/libnss_compat.so -> /lib/x86_64-linux-gnu/libnss_compat.so.2 /usr/lib/x86_64-linux-gnu/libnss_dns.so -> /lib/x86_64-linux-gnu/libnss_dns.so.2 /usr/lib/x86_64-linux-gnu/libnss_files.so -> /lib/x86_64-linux-gnu/libnss_files.so.2 /usr/lib/x86_64-linux-gnu/libnss_hesiod.so -> /lib/x86_64-linux-gnu/libnss_hesiod.so.2 /usr/lib/x86_64-linux-gnu/libnss_nisplus.so -> /lib/x86_64-linux-gnu/libnss_nisplus.so.2 /usr/lib/x86_64-linux-gnu/libnss_nis.so -> /lib/x86_64-linux-gnu/libnss_nis.so.2 /usr/lib/x86_64-linux-gnu/samba/libnss_info.so.0

I should send a new patch for that.

Best regards,
Beno?t

#5 lore raw

PATCH v2 1/1 samba: Add support for libnss_win*.so* installation

Dear Beno?t Th?baudeau,

Quoted 1 line · Beno?t Th?baudeau

I should send a new patch for that.

Yes, would be good. Thanks for having researched this!

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com