--- shellinabox/launcher.c.ori	2010-11-23 09:20:33.000000000 +0100
+++ shellinabox/launcher.c	2010-11-23 09:53:29.000000000 +0100
@@ -1145,6 +1145,52 @@
 
   // Retrieve supplementary group ids.
   int ngroups;
+
+//define own getgrouplist here taken from freebsd, for it's missing in uclib
+int
+getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt)
+{
+        const struct group *grp;
+        int i, maxgroups, ngroups, ret;
+
+        ret = 0;
+        ngroups = 0;
+        maxgroups = *grpcnt;
+        /*
+         * When installing primary group, duplicate it;
+         * the first element of groups is the effective gid
+         * and will be overwritten when a setgid file is executed.
+         */
+        groups[ngroups++] = agroup;
+        if (maxgroups > 1)
+                groups[ngroups++] = agroup;
+        /*
+         * Scan the group file to find additional groups.
+         */
+        setgrent();
+        while ((grp = getgrent()) != NULL) {
+                for (i = 0; i < ngroups; i++) {
+                        if (grp->gr_gid == groups[i])
+                                goto skip;
+                }
+                for (i = 0; grp->gr_mem[i]; i++) {
+                        if (!strcmp(grp->gr_mem[i], uname)) {
+                                if (ngroups >= maxgroups) {
+                                        ret = -1;
+                                        break;
+                                }
+                                groups[ngroups++] = grp->gr_gid;
+                                break;
+                        }
+                }
+skip:
+                ;
+        }
+        endgrent();
+        *grpcnt = ngroups;
+        return (ret);
+}
+
 #if defined(__linux__)
   // On Linux, we can query the number of supplementary groups. On all other
   // platforms, we play it safe and just assume a fixed upper bound.
