[24167] | 1 | /* Copyright © 2005-2007 Roger Leigh <rleigh@debian.org> |
---|
| 2 | * |
---|
| 3 | * schroot is free software: you can redistribute it and/or modify it |
---|
| 4 | * under the terms of the GNU General Public License as published by |
---|
| 5 | * the Free Software Foundation, either version 3 of the License, or |
---|
| 6 | * (at your option) any later version. |
---|
| 7 | * |
---|
| 8 | * schroot is distributed in the hope that it will be useful, but |
---|
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 11 | * General Public License for more details. |
---|
| 12 | * |
---|
| 13 | * You should have received a copy of the GNU General Public License |
---|
| 14 | * along with this program. If not, see |
---|
| 15 | * <http://www.gnu.org/licenses/>. |
---|
| 16 | * |
---|
| 17 | *********************************************************************/ |
---|
| 18 | |
---|
| 19 | #ifndef SBUILD_AUTH_PAM_MESSAGE_H |
---|
| 20 | #define SBUILD_AUTH_PAM_MESSAGE_H |
---|
| 21 | |
---|
| 22 | #include <string> |
---|
| 23 | |
---|
| 24 | #include <security/pam_appl.h> |
---|
| 25 | |
---|
| 26 | namespace sbuild |
---|
| 27 | { |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | * Authentication messages. |
---|
| 31 | * |
---|
| 32 | * When auth_pam needs to interact with the user, it does this by |
---|
| 33 | * sending a list of auth_pam_message objects to an auth_pam_conv |
---|
| 34 | * conversation object. These messages tell the conversation object |
---|
| 35 | * how to display the message to the user, and if necessary, whether |
---|
| 36 | * or not to ask the user for some input. They also store the |
---|
| 37 | * user's input, if required. |
---|
| 38 | */ |
---|
| 39 | class auth_pam_message |
---|
| 40 | { |
---|
| 41 | public: |
---|
| 42 | /// Message type |
---|
| 43 | enum message_type |
---|
| 44 | { |
---|
| 45 | /// Display a prompt, with no echoing of user input. |
---|
| 46 | MESSAGE_PROMPT_NOECHO = PAM_PROMPT_ECHO_OFF, |
---|
| 47 | /// Display a prompt, echoing user input. |
---|
| 48 | MESSAGE_PROMPT_ECHO = PAM_PROMPT_ECHO_ON, |
---|
| 49 | /// Display an error message. |
---|
| 50 | MESSAGE_ERROR = PAM_ERROR_MSG, |
---|
| 51 | /// Display an informational message. |
---|
| 52 | MESSAGE_INFO = PAM_TEXT_INFO |
---|
| 53 | }; |
---|
| 54 | |
---|
| 55 | /** |
---|
| 56 | * The constructor. |
---|
| 57 | * |
---|
| 58 | * @param type the type of message. |
---|
| 59 | * @param message the message to display. |
---|
| 60 | */ |
---|
| 61 | auth_pam_message (message_type type, |
---|
| 62 | std::string const& message); |
---|
| 63 | |
---|
| 64 | /// The destructor. |
---|
| 65 | virtual ~auth_pam_message (); |
---|
| 66 | |
---|
| 67 | /// The type of message. |
---|
| 68 | message_type type; |
---|
| 69 | /// The message to display. |
---|
| 70 | std::string message; |
---|
| 71 | /// The user's response (if any). |
---|
| 72 | std::string response; |
---|
| 73 | }; |
---|
| 74 | |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | #endif /* SBUILD_AUTH_PAM_MESSAGE_H */ |
---|
| 78 | |
---|
| 79 | /* |
---|
| 80 | * Local Variables: |
---|
| 81 | * mode:C++ |
---|
| 82 | * End: |
---|
| 83 | */ |
---|