diff svr-auth.c @ 1551:1acbdf64088e

add guard HAVE_GETGROUPLIST
author Matt Johnston <matt@ucc.asn.au>
date Tue, 27 Feb 2018 21:49:10 +0800
parents 51df3d53b050
children 61a793b6e471 f5026f7486de
line wrap: on
line diff
--- a/svr-auth.c	Tue Feb 27 21:41:56 2018 +0800
+++ b/svr-auth.c	Tue Feb 27 21:49:10 2018 +0800
@@ -197,6 +197,7 @@
 	m_free(methodname);
 }
 
+#ifdef HAVE_GETGROUPLIST
 /* returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
 static int check_group_membership(gid_t check_gid, const char* username, gid_t user_gid) {
 	int ngroups, i, ret;
@@ -230,7 +231,7 @@
 
 	return match;
 }
-
+#endif
 
 /* Check that the username exists and isn't disallowed (root), and has a valid shell.
  * returns DROPBEAR_SUCCESS on valid username, DROPBEAR_FAILURE on failure */
@@ -300,6 +301,7 @@
 	}
 
 	/* check for login restricted to certain group if desired */
+#ifdef HAVE_GETGROUPLIST
 	if (svr_opts.restrict_group) {
 		if (check_group_membership(svr_opts.restrict_group_gid,
 				ses.authstate.pw_name, ses.authstate.pw_gid) == DROPBEAR_FAILURE) {
@@ -310,6 +312,7 @@
 			return DROPBEAR_FAILURE;
 		}
 	}
+#endif HAVE_GETGROUPLIST
 
 	TRACE(("shell is %s", ses.authstate.pw_shell))