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

some fixes

parent 28ab9644
Loading
Loading
Loading
Loading
Loading
+17 −12
Changes for src/admin.cpp: 17 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -1498,16 +1498,15 @@ namespace authdb {
        }

        void createGpo(libhttppp::HttpRequest *curreq, const int tid, ULONG_PTR args){
            char cgpid[255],cdid[255];
            uuid_t gpid,did;
            char cdid[255];
            uuid_t did;

            uuid_clear(gpid);
            uuid_clear(did);

            if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/creategpo/%s",cdid,cgpid)<0){
                throw AuthBackendError("removeSession: wrong url!");
            if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/creategpo",cdid)<0){
                throw AuthBackendError("creatGPO: wrong url!");
            }

            uuid_parse(cgpid,gpid);
            uuid_parse(cdid,did);

            DomainBackend dbackend(_AdminBackend);
@@ -1536,12 +1535,14 @@ namespace authdb {
                            if( strcmp(curdispo->getKey(),"name")==0 &&
                                curdispo->getValue()!=nullptr){
                                if( strcmp(curdispo->getValue(),"gpoid")==0 ){
                                    uuid_t gpoid;
                                    uuid_parse(curformdat->Value.data(),gpoid);
                                    gpodat = new GpoData(gpoid);
                                    uuid_t gpouuid;
                                    if(uuid_parse_range(curformdat->Value.data(),
                                        curformdat->Value.data()+curformdat->Value.size(),gpouuid)==0){
                                        gpodat = new GpoData(gpouuid);
                                        break;
                                    }
                                }
                            }

                        }
                };
@@ -1585,7 +1586,8 @@ namespace authdb {
                                        gpodat->setGpoValue(true);
                                }else if(strcmp(curdispo->getValue(),"gpoingroup")==0 ){
                                    curformdat->Value.push_back('\0');
                                    uuid_parse(curformdat->Value.data(),allow.uid[i++]);
                                    if(uuid_parse(curformdat->Value.data(),allow.uid[i++])!=0)
                                        throw AuthBackendError("wrong uid in gpolist!");
                                }
                            }
                        }
@@ -1596,6 +1598,7 @@ namespace authdb {
                    Gpo gpo;
                    gpo.create(*backend,gpodat);
                    delete[] allow.uid;
                    delete gpodat;
                }
            }

@@ -1603,14 +1606,16 @@ namespace authdb {

            libhtmlpp::HtmlString form,out;

            uuid_t gpid;
            uuid_generate(gpid);

            uuid_unparse(gpid,cgpid);
            char cngpid[255];
            uuid_unparse(gpid,cngpid);

            form << "<table>"
                  << "<form method=\"post\" enctype=\"multipart/form-data\">"
                  << "<tr><td><label for=\"gpoid\">Policy ID:</label></td>"
                  << "<td></td><td><input type=\"text\" name=\"gpoid\" value=\"" << cgpid << "\" class=\"gpoform\" ></td></tr>"
                  << "<td></td><td><input type=\"text\" name=\"gpoid\" value=\"" << cngpid << "\" class=\"gpoform\" ></td></tr>"
                  << "<tr><td><label for=\"gponame\">Policy Name:</label></td>"
                  << "<td></td><td><input type=\"text\" name=\"gponame\"  class=\"gpoform\" ></td></tr>"
                  << "<tr><td><label for=\"gpodesc\">Policy Description:</label></td>"
+18 −12
Changes for src/gpo.cpp: 18 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@ namespace authdb {

        AuthData *curec=dat;

        uuid_t fuuid;

        uuid_copy(fuuid,dat->Data->uuid);

        if(!target){
            while(curec){
                if(curec->Data->type == authdb::PolicyData &&
@@ -60,7 +64,7 @@ namespace authdb {
        }

        target->start=0xFE;
        uuid_copy(target->uuid,dat->Data->uuid);
        uuid_copy(target->uuid,fuuid);
        target->type=DataType::PolicyData;
        target->storage=StorageType::TextStorage;

@@ -96,6 +100,10 @@ namespace authdb {

        AuthData *curec=dat;

        uuid_t fuuid;

        uuid_copy(fuuid,dat->Data->uuid);

        if(!target){
            while(curec){
                if(curec->Data->type == authdb::PolicyData &&
@@ -120,7 +128,7 @@ namespace authdb {
        }

        target->start=0xFE;
        uuid_copy(target->uuid,dat->Data->uuid);
        uuid_copy(target->uuid,fuuid);
        target->type=DataType::PolicyData;
        target->storage=StorageType::BoolStorage;

@@ -180,9 +188,9 @@ bool authdb::GpoData::getGpoValue(){

void authdb::GpoData::setAllowed(Allow *allowed){
        AuthData *curec=this;
        uuid_t fuuid;

        uuid_t gid;
        uuid_copy(gid,Data->uuid);
        uuid_copy(fuuid,Data->uuid);

        if(!_Allowed){
            while(curec){
@@ -208,7 +216,7 @@ void authdb::GpoData::setAllowed(Allow *allowed){
        memset(_Allowed,0,sizeof(AuthData::Record));

        _Allowed->start=0xFE;
        uuid_copy(_Allowed->uuid,gid);
        uuid_copy(_Allowed->uuid,fuuid);
        _Allowed->type=DataType::PolicyData;
        _Allowed->storage=StorageType::BinaryStorage;

@@ -234,6 +242,7 @@ authdb::GpoData::GpoData(uuid_t gpid) : AuthData(gpid){
    _Desc=nullptr;
    _GpoDefault=nullptr;
    _Allowed=nullptr;
    Data->type=PolicyData;
}

authdb::GpoData::GpoData(const GpoData& src) : AuthData(src){
@@ -241,6 +250,7 @@ authdb::GpoData::GpoData(const GpoData& src) : AuthData(src){
    _Desc=nullptr;
    _GpoDefault=nullptr;
    _Allowed=nullptr;
    Data->type=PolicyData;
}

authdb::GpoData::~GpoData(){
@@ -279,14 +289,14 @@ void authdb::Gpo::create(AuthBackend& backend, class GpoData* dat){
    int exi=0;

    if(uuid_is_null(dat->Data->uuid))
        throw authdb::AuthBackendError("Create Group: GUID not set !");
        throw authdb::AuthBackendError("Create GPO: GUID not set !");

    if(exits(backend,&dat->Data->uuid,dat->getName(),exi)){
        switch(exi){
            case 1:
                throw authdb::AuthBackendError("Create Group: Groupname already Exists aborting!");
                throw authdb::AuthBackendError("Create GPO: GPOname already Exists aborting!");
            default:
                throw authdb::AuthBackendError("Create Group: GUID already Exists aborting!");
                throw authdb::AuthBackendError("Create GPO: GPIID already Exists aborting!");
        }
    }

@@ -328,10 +338,6 @@ void authdb::Gpo::info(AuthBackend &backend, class GpoData& dat, size_t &pos){
            }else if(strcmp(dat.Data->fieldname,"gpodefault")==0){
                dat._GpoDefault=dat.Data;
            }

            AuthData::Record *_Desc;
            AuthData::Record *_GpoDefault;
            AuthData::Record *_Allowed;
        }
        delete cur;
    }