Debian Codegraph @

upstream/debian-unstable/man3/pam_set_data.3

raw
1 '\" t
2 .\" Title: pam_set_data
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
5 .\" Date: 06/29/2025
6 .\" Manual: Linux-PAM Manual
7 .\" Source: Linux-PAM
8 .\" Language: English
9 .\"
10 .TH "PAM_SET_DATA" "3" "06/29/2025" "Linux\-PAM" "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\&. It is generally used to indicate that the current closing of the library is in a
98 \fBfork\fR(2)ed process, and that the parent will take care of cleaning up things that exist outside of the current process space (files etc\&.)\&.
99 .RE
100 .SH "RETURN VALUES"
101 .PP
102 PAM_BUF_ERR
103 .RS 4
104 Memory buffer error\&.
105 .RE
106 .PP
107 PAM_SUCCESS
108 .RS 4
109 Data was successful stored\&.
110 .RE
111 .PP
112 PAM_SYSTEM_ERR
113 .RS 4
114 A NULL pointer was submitted as PAM handle or the function was called by an application\&.
115 .RE
116 .SH "SEE ALSO"
117 .PP
118 \fBpam_end\fR(3),
119 \fBpam_get_data\fR(3),
120 \fBpam_strerror\fR(3)