Loading src/admin.cpp +1 −1 Changes for src/admin.cpp: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -1707,7 +1707,7 @@ namespace authdb { int ret; if(!gpo.exits(*backend,&gpid,nullptr,ret)) if(!gpo.exits(*backend,gpid,nullptr,ret)) throw AuthBackendError("GPO doesn't extsts cannot edit !"); libhttppp::HttpForm GPOForm; Loading src/authdb.h +8 −7 Changes for src/authdb.h: 8 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include "backend.h" #include "types.h" #include "uuid.h" #pragma once Loading Loading @@ -68,11 +69,11 @@ namespace authdb { struct Record { char start = 0xFE; uuid_t uuid; int type; int storage; int type = EmptyData; int storage = EmptyStorage; char fieldname[255]; size_t datasize = 0; char *data; char *data = nullptr; size_t count = 0; } Data; Loading Loading @@ -144,15 +145,15 @@ namespace authdb { } template<class T> inline const T *getAuthData(int type,int storage,class AuthData *dat,AuthData::Record **varclass,const char *varname){ const T *getAuthData(int type,int storage,class AuthData *dat,AuthData::Record **varclass,const char *varname){ if(*varclass !=nullptr && (*varclass)->data ){ return (T*)(*varclass)->data; return reinterpret_cast<T*>((*varclass)->data); }else{ for(AuthData *curdat=dat; curdat; curdat=curdat->next()){ if(curdat->Data.type==type && curdat->Data.storage==storage if(curdat->Data.data && curdat->Data.type==type && curdat->Data.storage==storage && strcmp(curdat->Data.fieldname,varname)==0 ){ (*varclass)=&curdat->Data; return (T*)curdat->Data.data; return reinterpret_cast<T*>((*varclass)->data); } } } Loading src/gpo.cpp +10 −6 Changes for src/gpo.cpp: 10 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -68,11 +68,15 @@ void authdb::GpoData::setAllowed(Allow &allowed){ void authdb::GpoData::getAlowed(Allow &allowed){ if(!_Allowed){ const Allow *buf=getAuthData<Allow>(DataType::PolicyData,StorageType::BinaryStorage, getAuthData<Allow>(DataType::PolicyData,StorageType::BinaryStorage, this,&_Allowed,"groupmembers"); memcpy(&allowed,buf,sizeof(*buf)); allowed.count =_Allowed->count; allowed.uid = new uuid_t[allowed.count]; char *start =_Allowed->data+sizeof(GpoData::Allow); for(size_t i=0; i<allowed.count; ++i){ memcpy(&allowed.uid[i],start+(i*sizeof(uuid_t)),sizeof(uuid_t)); } } } Loading @@ -96,7 +100,7 @@ authdb::GpoData::GpoData(const GpoData& src) : AuthData(src){ authdb::GpoData::~GpoData(){ } bool authdb::Gpo::exits(AuthBackend& backend, uuid_t* gpid, const char* name, int& ret){ bool authdb::Gpo::exits(AuthBackend& backend, uuid gpid, const char* name, int& ret){ authdb::AuthData::Record cur; size_t rd=sizeof(authdb::AuthHeader),end=backend.end(); Loading @@ -113,7 +117,7 @@ bool authdb::Gpo::exits(AuthBackend& backend, uuid_t* gpid, const char* name, in ret=1; return true; }else if(gpid && uuid_compare(cur.uuid,*gpid)==0){ }else if(gpid==cur.uuid){ delete[] cur.data; ret=2; return true; Loading @@ -131,7 +135,7 @@ void authdb::Gpo::create(AuthBackend& backend, class GpoData* dat){ if(uuid_is_null(dat->Data.uuid)) throw authdb::AuthBackendError("Create GPO: GUID not set !"); if(exits(backend,&dat->Data.uuid,dat->getName(),exi)){ if(exits(backend,dat->Data.uuid,dat->getName(),exi)){ switch(exi){ case 1: throw authdb::AuthBackendError("Create GPO: GPOname already Exists aborting!"); Loading src/gpo.h +1 −1 Changes for src/gpo.h: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ namespace authdb { class Gpo { public: bool exits(AuthBackend &backend,uuid_t *gpid,const char *name, int &ret); bool exits(AuthBackend &backend,uuid gpid,const char *name, int &ret); void create(AuthBackend& backend, class GpoData* dat); void remove(AuthBackend &backend,const uuid_t gpid); void info(AuthBackend &backend, class GpoData& dat, size_t &pos); Loading Loading
src/admin.cpp +1 −1 Changes for src/admin.cpp: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -1707,7 +1707,7 @@ namespace authdb { int ret; if(!gpo.exits(*backend,&gpid,nullptr,ret)) if(!gpo.exits(*backend,gpid,nullptr,ret)) throw AuthBackendError("GPO doesn't extsts cannot edit !"); libhttppp::HttpForm GPOForm; Loading
src/authdb.h +8 −7 Changes for src/authdb.h: 8 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include "backend.h" #include "types.h" #include "uuid.h" #pragma once Loading Loading @@ -68,11 +69,11 @@ namespace authdb { struct Record { char start = 0xFE; uuid_t uuid; int type; int storage; int type = EmptyData; int storage = EmptyStorage; char fieldname[255]; size_t datasize = 0; char *data; char *data = nullptr; size_t count = 0; } Data; Loading Loading @@ -144,15 +145,15 @@ namespace authdb { } template<class T> inline const T *getAuthData(int type,int storage,class AuthData *dat,AuthData::Record **varclass,const char *varname){ const T *getAuthData(int type,int storage,class AuthData *dat,AuthData::Record **varclass,const char *varname){ if(*varclass !=nullptr && (*varclass)->data ){ return (T*)(*varclass)->data; return reinterpret_cast<T*>((*varclass)->data); }else{ for(AuthData *curdat=dat; curdat; curdat=curdat->next()){ if(curdat->Data.type==type && curdat->Data.storage==storage if(curdat->Data.data && curdat->Data.type==type && curdat->Data.storage==storage && strcmp(curdat->Data.fieldname,varname)==0 ){ (*varclass)=&curdat->Data; return (T*)curdat->Data.data; return reinterpret_cast<T*>((*varclass)->data); } } } Loading
src/gpo.cpp +10 −6 Changes for src/gpo.cpp: 10 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -68,11 +68,15 @@ void authdb::GpoData::setAllowed(Allow &allowed){ void authdb::GpoData::getAlowed(Allow &allowed){ if(!_Allowed){ const Allow *buf=getAuthData<Allow>(DataType::PolicyData,StorageType::BinaryStorage, getAuthData<Allow>(DataType::PolicyData,StorageType::BinaryStorage, this,&_Allowed,"groupmembers"); memcpy(&allowed,buf,sizeof(*buf)); allowed.count =_Allowed->count; allowed.uid = new uuid_t[allowed.count]; char *start =_Allowed->data+sizeof(GpoData::Allow); for(size_t i=0; i<allowed.count; ++i){ memcpy(&allowed.uid[i],start+(i*sizeof(uuid_t)),sizeof(uuid_t)); } } } Loading @@ -96,7 +100,7 @@ authdb::GpoData::GpoData(const GpoData& src) : AuthData(src){ authdb::GpoData::~GpoData(){ } bool authdb::Gpo::exits(AuthBackend& backend, uuid_t* gpid, const char* name, int& ret){ bool authdb::Gpo::exits(AuthBackend& backend, uuid gpid, const char* name, int& ret){ authdb::AuthData::Record cur; size_t rd=sizeof(authdb::AuthHeader),end=backend.end(); Loading @@ -113,7 +117,7 @@ bool authdb::Gpo::exits(AuthBackend& backend, uuid_t* gpid, const char* name, in ret=1; return true; }else if(gpid && uuid_compare(cur.uuid,*gpid)==0){ }else if(gpid==cur.uuid){ delete[] cur.data; ret=2; return true; Loading @@ -131,7 +135,7 @@ void authdb::Gpo::create(AuthBackend& backend, class GpoData* dat){ if(uuid_is_null(dat->Data.uuid)) throw authdb::AuthBackendError("Create GPO: GUID not set !"); if(exits(backend,&dat->Data.uuid,dat->getName(),exi)){ if(exits(backend,dat->Data.uuid,dat->getName(),exi)){ switch(exi){ case 1: throw authdb::AuthBackendError("Create GPO: GPOname already Exists aborting!"); Loading
src/gpo.h +1 −1 Changes for src/gpo.h: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ namespace authdb { class Gpo { public: bool exits(AuthBackend &backend,uuid_t *gpid,const char *name, int &ret); bool exits(AuthBackend &backend,uuid gpid,const char *name, int &ret); void create(AuthBackend& backend, class GpoData* dat); void remove(AuthBackend &backend,const uuid_t gpid); void info(AuthBackend &backend, class GpoData& dat, size_t &pos); Loading