Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/request.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | static fs::path GetAuthCookieFile(bool temp = false) { | ||||
} | } | ||||
return AbsPathForConfigVal(fs::path(arg)); | return AbsPathForConfigVal(fs::path(arg)); | ||||
} | } | ||||
bool GenerateAuthCookie(std::string *cookie_out) { | bool GenerateAuthCookie(std::string *cookie_out) { | ||||
const size_t COOKIE_SIZE = 32; | const size_t COOKIE_SIZE = 32; | ||||
uint8_t rand_pwd[COOKIE_SIZE]; | uint8_t rand_pwd[COOKIE_SIZE]; | ||||
GetRandBytes(rand_pwd, COOKIE_SIZE); | GetRandBytes(rand_pwd, COOKIE_SIZE); | ||||
std::string cookie = | std::string cookie = COOKIEAUTH_USER + ":" + HexStr(rand_pwd); | ||||
COOKIEAUTH_USER + ":" + HexStr(rand_pwd, rand_pwd + COOKIE_SIZE); | |||||
/** | /** | ||||
* the umask determines what permissions are used to create this file - | * the umask determines what permissions are used to create this file - | ||||
* these are set to 077 in init.cpp unless overridden with -sysperms. | * these are set to 077 in init.cpp unless overridden with -sysperms. | ||||
*/ | */ | ||||
fsbridge::ofstream file; | fsbridge::ofstream file; | ||||
fs::path filepath_tmp = GetAuthCookieFile(true); | fs::path filepath_tmp = GetAuthCookieFile(true); | ||||
file.open(filepath_tmp); | file.open(filepath_tmp); | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |