1 |
|
2 |
#include "stdpam.h" |
3 |
#include <string> |
4 |
#include <iostream> |
5 |
|
6 |
|
7 |
using namespace std; |
8 |
|
9 |
|
10 |
string StdPam::promptEchoOn(string msg) |
11 |
{ |
12 |
if (msg == "login: ") |
13 |
cout << "Login: " ; |
14 |
else |
15 |
cout << __FUNCTION__ << " = " << msg << ": "; |
16 |
|
17 |
char buf[128]; |
18 |
cin.getline(buf,128); |
19 |
string input = string(buf); |
20 |
if (input.size() == 0) |
21 |
input = " "; |
22 |
return input; |
23 |
} |
24 |
|
25 |
string StdPam::promptEchoOff(string msg) |
26 |
{ |
27 |
if (msg == "Password: ") |
28 |
cout << msg ; |
29 |
else |
30 |
cout << __FUNCTION__ << " = " << msg << ": "; |
31 |
string input = getpass(""); |
32 |
if (input.size() == 0) |
33 |
input = " "; |
34 |
return input; |
35 |
} |
36 |
|
37 |
void StdPam::errorMsg(string msg) |
38 |
{ |
39 |
cout << __FUNCTION__ << " : " << msg << endl; |
40 |
} |
41 |
|
42 |
void StdPam::textInfo(string msg) |
43 |
{ |
44 |
cout << __FUNCTION__ << " : " << msg << endl; |
45 |
} |