MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / fetchPassword

Function fetchPassword

src/common/utils.cpp:1006–1025  ·  view source on GitHub ↗

fetch password from file

Source from the content-addressed store, hash-verified

1004
1005// fetch password from file
1006FetchPassResult fetchPassword(const Firebird::PathName& name, const char*& password)
1007{
1008 InputFile file(name);
1009 if (!file)
1010 {
1011 return FETCH_PASS_FILE_OPEN_ERROR;
1012 }
1013
1014 Firebird::string pwd;
1015 if (! pwd.LoadFromFile(file.getStdioFile()))
1016 {
1017 return ferror(file.getStdioFile()) ? FETCH_PASS_FILE_READ_ERROR : FETCH_PASS_FILE_EMPTY;
1018 }
1019
1020 // this is planned leak of a few bytes of memory in utilities
1021 char* pass = FB_NEW_POOL(*getDefaultMemoryPool()) char[pwd.length() + 1];
1022 pwd.copyTo(pass, pwd.length() + 1);
1023 password = pass;
1024 return FETCH_PASS_OK;
1025}
1026
1027
1028

Callers 7

aliceFunction · 0.85
processFetchPassFunction · 0.85
nbackupFunction · 0.85
get_switchesFunction · 0.85
putFileArgumentFunction · 0.85
get_switchesFunction · 0.85
fbtraceFunction · 0.85

Calls 6

ferrorFunction · 0.85
getDefaultMemoryPoolFunction · 0.85
LoadFromFileMethod · 0.80
getStdioFileMethod · 0.80
lengthMethod · 0.45
copyToMethod · 0.45

Tested by

no test coverage detected