irods
4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems. Fossies Dox: irods-4.2.8.tar.gz ("unofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file.
35 #include <openssl/md5.h>
36 #include <boost/filesystem/operations.hpp>
37 #include <boost/filesystem/convenience.hpp>
52 "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x",
53 (
unsigned char )_sig[0],
54 (
unsigned char )_sig[1],
55 (
unsigned char )_sig[2],
56 (
unsigned char )_sig[3],
57 (
unsigned char )_sig[4],
58 (
unsigned char )_sig[5],
59 (
unsigned char )_sig[6],
60 (
unsigned char )_sig[7],
61 (
unsigned char )_sig[8],
62 (
unsigned char )_sig[9],
63 (
unsigned char )_sig[10],
64 (
unsigned char )_sig[11],
65 (
unsigned char )_sig[12],
66 (
unsigned char )_sig[13],
67 (
unsigned char )_sig[14],
68 (
unsigned char )_sig[15] );
82 for ( i = 0; i < len; i++ ) {
84 fprintf( stderr,
"Level %d: %s\n", i, ErrMsg->
msg );
88 char *mySubName =
NULL;
90 fprintf( stderr,
"%s failed with error %d %s %s\n", routineName,
91 status, myName, mySubName );
100 using namespace boost::filesystem;
108 if ( password[0] !=
'\0' ) {
109 strncpy( myPassword, password,
sizeof( myPassword ) );
112 irods::termiosUtil tiosutl(STDIN_FILENO);
113 if ( !tiosutl.echoOff() )
115 printf(
"WARNING: Error %d disabling echo mode. Password will be displayed in plaintext.\n", tiosutl.getError() );
118 printf(
"Enter your current PAM (system) password:" );
120 const char *fgets_return = fgets( myPassword,
sizeof( myPassword ), stdin );
121 if (fgets_return != myPassword || strlen(myPassword) < 2) {
123 myPassword[0] =
'\0';
127 if( tiosutl.getValid() && !tiosutl.echoOn() )
129 printf(
"Error reinstating echo mode.\n" );
132 len = strlen( myPassword );
133 if ( len > 0 && myPassword[len - 1] ==
'\n' ) {
134 myPassword[len - 1] =
'\0';
146 memset( &pamAuthReqInp, 0,
sizeof( pamAuthReqInp ) );
148 pamAuthReqInp.
pamUser = userName;
156 memset( myPassword, 0,
sizeof( myPassword ) );
178 memset( userPassword, 0,
sizeof( userPassword ) );
183 getLimitedPasswordInp.
ttl = ttl;
184 getLimitedPasswordInp.
unused1 =
"";
188 &getLimitedPasswordInp,
189 &getLimitedPasswordOut ) ) {
191 memset( userPassword, 0,
sizeof( userPassword ) );
198 memset( hashBuf, 0,
sizeof( hashBuf ) );
200 strncat( hashBuf, userPassword, 100 );
201 memset( userPassword, 0,
sizeof( userPassword ) );
203 unsigned char digest[100];
206 (
unsigned char* )hashBuf,
209 memset( hashBuf, 0,
sizeof( hashBuf ) );
224 const char* _context,
225 const char* _scheme_override ) {
246 if ( _scheme_override && strlen( _scheme_override ) > 0 ) {
247 auth_scheme = _scheme_override;
253 if ( !auth_env_var ) {
262 auth_scheme = auth_env_var;
267 std::string lower_scheme = auth_scheme;
268 std::transform( auth_scheme.begin(), auth_scheme.end(), auth_scheme.begin(), ::tolower );
297 irods::auth_ptr auth_plugin = boost::dynamic_pointer_cast< irods::auth >( ptr );
314 (
char* )ret.
result().c_str() );
333 (
char* )ret.
result().c_str() );
354 char userNameAndZone[
NAME_LEN * 2 + 1];
357 printError( Conn, -1,
"null password pointer" );
371 memset( md5Buf, 0,
sizeof( md5Buf ) );
376 len = strlen( password );
380 MD5_Init( &context );
382 MD5_Final( (
unsigned char* )digest, &context );
384 if ( digest[i] ==
'\0' ) {
401 strncat( userNameAndZone,
"#",
NAME_LEN );
403 authRespIn.
username = userNameAndZone;
void rodsLog(int level, const char *formatStr,...)
boost::shared_ptr< plugin_base > plugin_ptr
const std::string AUTH_ESTABLISH_CONTEXT("auth_establish_context")
int getRodsEnv(rodsEnv *myRodsEnv)
const std::string AUTH_CLIENT_START("auth_client_start")
void transform(const InputC &ic, OutputC &oc, UnaryOperation func)
int hashToStr(unsigned char *digest, char *digestStr)
char * getSessionSignatureClientside()
#define PASS(prev_error_)
int printError(rcComm_t *Conn, int status, char *routineName)
irods::error auth_factory(const std::string &, rError_t *, irods::auth_object_ptr &)
boost::shared_ptr< auth_object > auth_object_ptr
std::string to_env(const std::string &)
const std::string AUTH_NATIVE_SCHEME("native")
const std::string AUTH_INTERFACE("irods_auth_interface")
const char * rodsErrorName(int errorValue, char **subName)
const std::string AUTH_CLIENT_AUTH_REQUEST("auth_agent_client_request")
const std::string CFG_IRODS_AUTHENTICATION_SCHEME_KW("irods_authentication_scheme")
@ SYS_INVALID_INPUT_PARAM
void setSessionSignatureClientside(char *_sig)
static char prevChallengeSignatureClient[200]
void obfMakeOneWayHash(int hashType, unsigned const char *inBuf, int inBufSize, unsigned char *outHash)
int obfSavePw(int promptOpt, int fileOpt, int printOpt, const char *pwArg)
int sslEnd(rcComm_t *rcComm)
const std::string AUTH_PAM_SCHEME("pam")
int rcPamAuthRequest(rcComm_t *conn, pamAuthRequestInp_t *pamAuthRequestInp, pamAuthRequestOut_t **pamAuthRequestOut)
int clientLogin(rcComm_t *_comm, const char *_context, const char *_scheme_override)
int clientLoginWithPassword(rcComm_t *Conn, char *password)
char stringToHashWith[50]
int rcAuthResponse(rcComm_t *conn, authResponseInp_t *authResponseInp)
int sslStart(rcComm_t *rcComm)
#define HASH_TYPE_DEFAULT
int clientLoginTTL(rcComm_t *Conn, int ttl)
const std::string AUTH_CLIENT_AUTH_RESPONSE("auth_agent_client_response")
int clientLoginPam(rcComm_t *Conn, char *password, int ttl)
int rcGetLimitedPassword(rcComm_t *conn, getLimitedPasswordInp_t *getLimitedPasswordInp, getLimitedPasswordOut_t **getLimitedPasswordOut)
boost::shared_ptr< auth > auth_ptr
std::string result() const
int rcAuthRequest(rcComm_t *conn, authRequestOut_t **authRequestOut)