| 1 |
/* |
| 2 |
* constants.go - PAM flags and item types from github.com/msteinert/pam |
| 3 |
* |
| 4 |
* Modifications Copyright 2017 Google Inc. |
| 5 |
* Modifications 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 |
* Copyright 2011, krockot |
| 21 |
* Copyright 2015, Michael Steinert <[email protected]> |
| 22 |
* All rights reserved. |
| 23 |
* |
| 24 |
* Redistribution and use in source and binary forms, with or without |
| 25 |
* modification, are permitted provided that the following conditions are met: |
| 26 |
* |
| 27 |
* * Redistributions of source code must retain the above copyright notice, this |
| 28 |
* list of conditions and the following disclaimer. |
| 29 |
* |
| 30 |
* * Redistributions in binary form must reproduce the above copyright notice, |
| 31 |
* this list of conditions and the following disclaimer in the documentation |
| 32 |
* and/or other materials provided with the distribution. |
| 33 |
* |
| 34 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 35 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 36 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 37 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 38 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 39 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 40 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 41 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 42 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 43 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 44 |
*/ |
| 45 |
|
| 46 |
package pam |
| 47 |
|
| 48 |
/* |
| 49 |
#cgo LDFLAGS: -lpam |
| 50 |
|
| 51 |
#include <security/pam_modules.h> |
| 52 |
*/ |
| 53 |
import "C" |
| 54 |
|
| 55 |
// Item is a PAM information type. |
| 56 |
type Item int |
| 57 |
|
| 58 |
// PAM Item types. |
| 59 |
const ( |
| 60 |
// Service is the name which identifies the PAM stack. |
| 61 |
Service Item = C.PAM_SERVICE |
| 62 |
// User identifies the username identity used by a service. |
| 63 |
User = C.PAM_USER |
| 64 |
// Tty is the terminal name. |
| 65 |
Tty = C.PAM_TTY |
| 66 |
// Rhost is the requesting host name. |
| 67 |
Rhost = C.PAM_RHOST |
| 68 |
// Authtok is the currently active authentication token. |
| 69 |
Authtok = C.PAM_AUTHTOK |
| 70 |
// Oldauthtok is the old authentication token. |
| 71 |
Oldauthtok = C.PAM_OLDAUTHTOK |
| 72 |
// Ruser is the requesting user name. |
| 73 |
Ruser = C.PAM_RUSER |
| 74 |
// UserPrompt is the string use to prompt for a username. |
| 75 |
UserPrompt = C.PAM_USER_PROMPT |
| 76 |
) |
| 77 |
|
| 78 |
// Flag is used as input to various PAM functions. Flags can be combined with a |
| 79 |
// bitwise or. Refer to the official PAM documentation for which flags are |
| 80 |
// accepted by which functions. |
| 81 |
type Flag int |
| 82 |
|
| 83 |
// PAM Flag types. |
| 84 |
const ( |
| 85 |
// Silent indicates that no messages should be emitted. |
| 86 |
Silent Flag = C.PAM_SILENT |
| 87 |
// DisallowNullAuthtok indicates that authorization should fail |
| 88 |
// if the user does not have a registered authentication token. |
| 89 |
DisallowNullAuthtok = C.PAM_DISALLOW_NULL_AUTHTOK |
| 90 |
// EstablishCred indicates that credentials should be established |
| 91 |
// for the user. |
| 92 |
EstablishCred = C.PAM_ESTABLISH_CRED |
| 93 |
// DeleteCred inidicates that credentials should be deleted. |
| 94 |
DeleteCred = C.PAM_DELETE_CRED |
| 95 |
// ReinitializeCred indicates that credentials should be fully |
| 96 |
// reinitialized. |
| 97 |
ReinitializeCred = C.PAM_REINITIALIZE_CRED |
| 98 |
// RefreshCred indicates that the lifetime of existing credentials |
| 99 |
// should be extended. |
| 100 |
RefreshCred = C.PAM_REFRESH_CRED |
| 101 |
// ChangeExpiredAuthtok indicates that the authentication token |
| 102 |
// should be changed if it has expired. |
| 103 |
ChangeExpiredAuthtok = C.PAM_CHANGE_EXPIRED_AUTHTOK |
| 104 |
// PrelimCheck indicates that the modules are being probed as to their |
| 105 |
// ready status for altering the user's authentication token. |
| 106 |
PrelimCheck = C.PAM_PRELIM_CHECK |
| 107 |
// UpdateAuthtok informs the module that this is the call it should |
| 108 |
// change the authorization tokens. |
| 109 |
UpdateAuthtok = C.PAM_UPDATE_AUTHTOK |
| 110 |
) |