OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.4 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../pam_ldap/pam_ldap-178-nonDNmember.patch
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. ## pam_ldap-178-nonDNmember.patch by Peter Marschall <peter@adpm.de>
  17. ##
  18. ## DP: search for group members with non-DN attribute username
  19. ## DP: after searching for DN-valued attribute failed
  20. --- ./pam_ldap.c
  21. +++ ./pam_ldap.c 2005-03-28 11:44:52.939314905 +0200
  22. @@ -3871,15 +3871,39 @@
  23. rc = ldap_compare_s (session->ld,
  24. session->conf->groupdn,
  25. session->conf->groupattr, session->info->userdn);
  26. - if (rc != LDAP_COMPARE_TRUE)
  27. +
  28. + if (rc == LDAP_COMPARE_FALSE)
  29. + {
  30. +#ifndef NO_2ND_CHANCE
  31. + /* 2nd chance: compare group membership based on non-DN attributes */
  32. + rc = ldap_compare_s (session->ld,
  33. + session->conf->groupdn,
  34. + session->conf->groupattr, username);
  35. +#endif /* NO_2ND_CHANCE */
  36. +
  37. + if (rc != LDAP_COMPARE_TRUE)
  38. + {
  39. + snprintf (buf, sizeof buf, "You must be a %s of %s to login.",
  40. + session->conf->groupattr, session->conf->groupdn);
  41. + _conv_sendmsg (appconv, buf, PAM_ERROR_MSG, no_warn);
  42. +
  43. + /* return error in case of failure, denied in case of no membership */
  44. + return (rc == LDAP_COMPARE_FALSE) ? PAM_PERM_DENIED : PAM_AUTH_ERR;
  45. + }
  46. + }
  47. + else if (rc == LDAP_COMPARE_TRUE)
  48. + {
  49. + rc = success;
  50. + }
  51. + else
  52. {
  53. snprintf (buf, sizeof buf, "You must be a %s of %s to login.",
  54. session->conf->groupattr, session->conf->groupdn);
  55. _conv_sendmsg (appconv, buf, PAM_ERROR_MSG, no_warn);
  56. - return PAM_PERM_DENIED;
  57. +
  58. + /* return error in case of failure, denied in case of no membership */
  59. + return (rc == LDAP_COMPARE_FALSE) ? PAM_PERM_DENIED : PAM_AUTH_ERR;
  60. }
  61. - else
  62. - rc = success;
  63. }
  64. if (rc == success && session->conf->checkserviceattr)