summaryrefslogtreecommitdiffstats
path: root/testsuite/nsswitch/bigfd.c
blob: 99e402e0f3381b78fda694c51fd560eeced80606 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Test maximum number of file descriptors winbind daemon can handle
 */

#include <stdio.h>
#include <string.h>
#include <pwd.h>
#include <sys/types.h>

int main(int argc, char **argv)
{
    struct passwd *pw;
    int i;

    while(1) {
        
        /* Start getpwent until we get an NT user.  This way we know we
           have at least opened a connection to the winbind daemon */

        setpwent();

        while((pw = getpwent()) != NULL) {
            if (strchr(pw->pw_name, '/') != NULL) {
                break;
            }
        }

        if (pw != NULL) {
            i++;
            printf("got pwent handle %d\n", i);
        } else {
            printf("winbind daemon not running?\n");
            exit(1);
        }

        sleep(1);
    }
}