Subject: fatal: getgroups: Invalid argument
To: None <>
From: Kurt Schreiner <>
List: current-users
Date: 06/30/2007 23:23:16

after upgrading to current -current as of an hour or so ago I got
the error above from sshd trying to ssh to the upgraded machine.
The following patch remedies this and brings sys_getgroups to par
with what the manual for getgroups(2) states: (at least by my reading
of manual and code ;-)

     The possible errors for getgroups() are:

     [EINVAL]           The argument gidsetlen is non-zero and is smaller than
                        the number of groups in the group set.

cvs diff -u  kern_prot.c
Index: kern_prot.c
RCS file: /cvsroot/src/sys/kern/kern_prot.c,v
retrieving revision 1.103
diff -u -r1.103 kern_prot.c
--- kern_prot.c 30 Jun 2007 13:32:14 -0000      1.103
+++ kern_prot.c 30 Jun 2007 21:11:53 -0000
@@ -235,7 +235,7 @@
        *retval = kauth_cred_ngroups(l->l_cred);
        if (SCARG(uap, gidsetsize) == 0)
                return 0;
-       if (SCARG(uap, gidsetsize) > *retval)
+       if (SCARG(uap, gidsetsize) < *retval)
                return EINVAL;
        return kauth_cred_getgroups(l->l_cred, SCARG(uap, gidset), *retval,