Merge branch 'master' into careminster

avinationmerge
Melanie 2013-04-29 00:38:20 +01:00
commit 7c729e1519
7 changed files with 81 additions and 18 deletions

View File

@ -723,12 +723,12 @@ namespace OpenSim.Groups
#region Actions without permission checks
private void _AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
protected void _AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
{
_AddAgentToGroup(RequestingAgentID, AgentID, GroupID, RoleID, string.Empty);
}
public void _RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
protected void _RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
{
// 1. Delete membership
m_Database.DeleteMember(GroupID, AgentID);
@ -780,7 +780,7 @@ namespace OpenSim.Groups
}
private bool _AddOrUpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, bool add)
protected bool _AddOrUpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, bool add)
{
RoleData data = m_Database.RetrieveRole(groupID, roleID);
@ -810,12 +810,12 @@ namespace OpenSim.Groups
return m_Database.StoreRole(data);
}
private void _RemoveGroupRole(UUID groupID, UUID roleID)
protected void _RemoveGroupRole(UUID groupID, UUID roleID)
{
m_Database.DeleteRole(groupID, roleID);
}
private void _AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
protected void _AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
{
RoleMembershipData data = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
if (data != null)
@ -840,7 +840,7 @@ namespace OpenSim.Groups
}
private List<GroupRolesData> _GetGroupRoles(UUID groupID)
protected List<GroupRolesData> _GetGroupRoles(UUID groupID)
{
List<GroupRolesData> roles = new List<GroupRolesData>();
@ -865,7 +865,7 @@ namespace OpenSim.Groups
return roles;
}
private List<ExtendedGroupRoleMembersData> _GetGroupRoleMembers(UUID GroupID, bool isInGroup)
protected List<ExtendedGroupRoleMembersData> _GetGroupRoleMembers(UUID GroupID, bool isInGroup)
{
List<ExtendedGroupRoleMembersData> rmembers = new List<ExtendedGroupRoleMembersData>();

View File

@ -47,13 +47,10 @@ namespace OpenSim.Data.MySQL
public void DeleteOld()
{
uint now = (uint)Util.UnixTimeSinceEpoch();
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where TMStamp < ?tstamp", m_Realm);
cmd.Parameters.AddWithValue("?tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old
cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 WEEK", m_Realm);
ExecuteNonQuery(cmd);
}

View File

@ -690,7 +690,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
/// <param name="agentId"></param>
public void EconomyDataRequestHandler(IClientAPI user)
{
Scene s = LocateSceneClientIn(user.AgentId);
Scene s = (Scene)user.Scene;
user.SendEconomyData(EnergyEfficiency, s.RegionInfo.ObjectCapacity, ObjectCount, PriceEnergyUnit, PriceGroupCreate,
PriceObjectClaim, PriceObjectRent, PriceObjectScaleFactor, PriceParcelClaim, PriceParcelClaimFactor,

View File

@ -286,6 +286,7 @@ namespace OpenSim.Server.Base
e.InnerException == null ? e.Message : e.InnerException.Message,
e.StackTrace);
}
m_log.ErrorFormat("[SERVER UTILS]: Error loading plugin {0}: {1}", dllName, e.Message);
return null;
}

View File

@ -58,6 +58,7 @@ namespace OpenSim.Services.HypergridService
private static IUserAgentService m_UserAgentService;
private static ISimulationService m_SimulationService;
private static IGridUserService m_GridUserService;
private static IBansService m_BansService;
private static string m_AllowedClients = string.Empty;
private static string m_DeniedClients = string.Empty;
@ -87,6 +88,7 @@ namespace OpenSim.Services.HypergridService
string presenceService = serverConfig.GetString("PresenceService", String.Empty);
string simulationService = serverConfig.GetString("SimulationService", String.Empty);
string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
string bansService = serverConfig.GetString("BansService", String.Empty);
// These are mandatory, the others aren't
if (gridService == string.Empty || presenceService == string.Empty)
@ -121,6 +123,8 @@ namespace OpenSim.Services.HypergridService
m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
if (gridUserService != string.Empty)
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
if (bansService != string.Empty)
m_BansService = ServerUtils.LoadPlugin<IBansService>(bansService, args);
if (simService != null)
m_SimulationService = simService;
@ -223,7 +227,7 @@ namespace OpenSim.Services.HypergridService
m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9} Teleport Flags {10}",
aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName,
aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString());
//
// Check client
//
@ -287,17 +291,16 @@ namespace OpenSim.Services.HypergridService
}
}
}
m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok");
//
// Foreign agents allowed? Exceptions?
//
if (account == null)
if (account == null)
{
bool allowed = m_ForeignAgentsAllowed;
if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions))
allowed = false;
allowed = false;
if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions))
allowed = true;
@ -311,6 +314,20 @@ namespace OpenSim.Services.HypergridService
}
}
//
// Is the user banned?
// This uses a Ban service that's more powerful than the configs
//
string uui = (account != null ? aCircuit.AgentID.ToString() : Util.ProduceUserUniversalIdentifier(aCircuit));
if (m_BansService != null && m_BansService.IsBanned(uui, aCircuit.IPAddress, aCircuit.Id0, authURL))
{
reason = "You are banned from this world";
m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: user {0} is banned", uui);
return false;
}
m_log.DebugFormat("[GATEKEEPER SERVICE]: User is OK");
bool isFirstLogin = false;
//
// Login the presence, if it's not there yet (by the login service)

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Services.Interfaces
{
public interface IBansService
{
/// <summary>
/// Are any of the given arguments banned from the grid?
/// </summary>
/// <param name="userID"></param>
/// <param name="ip"></param>
/// <param name="id0"></param>
/// <param name="origin"></param>
/// <returns></returns>
bool IsBanned(string userID, string ip, string id0, string origin);
}
}

View File

@ -73,7 +73,7 @@ namespace OpenSim.Services.UserAccountService
return info;
}
public GridUserInfo[] GetGridUserInfo(string[] userIDs)
public virtual GridUserInfo[] GetGridUserInfo(string[] userIDs)
{
List<GridUserInfo> ret = new List<GridUserInfo>();