7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
authorWilliam.Johnston <William.Johnston@Sun.Com>
Mon, 18 Jun 2012 15:11:00 -0700
changeset 875 5e870fe2b411
parent 874 cef42778dd8b
child 876 46e15d3fb303
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
components/proftpd/Makefile
components/proftpd/patches/mod_auth_unix_getgrp.patch
--- a/components/proftpd/Makefile	Mon Jun 18 11:06:49 2012 -0700
+++ b/components/proftpd/Makefile	Mon Jun 18 15:11:00 2012 -0700
@@ -55,7 +55,7 @@
 # instead of 'e'.
 IPS_COMPONENT_VERSION=  $(COMPONENT_VERSION).0.7
 
-CONFIGURE_OPTIONS +=	CFLAGS="$(CFLAGS) -I/usr/include/kerberosv5 -DHAVE_KRB5_H=1 -DKRB5_DLLIMP="
+CONFIGURE_OPTIONS +=	CFLAGS="$(CFLAGS) -I/usr/include/kerberosv5 -DHAVE_KRB5_H=1 -DKRB5_DLLIMP= -DHAVE__GETGRPSBYMEMBER"
 # Force immediate binding because of chroot().
 CONFIGURE_OPTIONS +=	LDFLAGS="-z guidance=nolazyload -z nolazyload -lbsm"
 CONFIGURE_OPTIONS +=	install_user=$(LOGNAME)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/proftpd/patches/mod_auth_unix_getgrp.patch	Mon Jun 18 15:11:00 2012 -0700
@@ -0,0 +1,66 @@
+--- old/modules/mod_auth_unix.c	Fri May 25 08:31:35 2012
++++ new/modules/mod_auth_unix.c	Fri May 25 08:31:35 2012
+@@ -896,6 +896,13 @@
+ 
+   return gr ? mod_create_data(cmd, (void *) &gr->gr_gid) : PR_DECLINED(cmd);
+ }
++#ifdef HAVE__GETGRPSBYMEMBER
++  extern int _getgroupsbymember
++  (
++	const char* username, gid_t gid_array[],
++	int maxgids, int numgids
++  ); 
++#endif /* HAVE__GETGRPSBYMEMBER */
+ 
+ /* cmd->argv[0] = name
+  * cmd->argv[1] = (array_header **) group_ids
+@@ -1065,7 +1072,40 @@
+     }
+ 
+     free(ptr);
+-#else
++#else /* !HAVE_GETGRSET */
++#ifdef HAVE__GETGRPSBYMEMBER
++    gid_t group_ids[NGROUPS_MAX];
++    int ngroups = NGROUPS_MAX;
++    register unsigned int i;
++
++    pr_trace_msg("auth", 4,
++      "using _getgroupsbymember() to look up group membership");
++
++    memset(group_ids, 0, sizeof(group_ids));
++
++    group_ids[0]=pw->pw_gid;
++    ngroups=
++      _getgroupsbymember(pw->pw_name, group_ids, NGROUPS_MAX, 1);
++
++    if (ngroups < 0) {
++	pr_log_pri(PR_LOG_ERR,
++	    "_getgroupsbymember error: %s", strerror(errno));
++	return PR_DECLINED(cmd);
++    }
++
++    for (i = 0; i < ngroups; i++) {
++      gr = my_getgrgid(group_ids[i]);
++      if (gr) {
++        if (gids && pw->pw_gid != gr->gr_gid)
++          *((gid_t *) push_array(gids)) = gr->gr_gid;
++
++        if (groups && pw->pw_gid != gr->gr_gid) {
++          *((char **) push_array(groups)) = pstrdup(session.pool,
++            gr->gr_name);
++        }
++      }
++    }
++#else /* !HAVE__GETGRPSBYMEMBER */
+     char **gr_member = NULL;
+ 
+     /* This is where things get slow, expensive, and ugly.  Loop through
+@@ -1091,6 +1131,7 @@
+         }
+       }
+     }
++#endif /* !HAVE__GETGROUPSBYMEMBER */
+ #endif /* !HAVE_GETGRSET */
+   }
+