Merge branch 'org.openembedded.dev' of git://git.openembedded.net/openembedded into...
[vuplus_openembedded] / packages / mamona / bash-noemu-3.2 / 006-add_internal_libcpwd_functions.patch
1 Index: bash-3.2/libcnisint.c
2 ===================================================================
3 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4 +++ bash-3.2/libcnisint.c       2008-08-01 17:52:42.000000000 -0300
5 @@ -0,0 +1,296 @@
6 +#include "libcnisint.h"
7 +
8 +#include <stdlib.h>
9 +#include <stdio.h>
10 +#include <errno.h>
11 +#include <string.h>
12 +
13 +# undef ENTDATA
14 +
15 +struct parser_data
16 +  {
17 +#ifdef ENTDATA
18 +    struct ENTDATA entdata;
19 +# define ENTDATA_DECL(data) struct ENTDATA *const entdata = &data->entdata;
20 +#else
21 +# define ENTDATA_DECL(data)
22 +#endif
23 +    char linebuffer[0];
24 +  };
25 +
26 +
27 +static FILE *stream = NULL;
28 +static struct passwd passwd;
29 +static char buffer[NSS_BUFLEN_PASSWD];
30 +
31 +# define STRING_FIELD(variable, terminator_p, swallow)  \
32 +  {                                                     \
33 +    variable = line;                                    \
34 +    while (*line != '\0' && !terminator_p (*line))      \
35 +      ++line;                                           \
36 +    if (*line != '\0')                                  \
37 +      {                                                 \
38 +    *line = '\0';                                       \
39 +    do                                                  \
40 +      ++line;                                           \
41 +    while (swallow && terminator_p (*line));            \
42 +      }                                                 \
43 +  }
44 +
45 +# define STRUCTURE     passwd
46 +# define TRAILING_LIST_PARSER
47 +
48 +# define LINE_PARSER(EOLSET, BODY)                     \
49 +int parse_line (char *line, struct STRUCTURE *result,  \
50 +        struct parser_data *data, size_t datalen)      \
51 +{                                                      \
52 +  ENTDATA_DECL (data)                                  \
53 +  char *p = strpbrk (line, EOLSET "\n");               \
54 +  if (p != NULL)                                       \
55 +    *p = '\0';                                         \
56 +  BODY;                                                \
57 +  TRAILING_LIST_PARSER;                                \
58 +  return 1;                                            \
59 +}
60 +
61 +# define INT_FIELD_MAYBE_NULL(variable, terminator_p, swallow, base, convert, default)  \
62 +  {                                                                                     \
63 +    char *endp;                                                                         \
64 +    if (*line == '\0')                                                                  \
65 +      /* We expect some more input, so don't allow the string to end here. */           \
66 +      return 0;                                                                         \
67 +    variable = convert (strtoul (line, &endp, base));                                   \
68 +    if (endp == line)                                                                   \
69 +      variable = default;                                                               \
70 +    if (terminator_p (*endp))                                                           \
71 +      do                                                                                \
72 +    ++endp;                                                                             \
73 +      while (swallow && terminator_p (*endp));                                          \
74 +    else if (*endp != '\0')                                                             \
75 +      return 0;                                                                         \
76 +    line = endp;                                                                        \
77 +  }
78 +
79 +# define INT_FIELD(variable, terminator_p, swallow, base, convert) \
80 +  {                                                                \
81 +    char *endp;                                                    \
82 +    variable = convert (strtoul (line, &endp, base));              \
83 +    if (endp == line)                                              \
84 +      return 0;                                                    \
85 +    else if (terminator_p (*endp))                                 \
86 +      do                                                           \
87 +    ++endp;                                                        \
88 +      while (swallow && terminator_p (*endp));                     \
89 +    else if (*endp != '\0')                                        \
90 +      return 0;                                                    \
91 +    line = endp;                                                   \
92 +  }
93 +
94 +# define ISCOLON(c) ((c) == ':')
95 +
96 +LINE_PARSER (,
97 + STRING_FIELD (result->pw_name, ISCOLON, 0)
98 + if (line[0] == '\0'
99 +     && (result->pw_name[0] == '+' || result->pw_name[0] == '-'))
100 +   {
101 +     /* This a special case.  We allow lines containing only a `+' sign
102 +    since this is used for nss_compat.  All other services will
103 +    reject this entry later.  Initialize all other fields now.  */
104 +     result->pw_passwd = NULL;
105 +     result->pw_uid = 0;
106 +     result->pw_gid = 0;
107 +     result->pw_gecos = NULL;
108 +     result->pw_dir = NULL;
109 +     result->pw_shell = NULL;
110 +   }
111 + else
112 +   {
113 +     STRING_FIELD (result->pw_passwd, ISCOLON, 0)
114 +     if (result->pw_name[0] == '+' || result->pw_name[0] == '-')
115 +       {
116 +     INT_FIELD_MAYBE_NULL (result->pw_uid, ISCOLON, 0, 10, , 0)
117 +     INT_FIELD_MAYBE_NULL (result->pw_gid, ISCOLON, 0, 10, , 0)
118 +       }
119 +     else
120 +       {
121 +     INT_FIELD (result->pw_uid, ISCOLON, 0, 10,)
122 +     INT_FIELD (result->pw_gid, ISCOLON, 0, 10,)
123 +       }
124 +     STRING_FIELD (result->pw_gecos, ISCOLON, 0)
125 +     STRING_FIELD (result->pw_dir, ISCOLON, 0)
126 +     result->pw_shell = line;
127 +   }
128 + )
129 +
130 +
131 +void internal_setpwent (void)
132 +{
133 +  if (stream == NULL)
134 +    {
135 +      stream = fopen ("/etc/passwd", "rme");
136 +
137 +      if (stream == NULL)
138 +        fprintf (stderr, "ERROR: Cannot fopen \"/etc/passwd\". Errno: %d", errno);
139 +    }
140 +  else
141 +    rewind (stream);
142 +
143 +}
144 +
145 +void internal_endpwent (void)
146 +{
147 +  if (stream != NULL)
148 +    {
149 +      fclose (stream);
150 +      stream = NULL;
151 +    }
152 +}
153 +
154 +struct passwd *internal_getpwent (void)
155 +{
156 +  struct parser_data *data = (void *) &buffer;
157 +  struct passwd *result = &passwd;
158 +  int buflen = NSS_BUFLEN_PASSWD;
159 +
160 +  while (1)
161 +    {
162 +      fpos_t pos;
163 +      char *p;
164 +      int parse_res;
165 +
166 +      do
167 +    {
168 +      /* We need at least 3 characters for one line.  */
169 +      if (buflen < 3)
170 +        {
171 +        erange:
172 +          fprintf (stderr, "ERROR: Range error");
173 +          return NULL;
174 +        }
175 +
176 +      fgetpos (stream, &pos);
177 +      buffer[buflen - 1] = '\xff';
178 +      p = fgets (buffer, buflen, stream);
179 +      if (p == NULL && feof (stream))
180 +        return NULL;
181 +
182 +      if (p == NULL || buffer[buflen - 1] != '\xff')
183 +        {
184 +        erange_reset:
185 +          fsetpos (stream, &pos);
186 +          goto erange;
187 +        }
188 +
189 +      /* Terminate the line for any case.  */
190 +      buffer[buflen - 1] = '\0';
191 +
192 +      /* Skip leading blanks.  */
193 +      while (isspace (*p))
194 +        ++p;
195 +    }
196 +      while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines.  */
197 +              /* Parse the line.  If it is invalid, loop to
198 +                 get the next line of the file to parse.  */
199 +              !(parse_res = parse_line (p, result, data, buflen)));
200 +
201 +      if (parse_res == -1)
202 +          /* The parser ran out of space.  */
203 +          goto erange_reset;
204 +
205 +      if (result->pw_name[0] != '+' && result->pw_name[0] != '-')
206 +          /* This is a real entry.  */
207 +          break;
208 +
209 +      /* XXX Ignoring
210 +       *
211 +       *  -@netgroup
212 +       *  +@netgroup
213 +       *  -user
214 +       *  +user
215 +       *  +:...
216 +       *
217 +       * as we don't suppose to use them */
218 +
219 +    }
220 +
221 +  return result;
222 +
223 +}
224 +
225 +/* Searches in /etc/passwd and the NSS subsystem for a special user id */
226 +struct passwd *internal_getpwuid (uid_t uid)
227 +{
228 +  struct parser_data *data = (void *) buffer;
229 +  struct passwd *result = &passwd;
230 +  int buflen = NSS_BUFLEN_PASSWD;
231 +
232 +  internal_setpwent ();
233 +
234 +  while (1)
235 +    {
236 +      fpos_t pos;
237 +      char *p;
238 +      int parse_res;
239 +
240 +      do
241 +       {
242 +         /* We need at least 3 characters for one line.  */
243 +         if (buflen < 3)
244 +           {
245 +           erange:
246 +             fprintf (stderr, "ERROR: Range error");
247 +             return NULL;
248 +           }
249 +
250 +         fgetpos (stream, &pos);
251 +         buffer[buflen - 1] = '\xff';
252 +         p = fgets (buffer, buflen, stream);
253 +         if (p == NULL && feof (stream))
254 +           return NULL;
255 +
256 +         if (p == NULL || buffer[buflen - 1] != '\xff')
257 +           {
258 +           erange_reset:
259 +             fsetpos (stream, &pos);
260 +             goto erange;
261 +           }
262 +
263 +         /* Terminate the line for any case.  */
264 +         buffer[buflen - 1] = '\0';
265 +
266 +         /* Skip leading blanks.  */
267 +         while (isspace (*p))
268 +           ++p;
269 +       }
270 +      while (*p == '\0' || *p == '#' ||        /* Ignore empty and comment lines.  */
271 +            /* Parse the line.  If it is invalid, loop to
272 +               get the next line of the file to parse.  */
273 +            !(parse_res = parse_line (p, result, data, buflen)));
274 +
275 +      if (parse_res == -1)
276 +          /* The parser ran out of space.  */
277 +          goto erange_reset;
278 +
279 +      /* This is a real entry.  */
280 +      if (result->pw_name[0] != '+' && result->pw_name[0] != '-')
281 +      {
282 +          if (result->pw_uid == uid)
283 +              return result;
284 +          else
285 +              continue;
286 +      }
287 +
288 +      /* XXX Ignoring
289 +       *
290 +       *  -@netgroup
291 +       *  +@netgroup
292 +       *  -user
293 +       *  +user
294 +       *  +:...
295 +       *
296 +       * as we don't suppose to use them */
297 +
298 +    }
299 +  internal_endpwent ();
300 +  return result;
301 +}
302 Index: bash-3.2/libcnisint.h
303 ===================================================================
304 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
305 +++ bash-3.2/libcnisint.h       2008-08-01 17:18:20.000000000 -0300
306 @@ -0,0 +1,7 @@
307 +#include <pwd.h>
308 +
309 +void internal_setpwent (void);
310 +void internal_endpwent (void);
311 +struct passwd *internal_getpwent (void);
312 +struct passwd *internal_getpwuid (uid_t uid);
313 +
314 Index: bash-3.2/examples/loadables/finfo.c
315 ===================================================================
316 --- bash-3.2.orig/examples/loadables/finfo.c    2008-08-01 14:29:55.000000000 -0300
317 +++ bash-3.2/examples/loadables/finfo.c 2008-08-01 15:32:37.000000000 -0300
318 @@ -9,7 +9,6 @@
319  #include <sys/types.h>
320  #include "posixstat.h"
321  #include <stdio.h>
322 -#include <pwd.h>
323  #include <grp.h>
324  #include <errno.h>
325  
326 @@ -18,6 +17,8 @@
327  #include "builtins.h"
328  #include "common.h"
329  
330 +#include "libcnisint.h"
331 +
332  #ifndef errno
333  extern int     errno;
334  #endif
335 @@ -262,7 +263,7 @@
336         printf("Mode: (%o) ", (int) st->st_mode);
337         printmode((int) st->st_mode);
338         printf("Link count: %d\n", (int) st->st_nlink);
339 -       pw = getpwuid(st->st_uid);
340 +       pw = internal_getpwuid(st->st_uid);
341         owner = pw ? pw->pw_name : "unknown";
342         printf("Uid of owner: %d (%s)\n", (int) st->st_uid, owner);
343         gr = getgrgid(st->st_gid);
344 @@ -341,7 +342,7 @@
345         else if (flags & OPT_PMASK)
346                 printf("%o\n", getperm(st->st_mode) & pmask);
347         else if (flags & OPT_UID) {
348 -               pw = getpwuid(st->st_uid);
349 +               pw = internal_getpwuid(st->st_uid);
350                 if (flags & OPT_ASCII)
351                         printf("%s\n", pw ? pw->pw_name : "unknown");
352                 else
353 Index: bash-3.2/examples/loadables/id.c
354 ===================================================================
355 --- bash-3.2.orig/examples/loadables/id.c       2008-08-01 14:17:24.000000000 -0300
356 +++ bash-3.2/examples/loadables/id.c    2008-08-01 14:51:23.000000000 -0300
357 @@ -12,7 +12,6 @@
358  #include <config.h>
359  #include <stdio.h>
360  #include "bashtypes.h"
361 -#include <pwd.h>
362  #include <grp.h>
363  #include "bashansi.h"
364  
365 @@ -22,9 +21,8 @@
366  #  include <sys/param.h>
367  #endif
368  
369 -#if !defined (HAVE_GETPW_DECLS)
370 -extern struct passwd *getpwuid ();
371 -#endif
372 +#include "libcnisint.h"
373 +
374  extern struct group *getgrgid ();
375  
376  #include "shell.h"
377 @@ -152,7 +150,7 @@
378    r = 0;
379    if (id_flags & ID_USENAME)
380      {
381 -      pwd = getpwuid (uid);
382 +      pwd = internal_getpwuid (uid);
383        if (pwd == NULL)
384          r = 1;
385      }
386 @@ -233,7 +231,7 @@
387  
388    r = 0;
389    printf ("uid=%u", (unsigned) ruid);
390 -  pwd = getpwuid (ruid);
391 +  pwd = internal_getpwuid (ruid);
392    if (pwd == NULL)
393      r = 1;
394    else
395 @@ -249,7 +247,7 @@
396    if (euid != ruid)
397      { 
398        printf (" euid=%u", (unsigned) euid);
399 -      pwd = getpwuid (euid);
400 +      pwd = internal_getpwuid (euid);
401        if (pwd == NULL)
402         r = 1;
403        else 
404 Index: bash-3.2/lib/readline/complete.c
405 ===================================================================
406 --- bash-3.2.orig/lib/readline/complete.c       2008-07-31 19:06:06.000000000 -0300
407 +++ bash-3.2/lib/readline/complete.c    2008-08-01 15:52:25.000000000 -0300
408 @@ -48,9 +48,7 @@
409  extern int errno;
410  #endif /* !errno */
411  
412 -#if defined (HAVE_PWD_H)
413 -#include <pwd.h>
414 -#endif
415 +#include "libcnisint.h"
416  
417  #include "posixdir.h"
418  #include "posixstat.h"
419 @@ -79,12 +77,6 @@
420  /* Unix version of a hidden file.  Could be different on other systems. */
421  #define HIDDEN_FILE(fname)     ((fname)[0] == '.')
422  
423 -/* Most systems don't declare getpwent in <pwd.h> if _POSIX_SOURCE is
424 -   defined. */
425 -#if defined (HAVE_GETPWENT) && (!defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE))
426 -extern struct passwd *getpwent PARAMS((void));
427 -#endif /* HAVE_GETPWENT && (!HAVE_GETPW_DECLS || _POSIX_SOURCE) */
428 -
429  /* If non-zero, then this is the address of a function to call when
430     completing a word would normally display the list of possible matches.
431     This function is called instead of actually doing the display.
432 @@ -1849,24 +1841,19 @@
433  
434        username = savestring (&text[first_char_loc]);
435        namelen = strlen (username);
436 -      setpwent ();
437 +      internal_setpwent ();
438      }
439  
440 -#if defined (HAVE_GETPWENT)
441 -  while (entry = getpwent ())
442 +  while (entry = internal_getpwent ())
443      {
444        /* Null usernames should result in all users as possible completions. */
445        if (namelen == 0 || (STREQN (username, entry->pw_name, namelen)))
446         break;
447      }
448 -#endif
449  
450    if (entry == 0)
451      {
452 -#if defined (HAVE_GETPWENT)
453 -      endpwent ();
454 -#endif
455 -      return ((char *)NULL);
456 +      internal_endpwent ();
457      }
458    else
459      {
460 Index: bash-3.2/lib/readline/shell.c
461 ===================================================================
462 --- bash-3.2.orig/lib/readline/shell.c  2008-08-01 14:44:38.000000000 -0300
463 +++ bash-3.2/lib/readline/shell.c       2008-08-01 15:36:03.000000000 -0300
464 @@ -51,9 +51,8 @@
465  #if defined (HAVE_FCNTL_H)
466  #include <fcntl.h>
467  #endif
468 -#if defined (HAVE_PWD_H)
469 -#include <pwd.h>
470 -#endif
471 +
472 +#include "libcnisint.h"
473  
474  #include <stdio.h>
475  
476 @@ -61,10 +60,6 @@
477  #include "rlshell.h"
478  #include "xmalloc.h"
479  
480 -#if defined (HAVE_GETPWUID) && !defined (HAVE_GETPW_DECLS)
481 -extern struct passwd *getpwuid PARAMS((uid_t));
482 -#endif /* HAVE_GETPWUID && !HAVE_GETPW_DECLS */
483 -
484  #ifndef NULL
485  #  define NULL 0
486  #endif
487 @@ -163,11 +158,9 @@
488    struct passwd *entry;
489  
490    home_dir = (char *)NULL;
491 -#if defined (HAVE_GETPWUID)
492 -  entry = getpwuid (getuid ());
493 +  entry = internal_getpwuid (getuid ());
494    if (entry)
495      home_dir = entry->pw_dir;
496 -#endif
497    return (home_dir);
498  }
499  
500 Index: bash-3.2/lib/readline/tilde.c
501 ===================================================================
502 --- bash-3.2.orig/lib/readline/tilde.c  2008-07-31 19:09:19.000000000 -0300
503 +++ bash-3.2/lib/readline/tilde.c       2008-08-01 15:51:52.000000000 -0300
504 @@ -42,10 +42,7 @@
505  #  include "ansi_stdlib.h"
506  #endif /* HAVE_STDLIB_H */
507  
508 -#include <sys/types.h>
509 -#if defined (HAVE_PWD_H)
510 -#include <pwd.h>
511 -#endif
512 +#include "libcnisint.h"
513  
514  #include "tilde.h"
515  
516 @@ -56,9 +53,6 @@
517  #endif /* TEST || STATIC_MALLOC */
518  
519  #if !defined (HAVE_GETPW_DECLS)
520 -#  if defined (HAVE_GETPWUID)
521 -extern struct passwd *getpwuid PARAMS((uid_t));
522 -#  endif
523  #  if defined (HAVE_GETPWNAM)
524  extern struct passwd *getpwnam PARAMS((const char *));
525  #  endif
526 @@ -409,15 +403,11 @@
527        if (dirname == 0)
528         dirname = savestring (filename);
529      }
530 -#if defined (HAVE_GETPWENT)
531    else
532      dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
533 -#endif
534  
535    free (username);
536 -#if defined (HAVE_GETPWENT)
537 -  endpwent ();
538 -#endif
539 +  internal_endpwent ();
540    return (dirname);
541  }
542  
543 Index: bash-3.2/lib/tilde/shell.c
544 ===================================================================
545 --- bash-3.2.orig/lib/tilde/shell.c     2008-08-01 14:41:32.000000000 -0300
546 +++ bash-3.2/lib/tilde/shell.c  2008-08-01 15:32:49.000000000 -0300
547 @@ -43,11 +43,7 @@
548  #  include <strings.h>
549  #endif /* !HAVE_STRING_H */
550  
551 -#include <pwd.h>
552 -
553 -#if !defined (HAVE_GETPW_DECLS)
554 -extern struct passwd *getpwuid ();
555 -#endif /* !HAVE_GETPW_DECLS */
556 +#include "libcnisint.h"
557  
558  char *
559  get_env_value (varname)
560 @@ -63,7 +59,7 @@
561    struct passwd *entry;
562  
563    home_dir = (char *)NULL;
564 -  entry = getpwuid (getuid ());
565 +  entry = internal_getpwuid (getuid ());
566    if (entry)
567      home_dir = entry->pw_dir;
568    return (home_dir);
569 Index: bash-3.2/lib/tilde/tilde.c
570 ===================================================================
571 --- bash-3.2.orig/lib/tilde/tilde.c     2008-08-01 15:41:27.000000000 -0300
572 +++ bash-3.2/lib/tilde/tilde.c  2008-08-01 15:51:13.000000000 -0300
573 @@ -43,9 +43,8 @@
574  #endif /* HAVE_STDLIB_H */
575  
576  #include <sys/types.h>
577 -#if defined (HAVE_PWD_H)
578 -#include <pwd.h>
579 -#endif
580 +
581 +#include "libcnisint.h"
582  
583  #include "tilde.h"
584  
585 @@ -56,9 +55,6 @@
586  #endif /* TEST || STATIC_MALLOC */
587  
588  #if !defined (HAVE_GETPW_DECLS)
589 -#  if defined (HAVE_GETPWUID)
590 -extern struct passwd *getpwuid PARAMS((uid_t));
591 -#  endif
592  #  if defined (HAVE_GETPWNAM)
593  extern struct passwd *getpwnam PARAMS((const char *));
594  #  endif
595 @@ -409,15 +405,11 @@
596        if (dirname == 0)
597         dirname = savestring (filename);
598      }
599 -#if defined (HAVE_GETPWENT)
600    else
601      dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
602 -#endif
603  
604    free (username);
605 -#if defined (HAVE_GETPWENT)
606 -  endpwent ();
607 -#endif
608 +  internal_endpwent ();
609    return (dirname);
610  }
611  
612 Index: bash-3.2/shell.c
613 ===================================================================
614 --- bash-3.2.orig/shell.c       2008-07-31 19:10:00.000000000 -0300
615 +++ bash-3.2/shell.c    2008-08-01 15:46:10.000000000 -0300
616 @@ -37,7 +37,8 @@
617  #include <signal.h>
618  #include <errno.h>
619  #include "filecntl.h"
620 -#include <pwd.h>
621 +
622 +#include "libcnisint.h"
623  
624  #if defined (HAVE_UNISTD_H)
625  #  include <unistd.h>
626 @@ -78,10 +79,6 @@
627  #  include <opennt/opennt.h>
628  #endif
629  
630 -#if !defined (HAVE_GETPW_DECLS)
631 -extern struct passwd *getpwuid ();
632 -#endif /* !HAVE_GETPW_DECLS */
633 -
634  #if !defined (errno)
635  extern int errno;
636  #endif
637 @@ -1586,7 +1583,7 @@
638    /* Don't fetch this more than once. */
639    if (current_user.user_name == 0)
640      {
641 -      entry = getpwuid (current_user.uid);
642 +      entry = internal_getpwuid (current_user.uid);
643        if (entry)
644         {
645           current_user.user_name = savestring (entry->pw_name);
646 @@ -1602,7 +1599,7 @@
647           current_user.shell = savestring ("/bin/sh");
648           current_user.home_dir = savestring ("/");
649         }
650 -      endpwent ();
651 +      internal_endpwent ();
652      }
653  }
654  
655 Index: bash-3.2/config.h.in
656 ===================================================================
657 --- bash-3.2.orig/config.h.in   2008-08-01 15:54:05.000000000 -0300
658 +++ bash-3.2/config.h.in        2008-08-01 15:54:34.000000000 -0300
659 @@ -553,15 +553,9 @@
660  /* Define if you have the getpeername function.  */
661  #undef HAVE_GETPEERNAME
662  
663 -/* Define if you have the getpwent function. */
664 -#undef HAVE_GETPWENT
665 -
666  /* Define if you have the getpwnam function. */
667  #undef HAVE_GETPWNAM
668  
669 -/* Define if you have the getpwuid function. */
670 -#undef HAVE_GETPWUID
671 -
672  /* Define if you have the getrlimit function.  */
673  #undef HAVE_GETRLIMIT
674  
675 Index: bash-3.2/configure.in
676 ===================================================================
677 --- bash-3.2.orig/configure.in  2008-08-01 15:55:19.000000000 -0300
678 +++ bash-3.2/configure.in       2008-08-01 15:56:12.000000000 -0300
679 @@ -710,7 +710,7 @@
680  
681  AC_CHECK_FUNCS(vsnprintf snprintf vasprintf asprintf)
682  AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
683 -AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
684 +AC_CHECK_FUNCS(getpwnam)
685  AC_REPLACE_FUNCS(getcwd memset strcasecmp strerror strftime strnlen strpbrk strstr)
686  AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
687  
688 @@ -790,12 +790,6 @@
689  BASH_FUNC_INET_ATON
690  fi
691  
692 -dnl libraries
693 -dnl this is reportedly no longer necessary for irix[56].?
694 -case "$host_os" in
695 -irix4*)        AC_CHECK_LIB(sun, getpwent) ;;
696 -esac
697 -
698  dnl check for getpeername in the socket library only if it's not in libc
699  if test "$ac_cv_func_getpeername" = no; then
700         BASH_CHECK_LIB_SOCKET
701 Index: bash-3.2/patchlevel.h
702 ===================================================================
703 --- bash-3.2.orig/patchlevel.h  2008-08-01 16:24:52.000000000 -0300
704 +++ bash-3.2/patchlevel.h       2008-08-01 16:25:03.000000000 -0300
705 @@ -25,6 +25,6 @@
706     regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
707     looks for to find the patch level (for the sccs version string). */
708  
709 -#define PATCHLEVEL 5
710 +#define PATCHLEVEL 6
711  
712  #endif /* _PATCHLEVEL_H_ */
713 Index: bash-3.2/Makefile.in
714 ===================================================================
715 --- bash-3.2.orig/Makefile.in   2008-08-01 16:32:13.000000000 -0300
716 +++ bash-3.2/Makefile.in        2008-08-01 17:12:17.000000000 -0300
717 @@ -405,7 +405,7 @@
718            input.c bashhist.c array.c arrayfunc.c sig.c pathexp.c \
719            unwind_prot.c siglist.c bashline.c bracecomp.c error.c \
720            list.c stringlib.c locale.c findcmd.c redir.c \
721 -          pcomplete.c pcomplib.c syntax.c xmalloc.c
722 +          pcomplete.c pcomplib.c syntax.c xmalloc.c libcnisint.c
723  
724  HSOURCES = shell.h flags.h trap.h hashcmd.h hashlib.h jobs.h builtins.h \
725            general.h variables.h config.h $(ALLOC_HEADERS) alias.h \
726 @@ -413,7 +413,7 @@
727            command.h input.h error.h bashansi.h dispose_cmd.h make_cmd.h \
728            subst.h externs.h siglist.h bashhist.h bashline.h bashtypes.h \
729            array.h arrayfunc.h sig.h mailcheck.h bashintl.h bashjmp.h \
730 -          execute_cmd.h parser.h pathexp.h pathnames.h pcomplete.h \
731 +          execute_cmd.h parser.h pathexp.h pathnames.h pcomplete.h libcnisint.h \
732            $(BASHINCFILES)
733  
734  SOURCES         = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS)
735 @@ -433,7 +433,7 @@
736            trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o \
737            alias.o array.o arrayfunc.o braces.o bracecomp.o bashhist.o \
738            bashline.o $(SIGLIST_O) list.o stringlib.o locale.o findcmd.o redir.o \
739 -          pcomplete.o pcomplib.o syntax.o xmalloc.o $(SIGNAMES_O)
740 +          pcomplete.o pcomplib.o syntax.o xmalloc.o libcnisint.o $(SIGNAMES_O)
741  
742  # Where the source code of the shell builtins resides.
743  BUILTIN_SRCDIR=$(srcdir)/builtins
744 @@ -978,7 +978,7 @@
745  shell.o: make_cmd.h subst.h sig.h pathnames.h externs.h 
746  shell.o: flags.h trap.h mailcheck.h builtins.h $(DEFSRC)/common.h
747  shell.o: jobs.h siglist.h input.h execute_cmd.h findcmd.h bashhist.h
748 -shell.o: ${GLOB_LIBSRC}/strmatch.h ${BASHINCDIR}/posixtime.h
749 +shell.o: ${GLOB_LIBSRC}/strmatch.h ${BASHINCDIR}/posixtime.h libcnisint.h
750  sig.o: config.h bashtypes.h
751  sig.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h
752  sig.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h