Revision ae7842fe
src/rm/RequestManagerUserAuthenticate.cc | ||
---|---|---|
26 | 26 |
xmlrpc_c::paramList const& paramList, |
27 | 27 |
xmlrpc_c::value * const retval) |
28 | 28 |
{ |
29 |
string session; |
|
30 |
int uid; |
|
31 |
|
|
32 |
ostringstream oss; |
|
33 |
const string method_name = "UserAuthenticate"; |
|
34 |
|
|
29 |
string session; |
|
30 |
int rc; |
|
35 | 31 |
|
36 | 32 |
/* -- RPC specific vars -- */ |
37 | 33 |
vector<xmlrpc_c::value> arrayData; |
... | ... | |
43 | 39 |
session = xmlrpc_c::value_string(paramList.getString(0)); |
44 | 40 |
|
45 | 41 |
// Try to authenticate the user |
46 |
uid = UserAuthenticate::upool->authenticate(session); |
|
47 |
|
|
48 |
if( uid == -1 ) |
|
49 |
{ |
|
50 |
goto error_common; |
|
51 |
} |
|
42 |
rc = UserAuthenticate::upool->authenticate(session); |
|
52 | 43 |
|
53 | 44 |
//Result |
54 |
arrayData.push_back(xmlrpc_c::value_boolean( true )); |
|
55 |
arrayData.push_back(xmlrpc_c::value_int(uid)); |
|
45 |
arrayData.push_back(xmlrpc_c::value_boolean( rc == 0 )); |
|
56 | 46 |
arrayresult = new xmlrpc_c::value_array(arrayData); |
57 | 47 |
|
58 | 48 |
*retval = *arrayresult; |
... | ... | |
60 | 50 |
delete arrayresult; |
61 | 51 |
|
62 | 52 |
return; |
63 |
|
|
64 |
error_common: |
|
65 |
oss.str(authenticate_error(method_name)); |
|
66 |
|
|
67 |
arrayData.push_back(xmlrpc_c::value_boolean(false)); // FAILURE |
|
68 |
arrayData.push_back(xmlrpc_c::value_string( authenticate_error(method_name) ); |
|
69 |
|
|
70 |
NebulaLog::log("ReM",Log::ERROR,oss); |
|
71 |
|
|
72 |
xmlrpc_c::value_array arrayresult_error(arrayData); |
|
73 |
|
|
74 |
*retval = arrayresult_error; |
|
75 |
return; |
|
76 | 53 |
} |
77 | 54 |
|
78 | 55 |
/* -------------------------------------------------------------------------- */ |
Also available in: Unified diff