ldappasswords.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. // -*- Mode: c++ -*-
  18. #ifndef LDAPPASSWORDS_H
  19. #define LDAPPASSWORDS_H
  20. namespace KC {
  21. /**
  22. * @defgroup userplugin_password Password validation
  23. * @ingroup userplugin
  24. * @{
  25. */
  26. enum {
  27. PASSWORD_CRYPT,
  28. PASSWORD_MD5,
  29. PASSWORD_SMD5,
  30. PASSWORD_SHA,
  31. PASSWORD_SSHA
  32. };
  33. /**
  34. * Encrypt passwird using requested encryption type
  35. *
  36. * The returned array must be deleted with delete []
  37. *
  38. * @param[in] type
  39. * The encryption type (CRYPT, MD5, SMD5, SSHA)
  40. * @param[in] password
  41. * The password which should be encrypted
  42. * @return The encrypted password
  43. */
  44. extern char *encryptPassword(int type, const char *password);
  45. /**
  46. * Compare unencrypted password with encrypted password with the
  47. * requested encryption type
  48. *
  49. * @param[in] type
  50. * The encryption type (CRYPT, MD5, SMD5, SSHA)
  51. * @param[in] password
  52. * The unencryped password which should match crypted
  53. * @param[in] crypted
  54. * The encrypted password which should match password
  55. * @return 0 when the passwords match
  56. */
  57. extern int checkPassword(int type, const char *password, const char *crypted);
  58. /** @} */
  59. } /* namespace */
  60. #endif