pam_modules.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * <security/pam_modules.h>
  3. *
  4. * This header file collects definitions for the PAM API --- that is,
  5. * public interface between the PAM library and PAM modules.
  6. *
  7. * Note, the copyright information is at end of file.
  8. */
  9. #ifndef _SECURITY_PAM_MODULES_H
  10. #define _SECURITY_PAM_MODULES_H
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #include <security/_pam_types.h> /* Linux-PAM common defined types */
  15. /* -------------- The Linux-PAM Module PI ------------- */
  16. extern int PAM_NONNULL((1,2))
  17. pam_set_data(pam_handle_t *pamh, const char *module_data_name, void *data,
  18. void (*cleanup)(pam_handle_t *pamh, void *data,
  19. int error_status));
  20. extern int PAM_NONNULL((1,2,3))
  21. pam_get_data(const pam_handle_t *pamh, const char *module_data_name,
  22. const void **data);
  23. extern int PAM_NONNULL((1,2))
  24. pam_get_user(pam_handle_t *pamh, const char **user, const char *prompt);
  25. /* Authentication API's */
  26. int pam_sm_authenticate(pam_handle_t *pamh, int flags,
  27. int argc, const char **argv);
  28. int pam_sm_setcred(pam_handle_t *pamh, int flags,
  29. int argc, const char **argv);
  30. /* Account Management API's */
  31. int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
  32. int argc, const char **argv);
  33. /* Session Management API's */
  34. int pam_sm_open_session(pam_handle_t *pamh, int flags,
  35. int argc, const char **argv);
  36. int pam_sm_close_session(pam_handle_t *pamh, int flags,
  37. int argc, const char **argv);
  38. /* Password Management API's */
  39. int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
  40. int argc, const char **argv);
  41. /* The following two flags are for use across the Linux-PAM/module
  42. * interface only. The Application is not permitted to use these
  43. * tokens.
  44. *
  45. * The password service should only perform preliminary checks. No
  46. * passwords should be updated. */
  47. #define PAM_PRELIM_CHECK 0x4000
  48. /* The password service should update passwords Note: PAM_PRELIM_CHECK
  49. * and PAM_UPDATE_AUTHTOK cannot both be set simultaneously! */
  50. #define PAM_UPDATE_AUTHTOK 0x2000
  51. /*
  52. * here are some proposed error status definitions for the
  53. * 'error_status' argument used by the cleanup function associated
  54. * with data items they should be logically OR'd with the error_status
  55. * of the latest return from libpam -- new with .52 and positive
  56. * impression from Sun although not official as of 1996/9/4 there are
  57. * others in _pam_types.h -- they are for common module/app use.
  58. */
  59. #define PAM_DATA_REPLACE 0x20000000 /* used when replacing a data item */
  60. /* PAM_EXTERN isn't needed anymore, but don't remove it to not break
  61. lot of external code using it. */
  62. #define PAM_EXTERN extern
  63. /* take care of any compatibility issues */
  64. #include <security/_pam_compat.h>
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. /* Copyright (C) Theodore Ts'o, 1996.
  69. * Copyright (C) Andrew Morgan, 1996-8.
  70. * All rights reserved.
  71. *
  72. * Redistribution and use in source and binary forms, with or without
  73. * modification, are permitted provided that the following conditions
  74. * are met:
  75. * 1. Redistributions of source code must retain the above copyright
  76. * notice, and the entire permission notice in its entirety,
  77. * including the disclaimer of warranties.
  78. * 2. Redistributions in binary form must reproduce the above copyright
  79. * notice, this list of conditions and the following disclaimer in the
  80. * documentation and/or other materials provided with the distribution.
  81. * 3. The name of the author may not be used to endorse or promote
  82. * products derived from this software without specific prior
  83. * written permission.
  84. *
  85. * ALTERNATIVELY, this product may be distributed under the terms of
  86. * the GNU General Public License, in which case the provisions of the
  87. * GNU GPL are required INSTEAD OF the above restrictions. (This
  88. * clause is necessary due to a potential bad interaction between the
  89. * GNU GPL and the restrictions contained in a BSD-style copyright.)
  90. *
  91. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  92. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  93. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  94. * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  95. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  96. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  97. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  98. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  99. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  100. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  101. * OF THE POSSIBILITY OF SUCH DAMAGE. */
  102. #endif /* _SECURITY_PAM_MODULES_H */