00001
00002
00003
00004
00005
00006 #include "getTempPassword.h"
00007 #include "icatHighLevelRoutines.h"
00008
00009 int
00010 rsGetTempPassword (rsComm_t *rsComm,
00011 getTempPasswordOut_t **getTempPasswordOut)
00012 {
00013 rodsServerHost_t *rodsServerHost;
00014 int status;
00015
00016 status = getAndConnRcatHost(rsComm, MASTER_RCAT, NULL, &rodsServerHost);
00017
00018 if (status < 0) {
00019 return(status);
00020 }
00021
00022 if (rodsServerHost->localFlag == LOCAL_HOST) {
00023 #ifdef RODS_CAT
00024 status = _rsGetTempPassword (rsComm, getTempPasswordOut);
00025 #else
00026 status = SYS_NO_RCAT_SERVER_ERR;
00027 #endif
00028 }
00029 else {
00030 status = rcGetTempPassword(rodsServerHost->conn,
00031 getTempPasswordOut);
00032 }
00033
00034 if (status < 0 ) {
00035 rodsLog (LOG_NOTICE,
00036 "rsGetTempPassword: rcGetTempPassword failed, status = %d",
00037 status);
00038 }
00039 return (status);
00040 }
00041
00042 #ifdef RODS_CAT
00043 int
00044 _rsGetTempPassword (rsComm_t *rsComm,
00045 getTempPasswordOut_t **getTempPasswordOut)
00046 {
00047 int status;
00048 getTempPasswordOut_t *myGetTempPasswordOut;
00049
00050 myGetTempPasswordOut = (getTempPasswordOut_t*)malloc(sizeof(getTempPasswordOut_t));
00051
00052 status = chlMakeTempPw(rsComm,
00053 myGetTempPasswordOut->stringToHashWith);
00054 if (status < 0 ) {
00055 rodsLog (LOG_NOTICE,
00056 "_rsGetTempPassword: getTempPassword, status = %d",
00057 status);
00058 }
00059
00060 *getTempPasswordOut = myGetTempPasswordOut;
00061
00062 return (status);
00063 }
00064 #endif