summaryrefslogtreecommitdiff
path: root/source4/tests/getgroups.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-02-13 15:20:52 +0000
committerStefan Metzmacher <metze@samba.org>2004-02-13 15:20:52 +0000
commit7653fc6835ec1d97ee5483111e204b34060bbe84 (patch)
treef46c8b28afc911efd6168343059053dc8c815c1a /source4/tests/getgroups.c
parentf08565bd3a3a2d628be26957278988cc52e1b8f6 (diff)
downloadsamba-7653fc6835ec1d97ee5483111e204b34060bbe84.tar.gz
samba-7653fc6835ec1d97ee5483111e204b34060bbe84.tar.bz2
samba-7653fc6835ec1d97ee5483111e204b34060bbe84.zip
move external configure test programs
from tests/*.c to build/tests/*.c metze (This used to be commit dea3a3acbfe2341f9276ceaec2a42f0931e2c336)
Diffstat (limited to 'source4/tests/getgroups.c')
-rw-r--r--source4/tests/getgroups.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/source4/tests/getgroups.c b/source4/tests/getgroups.c
deleted file mode 100644
index 343fd5a184..0000000000
--- a/source4/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);
-}