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.
30 #include <openssl/md5.h>
57 "rsAuthResponse: proxyuser %s with %d no priv to auth clientUser %s",
71 const int requireServerAuth = 0;
86 "invalid plugin context" );
92 "null rcConn_t ptr" );
123 "invalid plugin context" );
144 ptr->request_result().c_str(),
155 int need_password = 0;
158 ptr->user_name().c_str(),
170 const_cast< char*
>( ptr->request_result().c_str() ),
171 const_cast< char*
>( ptr->user_name().c_str() ),
178 if ( 0 != need_password ) {
180 HANDLE hStdin = GetStdHandle( STD_INPUT_HANDLE );
182 GetConsoleMode( hStdin, &
mode );
183 DWORD lastMode =
mode;
184 mode &= ~ENABLE_ECHO_INPUT;
185 BOOL
error = !SetConsoleMode( hStdin,
mode );
189 tcgetattr( STDIN_FILENO, &tty );
190 tcflag_t oldflag = tty.c_lflag;
191 tty.c_lflag &= ~ECHO;
192 int error = tcsetattr( STDIN_FILENO, TCSANOW, &tty );
196 printf(
"WARNING: Error %d disabling echo mode. Password will be displayed in plaintext.", errsv );
198 printf(
"Enter your current iRODS password:" );
199 std::string password =
"";
203 if ( !SetConsoleMode( hStdin, lastMode ) ) {
204 printf(
"Error reinstating echo mode." );
207 tty.c_lflag = oldflag;
208 if ( tcsetattr( STDIN_FILENO, TCSANOW, &tty ) ) {
209 printf(
"Error reinstating echo mode." );
217 MD5_Init( &context );
220 (
unsigned char* )md5_buf,
224 MD5_Final( (
unsigned char* )digest, &context );
231 if ( digest[ i ] ==
'\0' ) {
238 ptr->digest( digest );
254 "invalid plugin context" );
276 "call to rcAuthRequest failed." );
345 "invalid plugin context" );
350 "null rcComm_t ptr" );
363 ptr->digest().c_str() );
367 std::string user_name = ptr->user_name() +
386 "call to rcAuthResponse failed." );
406 "invalid plugin context" );
411 "null authResponseInp_t ptr" );
437 "getAndConnRcatHostNoLogin failed" );
440 memset( &authCheckInp, 0,
sizeof( authCheckInp ) );
451 authCheckInp.
response =
const_cast<char*
>( resp_str.c_str() );
464 if ( authCheckOut !=
NULL ) {
467 free( authCheckOut );
470 "rxAuthCheck failed" );
475 rodsLog(
LOG_NOTICE,
"Warning, cannot authenticate remote server, no serverResponse field" );
476 if ( requireServerAuth ) {
477 free( authCheckOut );
480 "Authentication disallowed, no serverResponse field" );
487 rodsLog(
LOG_NOTICE,
"Warning, cannot authenticate remote server, serverResponse field is empty" );
488 if ( requireServerAuth ) {
490 free( authCheckOut );
493 "Authentication disallowed, empty serverResponse" );
499 memset( md5Buf, 0,
sizeof( md5Buf ) );
503 len = strlen( serverId );
505 rodsLog(
LOG_NOTICE,
"rsAuthResponse: Warning, cannot authenticate the remote server, no RemoteZoneSID defined in server_config.json",
status );
506 if ( requireServerAuth ) {
508 free( authCheckOut );
511 "Authentication disallowed, no RemoteZoneSID defined" );
516 MD5_Init( &context );
517 MD5_Update( &context, (
unsigned char* )md5Buf,
519 MD5_Final( (
unsigned char* )digest, &context );
521 if ( digest[i] ==
'\0' ) {
529 if ( *cp++ != digest[i] ) {
536 free( authCheckOut );
539 "Server response incorrect, authentication disallowed" );
552 free( authCheckOut );
555 "getLocalZoneInfo failed" );
585 free( authCheckOut );
588 "getLocalZoneInfo failed" );
621 free( authCheckOut );
624 "check_proxy_user_privileges failed" );
628 "rsAuthResponse set proxy authFlag to %d, client authFlag to %d, user:%s proxy:%s client:%s",
645 free( authCheckOut );
654 const char* _challenge,
655 const char* _user_name,
656 const char* _response ) {
660 const_cast< char*
>( _challenge ),
661 const_cast< char*
>( _user_name ),
662 const_cast< char*
>( _response ) );
666 "osauthVerifyResponse failed" );
703 const std::string& _nm,
704 const std::string& _ctx ) :
719 const std::string& _inst_name,
720 const std::string& _context ) {
730 using namespace irods;
734 function<error(plugin_context&,rcComm_t*,const char*)>(
742 function<error(plugin_context&,rcComm_t*)>(
746 function<error(plugin_context&,rcComm_t*)>(
751 function<error(plugin_context&,const char*)>(
752 osauth_auth_agent_start ) );
756 osauth_auth_agent_request ) );
759 function<error(plugin_context&,authResponseInp_t*)>(
760 osauth_auth_agent_response ) );
763 function<error(plugin_context&,const char*,const char*,const char*)>(
764 osauth_auth_agent_verify ) );
void rodsLog(int level, const char *formatStr,...)
const std::string AUTH_ESTABLISH_CONTEXT("auth_establish_context")
const std::string AUTH_CLIENT_START("auth_client_start")
boost::shared_ptr< osauth_auth_object > osauth_auth_object_ptr
int getAndConnRcatHostNoLogin(rsComm_t *rsComm, int rcatType, char *rcatZoneHint, rodsServerHost_t **rodsServerHost)
auth(const std::string &_inst, const std::string &_ctx)
void setSessionSignatureClientside(char *_sig)
irods::error osauth_auth_establish_context(irods::plugin_context &_ctx)
const std::string AUTH_OSAUTH_SCHEME("osauth")
std::string kvp_delimiter()
const std::string AUTH_AGENT_AUTH_RESPONSE("auth_agent_auth_response")
const std::string AUTH_RESPONSE_KEY("a_resp")
const std::string AUTH_CLIENT_AUTH_REQUEST("auth_agent_client_request")
@ SYS_INVALID_INPUT_PARAM
irods::error osauth_auth_client_start(irods::plugin_context &_ctx, rcComm_t *_comm, const char *)
@ REMOTE_SERVER_AUTH_NOT_PROVIDED
const std::string AUTH_AGENT_AUTH_REQUEST("auth_agent_auth_request")
virtual rsComm_t * comm()
@ REMOTE_SERVER_AUTH_EMPTY
static int check_proxy_user_privileges(rsComm_t *rsComm, int proxyUserPriv)
int getline(char *s, int n, FILE *f)
osauth_auth_plugin(const std::string &_nm, const std::string &_ctx)
int osauthVerifyResponse(char *challenge, char *username, char *response)
int osauthGetAuth(char *challenge, char *username, char *authenticator, int authenticator_buflen)
#define REMOTE_PRIV_USER_AUTH
int rcAuthCheck(rcComm_t *conn, authCheckInp_t *authCheckInp, authCheckOut_t **authCheckOut)
int getLocalZoneInfo(zoneInfo_t **outZoneInfo)
#define LOCAL_PRIV_USER_AUTH
virtual std::string request_result() const
const std::string AUTH_AGENT_START("auth_agent_start")
irods::auth * plugin_factory(const std::string &_inst_name, const std::string &_context)
#define ERROR(code_, message_)
void _rsSetAuthRequestGetChallenge(const char *_c)
int rcAuthResponse(rcComm_t *conn, authResponseInp_t *authResponseInp)
int rsAuthCheck(rsComm_t *rsComm, authCheckInp_t *authCheckInp, authCheckOut_t **authCheckOut)
const std::string AUTH_SCHEME_KEY("a_scheme")
int rcDisconnect(rcComm_t *conn)
error add_operation(const std::string &_op, std::function< error(plugin_context &)> _f)
virtual first_class_object_ptr fco()
irods::error osauth_auth_client_request(irods::plugin_context &_ctx, rcComm_t *_comm)
void getZoneServerId(char *zoneName, char *zoneSID)
std::string kvp_association()
irods::error osauth_auth_client_response(irods::plugin_context &_ctx, rcComm_t *_comm)
const std::string AUTH_AGENT_AUTH_VERIFY("auth_agent_auth_verify")
char auth_scheme_[(1024+64)]
@ REMOTE_SERVER_AUTHENTICATION_FAILURE
char * _rsAuthRequestGetChallenge()
int rcAuthPluginRequest(rcComm_t *server_comm_ptr, authPluginReqInp_t *incoming_struct_with_scheme, authPluginReqOut_t **response_from_agent)
const std::string AUTH_CLIENT_AUTH_RESPONSE("auth_agent_client_response")
int parseUserName(const char *fullUserNameIn, char *userName, char *userZone)
int get64RandomBytes(char *buf)
std::string user_name() const
@ REMOTE_SERVER_SID_NOT_DEFINED