Re: uclibc patch for shadow-4.0.15

Mike Frysinger <[email protected]> Sun, 7 May 2006 23:56:12 -0400
Newsgroups gmane.linux.pld.shadow.general
Organization wh0rd.org
Message-ID <[email protected]>
On Thursday 04 May 2006 19:26, Michael Mohr wrote:
> Unfortunately I don't really have any idea how to actually solve the first
> problem; it appears that NIS is not supported by uclibc.  Based on some
> google searches, I found that others had simply turned the function into a
> stub.  That seemed easiest, so that is what I've done.

nor will NIS be supported by uClibc ... this has been covered in the past, and 
the maintainer said he would rather clean up the current situation than 
propagate usage of the NIS define further ...

also, your patch isnt quite correct ... ive attached the more complete one we 
use in Gentoo atm

> The second problem was easier.  l64a() is a fairly simple piece of code to
> implement; indeed, J.T. Conklin of NetBSD has released a simple and clean
> implementation into the public domain.  I simply add his code into libmisc
> to fix the problem.

we've also mentioned this before on the list ... this is a bug in uClibc, not 
shadow ... ive already imported the a64l and l64a functions into uClibc svn, 
so this has been resolved there:
http://www.uclibc.org/cgi-bin/viewcvs.cgi?rev=11239&view=rev

> --- shadow-4.0.15/configure.in
> +++ shadow-4.0.15.new/configure.in
> @@ -108,6 +108,8 @@
>  AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
>  AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
>
> +dnl cannot check setpgrp if we are cross-compiling

no ... this is a bug in autoconf which i'm pretty sure has already been fixed 
in upstream gnu cvs, just not in the last released version

> +if test -z "$CC"; then

this is the wrong way to test for cross-compiling ... you should be testing 
the value of '$cross_compiling'
-mike
shadow-4.0.13-nonis.patch (text/x-diff, 1.8 KB)
--- src/login_nopam.c
+++ src/login_nopam.c
@@ -50,7 +50,9 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>		/* for inet_ntoa() */
 extern struct group *getgrnam ();
+#ifdef USE_NIS
 extern int innetgr ();
+#endif
 
 #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
 #undef MAXHOSTNAMELEN
@@ -178,6 +180,7 @@ static char *myhostname (void)
 	return (name);
 }
 
+#ifdef USE_NIS
 /* netgroup_match - match group against machine or user */
 static int
 netgroup_match (const char *group, const char *machine, const char *user)
@@ -193,6 +196,7 @@ netgroup_match (const char *group, const
 
 	return innetgr (group, machine, user, mydomain);
 }
+#endif
 
 /* user_match - match a username against one token */
 static int user_match (const char *tok, const char *string)
@@ -214,8 +218,10 @@ static int user_match (const char *tok, 
 		*at = 0;
 		return (user_match (tok, string)
 			&& from_match (at + 1, myhostname ()));
+#ifdef USE_NIS
 	} else if (tok[0] == '@') {	/* netgroup */
 		return (netgroup_match (tok + 1, (char *) 0, string));
+#endif
 	} else if (string_match (tok, string)) {	/* ALL or exact match */
 		return (YES);
 	} else if ((group = getgrnam (tok))) {	/* try group membership */
@@ -271,9 +277,12 @@ static int from_match (const char *tok, 
 	 * contain a "." character. If the token is a network number, return YES
 	 * if it matches the head of the string.
 	 */
+#ifdef USE_NIS
 	if (tok[0] == '@') {	/* netgroup */
 		return (netgroup_match (tok + 1, string, (char *) 0));
-	} else if (string_match (tok, string)) {	/* ALL or exact match */
+	} else
+#endif
+	if (string_match (tok, string)) {	/* ALL or exact match */
 		return (YES);
 	} else if (tok[0] == '.') {	/* domain: match last fields */
 		if ((str_len = strlen (string)) > (tok_len = strlen (tok))