From 427054c3d50198dff65b5e003165b1f564ebd26f Mon Sep 17 00:00:00 2001 From: Lee Clagett Date: Fri, 16 Dec 2016 18:08:24 -0500 Subject: Enabled HTTP auth support for monero-wallet-rpc --- src/common/util.h | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/common/util.h') diff --git a/src/common/util.h b/src/common/util.h index 4fcf66b8f..3bb9a053e 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -30,13 +30,15 @@ #pragma once -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include -#include "crypto/crypto.h" #include "crypto/hash.h" -#include "misc_language.h" #include "p2p/p2p_protocol_defs.h" /*! \brief Various Tools @@ -46,6 +48,21 @@ */ namespace tools { + //! Functional class for closing C file handles. + struct close_file + { + void operator()(std::FILE* handle) const noexcept + { + if (handle) + { + std::fclose(handle); + } + } + }; + + //! \return File only readable by owner. nullptr if `filename` exists. + std::unique_ptr create_private_file(const std::string& filename); + /*! \brief Returns the default data directory. * * \details Windows < Vista: C:\\Documents and Settings\\Username\\Application Data\\CRYPTONOTE_NAME -- cgit v1.2.3