]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/glibc/glibc-2.3.2/nss_compat-shadow.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / glibc / glibc-2.3.2 / nss_compat-shadow.patch
1 --- nis/nss_compat/compat-spwd.c
2 +++ nis/nss_compat/compat-spwd.c        2003/09/01 15:14:14
3 @@ -435,7 +435,7 @@
4    copy_spwd_changes (result, &pwd, p, plen);
5    give_spwd_free (&pwd);
6    /* We found the entry.  */
7 -  return NSS_STATUS_RETURN;
8 +  return NSS_STATUS_SUCCESS;
9  }
10  
11  static enum nss_status
12 @@ -539,13 +539,16 @@
13        if (result->sp_namp[0] == '+' && result->sp_namp[1] != '\0'
14           && result->sp_namp[1] != '@')
15         {
16 +          size_t len = strlen (result->sp_namp);
17 +          char buf[len];
18           enum nss_status status;
19  
20           /* Store the User in the blacklist for the "+" at the end of
21              /etc/passwd */
22 -         blacklist_store_name (&result->sp_namp[1], ent);
23 +          memcpy (buf, &result->sp_namp[1], len);
24           status = getspnam_plususer (&result->sp_namp[1], result, ent,
25                                       buffer, buflen, errnop);
26 +         blacklist_store_name (buf, ent);
27  
28           if (status == NSS_STATUS_SUCCESS)     /* We found the entry. */
29             break;
30 @@ -653,6 +656,9 @@
31               return NSS_STATUS_TRYAGAIN;
32             }
33  
34 +          /* Terminate the line for any case.  */
35 +          buffer[buflen - 1] = '\0';
36 +
37           /* Skip leading blanks.  */
38           while (isspace (*p))
39             ++p;
40 @@ -686,21 +692,8 @@
41        if (result->sp_namp[0] == '-' && result->sp_namp[1] == '@'
42           && result->sp_namp[2] != '\0')
43         {
44 -         /* XXX Do not use fixed length buffers.  */
45 -         char buf2[1024];
46 -         char *user, *host, *domain;
47 -         struct __netgrent netgrdata;
48 -
49 -         bzero (&netgrdata, sizeof (struct __netgrent));
50 -         __internal_setnetgrent (&result->sp_namp[2], &netgrdata);
51 -         while (__internal_getnetgrent_r (&host, &user, &domain, &netgrdata,
52 -                                          buf2, sizeof (buf2), errnop))
53 -           {
54 -             if (user != NULL && user[0] != '-')
55 -               if (strcmp (user, name) == 0)
56 -                 return NSS_STATUS_NOTFOUND;
57 -           }
58 -         __internal_endnetgrent (&netgrdata);
59 +         if (innetgr (&result->sp_namp[2], NULL, name, NULL))
60 +            return NSS_STATUS_NOTFOUND;
61           continue;
62         }
63  
64 @@ -708,25 +701,18 @@
65        if (result->sp_namp[0] == '+' && result->sp_namp[1] == '@'
66           && result->sp_namp[2] != '\0')
67         {
68 -         char *buf = strdupa (&result->sp_namp[2]);
69 -         int status;
70 +          enum nss_status status;
71  
72 -         ent->netgroup = TRUE;
73 -         ent->first = TRUE;
74 -         copy_spwd_changes (&ent->pwd, result, NULL, 0);
75 +          if (innetgr (&result->sp_namp[2], NULL, name, NULL))
76 +            {
77 +              status = getspnam_plususer (name, result, ent, buffer,
78 +                                          buflen, errnop);
79  
80 -         do
81 -           {
82 -             status = getspent_next_nss_netgr (name, result, ent, buf,
83 -                                               buffer, buflen, errnop);
84 -             if (status == NSS_STATUS_RETURN)
85 -               continue;
86 +              if (status == NSS_STATUS_RETURN)
87 +                continue;
88  
89 -             if (status == NSS_STATUS_SUCCESS
90 -                 && strcmp (result->sp_namp, name) == 0)
91 -               return NSS_STATUS_SUCCESS;
92 -           }
93 -         while (status == NSS_STATUS_SUCCESS);
94 +              return status;
95 +            }
96           continue;
97         }
98  
99 @@ -767,10 +753,12 @@
100           status = getspnam_plususer (name, result, ent,
101                                       buffer, buflen, errnop);
102  
103 -         if (status == NSS_STATUS_RETURN)      /* We couldn't parse the entry */
104 -           return NSS_STATUS_NOTFOUND;
105 -         else
106 -           return status;
107 +          if (status == NSS_STATUS_SUCCESS)     /* We found the entry. */
108 +            break;
109 +          else if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
110 +            return NSS_STATUS_NOTFOUND;
111 +          else
112 +            return status;
113         }
114      }
115    return NSS_STATUS_SUCCESS;
116 @@ -796,10 +784,8 @@
117  
118    result = internal_setspent (&ent, 0);
119  
120 -  if (result != NSS_STATUS_SUCCESS)
121 -    return result;
122 -
123 -  result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop);
124 +  if (result == NSS_STATUS_SUCCESS)
125 +    result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop);
126  
127    internal_endspent (&ent);
128