passverify.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright information at end of file.
  3. */
  4. #include <sys/types.h>
  5. #include <pwd.h>
  6. #include <security/pam_modules.h>
  7. #define PAM_UNIX_RUN_HELPER PAM_CRED_INSUFFICIENT
  8. #define OLD_PASSWORDS_FILE "/etc/security/opasswd"
  9. int
  10. is_pwd_shadowed(const struct passwd *pwd);
  11. char *
  12. crypt_md5_wrapper(const char *pass_new);
  13. int
  14. unix_selinux_confined(void);
  15. int
  16. lock_pwdf(void);
  17. void
  18. unlock_pwdf(void);
  19. #ifdef HELPER_COMPILE
  20. int
  21. save_old_password(const char *forwho, const char *oldpass,
  22. int howmany);
  23. #else
  24. int
  25. save_old_password(pam_handle_t *pamh, const char *forwho, const char *oldpass,
  26. int howmany);
  27. #endif
  28. #ifdef HELPER_COMPILE
  29. void
  30. helper_log_err(int err, const char *format,...);
  31. int
  32. helper_verify_password(const char *name, const char *p, int nullok);
  33. void
  34. setup_signals(void);
  35. char *
  36. getuidname(uid_t uid);
  37. #endif
  38. #ifdef HELPER_COMPILE
  39. #define PAMH_ARG_DECL(fname, ...) fname(__VA_ARGS__)
  40. #define PAMH_ARG(...) __VA_ARGS__
  41. #else
  42. #define PAMH_ARG_DECL(fname, ...) fname(pam_handle_t *pamh, __VA_ARGS__)
  43. #define PAMH_ARG(...) pamh, __VA_ARGS__
  44. #endif
  45. PAMH_ARG_DECL(int verify_pwd_hash,
  46. const char *p, char *hash, unsigned int nullok);
  47. PAMH_ARG_DECL(char * create_password_hash,
  48. const char *password, unsigned long long ctrl, int rounds);
  49. PAMH_ARG_DECL(int get_account_info,
  50. const char *name, struct passwd **pwd, struct spwd **spwdent);
  51. PAMH_ARG_DECL(int get_pwd_hash,
  52. const char *name, struct passwd **pwd, char **hash);
  53. PAMH_ARG_DECL(int check_shadow_expiry,
  54. struct spwd *spent, int *daysleft);
  55. PAMH_ARG_DECL(int unix_update_passwd,
  56. const char *forwho, const char *towhat);
  57. PAMH_ARG_DECL(int unix_update_shadow,
  58. const char *forwho, char *towhat);
  59. /* ****************************************************************** *
  60. * Copyright (c) Red Hat, Inc. 2007.
  61. *
  62. * Redistribution and use in source and binary forms, with or without
  63. * modification, are permitted provided that the following conditions
  64. * are met:
  65. * 1. Redistributions of source code must retain the above copyright
  66. * notice, and the entire permission notice in its entirety,
  67. * including the disclaimer of warranties.
  68. * 2. Redistributions in binary form must reproduce the above copyright
  69. * notice, this list of conditions and the following disclaimer in the
  70. * documentation and/or other materials provided with the distribution.
  71. * 3. The name of the author may not be used to endorse or promote
  72. * products derived from this software without specific prior
  73. * written permission.
  74. *
  75. * ALTERNATIVELY, this product may be distributed under the terms of
  76. * the GNU Public License, in which case the provisions of the GPL are
  77. * required INSTEAD OF the above restrictions. (This clause is
  78. * necessary due to a potential bad interaction between the GPL and
  79. * the restrictions contained in a BSD-style copyright.)
  80. *
  81. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  82. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  83. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  84. * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  85. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  86. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  87. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  88. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  89. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  90. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  91. * OF THE POSSIBILITY OF SUCH DAMAGE.
  92. */