Commit f29f8a66 authored by jan.koester's avatar jan.koester
Browse files

fixed count in gpo

parent 8964f808
Loading
Loading
Loading
Loading
Loading
+9 −10
Changes for src/gpo.cpp: 9 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -75,20 +75,19 @@ void authdb::GpoData::setAllowed(Allow &allowed){
}

void authdb::GpoData::getAlowed(Allow &allowed){
    size_t count=0;

    try{
        getAuthData<char>(DataType::PolicyData,StorageType::BinaryStorage,
                                                                        this,&_Allowed,"gpoallowed");

    if(!_Allowed)
    }catch(...){
        return;
    }

    std::copy(_Allowed->data,_Allowed->data+sizeof(size_t),&count);
    allowed.uid=new uuid_t[count];
    char *start = _Allowed->data+sizeof(size_t);
    for(size_t i =0; i<count; ++i){
        std::copy(start,start+(sizeof(uuid_t)*i)+sizeof(uuid_t), reinterpret_cast<char*>(&allowed.uid[i])
        );
    std::copy(_Allowed->data,_Allowed->data+sizeof(size_t),&allowed.count);
    std::cout << allowed.count << std::endl;
    allowed.uid=new uuid_t[allowed.count];
    const char *start = _Allowed->data+sizeof(size_t);
    for(size_t i =0; i<allowed.count; ++i){
         std::copy(start+(sizeof(uuid_t)*i),start+(sizeof(uuid_t)*i)+sizeof(uuid_t), reinterpret_cast<char*>(&allowed.uid[i]));
    }
}