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

test

parent 4d36189d
Loading
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -97,7 +97,6 @@ namespace {
class Api {
public:
    void checkGPO(json_object *request, json_object *response) {
        AuthBackend::Guard guard(_Backend, AuthBackend::Shared);
        json_object* cmd = get_commands_array_or_throw(request);

        int fcount = json_object_array_length(cmd);
@@ -120,7 +119,6 @@ public:
    }

    void existsGPO(json_object *request, json_object *response) {
        AuthBackend::Guard guard(_Backend, AuthBackend::Shared);
        json_object* cmd = get_commands_array_or_throw(request);

        int fcount = json_object_array_length(cmd);
@@ -150,7 +148,6 @@ public:
    }

    void addGPO(json_object *request, json_object *response) {
        AuthBackend::Guard guard(_Backend, AuthBackend::Exclusive);
        json_object* cmd = get_commands_array_or_throw(request);

        int fcount = json_object_array_length(cmd);
@@ -252,7 +249,6 @@ public:
    }

    const SessionData* userLogin(json_object *request, json_object *response) {
        AuthBackend::Guard guard(_Backend, AuthBackend::Shared);
        json_object* cmd = get_commands_array_or_throw(request);

        int fcount = json_object_array_length(cmd);
@@ -322,7 +318,6 @@ public:
    }

    const ClientConnections* ClientLogin(json_object *request, json_object *response) {
        AuthBackend::Guard guard(_Backend, AuthBackend::Shared);
        json_object* cmd = get_commands_array_or_throw(request);

        int fcount = json_object_array_length(cmd);
@@ -383,7 +378,6 @@ public:
    }

    void Connection(json_object *request, json_object *response) {
        AuthBackend::Guard guard(_Backend, AuthBackend::Exclusive);
        json_object* cmd = get_commands_array_or_throw(request);

        int fcount = json_object_array_length(cmd);
@@ -573,7 +567,6 @@ public:
    }

    void changeUserPw(json_object *request, json_object *response) {
        AuthBackend::Guard guard(_Backend, AuthBackend::Exclusive);
        json_object* cmd = get_commands_array_or_throw(request);

        int fcount = json_object_array_length(cmd);
@@ -650,7 +643,6 @@ public:
    }

    void UserInfo(json_object *request, json_object *response) {
        AuthBackend::Guard guard(_Backend, AuthBackend::Shared);
        json_object* cmd = get_commands_array_or_throw(request);

        int fcount = json_object_array_length(cmd);
@@ -690,7 +682,6 @@ public:
    }

    void listGroups(json_object *request, json_object *response) {
        AuthBackend::Guard guard(_Backend, AuthBackend::Shared);
        json_object* cmd = get_commands_array_or_throw(request);

        int fcount = json_object_array_length(cmd);
+1 −0
Original line number Diff line number Diff line
@@ -342,6 +342,7 @@ namespace authdb {
                    }

                    if(apidb){
                        AuthBackend::Guard guard(*apidb);
                        try{
                            ApiController(*apidb,did,curreq,tid,args);
                            g_Log.access(clientAddr,method,curreq.getRequestURL(),200);
+0 −9
Original line number Diff line number Diff line
@@ -85,15 +85,6 @@ void authdb::AuthBackend::unlock(){
}

void authdb::AuthBackend::lock_shared(){
    // Briefly upgrade to exclusive to allow fetchFromCluster, then downgrade.
    // This is safe because _Lock serializes access and the fetch is cached (30 s).
    if (_Lock.try_lock_for(std::chrono::seconds(2))) {
        try {
            _Api->lock();
            _Api->unlock();
        } catch (...) {}
        _Lock.unlock();
    }
    if (!_Lock.try_lock_shared_for(std::chrono::seconds(5)))
        throw AuthBackendError("backend shared lock timeout");
}