pam_set_item.3 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. '\" t
  2. .\" Title: pam_set_item
  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_ITEM" "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_item \- set and update PAM information
  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_item('u
  40. .BI "int pam_set_item(pam_handle_t\ *" "pamh" ", int\ " "item_type" ", const\ void\ *" "item" ");"
  41. .SH "DESCRIPTION"
  42. .PP
  43. The
  44. \fBpam_set_item\fR
  45. function allows applications and PAM service modules to access and to update PAM information of
  46. \fIitem_type\fR\&. For this a copy of the object pointed to by the
  47. \fIitem\fR
  48. argument is created\&. The following
  49. \fIitem_type\fRs are supported:
  50. .PP
  51. PAM_SERVICE
  52. .RS 4
  53. The service name (which identifies that PAM stack that the PAM functions will use to authenticate the program)\&.
  54. .RE
  55. .PP
  56. PAM_USER
  57. .RS 4
  58. The username of the entity under whose identity service will be given\&. That is, following authentication,
  59. \fIPAM_USER\fR
  60. identifies the local entity that gets to use the service\&. Note, this value can be mapped from something (eg\&., "anonymous") to something else (eg\&. "guest119") by any module in the PAM stack\&. As such an application should consult the value of
  61. \fIPAM_USER\fR
  62. after each call to a PAM function\&.
  63. .RE
  64. .PP
  65. PAM_USER_PROMPT
  66. .RS 4
  67. The string used when prompting for a user\*(Aqs name\&. The default value for this string is a localized version of "login: "\&.
  68. .RE
  69. .PP
  70. PAM_TTY
  71. .RS 4
  72. The terminal name: prefixed by
  73. /dev/
  74. if it is a device file; for graphical, X\-based, applications the value for this item should be the
  75. \fI$DISPLAY\fR
  76. variable\&.
  77. .RE
  78. .PP
  79. PAM_RUSER
  80. .RS 4
  81. The requesting user name: local name for a locally requesting user or a remote user name for a remote requesting user\&.
  82. .sp
  83. Generally an application or module will attempt to supply the value that is most strongly authenticated (a local account before a remote one\&. The level of trust in this value is embodied in the actual authentication stack associated with the application, so it is ultimately at the discretion of the system administrator\&.
  84. .sp
  85. \fIPAM_RUSER@PAM_RHOST\fR
  86. should always identify the requesting user\&. In some cases,
  87. \fIPAM_RUSER\fR
  88. may be NULL\&. In such situations, it is unclear who the requesting entity is\&.
  89. .RE
  90. .PP
  91. PAM_RHOST
  92. .RS 4
  93. The requesting hostname (the hostname of the machine from which the
  94. \fIPAM_RUSER\fR
  95. entity is requesting service)\&. That is
  96. \fIPAM_RUSER@PAM_RHOST\fR
  97. does identify the requesting user\&. In some applications,
  98. \fIPAM_RHOST\fR
  99. may be NULL\&. In such situations, it is unclear where the authentication request is originating from\&.
  100. .RE
  101. .PP
  102. PAM_AUTHTOK
  103. .RS 4
  104. The authentication token (often a password)\&. This token should be ignored by all module functions besides
  105. \fBpam_sm_authenticate\fR(3)
  106. and
  107. \fBpam_sm_chauthtok\fR(3)\&. In the former function it is used to pass the most recent authentication token from one stacked module to another\&. In the latter function the token is used for another purpose\&. It contains the currently active authentication token\&.
  108. .RE
  109. .PP
  110. PAM_OLDAUTHTOK
  111. .RS 4
  112. The old authentication token\&. This token should be ignored by all module functions except
  113. \fBpam_sm_chauthtok\fR(3)\&.
  114. .RE
  115. .PP
  116. PAM_CONV
  117. .RS 4
  118. The pam_conv structure\&. See
  119. \fBpam_conv\fR(3)\&.
  120. .RE
  121. .PP
  122. The following additional items are specific to Linux\-PAM and should not be used in portable applications:
  123. .PP
  124. PAM_FAIL_DELAY
  125. .RS 4
  126. A function pointer to redirect centrally managed failure delays\&. See
  127. \fBpam_fail_delay\fR(3)\&.
  128. .RE
  129. .PP
  130. PAM_XDISPLAY
  131. .RS 4
  132. The name of the X display\&. For graphical, X\-based applications the value for this item should be the
  133. \fI$DISPLAY\fR
  134. variable\&. This value may be used independently of
  135. \fIPAM_TTY\fR
  136. for passing the name of the display\&.
  137. .RE
  138. .PP
  139. PAM_XAUTHDATA
  140. .RS 4
  141. A pointer to a structure containing the X authentication data required to make a connection to the display specified by
  142. \fIPAM_XDISPLAY\fR, if such information is necessary\&. See
  143. \fBpam_xauth_data\fR(3)\&.
  144. .RE
  145. .PP
  146. PAM_AUTHTOK_TYPE
  147. .RS 4
  148. The default action is for the module to use the following prompts when requesting passwords: "New UNIX password: " and "Retype UNIX password: "\&. The example word
  149. \fIUNIX\fR
  150. can be replaced with this item, by default it is empty\&. This item is used by
  151. \fBpam_get_authtok\fR(3)\&.
  152. .RE
  153. .PP
  154. For all
  155. \fIitem_type\fRs, other than PAM_CONV and PAM_FAIL_DELAY,
  156. \fIitem\fR
  157. is a pointer to a <NUL> terminated character string\&. In the case of PAM_CONV,
  158. \fIitem\fR
  159. points to an initialized
  160. \fIpam_conv\fR
  161. structure\&. In the case of PAM_FAIL_DELAY,
  162. \fIitem\fR
  163. is a function pointer:
  164. \fBvoid (*delay_fn)(int retval, unsigned usec_delay, void *appdata_ptr)\fR
  165. .PP
  166. Both, PAM_AUTHTOK and PAM_OLDAUTHTOK, will be reset before returning to the application\&. Which means an application is not able to access the authentication tokens\&.
  167. .SH "RETURN VALUES"
  168. .PP
  169. PAM_BAD_ITEM
  170. .RS 4
  171. The application attempted to set an undefined or inaccessible item\&.
  172. .RE
  173. .PP
  174. PAM_BUF_ERR
  175. .RS 4
  176. Memory buffer error\&.
  177. .RE
  178. .PP
  179. PAM_SUCCESS
  180. .RS 4
  181. Data was successful updated\&.
  182. .RE
  183. .PP
  184. PAM_SYSTEM_ERR
  185. .RS 4
  186. The
  187. \fIpam_handle_t\fR
  188. passed as first argument was invalid\&.
  189. .RE
  190. .SH "SEE ALSO"
  191. .PP
  192. \fBpam_get_item\fR(3),
  193. \fBpam_strerror\fR(3)