zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: disabling dependence on dynamic NSS modules
@ 2006-02-19 19:31 Clint Adams
  2006-02-20  4:27 ` Dan Nelson
  0 siblings, 1 reply; 5+ messages in thread
From: Clint Adams @ 2006-02-19 19:31 UTC (permalink / raw)
  To: zsh-workers

If one has zsh statically-linked against GNU libc, one will
encounter troubles if /lib/libnss*.so are missing or have a
different ABI from the glibc zsh was compiled against.

Since these ABI changes are not uncommon, this is meant to
make a static zsh more robust.

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.48
diff -u -r1.48 configure.ac
--- configure.ac	8 Jan 2006 23:08:39 -0000	1.48
+++ configure.ac	19 Feb 2006 19:27:40 -0000
@@ -2099,6 +2099,23 @@
   AC_DEFINE(MULTIBYTE_SUPPORT)
 fi
 
+dnl
+dnl static user lookup
+dnl
+AC_ARG_ENABLE(dynamic-nss,
+	      AC_HELP_STRING([--disable-dynamic-nss], [do not call
+			      functions that will require dynamic NSS
+			      modules]),
+[zsh_cv_c_dynamic_nss=$enableval],
+[])
+
+AH_TEMPLATE([DISABLE_DYNAMIC_NSS],
+[Define to 1 if you want to avoid calling functions that will require
+ dynamic NSS modules.])
+if test $zsh_cv_c_dynamic_nss = no; then
+  AC_DEFINE(DISABLE_DYNAMIC_NSS)
+fi
+
 dnl ---------------
 dnl dynamic loading
 dnl ---------------
Index: Src/glob.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/glob.c,v
retrieving revision 1.49
diff -u -r1.49 glob.c
--- Src/glob.c	15 Dec 2005 10:38:56 -0000	1.49
+++ Src/glob.c	19 Feb 2006 19:27:42 -0000
@@ -1263,7 +1263,7 @@
 				 NULL, 0);
 			    data = 0;
 			} else {
-#ifdef HAVE_GETPWNAM
+#ifdef USE_GETPWNAM
 			    struct passwd *pw;
 			    sav = *tt;
 			    *tt = '\0';
@@ -1275,11 +1275,11 @@
 				data = 0;
 			    }
 			    *tt = sav;
-#else /* !HAVE_GETPWNAM */
+#else /* !USE_GETPWNAM */
 			    sav = *tt;
 			    zerr("unknown user", NULL, 0);
 			    data = 0;
-#endif /* !HAVE_GETPWNAM */
+#endif /* !USE_GETPWNAM */
 			    if (sav)
 				s = tt + 1;
 			    else
@@ -1303,7 +1303,7 @@
 				 NULL, 0);
 			    data = 0;
 			} else {
-#ifdef HAVE_GETGRNAM
+#ifdef USE_GETGRNAM
 			    struct group *gr;
 			    sav = *tt;
 			    *tt = '\0';
@@ -1315,11 +1315,11 @@
 				data = 0;
 			    }
 			    *tt = sav;
-#else /* !HAVE_GETGRNAM */
+#else /* !USE_GETGRNAM */
 			    sav = *tt;
 			    zerr("unknown group", NULL, 0);
 			    data = 0;
-#endif /* !HAVE_GETGRNAM */
+#endif /* !USE_GETGRNAM */
 			    if (sav)
 				s = tt + 1;
 			    else
Index: Src/hashtable.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hashtable.c,v
retrieving revision 1.22
diff -u -r1.22 hashtable.c
--- Src/hashtable.c	15 Nov 2005 08:44:17 -0000	1.22
+++ Src/hashtable.c	19 Feb 2006 19:27:43 -0000
@@ -1340,7 +1340,7 @@
 	    }
 	}
 #else  /* no NIS or NIS_PLUS */
-#ifdef HAVE_GETPWENT
+#ifdef USE_GETPWENT
 	struct passwd *pw;
  
 	setpwent();
Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.63
diff -u -r1.63 init.c
--- Src/init.c	7 Feb 2006 11:29:33 -0000	1.63
+++ Src/init.c	19 Feb 2006 19:27:44 -0000
@@ -628,7 +628,7 @@
 void
 setupvals(void)
 {
-#ifdef HAVE_GETPWUID
+#ifdef USE_GETPWUID
     struct passwd *pswd;
 #endif
     struct timezone dummy_tz;
@@ -796,14 +796,14 @@
     cached_uid = getuid();
 
     /* Get password entry and set info for `USERNAME' */
-#ifdef HAVE_GETPWUID
+#ifdef USE_GETPWUID
     if ((pswd = getpwuid(cached_uid))) {
 	if (emulation == EMULATE_ZSH)
 	    home = metafy(pswd->pw_dir, -1, META_DUP);
 	cached_username = ztrdup(pswd->pw_name);
     }
     else
-#endif /* HAVE_GETPWUID */
+#endif /* USE_GETPWUID */
     {
 	if (emulation == EMULATE_ZSH)
 	    home = ztrdup("/");
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.109
diff -u -r1.109 params.c
--- Src/params.c	7 Feb 2006 11:29:33 -0000	1.109
+++ Src/params.c	19 Feb 2006 19:27:46 -0000
@@ -3019,7 +3019,7 @@
     struct passwd *pswd;
 
     if (x && (pswd = getpwnam(x)) && (pswd->pw_uid != cached_uid)) {
-# ifdef HAVE_INITGROUPS
+# ifdef USE_INITGROUPS
 	initgroups(x, pswd->pw_gid);
 # endif
 	if(!setgid(pswd->pw_gid) && !setuid(pswd->pw_uid)) {
Index: Src/system.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/system.h,v
retrieving revision 1.38
diff -u -r1.38 system.h
--- Src/system.h	8 Jan 2006 22:37:15 -0000	1.38
+++ Src/system.h	19 Feb 2006 19:27:46 -0000
@@ -710,3 +710,28 @@
 #    include <iconv.h>
 #  endif
 #endif
+
+#if defined(HAVE_INITGROUPS) && !defined(DISABLE_DYNAMIC_NSS)
+# define USE_INITGROUPS
+#endif
+
+#if defined(HAVE_GETGRGID) && !defined(DISABLE_DYNAMIC_NSS)
+# define USE_GETGRGID
+#endif
+
+#if defined(HAVE_GETGRNAM) && !defined(DISABLE_DYNAMIC_NSS)
+# define USE_GETGRNAM
+#endif
+
+#if defined(HAVE_GETPWENT) && !defined(DISABLE_DYNAMIC_NSS)
+# define USE_GETPWENT
+#endif
+
+#if defined(HAVE_GETPWNAM) && !defined(DISABLE_DYNAMIC_NSS)
+# define USE_GETPWNAM
+#endif
+
+#if defined(HAVE_GETPWUID) && !defined(DISABLE_DYNAMIC_NSS)
+# define USE_GETPWUID
+#endif
+
Index: Src/Modules/stat.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/stat.c,v
retrieving revision 1.11
diff -u -r1.11 stat.c
--- Src/Modules/stat.c	13 Jan 2006 09:15:59 -0000	1.11
+++ Src/Modules/stat.c	19 Feb 2006 19:27:46 -0000
@@ -166,13 +166,13 @@
 	    strcat(outbuf, " (");
     }
     if (flags & STF_STRING) {
-#ifdef HAVE_GETGRGID
+#ifdef USE_GETGRGID
 	struct group *gr;
 	gr = getgrgid(gid);
 	if (gr)
 	    strcat(outbuf, gr->gr_name);
 	else
-#endif /* !HAVE_GETGRGID */
+#endif /* !USE_GETGRGID */
 	{
 	    char *optr;
 	    for (optr = outbuf; *optr; optr++)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: disabling dependence on dynamic NSS modules
  2006-02-19 19:31 PATCH: disabling dependence on dynamic NSS modules Clint Adams
@ 2006-02-20  4:27 ` Dan Nelson
  2006-02-20  4:37   ` Clint Adams
  2006-02-20  4:45   ` Andrey Borzenkov
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Nelson @ 2006-02-20  4:27 UTC (permalink / raw)
  To: zsh-workers

In the last episode (Feb 19), Clint Adams said:
> If one has zsh statically-linked against GNU libc, one will
> encounter troubles if /lib/libnss*.so are missing or have a
> different ABI from the glibc zsh was compiled against.

If you run nscd, applications will ask it over a unix socket using a
standard protocol, nscd will dlopen the required libs, do the lookups,
and return the result.  It also caches results so access to slow
providers like ldaps becomes tolerable.  It's basically required when
using newish versions of Oracle since it includes its own ldap
libraries which conflict with openldap, so if you are using nss_ldap
and not running nscd, you coredump :)

-- 
	Dan Nelson
	dnelson@allantgroup.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: disabling dependence on dynamic NSS modules
  2006-02-20  4:27 ` Dan Nelson
@ 2006-02-20  4:37   ` Clint Adams
  2006-02-20  4:45   ` Andrey Borzenkov
  1 sibling, 0 replies; 5+ messages in thread
From: Clint Adams @ 2006-02-20  4:37 UTC (permalink / raw)
  To: Dan Nelson; +Cc: zsh-workers

> If you run nscd, applications will ask it over a unix socket using a
> standard protocol, nscd will dlopen the required libs, do the lookups,
> and return the result.  It also caches results so access to slow
> providers like ldaps becomes tolerable.  It's basically required when
> using newish versions of Oracle since it includes its own ldap
> libraries which conflict with openldap, so if you are using nss_ldap
> and not running nscd, you coredump :)

In situations when one needs a statically-compiled shell, there is a
high degree of probability that nscd won't run.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: disabling dependence on dynamic NSS modules
  2006-02-20  4:27 ` Dan Nelson
  2006-02-20  4:37   ` Clint Adams
@ 2006-02-20  4:45   ` Andrey Borzenkov
  2006-02-20  5:28     ` Dan Nelson
  1 sibling, 1 reply; 5+ messages in thread
From: Andrey Borzenkov @ 2006-02-20  4:45 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 20 February 2006 07:27, Dan Nelson wrote:
> In the last episode (Feb 19), Clint Adams said:
> > If one has zsh statically-linked against GNU libc, one will
> > encounter troubles if /lib/libnss*.so are missing or have a
> > different ABI from the glibc zsh was compiled against.
>
> If you run nscd, applications will ask it over a unix socket using a
> standard protocol, nscd will dlopen the required libs, do the lookups,
> and return the result.  It also caches results so access to slow
> providers like ldaps becomes tolerable. 


Slightly OT, but at least on Solaris nscd is known to be single threaded 
meaning using it will effectively serialize lookup-intensive applications 
(like web or mail server). They may have changed in recent versions though.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD+UmAR6LMutpd94wRAkxEAKCxsecbdjKkXv1gmzhaUFw2TaxuagCeOxGG
R/fVlwAEebQBVAiBf1iwkcA=
=eySK
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: disabling dependence on dynamic NSS modules
  2006-02-20  4:45   ` Andrey Borzenkov
@ 2006-02-20  5:28     ` Dan Nelson
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Nelson @ 2006-02-20  5:28 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: zsh-workers

In the last episode (Feb 20), Andrey Borzenkov said:
> Slightly OT, but at least on Solaris nscd is known to be single
> threaded meaning using it will effectively serialize lookup-intensive
> applications (like web or mail server). They may have changed in
> recent versions though.

All my web searches point to nscd being threaded in at least S7.

-- 
	Dan Nelson
	dnelson@allantgroup.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-02-20  5:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-19 19:31 PATCH: disabling dependence on dynamic NSS modules Clint Adams
2006-02-20  4:27 ` Dan Nelson
2006-02-20  4:37   ` Clint Adams
2006-02-20  4:45   ` Andrey Borzenkov
2006-02-20  5:28     ` Dan Nelson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).