Commit 7f6afeb2 authored by jan.koester's avatar jan.koester
Browse files

optimized

parent c6282f5f
Loading
Loading
Loading
Loading
+3 −3
Changes for src/admin.cpp: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -1595,7 +1595,7 @@ namespace authdb {
                        }
                    }

                    gpodat->setAllowed(&allow);
                    gpodat->setAllowed(allow);

                    Gpo gpo;
                    gpo.create(*backend,gpodat);
@@ -1767,7 +1767,7 @@ namespace authdb {
                    }
                }

                gpodat.setAllowed(&allow);
                gpodat.setAllowed(allow);

                gpo.create(*backend,&gpodat);
                delete[] allow.uid;
@@ -1822,7 +1822,7 @@ namespace authdb {
            ngroupel=formel->getElementbyID("notingroup");
            groupel=formel->getElementbyID("gpoingroup");

            gpodat.getAlowed(&allow);
            gpodat.getAlowed(allow);

            size_t rd=sizeof(AuthHeader),end=backend->end();
            try{
+8 −21
Changes for src/gpo.cpp: 8 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -60,34 +60,21 @@ bool authdb::GpoData::getGpoValue(){
                              this,&_GpoDefault,"gpodefault");
}

void authdb::GpoData::setAllowed(Allow *allowed){
void authdb::GpoData::setAllowed(Allow &allowed){
    setAuthData<Allow,uuid_t>(DataType::PolicyData,StorageType::BinaryStorage,
                           this,&_Allowed,"groupmembers",allowed->uid,allowed->count);
                           this,&_Allowed,"groupmembers",allowed.uid,allowed.count);

}

void authdb::GpoData::getAlowed(Allow *allowed){
void authdb::GpoData::getAlowed(Allow &allowed){
    if(!_Allowed){
        for(AuthData *curdat=this; curdat; curdat=curdat->next()){
            if(
                curdat->Data.storage==StorageType::BinaryStorage &&
                curdat->Data.type==DataType::PolicyData &&
                strcmp(curdat->Data.fieldname,"gpoallowed") ==0
            ){
                _Allowed=&curdat->Data;
                allowed->count =((Allow*)_Allowed->data)->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));
                }
                return;
            }
        }
        throw(authdb::AuthBackendError("gpoallowed data not found"));
    }
       const  Allow *buf=getAuthData<Allow>(DataType::PolicyData,StorageType::BinaryStorage,
                                                                        this,&_Allowed,"groupmembers");

       memcpy(&allowed,buf,sizeof(*buf));

    }
}


authdb::GpoData::GpoData(uuid gpid) : AuthData(gpid.value){
+2 −2
Changes for src/gpo.h: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -54,8 +54,8 @@ namespace authdb {
            uuid_t *uid;
        };
    public:
        void setAllowed(Allow *allowed);
        void getAlowed(Allow *allowed);
        void setAllowed(Allow &allowed);
        void getAlowed(Allow &allowed);
    private:
        AuthData::Record* _Name;
        AuthData::Record* _Desc;
+1 −1
Changes for src/group.cpp: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ bool authdb::GroupData::isMember(const uuid_t uid){

    MemberUids *mem=(MemberUids*)_Members->data;

    char *start=_Members->data+sizeof(MemberUids);
    char *start=_Members->data+(sizeof(MemberUids)-sizeof(uuid_t));

    for(size_t i=0; i<mem->count; ++i){
        uuid_t *ucmp =(uuid_t*)start+i;