mirror of https://github.com/vitalif/grive2
set the mode of .grive to 0600 for security.
Thanks Huin for the reminder.pull/40/head
parent
a0570d507c
commit
50f1d813e2
|
@ -19,7 +19,8 @@
|
|||
|
||||
#include "Config.hh"
|
||||
|
||||
#include <fstream>
|
||||
#include "util/StdioFile.hh"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace gr {
|
||||
|
@ -39,8 +40,9 @@ Config::Config() :
|
|||
|
||||
void Config::Save( )
|
||||
{
|
||||
std::ofstream ofile( Filename().c_str() ) ;
|
||||
ofile << m_cfg ;
|
||||
StdioFile file( Filename(), "w" ) ;
|
||||
file.Chmod( 0600 ) ;
|
||||
m_cfg.Write( file ) ;
|
||||
}
|
||||
|
||||
Json& Config::Get()
|
||||
|
|
|
@ -117,7 +117,6 @@ Drive::Drive( OAuth2& auth ) :
|
|||
|
||||
if ( has_next )
|
||||
{
|
||||
// http::ResponseLog log2( "second-", ".xml", &xrsp ) ;
|
||||
http.Get( nss["@href"], &xrsp, m_http_hdr ) ;
|
||||
resp = xrsp.Response() ;
|
||||
}
|
||||
|
@ -132,8 +131,6 @@ void Drive::SaveState()
|
|||
void Drive::ConstructDirTree( http::Agent *http )
|
||||
{
|
||||
http::XmlResponse xml ;
|
||||
// http::ResponseLog log( "dir-", ".xml", &xml ) ;
|
||||
|
||||
http->Get( feed_base + "/-/folder?max-results=10&showroot=true", &xml, m_http_hdr ) ;
|
||||
|
||||
xml::Node resp = xml.Response() ;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <json/linkhash.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
|
@ -256,6 +257,12 @@ std::ostream& operator<<( std::ostream& os, const Json& json )
|
|||
return os << ::json_object_to_json_string( json.m_json ) ;
|
||||
}
|
||||
|
||||
void Json::Write( StdioFile& file ) const
|
||||
{
|
||||
const char *str = ::json_object_to_json_string( m_json ) ;
|
||||
file.Write( str, std::strlen(str) ) ;
|
||||
}
|
||||
|
||||
Json::Type Json::DataType() const
|
||||
{
|
||||
assert( m_json != 0 ) ;
|
||||
|
|
|
@ -29,6 +29,8 @@ struct json_object ;
|
|||
|
||||
namespace gr {
|
||||
|
||||
class StdioFile ;
|
||||
|
||||
class Json
|
||||
{
|
||||
public :
|
||||
|
@ -72,6 +74,7 @@ public :
|
|||
bool FindInArray( const std::string& key, const std::string& value, Json& result ) const ;
|
||||
|
||||
friend std::ostream& operator<<( std::ostream& os, const Json& json ) ;
|
||||
void Write( StdioFile& file ) const ;
|
||||
|
||||
enum Type { null_type, bool_type, double_type, int_type, object_type, array_type, string_type } ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue