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)  

obf.cpp File Reference
#include <stdio.h>
#include <openssl/md5.h>
#include <openssl/sha.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/timeb.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
#include <termios.h>
#include "termiosUtil.hpp"
#include <cstdlib>
#include "rods.h"
#include "rodsPath.h"
#include "authenticate.h"
#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/convenience.hpp>
Include dependency graph for obf.cpp:

Go to the source code of this file.

Macros

#define TMP_FLAG   "%TEMPORARY_PW%"
 
#define AUTH_FILENAME_DEFAULT   ".irods/.irodsA" /* under the HOME dir */
 
#define V2_Prefix   "A.ObfV2"
 

Functions

int obftestmain (int argc, char *argv[])
 
int obfSetDebug (int opt)
 
int obfiGetFilename (char *fileName)
 
int obfGetPw (char *pw)
 
int obfRmPw (int opt)
 
int obfiSetTimeFromFile (int fd)
 
int obfSavePw (int promptOpt, int fileOpt, int printOpt, const char *pwArg)
 
int obfTempOps (int tmpOpt)
 
int obfiGetTv (char *fileName)
 
int obfiGetPw (const char *fileName, char *pw)
 
int obfiOpenOutFile (const char *fileName, int fileOpt)
 
int obfiWritePw (int fd, const char *pw)
 
int obfiTimeval ()
 
void obfiEncode (const char *in, char *out, int extra)
 
int obfiTimeCheck (int time1, int time2)
 
int obfiDecode (const char *in, char *out, int extra)
 
int obfiGetEnvKey ()
 
void obfSetDefaultHashType (int type)
 
int obfGetDefaultHashType ()
 
void obfMakeOneWayHash (int hashType, unsigned const char *inBuf, int inBufSize, unsigned char *outHash)
 
void obfEncodeByKey (const char *in, const char *key, char *out)
 
void obfEncodeByKeyV2 (const char *in, const char *key, const char *key2, char *out)
 
void obfDecodeByKey (const char *in, const char *key, char *out)
 
void obfDecodeByKeyV2 (const char *in, const char *key, const char *key2, char *out)
 
char * obfGetMD5Hash (const char *stringToHash)
 

Variables

int obfDebug = 0
 
int timeVal = 0
 
int isTemp = 0
 
int doTemp = 0
 
int cipherBlockChaining = 0
 
static int defaultHashType = 1
 

Macro Definition Documentation

◆ AUTH_FILENAME_DEFAULT

#define AUTH_FILENAME_DEFAULT   ".irods/.irodsA" /* under the HOME dir */

Definition at line 69 of file obf.cpp.

◆ TMP_FLAG

#define TMP_FLAG   "%TEMPORARY_PW%"

Definition at line 67 of file obf.cpp.

◆ V2_Prefix

#define V2_Prefix   "A.ObfV2"

Definition at line 1118 of file obf.cpp.

Function Documentation

◆ obfDecodeByKey()

void obfDecodeByKey ( const char *  in,
const char *  key,
char *  out 
)

Definition at line 1155 of file obf.cpp.

References irods.pypyodbc::buffer, cipherBlockChaining, HASH_TYPE_MD5, HASH_TYPE_SHA1, int(), keyBuf(), obfDebug, obfMakeOneWayHash(), manual_cleanup::out, and irods.password_obfuscation::wheel.

Referenced by icatDescramble(), and obfDecodeByKeyV2().

Here is the call graph for this function:

◆ obfDecodeByKeyV2()

void obfDecodeByKeyV2 ( const char *  in,
const char *  key,
const char *  key2,
char *  out 
)

Definition at line 1268 of file obf.cpp.

References cipherBlockChaining, match(), MAX_PASSWORD_LEN, obfDecodeByKey(), obfGetMD5Hash(), manual_cleanup::out, and V2_Prefix.

Referenced by decodePw().

Here is the call graph for this function:

◆ obfEncodeByKey()

void obfEncodeByKey ( const char *  in,
const char *  key,
char *  out 
)

Definition at line 1007 of file obf.cpp.

References irods.pypyodbc::buffer, cipherBlockChaining, defaultHashType, HASH_TYPE_DEFAULT, HASH_TYPE_SHA1, int(), keyBuf(), obfDebug, obfMakeOneWayHash(), manual_cleanup::out, and irods.password_obfuscation::wheel.

Referenced by icatScramble(), and obfEncodeByKeyV2().

Here is the call graph for this function:

◆ obfEncodeByKeyV2()

void obfEncodeByKeyV2 ( const char *  in,
const char *  key,
const char *  key2,
char *  out 
)

Definition at line 1120 of file obf.cpp.

References cipherBlockChaining, obfEncodeByKey(), obfGetMD5Hash(), manual_cleanup::out, and V2_Prefix.

Here is the call graph for this function:

◆ obfGetDefaultHashType()

int obfGetDefaultHashType ( )

Definition at line 964 of file obf.cpp.

References defaultHashType.

◆ obfGetMD5Hash()

char* obfGetMD5Hash ( const char *  stringToHash)

Definition at line 1305 of file obf.cpp.

References irods.pypyodbc::buffer, HASH_TYPE_DEFAULT, keyBuf(), and obfMakeOneWayHash().

Referenced by obfDecodeByKeyV2(), and obfEncodeByKeyV2().

Here is the call graph for this function:

◆ obfGetPw()

int obfGetPw ( char *  pw)

Definition at line 159 of file obf.cpp.

References isTemp, MAX_NAME_LEN, MAX_PASSWORD_LEN, obfDebug, obfiDecode(), obfiGetEnvKey(), obfiGetFilename(), obfiGetPw(), obfiGetTv(), and TMP_FLAG.

Referenced by clientLoginTTL(), native_auth_establish_context(), obfTempOps(), and obftestmain().

Here is the call graph for this function:

◆ obfiDecode()

int obfiDecode ( const char *  in,
char *  out,
int  extra 
)

Definition at line 742 of file obf.cpp.

References AUTH_FILE_NOT_ENCRYPTED, int(), obfDebug, obfiTimeCheck(), manual_cleanup::out, timeVal, and irods.password_obfuscation::wheel.

Referenced by obfGetPw().

Here is the call graph for this function:

◆ obfiEncode()

void obfiEncode ( const char *  in,
char *  out,
int  extra 
)

Definition at line 534 of file obf.cpp.

References int(), obfDebug, obfiTimeval(), manual_cleanup::out, timeVal, and irods.password_obfuscation::wheel.

Referenced by obfSavePw().

Here is the call graph for this function:

◆ obfiGetEnvKey()

int obfiGetEnvKey ( )

Definition at line 950 of file obf.cpp.

Referenced by obfGetPw(), and obfSavePw().

◆ obfiGetFilename()

int obfiGetFilename ( char *  fileName)

Definition at line 119 of file obf.cpp.

References AUTH_FILENAME_DEFAULT, CLIENT_PT, ENVIRONMENT_VAR_HOME_NOT_DEFINED, getRodsEnvAuthFileName(), MAX_NAME_LEN, NULL, and ProcessType.

Referenced by obfGetPw(), obfRmPw(), obfSavePw(), and obfTempOps().

Here is the call graph for this function:

◆ obfiGetPw()

int obfiGetPw ( const char *  fileName,
char *  pw 
)

Definition at line 429 of file obf.cpp.

References buf, FILE_OPEN_ERR, FILE_READ_ERR, MAX_PASSWORD_LEN, and PASSWORD_EXCEEDS_MAX_SIZE.

Referenced by obfGetPw().

◆ obfiGetTv()

int obfiGetTv ( char *  fileName)

Definition at line 405 of file obf.cpp.

References timeVal, and UNABLE_TO_STAT_FILE.

Referenced by obfGetPw().

◆ obfiOpenOutFile()

int obfiOpenOutFile ( const char *  fileName,
int  fileOpt 
)

Definition at line 457 of file obf.cpp.

References FILE_OPEN_ERR, MAX_NAME_LEN, and NULL.

Referenced by obfSavePw().

◆ obfiSetTimeFromFile()

int obfiSetTimeFromFile ( int  fd)

Definition at line 245 of file obf.cpp.

References FILE_WRITE_ERR, timeVal, and UNABLE_TO_STAT_FILE.

Referenced by obfSavePw().

◆ obfiTimeCheck()

int obfiTimeCheck ( int  time1,
int  time2 
)

Definition at line 707 of file obf.cpp.

Referenced by obfiDecode().

◆ obfiTimeval()

int obfiTimeval ( )

Definition at line 512 of file obf.cpp.

References obfDebug.

Referenced by obfiEncode().

◆ obfiWritePw()

int obfiWritePw ( int  fd,
const char *  pw 
)

Definition at line 502 of file obf.cpp.

References FILE_WRITE_ERR.

Referenced by obfSavePw().

◆ obfMakeOneWayHash()

void obfMakeOneWayHash ( int  hashType,
unsigned const char *  inBuf,
int  inBufSize,
unsigned char *  outHash 
)

◆ obfRmPw()

int obfRmPw ( int  opt)

Definition at line 212 of file obf.cpp.

References AUTH_FILE_DOES_NOT_EXIST, error, irods::experimental::administration::client::v1::exists(), MAX_NAME_LEN, NULL, obfiGetFilename(), irods::experimental::filesystem::client::remove(), irods.pypyodbc::status, and UNLINK_FAILED.

Here is the call graph for this function:

◆ obfSavePw()

int obfSavePw ( int  promptOpt,
int  fileOpt,
int  printOpt,
const char *  pwArg 
)

Definition at line 281 of file obf.cpp.

References doTemp, FILE_OPEN_ERR, MAX_NAME_LEN, MAX_PASSWORD_LEN, NO_PASSWORD_ENTERED, NULL, obfDebug, obfiEncode(), obfiGetEnvKey(), obfiGetFilename(), obfiOpenOutFile(), obfiSetTimeFromFile(), obfiWritePw(), PASSWORD_EXCEEDS_MAX_SIZE, and TMP_FLAG.

Referenced by clientLoginPam(), clientLoginTTL(), obftestmain(), and pam_auth_client_request().

Here is the call graph for this function:

◆ obfSetDebug()

int obfSetDebug ( int  opt)

Definition at line 113 of file obf.cpp.

References obfDebug.

◆ obfSetDefaultHashType()

void obfSetDefaultHashType ( int  type)

Definition at line 956 of file obf.cpp.

References defaultHashType, obfDebug, and type.

◆ obfTempOps()

int obfTempOps ( int  tmpOpt)

Definition at line 379 of file obf.cpp.

References doTemp, isTemp, MAX_NAME_LEN, MAX_PASSWORD_LEN, obfGetPw(), and obfiGetFilename().

Here is the call graph for this function:

◆ obftestmain()

int obftestmain ( int  argc,
char *  argv[] 
)

Definition at line 85 of file obf.cpp.

References MAX_PASSWORD_LEN, obfDebug, obfGetPw(), and obfSavePw().

Here is the call graph for this function:

Variable Documentation

◆ cipherBlockChaining

int cipherBlockChaining = 0

Definition at line 75 of file obf.cpp.

Referenced by obfDecodeByKey(), obfDecodeByKeyV2(), obfEncodeByKey(), and obfEncodeByKeyV2().

◆ defaultHashType

int defaultHashType = 1
static

◆ doTemp

int doTemp = 0

Definition at line 73 of file obf.cpp.

Referenced by obfSavePw(), and obfTempOps().

◆ isTemp

int isTemp = 0

Definition at line 72 of file obf.cpp.

Referenced by obfGetPw(), and obfTempOps().

◆ obfDebug

◆ timeVal

int timeVal = 0

Definition at line 71 of file obf.cpp.

Referenced by obfiDecode(), obfiEncode(), obfiGetTv(), and obfiSetTimeFromFile().