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

test

parent 4c264ca0
Loading
Loading
Loading
Loading
Loading
+16 −2
Changes for src/session.cpp: 16 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ const authdb::SessionData *authdb::Session::addSession(AuthBackend &backend,uuid
        }
    }

    // Populate default GPOs that are missing from the backend
    // Populate default GPOs that are missing from the backend and create them
    for(size_t i=0; gpo_default[i][0]!=nullptr; ++i){
        uuid::uuid defid(gpo_default[i][0]);
        bool found=false;
@@ -371,12 +371,26 @@ const authdb::SessionData *authdb::Session::addSession(AuthBackend &backend,uuid
            }
        }
        if(!found){
            bool defval=(strcmp(gpo_default[i][3],"true")==0);

            // Add to session result
            if(!gpores->GPOId.empty()){
                gpores->next=new SessionData::GPOResult();
                gpores=gpores->next;
            }
            gpores->GPOId=defid;
            gpores->GPORes=(strcmp(gpo_default[i][3],"true")==0);
            gpores->GPORes=defval;

            // Create the missing GPO record in the backend
            try {
                GpoData gdat(defid);
                gdat.setName(gpo_default[i][1]);
                gdat.setDesc(gpo_default[i][2]);
                gdat.setGpoValue(defval);
                gpo.create(backend, &gdat);
            } catch (...) {
                // GPO may already exist from concurrent creation
            }
        }
    }