Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Anonymous
Thursday, January 11th, 2007 at 11:53:57am UTC 

  1. --- fopen_wrappers.c.old        2007-01-11 14:19:32.317404224 +0000
  2. +++ fopen_wrappers.c    2007-01-11 15:43:41.241851040 +0000
  3. @@ -274,13 +274,23 @@
  4.                filename = NULL;       /* discard the original filename, it must not be used */
  5.                if (s) {                     /* if there is no path name after the file, do not bother */
  6.                                                   /* to try open the directory */
  7. +#ifdef HAVE_GETPWNAM_R
  8. +                     struct passwd pwstruc;
  9. +                     int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
  10. +                     char *pwbuf = emalloc(pwbuflen);
  11. +#endif
  12. +                     struct passwd *pw;
  13. +
  14.                       length = s - (path_info + 2);
  15.                       if (length > (int)sizeof(user) - 1)
  16.                              length = sizeof(user) - 1;
  17.                       memcpy(user, path_info + 2, length);
  18.                       user[length] = '\0';
  19. -
  20. +#ifdef HAVE_GETPWNAM_R
  21. +                     getpwnam_r(user, &pwstruc, pwbuf, pwbuflen, &pw);
  22. +#else
  23.                       pw = getpwnam(user);
  24. +#endif
  25.                       if (pw && pw->pw_dir) {
  26.                              filename = emalloc(strlen(PG(user_dir)) + strlen(path_info) + strlen(pw->pw_dir) + 4);
  27.                              if (filename) {
  28. @@ -290,6 +300,9 @@
  29.                                     SG(request_info).path_translated = filename;
  30.                              }
  31.                       }
  32. +#ifdef HAVE_GETPWNAM_R
  33. +                     efree(pwbuf);
  34. +#endif
  35.                }
  36.         } else
  37.  #endif

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right worth-right