<commit_before>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aurora.Framework;
using Aurora.DataManager;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using Nini.Config;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using RegionFlags = Aurora.Framework.RegionFlags;

namespace Aurora.Services.DataService
{
    public class LocalAuthConnector : IAuthenticationData
    {
        private IGenericData GD = null;
        private string m_realm = "auth";
        private string m_tokensrealm = "tokens";
        private int m_LastExpire = 0;

        public void Initialize(IGenericData GenericData, IConfigSource source, IRegistryCore simBase, string defaultConnectionString)
        {
            if (source.Configs["AuroraConnectors"].GetString("AuthConnector", "LocalConnector") == "LocalConnector")
            {
                GD = GenericData;

                string connectionString = defaultConnectionString;
                if (source.Configs[Name] != null)
                    connectionString = source.Configs[Name].GetString("ConnectionString", defaultConnectionString);

                GD.ConnectToDatabase(connectionString, "Auth");

                DataManager.DataManager.RegisterPlugin(Name, this);
            }
        }

        public string Name
        {
            get { return "IAuthenticationData"; }
        }

        public void Dispose()
        {
        }

        #region IAuthenticationData Members

        public AuthData Get(UUID principalID)
        {
            List<string> query = GD.Query("UUID", principalID.ToString(), m_realm, "*");
            AuthData data = new AuthData();
            for (int i = 0; i < query.Count; i += 5)
            {
                data.PrincipalID = UUID.Parse(query[i]);
                data.PasswordHash = query[i + 1];
                data.PasswordSalt = query[i + 2];
                data.WebLoginKey = query[i + 3];
                data.AccountType = query[i + 4];
            }
            return data;
        }

        public bool Store(AuthData data)
        {
            return GD.Replace(m_realm, new string[] { "UUID", "passwordHash", "passwordSalt",
                "webLoginKey", "accountType" }, new object[] { data.PrincipalID, 
                    data.PasswordHash, data.PasswordSalt, data.WebLoginKey, data.AccountType });
        }<commit_msg>Fix a bug in the auth connector.<commit_after>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aurora.Framework;
using Aurora.DataManager;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using Nini.Config;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using RegionFlags = Aurora.Framework.RegionFlags;

namespace Aurora.Services.DataService
{
    public class LocalAuthConnector : IAuthenticationData
    {
        private IGenericData GD = null;
        private string m_realm = "auth";
        private string m_tokensrealm = "tokens";
        private int m_LastExpire = 0;

        public void Initialize(IGenericData GenericData, IConfigSource source, IRegistryCore simBase, string defaultConnectionString)
        {
            if (source.Configs["AuroraConnectors"].GetString("AuthConnector", "LocalConnector") == "LocalConnector")
            {
                GD = GenericData;

                string connectionString = defaultConnectionString;
                if (source.Configs[Name] != null)
                    connectionString = source.Configs[Name].GetString("ConnectionString", defaultConnectionString);

                GD.ConnectToDatabase(connectionString, "Auth");

                DataManager.DataManager.RegisterPlugin(Name, this);
            }
        }

        public string Name
        {
            get { return "IAuthenticationData"; }
        }

        public void Dispose()
        {
        }

        #region IAuthenticationData Members

        public AuthData Get(UUID principalID)
        {
            List<string> query = GD.Query("UUID", principalID.ToString(), m_realm, "*");
            AuthData data = null;
            for (int i = 0; i < query.Count; i += 5)
            {
                data = new AuthData();
                data.PrincipalID = UUID.Parse(query[i]);
                data.PasswordHash = query[i + 1];
                data.PasswordSalt = query[i + 2];
                data.WebLoginKey = query[i + 3];
                data.AccountType = query[i + 4];
            }
            return data;
        }

        public bool Store(AuthData data)
        {
            return GD.Replace(m_realm, new string[] { "UUID", "passwordHash", "passwordSalt",
                "webLoginKey", "accountType" }, new object[] { data.PrincipalID, 
                    data.PasswordHash, data.PasswordSalt, data.WebLoginKey, data.AccountType });
        }
{'fraction_non_alphanumeric': 0.09555288461538461, 'fraction_numerical': 0.0028044871794871795, 'mean_word_length': 2.2109324758842446, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '259077', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1267, 'n_words': 304}