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

test

parent b46e1a5e
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -436,9 +436,19 @@ const authdb::SessionData *authdb::ClusterSession::addSession(AuthBackend &backe
        std::vector<std::pair<uuid::uuid, bool>> cluster_gpo;
        std::vector<std::pair<uuid::uuid, bool>> cluster_gpo;
        if (g_Cluster->fetchSession(userid, domainid, cluster_sid,
        if (g_Cluster->fetchSession(userid, domainid, cluster_sid,
                                     cluster_members, cluster_username, cluster_gpo)) {
                                     cluster_members, cluster_username, cluster_gpo)) {
            std::cerr << "[SESSION] addSession: found existing session sid=" << cluster_sid.c_str()
                      << " via uid+did lookup, ensuring sid_gid entry exists" << std::endl;
            SessionData *imported = new SessionData(cluster_sid, userid, domainid, cluster_members);
            SessionData *imported = new SessionData(cluster_sid, userid, domainid, cluster_members);
            imported->_username = cluster_username;
            imported->_username = cluster_username;
            imported->setGPOResults(cluster_gpo);
            imported->setGPOResults(cluster_gpo);

            // Ensure sid_gid entry exists — it may have been lost
            try {
                g_Cluster->pushSession(*imported);
            } catch (const std::exception &e) {
                std::cerr << "[SESSION] addSession: re-push of existing session FAILED: " << e.what() << std::endl;
            }

            std::lock_guard<std::mutex> guard(_lock);
            std::lock_guard<std::mutex> guard(_lock);
            removeLocal(cluster_sid);
            removeLocal(cluster_sid);
            appendLocal(imported);
            appendLocal(imported);