Loading src/data.cpp +6 −8 Changes for src/data.cpp: 6 added lines, 8 removed lines. Original line number Diff line number Diff line #include <vector> #include <memory> #include <iostream> #include "authdb.h" Loading Loading @@ -205,25 +206,22 @@ namespace authdb { throw AuthBackendError("user info uid required!"); while(rd<end){ std::shared_ptr<authdb::AuthData::Record> cur(new AuthData::Record); std::shared_ptr<authdb::AuthData::Record> cur=std::make_shared<authdb::AuthData::Record>(); backend.setPos(rd); size_t wr=backend.getPos(); backend.read(reinterpret_cast<unsigned char*>(cur.get()),sizeof(AuthData::Record)); rd=backend.getPos()+cur->datasize; if(uid==cur->ruid && type == cur->type){ size_t dsize=cur->datasize; cur->start = 0xFE; cur->data=new char[dsize]; memset(cur->data,0,dsize); memset(&cur->fieldname,0,255); std::cout << cur->datasize << std::endl; memset(cur->ruid,0,sizeof(uuid_t)); cur->start = 0xFE; cur->storage=StorageType::EmptyStorage; cur->type=DataType::EmptyData; cur->datasize=dsize; memset(cur->fieldname,0,255); backend.setPos(wr); backend.write(reinterpret_cast<unsigned char*>(cur.get()),sizeof(AuthData::Record)); const unsigned char zero=0; for(size_t i=0; i<dsize; ++i){ for(size_t i=0; i<cur->datasize; ++i){ backend.write(&zero,1); } } Loading src/gpo.cpp +2 −1 Changes for src/gpo.cpp: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include "types.h" #include "gpo.h" #include <assert.h> void authdb::GpoData::setName(const char* src){ setAuthData<char>(DataType::PolicyData,StorageType::TextStorage, this,&_Name,"gponame",src,strlen(src)+1); Loading @@ -50,7 +51,7 @@ const char * authdb::GpoData::getDesc(){ } void authdb::GpoData::setGpoValue(const bool dest){ setAuthData<bool>(DataType::PolicyData,StorageType::BoolStorage,this,&_GpoDefault,"gpodefault",&dest,sizeof(dest)); setAuthData<bool>(DataType::PolicyData,StorageType::BoolStorage,this,&_GpoDefault,"gpodefault",&dest,sizeof(bool)); } bool authdb::GpoData::getGpoValue(){ Loading src/session.cpp +2 −2 Changes for src/session.cpp: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -240,7 +240,6 @@ const authdb::SessionData *authdb::Session::addSession(AuthBackend &backend,uuid SessionData::GPOResult *gpores=&_lastData->_GPOResult; Gpo gpo; std::shared_ptr<class GpoData> gpodat=std::make_shared<class GpoData>(cur->ruid); std::vector<uuid> allow; rd=sizeof(authdb::AuthHeader); Loading @@ -253,7 +252,8 @@ const authdb::SessionData *authdb::Session::addSession(AuthBackend &backend,uuid rd=backend.getPos()+cur->datasize; if(!uuid(cur->ruid).empty() && cur->type == PolicyData && strcmp(cur->fieldname,"gponame")==0){ if(cur->type == PolicyData && strcmp(cur->fieldname,"gponame")==0){ std::shared_ptr<class GpoData> gpodat=std::make_shared<class GpoData>(cur->ruid); size_t upos=sizeof(authdb::AuthHeader); gpo.info(backend,*gpodat,upos); if(!gpores->GPOId.empty()){ Loading Loading
src/data.cpp +6 −8 Changes for src/data.cpp: 6 added lines, 8 removed lines. Original line number Diff line number Diff line #include <vector> #include <memory> #include <iostream> #include "authdb.h" Loading Loading @@ -205,25 +206,22 @@ namespace authdb { throw AuthBackendError("user info uid required!"); while(rd<end){ std::shared_ptr<authdb::AuthData::Record> cur(new AuthData::Record); std::shared_ptr<authdb::AuthData::Record> cur=std::make_shared<authdb::AuthData::Record>(); backend.setPos(rd); size_t wr=backend.getPos(); backend.read(reinterpret_cast<unsigned char*>(cur.get()),sizeof(AuthData::Record)); rd=backend.getPos()+cur->datasize; if(uid==cur->ruid && type == cur->type){ size_t dsize=cur->datasize; cur->start = 0xFE; cur->data=new char[dsize]; memset(cur->data,0,dsize); memset(&cur->fieldname,0,255); std::cout << cur->datasize << std::endl; memset(cur->ruid,0,sizeof(uuid_t)); cur->start = 0xFE; cur->storage=StorageType::EmptyStorage; cur->type=DataType::EmptyData; cur->datasize=dsize; memset(cur->fieldname,0,255); backend.setPos(wr); backend.write(reinterpret_cast<unsigned char*>(cur.get()),sizeof(AuthData::Record)); const unsigned char zero=0; for(size_t i=0; i<dsize; ++i){ for(size_t i=0; i<cur->datasize; ++i){ backend.write(&zero,1); } } Loading
src/gpo.cpp +2 −1 Changes for src/gpo.cpp: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include "types.h" #include "gpo.h" #include <assert.h> void authdb::GpoData::setName(const char* src){ setAuthData<char>(DataType::PolicyData,StorageType::TextStorage, this,&_Name,"gponame",src,strlen(src)+1); Loading @@ -50,7 +51,7 @@ const char * authdb::GpoData::getDesc(){ } void authdb::GpoData::setGpoValue(const bool dest){ setAuthData<bool>(DataType::PolicyData,StorageType::BoolStorage,this,&_GpoDefault,"gpodefault",&dest,sizeof(dest)); setAuthData<bool>(DataType::PolicyData,StorageType::BoolStorage,this,&_GpoDefault,"gpodefault",&dest,sizeof(bool)); } bool authdb::GpoData::getGpoValue(){ Loading
src/session.cpp +2 −2 Changes for src/session.cpp: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -240,7 +240,6 @@ const authdb::SessionData *authdb::Session::addSession(AuthBackend &backend,uuid SessionData::GPOResult *gpores=&_lastData->_GPOResult; Gpo gpo; std::shared_ptr<class GpoData> gpodat=std::make_shared<class GpoData>(cur->ruid); std::vector<uuid> allow; rd=sizeof(authdb::AuthHeader); Loading @@ -253,7 +252,8 @@ const authdb::SessionData *authdb::Session::addSession(AuthBackend &backend,uuid rd=backend.getPos()+cur->datasize; if(!uuid(cur->ruid).empty() && cur->type == PolicyData && strcmp(cur->fieldname,"gponame")==0){ if(cur->type == PolicyData && strcmp(cur->fieldname,"gponame")==0){ std::shared_ptr<class GpoData> gpodat=std::make_shared<class GpoData>(cur->ruid); size_t upos=sizeof(authdb::AuthHeader); gpo.info(backend,*gpodat,upos); if(!gpores->GPOId.empty()){ Loading