Loading src/admin.cpp +18 −36 Changes for src/admin.cpp: 18 added lines, 36 removed lines. Original line number Diff line number Diff line Loading @@ -1701,23 +1701,27 @@ namespace authdb { throw AuthBackendError("creategpo: could not parse uuid!"); } Gpo gpo; int ret; if(!gpo.exits(*backend,&gpid,nullptr,ret)) throw AuthBackendError("GPO doesn't extsts cannot edit !"); libhttppp::HttpForm GPOForm; GPOForm.parse(curreq); Gpo gpo; class GpoData gpodat(gpid); size_t gppos=sizeof(authdb::AuthHeader); gpo.info(*backend,gpodat,gppos); GpoData::Allow allow; gpodat.getAlowed(&allow); if(GPOForm.getBoundary()){ gpo.remove(*backend,gpid); GpoData::Allow allow; allow.count=0; Loading @@ -1732,13 +1736,6 @@ namespace authdb { } } int ret; if(!gpo.exits(*backend,&gpid,nullptr,ret)) throw AuthBackendError("GPO doesn't extsts cannot edit !"); allow.uid = new uuid_t[allow.count]; size_t i = 0; Loading @@ -1759,8 +1756,9 @@ namespace authdb { else gpodat.setGpoValue(true); }else if(strcmp(curdispo->getValue(),"gpoingroup")==0 ){ curformdat->Value.push_back('\0'); if(uuid_parse(curformdat->Value.data(),allow.uid[i++])!=0) if(uuid_parse_range(curformdat->Value.data(), curformdat->Value.data()+curformdat->Value.size(), allow.uid[i++])!=0) throw AuthBackendError("wrong uid in gpolist!"); } } Loading @@ -1768,7 +1766,7 @@ namespace authdb { } gpodat.setAllowed(&allow); gpo.remove(*backend,gpid); gpo.create(*backend,&gpodat); delete[] allow.uid; Loading Loading @@ -1822,27 +1820,15 @@ namespace authdb { ngroupel=formel->getElementbyID("notingroup"); groupel=formel->getElementbyID("gpoingroup"); gpodat.getAlowed(&allow); size_t rd=sizeof(AuthHeader),end=backend->end(); try{ while(rd<end){ authdb::AuthData::Record cur; cur.type=EmptyData; AuthData::Record cur; backend->setPos(rd); backend->read((unsigned char*)&cur,sizeof(AuthData::Record)); rd=backend->getPos()+cur.datasize; if( uuid_compare(cur.uuid ,gpid)==0 && cur.type == PolicyData && strcmp(cur.fieldname,"gponame")==0){ try { size_t urd=sizeof(AuthHeader),uend=backend->end(); while(urd<uend){ AuthData::Record cur; backend->setPos(urd); backend->read((unsigned char*)&cur,sizeof(AuthData::Record)); urd=backend->getPos()+cur.datasize; if(cur.type == GroupData && strcmp(cur.fieldname,"groupname")==0){ cur.data = new char[cur.datasize]; backend->read((unsigned char*)cur.data,cur.datasize); Loading @@ -1860,9 +1846,6 @@ namespace authdb { bool found=false; for(size_t i = 0; i < allow.count; ++i){ char auid[255];; uuid_unparse(allow.uid[i],auid); if( uuid_compare(cur.uuid,allow.uid[i])==0 ){ found=true; groupel->appendChild(&opt); Loading @@ -1878,8 +1861,7 @@ namespace authdb { }catch(AuthBackendError &e){ std::cerr << e.what() << std::endl; } } } libhtmlpp::HtmlElement root=_IndexElement; libhtmlpp::HtmlElement *content=root.getElementbyID("content"); Loading src/domain.cpp +3 −1 Changes for src/domain.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -286,7 +286,9 @@ void authdb::Domain::info(AuthBackend& backend, class DomainData& dat, size_t& p backend.setPos(pos); backend.read((unsigned char*)cur,sizeof(AuthData::Record)); pos=backend.getPos()+cur->datasize; if(cur->type == DataType::DomainData && uuid_compare(dat.did,cur->uuid) == 0){ if(cur->type == DataType::DomainData && uuid_compare(dat.did,cur->uuid) == 0 && strcmp(cur->fieldname,"domainname")==0 ){ if(!getRecord(backend,dat,DataType::DomainData)) continue; Loading src/gpo.cpp +11 −5 Changes for src/gpo.cpp: 11 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ namespace authdb { if(!target){ while(curec){ if(curec->Data->type == authdb::PolicyData && uuid_compare(curec->Data->uuid,dat->Data->uuid)==0 && uuid_compare(curec->Data->uuid,fuuid)==0 && strcmp(curec->Data->fieldname,varname)==0 ){ Loading @@ -63,6 +63,8 @@ namespace authdb { target=*varclass; } memset(target,0,sizeof(AuthData::Record)); target->start=0xFE; uuid_copy(target->uuid,fuuid); target->type=DataType::PolicyData; Loading Loading @@ -107,7 +109,7 @@ namespace authdb { if(!target){ while(curec){ if(curec->Data->type == authdb::PolicyData && uuid_compare(curec->Data->uuid,dat->Data->uuid)==0 && uuid_compare(curec->Data->uuid,fuuid)==0 && strcmp(curec->Data->fieldname,varname)==0 ){ Loading @@ -127,6 +129,8 @@ namespace authdb { target=*varclass; } memset(target,0,sizeof(AuthData::Record)); target->start=0xFE; uuid_copy(target->uuid,fuuid); target->type=DataType::PolicyData; Loading Loading @@ -224,7 +228,7 @@ void authdb::GpoData::setAllowed(Allow *allowed){ _Allowed->datasize = sizeof(GpoData::Allow)+(sizeof(uuid_t)*allowed->count); _Allowed->data=new char [_Allowed->datasize]; memset(_Allowed->data,0,_Allowed->datasize); memcpy(_Allowed->data,allowed,sizeof(*allowed)); memcpy(_Allowed->data,allowed,sizeof(GpoData::Allow)); char *start =_Allowed->data+sizeof(GpoData::Allow); for(int i=0; i< allowed->count; ++i){ memcpy(start+(i*sizeof(uuid_t)),&allowed->uid[i],sizeof(uuid_t)); Loading Loading @@ -340,14 +344,16 @@ void authdb::Gpo::info(AuthBackend &backend, class GpoData& dat, size_t &pos){ backend.setPos(pos); backend.read((unsigned char*)cur,sizeof(AuthData::Record)); pos=backend.getPos()+cur->datasize; if(cur->type == PolicyData && uuid_compare(dat.Data->uuid,cur->uuid) == 0){ if(cur->type == PolicyData && uuid_compare(dat.Data->uuid,cur->uuid)==0 && strcmp(cur->fieldname,"gponame")==0 ){ if(!getRecord(backend,dat,DataType::PolicyData)) continue; if(strcmp(dat.Data->fieldname,"gponame")==0){ dat._Name=dat.Data; }else if(strcmp(dat.Data->fieldname,"desc")==0){ }else if(strcmp(dat.Data->fieldname,"gpodesc")==0){ dat._Desc=dat.Data; }else if(strcmp(dat.Data->fieldname,"gpoallowed")==0){ dat._Allowed=dat.Data; Loading src/group.cpp +2 −1 Changes for src/group.cpp: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -245,7 +245,8 @@ void authdb::Group::info(AuthBackend &backend, class GroupData& dat, size_t &pos backend.setPos(pos); backend.read((unsigned char*)cur,sizeof(AuthData::Record)); pos=backend.getPos()+cur->datasize; if(cur->type == GroupData && uuid_compare(dat.Data->uuid,cur->uuid) == 0 if(cur->type == GroupData && uuid_compare(dat.Data->uuid,cur->uuid) == 0 && strcmp(cur->fieldname,"groupname") == 0 ){ if(!getRecord(backend,dat,DataType::GroupData)) Loading src/user.cpp +3 −1 Changes for src/user.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -274,7 +274,9 @@ void authdb::User::info(AuthBackend &backend, class UserData& dat, size_t &pos){ backend.setPos(pos); backend.read((unsigned char*)cur,sizeof(AuthData::Record)); pos=backend.getPos()+cur->datasize; if(cur->type == UserData && uuid_compare(dat.uid,cur->uuid) == 0){ if(cur->type == UserData && uuid_compare(dat.uid,cur->uuid) == 0 && strcmp(cur->fieldname,"username")==0 ){ if(!getRecord(backend,dat,DataType::UserData)) continue; Loading Loading
src/admin.cpp +18 −36 Changes for src/admin.cpp: 18 added lines, 36 removed lines. Original line number Diff line number Diff line Loading @@ -1701,23 +1701,27 @@ namespace authdb { throw AuthBackendError("creategpo: could not parse uuid!"); } Gpo gpo; int ret; if(!gpo.exits(*backend,&gpid,nullptr,ret)) throw AuthBackendError("GPO doesn't extsts cannot edit !"); libhttppp::HttpForm GPOForm; GPOForm.parse(curreq); Gpo gpo; class GpoData gpodat(gpid); size_t gppos=sizeof(authdb::AuthHeader); gpo.info(*backend,gpodat,gppos); GpoData::Allow allow; gpodat.getAlowed(&allow); if(GPOForm.getBoundary()){ gpo.remove(*backend,gpid); GpoData::Allow allow; allow.count=0; Loading @@ -1732,13 +1736,6 @@ namespace authdb { } } int ret; if(!gpo.exits(*backend,&gpid,nullptr,ret)) throw AuthBackendError("GPO doesn't extsts cannot edit !"); allow.uid = new uuid_t[allow.count]; size_t i = 0; Loading @@ -1759,8 +1756,9 @@ namespace authdb { else gpodat.setGpoValue(true); }else if(strcmp(curdispo->getValue(),"gpoingroup")==0 ){ curformdat->Value.push_back('\0'); if(uuid_parse(curformdat->Value.data(),allow.uid[i++])!=0) if(uuid_parse_range(curformdat->Value.data(), curformdat->Value.data()+curformdat->Value.size(), allow.uid[i++])!=0) throw AuthBackendError("wrong uid in gpolist!"); } } Loading @@ -1768,7 +1766,7 @@ namespace authdb { } gpodat.setAllowed(&allow); gpo.remove(*backend,gpid); gpo.create(*backend,&gpodat); delete[] allow.uid; Loading Loading @@ -1822,27 +1820,15 @@ namespace authdb { ngroupel=formel->getElementbyID("notingroup"); groupel=formel->getElementbyID("gpoingroup"); gpodat.getAlowed(&allow); size_t rd=sizeof(AuthHeader),end=backend->end(); try{ while(rd<end){ authdb::AuthData::Record cur; cur.type=EmptyData; AuthData::Record cur; backend->setPos(rd); backend->read((unsigned char*)&cur,sizeof(AuthData::Record)); rd=backend->getPos()+cur.datasize; if( uuid_compare(cur.uuid ,gpid)==0 && cur.type == PolicyData && strcmp(cur.fieldname,"gponame")==0){ try { size_t urd=sizeof(AuthHeader),uend=backend->end(); while(urd<uend){ AuthData::Record cur; backend->setPos(urd); backend->read((unsigned char*)&cur,sizeof(AuthData::Record)); urd=backend->getPos()+cur.datasize; if(cur.type == GroupData && strcmp(cur.fieldname,"groupname")==0){ cur.data = new char[cur.datasize]; backend->read((unsigned char*)cur.data,cur.datasize); Loading @@ -1860,9 +1846,6 @@ namespace authdb { bool found=false; for(size_t i = 0; i < allow.count; ++i){ char auid[255];; uuid_unparse(allow.uid[i],auid); if( uuid_compare(cur.uuid,allow.uid[i])==0 ){ found=true; groupel->appendChild(&opt); Loading @@ -1878,8 +1861,7 @@ namespace authdb { }catch(AuthBackendError &e){ std::cerr << e.what() << std::endl; } } } libhtmlpp::HtmlElement root=_IndexElement; libhtmlpp::HtmlElement *content=root.getElementbyID("content"); Loading
src/domain.cpp +3 −1 Changes for src/domain.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -286,7 +286,9 @@ void authdb::Domain::info(AuthBackend& backend, class DomainData& dat, size_t& p backend.setPos(pos); backend.read((unsigned char*)cur,sizeof(AuthData::Record)); pos=backend.getPos()+cur->datasize; if(cur->type == DataType::DomainData && uuid_compare(dat.did,cur->uuid) == 0){ if(cur->type == DataType::DomainData && uuid_compare(dat.did,cur->uuid) == 0 && strcmp(cur->fieldname,"domainname")==0 ){ if(!getRecord(backend,dat,DataType::DomainData)) continue; Loading
src/gpo.cpp +11 −5 Changes for src/gpo.cpp: 11 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ namespace authdb { if(!target){ while(curec){ if(curec->Data->type == authdb::PolicyData && uuid_compare(curec->Data->uuid,dat->Data->uuid)==0 && uuid_compare(curec->Data->uuid,fuuid)==0 && strcmp(curec->Data->fieldname,varname)==0 ){ Loading @@ -63,6 +63,8 @@ namespace authdb { target=*varclass; } memset(target,0,sizeof(AuthData::Record)); target->start=0xFE; uuid_copy(target->uuid,fuuid); target->type=DataType::PolicyData; Loading Loading @@ -107,7 +109,7 @@ namespace authdb { if(!target){ while(curec){ if(curec->Data->type == authdb::PolicyData && uuid_compare(curec->Data->uuid,dat->Data->uuid)==0 && uuid_compare(curec->Data->uuid,fuuid)==0 && strcmp(curec->Data->fieldname,varname)==0 ){ Loading @@ -127,6 +129,8 @@ namespace authdb { target=*varclass; } memset(target,0,sizeof(AuthData::Record)); target->start=0xFE; uuid_copy(target->uuid,fuuid); target->type=DataType::PolicyData; Loading Loading @@ -224,7 +228,7 @@ void authdb::GpoData::setAllowed(Allow *allowed){ _Allowed->datasize = sizeof(GpoData::Allow)+(sizeof(uuid_t)*allowed->count); _Allowed->data=new char [_Allowed->datasize]; memset(_Allowed->data,0,_Allowed->datasize); memcpy(_Allowed->data,allowed,sizeof(*allowed)); memcpy(_Allowed->data,allowed,sizeof(GpoData::Allow)); char *start =_Allowed->data+sizeof(GpoData::Allow); for(int i=0; i< allowed->count; ++i){ memcpy(start+(i*sizeof(uuid_t)),&allowed->uid[i],sizeof(uuid_t)); Loading Loading @@ -340,14 +344,16 @@ void authdb::Gpo::info(AuthBackend &backend, class GpoData& dat, size_t &pos){ backend.setPos(pos); backend.read((unsigned char*)cur,sizeof(AuthData::Record)); pos=backend.getPos()+cur->datasize; if(cur->type == PolicyData && uuid_compare(dat.Data->uuid,cur->uuid) == 0){ if(cur->type == PolicyData && uuid_compare(dat.Data->uuid,cur->uuid)==0 && strcmp(cur->fieldname,"gponame")==0 ){ if(!getRecord(backend,dat,DataType::PolicyData)) continue; if(strcmp(dat.Data->fieldname,"gponame")==0){ dat._Name=dat.Data; }else if(strcmp(dat.Data->fieldname,"desc")==0){ }else if(strcmp(dat.Data->fieldname,"gpodesc")==0){ dat._Desc=dat.Data; }else if(strcmp(dat.Data->fieldname,"gpoallowed")==0){ dat._Allowed=dat.Data; Loading
src/group.cpp +2 −1 Changes for src/group.cpp: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -245,7 +245,8 @@ void authdb::Group::info(AuthBackend &backend, class GroupData& dat, size_t &pos backend.setPos(pos); backend.read((unsigned char*)cur,sizeof(AuthData::Record)); pos=backend.getPos()+cur->datasize; if(cur->type == GroupData && uuid_compare(dat.Data->uuid,cur->uuid) == 0 if(cur->type == GroupData && uuid_compare(dat.Data->uuid,cur->uuid) == 0 && strcmp(cur->fieldname,"groupname") == 0 ){ if(!getRecord(backend,dat,DataType::GroupData)) Loading
src/user.cpp +3 −1 Changes for src/user.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -274,7 +274,9 @@ void authdb::User::info(AuthBackend &backend, class UserData& dat, size_t &pos){ backend.setPos(pos); backend.read((unsigned char*)cur,sizeof(AuthData::Record)); pos=backend.getPos()+cur->datasize; if(cur->type == UserData && uuid_compare(dat.uid,cur->uuid) == 0){ if(cur->type == UserData && uuid_compare(dat.uid,cur->uuid) == 0 && strcmp(cur->fieldname,"username")==0 ){ if(!getRecord(backend,dat,DataType::UserData)) continue; Loading