~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to testsuite/nsswitch/bigfd.c

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Test maximum number of file descriptors winbind daemon can handle
 
3
 */
 
4
 
 
5
#include <stdio.h>
 
6
#include <string.h>
 
7
#include <pwd.h>
 
8
#include <sys/types.h>
 
9
 
 
10
int main(int argc, char **argv)
 
11
{
 
12
    struct passwd *pw;
 
13
    int i;
 
14
 
 
15
    while(1) {
 
16
        
 
17
        /* Start getpwent until we get an NT user.  This way we know we
 
18
           have at least opened a connection to the winbind daemon */
 
19
 
 
20
        setpwent();
 
21
 
 
22
        while((pw = getpwent()) != NULL) {
 
23
            if (strchr(pw->pw_name, '/') != NULL) {
 
24
                break;
 
25
            }
 
26
        }
 
27
 
 
28
        if (pw != NULL) {
 
29
            i++;
 
30
            printf("got pwent handle %d\n", i);
 
31
        } else {
 
32
            printf("winbind daemon not running?\n");
 
33
            exit(1);
 
34
        }
 
35
 
 
36
        sleep(1);
 
37
    }
 
38
}