summaryrefslogtreecommitdiff
path: root/source3/tests/getgroups.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-01-22 11:35:28 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-01-22 11:35:28 +0100
commite490c1b8c858ea42e31ae1a6504c4788e0fb1545 (patch)
tree850087c9403c37adfc54deaf831a3e729223fa9a /source3/tests/getgroups.c
parent63e23a7d648cb608a9834b4397c0aed765a1d459 (diff)
downloadsamba-e490c1b8c858ea42e31ae1a6504c4788e0fb1545.tar.gz
samba-e490c1b8c858ea42e31ae1a6504c4788e0fb1545.tar.bz2
samba-e490c1b8c858ea42e31ae1a6504c4788e0fb1545.zip
Move configure test files to the top-level and share them between s3 and
s4.
Diffstat (limited to 'source3/tests/getgroups.c')
-rw-r--r--source3/tests/getgroups.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/source3/tests/getgroups.c b/source3/tests/getgroups.c
deleted file mode 100644
index 343fd5a184..0000000000
--- a/source3/tests/getgroups.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* this tests whether getgroups actually returns lists of integers
- rather than gid_t. The test only works if the user running
- the test is in at least 1 group
-
- The test is designed to check for those broken OSes that define
- getgroups() as returning an array of gid_t but actually return a
- array of ints! Ultrix is one culprit
- */
-
-#if defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <grp.h>
-
-main()
-{
- int i;
- int *igroups;
- char *cgroups;
- int grp = 0;
- int ngroups = getgroups(0,&grp);
-
- if (sizeof(gid_t) == sizeof(int)) {
- fprintf(stderr,"gid_t and int are the same size\n");
- exit(1);
- }
-
- if (ngroups <= 0)
- ngroups = 32;
-
- igroups = (int *)malloc(sizeof(int)*ngroups);
-
- for (i=0;i<ngroups;i++)
- igroups[i] = 0x42424242;
-
- ngroups = getgroups(ngroups,(gid_t *)igroups);
-
- if (igroups[0] == 0x42424242)
- ngroups = 0;
-
- if (ngroups == 0) {
- printf("WARNING: can't determine getgroups return type\n");
- exit(1);
- }
-
- cgroups = (char *)igroups;
-
- if (ngroups == 1 &&
- cgroups[2] == 0x42 && cgroups[3] == 0x42) {
- fprintf(stderr,"getgroups returns gid_t\n");
- exit(1);
- }
-
- for (i=0;i<ngroups;i++) {
- if (igroups[i] == 0x42424242) {
- fprintf(stderr,"getgroups returns gid_t\n");
- exit(1);
- }
- }
-
- exit(0);
-}