This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nscd/22632] New: frequest getpwuid failures in LDAP environemnt
- From: "hiralo at netapp dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 19 Dec 2017 06:30:30 +0000
- Subject: [Bug nscd/22632] New: frequest getpwuid failures in LDAP environemnt
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=22632
Bug ID: 22632
Summary: frequest getpwuid failures in LDAP environemnt
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: nscd
Assignee: unassigned at sourceware dot org
Reporter: hiralo at netapp dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
We are observing glibc-2.16 ‘getpwuid()’ failing even for valid uids.
Can you please suggest patch for glibc-2.16?
Sample C prog and compile steps:
5 /*
6 a. Using glibc-2.16
7 $ gcc -Wl,-rpath <path_to_host_glibc-2.16 i.e. /tmp/glibc-2.16/lib>
-o using_glibc-2.16 test.c
8 $ ldd using_glibc-2.16
9 linux-vdso.so.1 (0x00007fff4e968000)
10 libc.so.6 => //tmp/glibc-2.16/lib/libc.so.6 (0x00007f555a35d000)
11 /tmp/glibc-2.16/lib/ld-linux-x86-64.so.2 (0x00007f555a705000)
12 */
13
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <errno.h>
17 #include <string.h>
18 #include <sys/types.h>
19 #include <pwd.h>
20 #include <sys/time.h>
21
22 char noerror[] = "The given name or uid was not found.";
23
24 int main( int argc, char **argv )
25 {
26 FILE *fp;
27 char uidnumber[32];
28 uid_t uidn[32768];
29 unsigned long i = 0, iteration = 0, failed = 0, sample = 100;
30 float per_s = 0, pct = 0;
31 int errsv;
32 struct passwd *pwent;
33 struct timeval start;
34 struct timeval now;
35
36 /* Open the command for reading. */
37 fp = popen("/usr/bin/ldapcat passwd | /usr/bin/cut -d: -f3", "r");
38 if (fp == NULL) {
39 printf("Failed to run command\n" );
40 exit(1);
41 }
42
43 /* Read the output a line at a time - output it. */
44 while (fgets(uidnumber, sizeof(uidnumber)-1, fp) != NULL) {
45 uidn[i++] = atol(uidnumber);
46 uidn[i] = -1;
47 }
48
49 /* close */
50 pclose(fp);
51
52 gettimeofday(&start, NULL);
53 while (1)
54 {
55 i = 0;
56 while (uidn[i] != -1)
57 {
58 iteration++;
59 pct = (float)failed / (float)iteration * 100;
60 errno = 0;
61 if ((pwent = getpwuid(uidn[i])) == NULL)
62 {
63 errsv = errno;
64 failed++;
65 pct = (float)failed / (float)iteration * 100;
66 printf("%ld/%ld (%0.6f%) (%1.0f/sec %ds ET)
getpwuid(%ld) - %s (%d)\n",
67 failed, iteration, pct, per_s, now.tv_sec -
start.tv_sec, uidn[i++],
68 (errsv == 0 ? noerror : strerror(errsv)),
errsv);
69 }
70
71 if ((iteration % (sample*10)) == 0)
72 {
73 gettimeofday(&now, NULL);
74 if (now.tv_sec - start.tv_sec > 0)
75 {
76 per_s = iteration / (now.tv_sec - start.tv_sec);
77 }
78
79 sample = (((int)per_s/40)/10)*10;
80 if (sample < 10) { sample = 10; }
81 if (sample > 10000) { sample = 10000; }
82 }
83
84 if (iteration % sample == 0)
85 {
86 printf("%ld/%ld (%0.6f%) (%1.0f/sec %ds ET)
getpwuid(%ld) \r",
87 failed, iteration, pct, per_s, now.tv_sec -
start.tv_sec, uidn[i++]);
88 }
89 }
90 }
91 return 0;
92 }
</draft>
Thank you.
--
You are receiving this mail because:
You are on the CC list for the bug.