patch-authenticate_c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. $OpenBSD: patch-authenticate_c,v 1.2 2017/05/22 20:03:43 giovanni Exp $
  2. Index: authenticate.c
  3. --- authenticate.c.orig
  4. +++ authenticate.c
  5. @@ -25,6 +25,9 @@
  6. #include "strlcpy.h"
  7. #include "mysql.h"
  8. +#define POP3ALLOW_FILE SYSCONFDIR "/pop3.allow"
  9. +#define POP3DENY_FILE SYSCONFDIR "/pop3.deny"
  10. +
  11. extern const char * authfile;
  12. char real_username[MAXLINE+1];
  13. char real_maildrop[MAXLINE+1];
  14. @@ -104,7 +107,7 @@ static int user_in_file(char * user, char * path) {
  15. static int is_user_allowed(char * user) {
  16. int allow, deny;
  17. - switch (user_in_file(user,"/etc/pop3.allow")>0) {
  18. + switch (user_in_file(user,POP3ALLOW_FILE)>0) {
  19. case 0:
  20. allow = 0;
  21. break;
  22. @@ -115,7 +118,7 @@ static int is_user_allowed(char * user) {
  23. return 0;
  24. }
  25. - switch (user_in_file(user,"/etc/pop3.deny")) {
  26. + switch (user_in_file(user,POP3DENY_FILE)) {
  27. case 0:
  28. deny = 0;
  29. break;
  30. @@ -322,7 +325,7 @@ int authenticate(char * username, char * password) {
  31. memset(pass,0,sizeof(pass));
  32. strlcpy(pass,password,len+1);
  33. - /* check /etc/pop3.{allow,deny} */
  34. + /* check %sysconfdir%/pop3.{allow,deny} */
  35. if (0!=use_pop3_allow_deny && 0==is_user_allowed(user)) {
  36. return 0;
  37. }
  38. @@ -335,7 +338,7 @@ int authenticate(char * username, char * password) {
  39. }
  40. #ifndef HAVE_LIBMYSQLCLIENT
  41. - u = getpwnam(user);
  42. + u = getpwnam_shadow(user);
  43. #else
  44. u = getMpwnam( user ); /* getMpwnam first checks getpwnam() */
  45. #endif /* HAVE_LIBMYSQLCLIENT */