pam_set_data.3.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
  4. <refentry id='pam_set_data'>
  5. <refmeta>
  6. <refentrytitle>pam_set_data</refentrytitle>
  7. <manvolnum>3</manvolnum>
  8. <refmiscinfo class='setdesc'>Linux-PAM Manual</refmiscinfo>
  9. </refmeta>
  10. <refnamediv id='pam_set_data-name'>
  11. <refname>pam_set_data</refname>
  12. <refpurpose>
  13. set module internal data
  14. </refpurpose>
  15. </refnamediv>
  16. <!-- body begins here -->
  17. <refsynopsisdiv>
  18. <funcsynopsis id="pam_set_data-synopsis">
  19. <funcsynopsisinfo>#include &lt;security/pam_modules.h&gt;</funcsynopsisinfo>
  20. <funcprototype>
  21. <funcdef>int <function>pam_set_data</function></funcdef>
  22. <paramdef>pam_handle_t *<parameter>pamh</parameter></paramdef>
  23. <paramdef>const char *<parameter>module_data_name</parameter></paramdef>
  24. <paramdef>void *<parameter>data</parameter></paramdef>
  25. <paramdef>void <parameter>(*cleanup)(pam_handle_t *pamh, void *data, int error_status)</parameter></paramdef>
  26. </funcprototype>
  27. </funcsynopsis>
  28. </refsynopsisdiv>
  29. <refsect1 id="pam_set_data-description">
  30. <title>DESCRIPTION</title>
  31. <para>
  32. The <function>pam_set_data</function> function associates a pointer
  33. to an object with the (hopefully) unique string
  34. <emphasis>module_data_name</emphasis> in the PAM context specified
  35. by the <emphasis>pamh</emphasis> argument.
  36. </para>
  37. <para>
  38. PAM modules may be dynamically loadable objects. In general such files
  39. should not contain <emphasis>static</emphasis> variables. This function
  40. and its counterpart
  41. <citerefentry>
  42. <refentrytitle>pam_get_data</refentrytitle><manvolnum>3</manvolnum>
  43. </citerefentry>,
  44. provide a mechanism for a module to associate some data with
  45. the handle <emphasis>pamh</emphasis>. Typically a module will call the
  46. <function>pam_set_data</function> function to register some data
  47. under a (hopefully) unique <emphasis>module_data_name</emphasis>.
  48. The data is available for use by other modules too but
  49. <emphasis>not</emphasis> by an application. Since this functions
  50. stores only a pointer to the <emphasis>data</emphasis>, the module
  51. should not modify or free the content of it.
  52. </para>
  53. <para>
  54. The function <function>cleanup()</function> is associated with the
  55. <emphasis>data</emphasis> and, if non-NULL, it is called when this
  56. data is over-written or following a call to
  57. <citerefentry>
  58. <refentrytitle>pam_end</refentrytitle><manvolnum>3</manvolnum>
  59. </citerefentry>.
  60. </para>
  61. <para>
  62. The <emphasis>error_status</emphasis> argument is used to indicate
  63. to the module the sort of action it is to take in cleaning this data
  64. item. As an example, Kerberos creates a ticket file during the
  65. authentication phase, this file might be associated with a data item.
  66. When
  67. <citerefentry>
  68. <refentrytitle>pam_end</refentrytitle><manvolnum>3</manvolnum>
  69. </citerefentry>
  70. is called by the module, the <emphasis>error_status</emphasis>
  71. carries the return value of the
  72. <citerefentry>
  73. <refentrytitle>pam_authenticate</refentrytitle><manvolnum>3</manvolnum>
  74. </citerefentry>
  75. or other <emphasis>libpam</emphasis> function as appropriate. Based
  76. on this value the Kerberos module may choose to delete the ticket file
  77. (<emphasis>authentication failure</emphasis>) or leave it in place.
  78. </para>
  79. <para>
  80. The <emphasis>error_status</emphasis> may have been logically
  81. OR'd with either of the following two values:
  82. </para>
  83. <variablelist>
  84. <varlistentry>
  85. <term>PAM_DATA_REPLACE</term>
  86. <listitem>
  87. <para>
  88. When a data item is being replaced (through a second call to
  89. <function>pam_set_data</function>) this mask is used.
  90. Otherwise, the call is assumed to be from
  91. <citerefentry>
  92. <refentrytitle>pam_end</refentrytitle><manvolnum>3</manvolnum>
  93. </citerefentry>.
  94. </para>
  95. </listitem>
  96. </varlistentry>
  97. <varlistentry>
  98. <term>PAM_DATA_SILENT</term>
  99. <listitem>
  100. <para>
  101. Which indicates that the process would prefer to perform the
  102. <function>cleanup()</function> quietly. That is, discourages
  103. logging/messages to the user.
  104. </para>
  105. </listitem>
  106. </varlistentry>
  107. </variablelist>
  108. </refsect1>
  109. <refsect1 id="pam_set_data-return_values">
  110. <title>RETURN VALUES</title>
  111. <variablelist>
  112. <varlistentry>
  113. <term>PAM_BUF_ERR</term>
  114. <listitem>
  115. <para>
  116. Memory buffer error.
  117. </para>
  118. </listitem>
  119. </varlistentry>
  120. <varlistentry>
  121. <term>PAM_SUCCESS</term>
  122. <listitem>
  123. <para>
  124. Data was successful stored.
  125. </para>
  126. </listitem>
  127. </varlistentry>
  128. <varlistentry>
  129. <term>PAM_SYSTEM_ERR</term>
  130. <listitem>
  131. <para>
  132. A NULL pointer was submitted as PAM handle or the
  133. function was called by an application.
  134. </para>
  135. </listitem>
  136. </varlistentry>
  137. </variablelist>
  138. </refsect1>
  139. <refsect1 id="pam_set_data-see_also">
  140. <title>SEE ALSO</title>
  141. <para>
  142. <citerefentry>
  143. <refentrytitle>pam_end</refentrytitle><manvolnum>3</manvolnum>
  144. </citerefentry>,
  145. <citerefentry>
  146. <refentrytitle>pam_get_data</refentrytitle><manvolnum>3</manvolnum>
  147. </citerefentry>,
  148. <citerefentry>
  149. <refentrytitle>pam_strerror</refentrytitle><manvolnum>3</manvolnum>
  150. </citerefentry>
  151. </para>
  152. </refsect1>
  153. </refentry>