Debian Codegraph @

pam/pam.h

raw
1 /*
2 * pam.h - Functions to let us call into libpam from Go.
3 *
4 * Copyright 2017 Google Inc.
5 * Author: Joe Richey ([email protected])
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
8 * use this file except in compliance with the License. You may obtain a copy of
9 * the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 * License for the specific language governing permissions and limitations under
17 * the License.
18 */
19
20 #ifndef FSCRYPT_PAM_H
21 #define FSCRYPT_PAM_H
22
23 #include <security/pam_appl.h>
24
25 // Conversation that will call back into Go code when appropriate.
26 extern const struct pam_conv *goConv;
27
28 // CleaupFuncs are used to cleanup specific PAM data.
29 typedef void (*CleanupFunc)(pam_handle_t *pamh, void *data, int error_status);
30
31 // CleaupFunc that calls free() on data.
32 void freeData(pam_handle_t *pamh, void *data, int error_status);
33
34 // CleaupFunc that frees each item in a null terminated array of pointers and
35 // then frees the array itself.
36 void freeArray(pam_handle_t *pamh, void **array, int error_status);
37
38 // Creates a copy of a C string, which resides in a locked buffer.
39 void *copyIntoSecret(void *data);
40
41 // CleaupFunc that Zeros wipes a C string and unlocks and frees its memory.
42 void freeSecret(pam_handle_t *pamh, char *data, int error_status);
43
44 // Sends a message to the application using pam_info().
45 void infoMessage(pam_handle_t *pamh, const char *message);
46
47 #endif // FSCRYPT_PAM_H