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)  

rsGetLimitedPassword.cpp
Go to the documentation of this file.
1 
4 /* See getLimitedPassword.h for a description of this API call.*/
5 
6 #include "getLimitedPassword.h"
8 #include "miscServerFunct.hpp"
10 #include "rsGetLimitedPassword.hpp"
11 
12 
13 
14 int
16  getLimitedPasswordInp_t *getLimitedPasswordInp,
17  getLimitedPasswordOut_t **getLimitedPasswordOut ) {
19  int status;
20 
21  status = getAndConnRcatHost( rsComm, MASTER_RCAT, ( const char* )NULL, &rodsServerHost );
22  if ( status < 0 ) {
23  return status;
24  }
25 
27  std::string svc_role;
28  irods::error ret = get_catalog_service_role(svc_role);
29  if(!ret.ok()) {
30  irods::log(PASS(ret));
31  return ret.code();
32  }
33  if( irods::CFG_SERVICE_ROLE_PROVIDER == svc_role ) {
35  rsComm,
36  getLimitedPasswordInp,
37  getLimitedPasswordOut );
38  } else if( irods::CFG_SERVICE_ROLE_CONSUMER == svc_role ) {
40  } else {
41  rodsLog(
42  LOG_ERROR,
43  "role not supported [%s]",
44  svc_role.c_str() );
46  }
47  }
48  else {
50  getLimitedPasswordInp,
51  getLimitedPasswordOut );
52  }
53 
54  if ( status < 0 ) {
56  "rsGetLimitedPassword: rcGetLimitedPassword failed, status = %d",
57  status );
58  }
59  return status;
60 }
61 
62 int
64  getLimitedPasswordInp_t *getLimitedPasswordInp,
65  getLimitedPasswordOut_t **getLimitedPasswordOut ) {
66  int status;
67  getLimitedPasswordOut_t *myGetLimitedPasswordOut;
68 
69  myGetLimitedPasswordOut = ( getLimitedPasswordOut_t* )malloc( sizeof( getLimitedPasswordOut_t ) );
70 
71  status = chlMakeLimitedPw( rsComm, getLimitedPasswordInp->ttl,
72  myGetLimitedPasswordOut->stringToHashWith );
73  if ( status < 0 ) {
75  "_rsGetLimitedPassword: getLimitedPassword, status = %d",
76  status );
77  }
78 
79  *getLimitedPasswordOut = myGetLimitedPasswordOut;
80 
81  return status;
82 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
irods::CFG_SERVICE_ROLE_CONSUMER
const std::string CFG_SERVICE_ROLE_CONSUMER("consumer")
irods_configuration_keywords.hpp
rodsServerHost::localFlag
int localFlag
Definition: rodsConnect.h:68
SYS_SERVICE_ROLE_NOT_SUPPORTED
@ SYS_SERVICE_ROLE_NOT_SUPPORTED
Definition: rodsErrorTable.h:217
chlMakeLimitedPw
int chlMakeLimitedPw(rsComm_t *rsComm, int ttl, char *pwValueToHash)
Definition: icatHighLevelRoutines.cpp:1987
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
rsGetLimitedPassword
int rsGetLimitedPassword(rsComm_t *rsComm, getLimitedPasswordInp_t *getLimitedPasswordInp, getLimitedPasswordOut_t **getLimitedPasswordOut)
Definition: rsGetLimitedPassword.cpp:15
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
irods::error::code
long long code() const
Definition: irods_error.cpp:194
irods::CFG_SERVICE_ROLE_PROVIDER
const std::string CFG_SERVICE_ROLE_PROVIDER("provider")
SYS_NO_RCAT_SERVER_ERR
@ SYS_NO_RCAT_SERVER_ERR
Definition: rodsErrorTable.h:110
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
irods::log
void log(const error &)
Definition: irods_log.cpp:13
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
rsGetLimitedPassword.hpp
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
getLimitedPasswordOut_t::stringToHashWith
char stringToHashWith[50]
Definition: getLimitedPassword.h:14
getAndConnRcatHost
int getAndConnRcatHost(rsComm_t *rsComm, int rcatType, const char *rcatZoneHint, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:26
MASTER_RCAT
#define MASTER_RCAT
Definition: rodsDef.h:85
getLimitedPasswordOut_t
Definition: getLimitedPassword.h:13
get_catalog_service_role
irods::error get_catalog_service_role(std::string &_role)
Definition: miscServerFunct.cpp:3153
rodsServerHost
Definition: rodsConnect.h:62
_rsGetLimitedPassword
int _rsGetLimitedPassword(rsComm_t *rsComm, getLimitedPasswordInp_t *getLimitedPasswordInp, getLimitedPasswordOut_t **getLimitedPasswordOut)
Definition: rsGetLimitedPassword.cpp:63
icatHighLevelRoutines.hpp
getLimitedPasswordInp_t
Definition: getLimitedPassword.h:7
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
getLimitedPassword.h
rcGetLimitedPassword
int rcGetLimitedPassword(rcComm_t *conn, getLimitedPasswordInp_t *getLimitedPasswordInp, getLimitedPasswordOut_t **getLimitedPasswordOut)
Definition: rcGetLimitedPassword.cpp:9
getLimitedPasswordInp_t::ttl
int ttl
Definition: getLimitedPassword.h:8