pam_set_data.3 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. '\" t
  2. .\" Title: pam_set_data
  3. .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
  5. .\" Date: 09/03/2021
  6. .\" Manual: Linux-PAM Manual
  7. .\" Source: Linux-PAM Manual
  8. .\" Language: English
  9. .\"
  10. .TH "PAM_SET_DATA" "3" "09/03/2021" "Linux-PAM Manual" "Linux-PAM Manual"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. pam_set_data \- set module internal data
  32. .SH "SYNOPSIS"
  33. .sp
  34. .ft B
  35. .nf
  36. #include <security/pam_modules\&.h>
  37. .fi
  38. .ft
  39. .HP \w'int\ pam_set_data('u
  40. .BI "int pam_set_data(pam_handle_t\ *" "pamh" ", const\ char\ *" "module_data_name" ", void\ *" "data" ", void\ " "(*cleanup)(pam_handle_t\ *pamh,\ void\ *data,\ int\ error_status)" ");"
  41. .SH "DESCRIPTION"
  42. .PP
  43. The
  44. \fBpam_set_data\fR
  45. function associates a pointer to an object with the (hopefully) unique string
  46. \fImodule_data_name\fR
  47. in the PAM context specified by the
  48. \fIpamh\fR
  49. argument\&.
  50. .PP
  51. PAM modules may be dynamically loadable objects\&. In general such files should not contain
  52. \fIstatic\fR
  53. variables\&. This function and its counterpart
  54. \fBpam_get_data\fR(3), provide a mechanism for a module to associate some data with the handle
  55. \fIpamh\fR\&. Typically a module will call the
  56. \fBpam_set_data\fR
  57. function to register some data under a (hopefully) unique
  58. \fImodule_data_name\fR\&. The data is available for use by other modules too but
  59. \fInot\fR
  60. by an application\&. Since this functions stores only a pointer to the
  61. \fIdata\fR, the module should not modify or free the content of it\&.
  62. .PP
  63. The function
  64. \fBcleanup()\fR
  65. is associated with the
  66. \fIdata\fR
  67. and, if non\-NULL, it is called when this data is over\-written or following a call to
  68. \fBpam_end\fR(3)\&.
  69. .PP
  70. The
  71. \fIerror_status\fR
  72. argument is used to indicate to the module the sort of action it is to take in cleaning this data item\&. As an example, Kerberos creates a ticket file during the authentication phase, this file might be associated with a data item\&. When
  73. \fBpam_end\fR(3)
  74. is called by the module, the
  75. \fIerror_status\fR
  76. carries the return value of the
  77. \fBpam_authenticate\fR(3)
  78. or other
  79. \fIlibpam\fR
  80. function as appropriate\&. Based on this value the Kerberos module may choose to delete the ticket file (\fIauthentication failure\fR) or leave it in place\&.
  81. .PP
  82. The
  83. \fIerror_status\fR
  84. may have been logically OR\*(Aqd with either of the following two values:
  85. .PP
  86. PAM_DATA_REPLACE
  87. .RS 4
  88. When a data item is being replaced (through a second call to
  89. \fBpam_set_data\fR) this mask is used\&. Otherwise, the call is assumed to be from
  90. \fBpam_end\fR(3)\&.
  91. .RE
  92. .PP
  93. PAM_DATA_SILENT
  94. .RS 4
  95. Which indicates that the process would prefer to perform the
  96. \fBcleanup()\fR
  97. quietly\&. That is, discourages logging/messages to the user\&.
  98. .RE
  99. .SH "RETURN VALUES"
  100. .PP
  101. PAM_BUF_ERR
  102. .RS 4
  103. Memory buffer error\&.
  104. .RE
  105. .PP
  106. PAM_SUCCESS
  107. .RS 4
  108. Data was successful stored\&.
  109. .RE
  110. .PP
  111. PAM_SYSTEM_ERR
  112. .RS 4
  113. A NULL pointer was submitted as PAM handle or the function was called by an application\&.
  114. .RE
  115. .SH "SEE ALSO"
  116. .PP
  117. \fBpam_end\fR(3),
  118. \fBpam_get_data\fR(3),
  119. \fBpam_strerror\fR(3)