Merge branch 'master' into httptests

httptests
UbitUmarov 2017-05-11 23:14:02 +01:00
commit 1b7aee89d3
9 changed files with 336 additions and 122 deletions

View File

@ -512,18 +512,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (((fi.MyFlags & (int)FriendRights.CanSeeOnline) != 0) && (fi.TheirFlags != -1)) if (((fi.MyFlags & (int)FriendRights.CanSeeOnline) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi); friendList.Add(fi);
} }
if(friendList.Count > 0)
{
Util.FireAndForget(
delegate
{
// m_log.DebugFormat(
// "[FRIENDS MODULE]: Notifying {0} friends of {1} of online status {2}",
// friendList.Count, agentID, online);
Util.FireAndForget( // Notify about this user status
delegate StatusNotify(friendList, agentID, online);
{ }, null, "FriendsModule.StatusChange"
// m_log.DebugFormat( );
// "[FRIENDS MODULE]: Notifying {0} friends of {1} of online status {2}", }
// friendList.Count, agentID, online);
// Notify about this user status
StatusNotify(friendList, agentID, online);
}, null, "FriendsModule.StatusChange"
);
} }
} }
@ -552,6 +554,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// We do this regrouping so that we can efficiently send a single request rather than one for each // We do this regrouping so that we can efficiently send a single request rather than one for each
// friend in what may be a very large friends list. // friend in what may be a very large friends list.
PresenceInfo[] friendSessions = PresenceService.GetAgents(remoteFriendStringIds.ToArray()); PresenceInfo[] friendSessions = PresenceService.GetAgents(remoteFriendStringIds.ToArray());
if(friendSessions == null)
return;
foreach (PresenceInfo friendSession in friendSessions) foreach (PresenceInfo friendSession in friendSessions)
{ {

View File

@ -59,21 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
/// <summary>Special UUID for actions that apply to all agents</summary> /// <summary>Special UUID for actions that apply to all agents</summary>
private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb");
private static readonly UUID UUID_GRID_GOD = new UUID("6571e388-6218-4574-87db-f9379718315e");
protected Scene m_scene; protected Scene m_scene;
protected IDialogModule m_dialogModule; protected IDialogModule m_dialogModule;
protected IDialogModule DialogModule
{
get
{
if (m_dialogModule == null)
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
return m_dialogModule;
}
}
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
} }
@ -97,6 +87,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
{ {
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
} }
public void Close() {} public void Close() {}
@ -152,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
if (god == null || god.ControllingClient.SessionId != godSessionID) if (god == null || god.ControllingClient.SessionId != godSessionID)
return String.Empty; return String.Empty;
KickUser(godID, agentID, kickFlags, Util.StringToBytes1024(reason)); KickUser(godID, agentID, kickFlags, reason);
} }
else else
{ {
@ -173,8 +164,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
sp.GrantGodlikePowers(token, godLike); sp.GrantGodlikePowers(token, godLike);
if (godLike && !sp.IsViewerUIGod && DialogModule != null) if (godLike && !sp.IsViewerUIGod && m_dialogModule != null)
DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied");
}
public void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason)
{
KickUser(godID, agentID, kickflags, Utils.BytesToString(reason));
} }
/// <summary> /// <summary>
@ -184,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
/// <param name="agentID">the person that is being kicked</param> /// <param name="agentID">the person that is being kicked</param>
/// <param name="kickflags">Tells what to do to the user</param> /// <param name="kickflags">Tells what to do to the user</param>
/// <param name="reason">The message to send to the user after it's been turned into a field</param> /// <param name="reason">The message to send to the user after it's been turned into a field</param>
public void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason) public void KickUser(UUID godID, UUID agentID, uint kickflags, string reason)
{ {
// assuming automatic god rights on this for fast griefing reaction // assuming automatic god rights on this for fast griefing reaction
// this is also needed for kick via message // this is also needed for kick via message
@ -200,10 +196,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
if(agentID == ALL_AGENTS) if(agentID == ALL_AGENTS)
{ {
m_scene.ForEachRootScenePresence(delegate(ScenePresence p) m_scene.ForEachRootScenePresence(delegate(ScenePresence p)
{
if (p.UUID != godID)
{ {
if (p.UUID != godID && godlevel > p.GodController.GodLevel) if(godlevel > p.GodController.GodLevel)
doKickmodes(godID, p, kickflags, reason); doKickmodes(godID, p, kickflags, reason);
}); else if(m_dialogModule != null)
m_dialogModule.SendAlertToUser(p.UUID, "Kick from " + godID.ToString() + " ignored, kick reason: " + reason);
}
});
return; return;
} }
@ -217,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID); m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID);
transferModule.SendInstantMessage(new GridInstantMessage( transferModule.SendInstantMessage(new GridInstantMessage(
m_scene, godID, "God", agentID, (byte)250, false, m_scene, godID, "God", agentID, (byte)250, false,
Utils.BytesToString(reason), UUID.Zero, true, reason, UUID.Zero, true,
new Vector3(), new byte[] {(byte)kickflags}, true), new Vector3(), new byte[] {(byte)kickflags}, true),
delegate(bool success) {} ); delegate(bool success) {} );
} }
@ -225,7 +226,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
} }
if (godlevel <= sp.GodController.GodLevel) // no god wars if (godlevel <= sp.GodController.GodLevel) // no god wars
{
if(m_dialogModule != null)
m_dialogModule.SendAlertToUser(sp.UUID, "Kick from " + godID.ToString() + " ignored, kick reason: " + reason);
return; return;
}
if(sp.UUID == godID) if(sp.UUID == godID)
return; return;
@ -233,29 +238,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
doKickmodes(godID, sp, kickflags, reason); doKickmodes(godID, sp, kickflags, reason);
} }
private void doKickmodes(UUID godID, ScenePresence sp, uint kickflags, byte[] reason) private void doKickmodes(UUID godID, ScenePresence sp, uint kickflags, string reason)
{ {
switch (kickflags) switch (kickflags)
{ {
case 0: case 0:
KickPresence(sp, Utils.BytesToString(reason)); KickPresence(sp, reason);
break; break;
case 1: case 1:
sp.AllowMovement = false; sp.AllowMovement = false;
m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason)); if(m_dialogModule != null)
m_dialogModule.SendAlertToUser(godID, "User Frozen"); {
m_dialogModule.SendAlertToUser(sp.UUID, reason);
m_dialogModule.SendAlertToUser(godID, "User Frozen");
}
break; break;
case 2: case 2:
sp.AllowMovement = true; sp.AllowMovement = true;
m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason)); if(m_dialogModule != null)
m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); {
m_dialogModule.SendAlertToUser(sp.UUID, reason);
m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
}
break; break;
default: default:
break; break;
} }
} }
private void KickPresence(ScenePresence sp, string reason) private void KickPresence(ScenePresence sp, string reason)
{ {
if(sp.IsDeleted || sp.IsChildAgent) if(sp.IsDeleted || sp.IsChildAgent)
@ -264,6 +274,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
sp.Scene.CloseAgent(sp.UUID, true); sp.Scene.CloseAgent(sp.UUID, true);
} }
public void GridKickUser(UUID agentID, string reason)
{
int godlevel = 240; // grid god default
ScenePresence sp = m_scene.GetScenePresence(agentID);
if (sp == null || sp.IsChildAgent)
{
IMessageTransferModule transferModule =
m_scene.RequestModuleInterface<IMessageTransferModule>();
if (transferModule != null)
{
m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID);
transferModule.SendInstantMessage(new GridInstantMessage(
m_scene, UUID_GRID_GOD, "GRID", agentID, (byte)250, false,
reason, UUID.Zero, true,
new Vector3(), new byte[] {0}, true),
delegate(bool success) {} );
}
return;
}
if(sp.IsDeleted)
return;
if (godlevel <= sp.GodController.GodLevel) // no god wars
{
if(m_dialogModule != null)
m_dialogModule.SendAlertToUser(sp.UUID, "GRID kick detected and ignored, kick reason: " + reason);
return;
}
sp.ControllingClient.Kick(reason);
sp.Scene.CloseAgent(sp.UUID, true);
}
private void OnIncomingInstantMessage(GridInstantMessage msg) private void OnIncomingInstantMessage(GridInstantMessage msg)
{ {
if (msg.dialog == (uint)250) // Nonlocal kick if (msg.dialog == (uint)250) // Nonlocal kick
@ -273,7 +318,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
UUID godID = new UUID(msg.fromAgentID); UUID godID = new UUID(msg.fromAgentID);
uint kickMode = (uint)msg.binaryBucket[0]; uint kickMode = (uint)msg.binaryBucket[0];
KickUser(godID, agentID, kickMode, Util.StringToBytes1024(reason)); if(godID == UUID_GRID_GOD)
GridKickUser(agentID, reason);
else
KickUser(godID, agentID, kickMode, reason);
} }
} }
} }

View File

@ -35,8 +35,8 @@ using OpenSim.Framework;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Connectors.InstantMessage;
using OpenSim.Services.Connectors.Hypergrid; using OpenSim.Services.Connectors.Hypergrid;
using OpenMetaverse; using OpenMetaverse;
using Nini.Config; using Nini.Config;
@ -71,6 +71,7 @@ namespace OpenSim.Services.HypergridService
private static string m_ExternalName; private static string m_ExternalName;
private static Uri m_Uri; private static Uri m_Uri;
private static GridRegion m_DefaultGatewayRegion; private static GridRegion m_DefaultGatewayRegion;
private bool m_allowDuplicatePresences = false;
public GatekeeperService(IConfigSource config, ISimulationService simService) public GatekeeperService(IConfigSource config, ISimulationService simService)
{ {
@ -144,6 +145,12 @@ namespace OpenSim.Services.HypergridService
if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
IConfig presenceConfig = config.Configs["PresenceService"];
if (presenceConfig != null)
{
m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences);
}
m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
} }
} }
@ -369,6 +376,36 @@ namespace OpenSim.Services.HypergridService
return false; return false;
} }
if(account.PrincipalID == new UUID("6571e388-6218-4574-87db-f9379718315e"))
{
// really?
reason = "Invalid account ID";
return false;
}
if(m_GridUserService != null)
{
string PrincipalIDstr = account.PrincipalID.ToString();
GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr);
if(!m_allowDuplicatePresences)
{
if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero)
{
if(SendAgentGodKillToRegion(UUID.Zero, account.PrincipalID, guinfo))
{
m_log.InfoFormat(
"[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in",
account.FirstName, account.LastName);
reason = "You appear to be already logged in on destiny grid " +
"Please wait a a minute or two and retry. " +
"If this takes longer than a few minutes please contact the grid owner. ";
return false;
}
}
}
}
m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name);
bool isFirstLogin = false; bool isFirstLogin = false;
@ -389,26 +426,6 @@ namespace OpenSim.Services.HypergridService
return false; return false;
} }
m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name);
// Also login foreigners with GridUser service
if (m_GridUserService != null && account == null)
{
string userId = aCircuit.AgentID.ToString();
string first = aCircuit.firstname, last = aCircuit.lastname;
if (last.StartsWith("@"))
{
string[] parts = aCircuit.firstname.Split('.');
if (parts.Length >= 2)
{
first = parts[0];
last = parts[1];
}
}
userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last;
m_GridUserService.LoggedIn(userId);
}
} }
// //
@ -465,7 +482,33 @@ namespace OpenSim.Services.HypergridService
true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
return false; return false;
return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason); bool didit = m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason);
if(didit)
{
m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name);
if(!isFirstLogin && m_GridUserService != null && account == null)
{
// Also login foreigners with GridUser service
string userId = aCircuit.AgentID.ToString();
string first = aCircuit.firstname, last = aCircuit.lastname;
if (last.StartsWith("@"))
{
string[] parts = aCircuit.firstname.Split('.');
if (parts.Length >= 2)
{
first = parts[0];
last = parts[1];
}
}
userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last;
m_GridUserService.LoggedIn(userId);
}
}
return didit;
} }
protected bool Authenticate(AgentCircuitData aCircuit) protected bool Authenticate(AgentCircuitData aCircuit)
@ -563,6 +606,40 @@ namespace OpenSim.Services.HypergridService
return exception; return exception;
} }
private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo)
{
UUID regionID = guinfo.LastRegionID;
GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID);
if(regInfo == null)
return false;
string regURL = regInfo.ServerURI;
if(String.IsNullOrEmpty(regURL))
return false;
UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e");
GridInstantMessage msg = new GridInstantMessage();
msg.imSessionID = UUID.Zero.Guid;
msg.fromAgentID = guuid.Guid;
msg.toAgentID = agentID.Guid;
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
msg.fromAgentName = "GRID";
msg.message = string.Format("New login detected");
msg.dialog = 250; // God kick
msg.fromGroup = false;
msg.offline = (byte)0;
msg.ParentEstateID = 0;
msg.Position = Vector3.Zero;
msg.RegionID = scopeID.Guid;
msg.binaryBucket = new byte[1] {0};
InstantMessageServiceConnector.SendInstantMessage(regURL,msg);
m_GridUserService.LoggedOut(agentID.ToString(),
UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt);
return true;
}
#endregion #endregion
} }
} }

View File

@ -254,7 +254,6 @@ namespace OpenSim.Services.HypergridService
} }
} }
// Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
GridRegion region = new GridRegion(gatekeeper); GridRegion region = new GridRegion(gatekeeper);
region.ServerURI = gatekeeper.ServerURI; region.ServerURI = gatekeeper.ServerURI;

View File

@ -82,9 +82,8 @@ namespace OpenSim.Services.LLLoginService
"false"); "false");
AlreadyLoggedInProblem = new LLFailedLoginResponse("presence", AlreadyLoggedInProblem = new LLFailedLoginResponse("presence",
"You appear to be already logged in. " + "You appear to be already logged in. " +
"If this is not the case please wait for your session to timeout. " + "Please wait a a minute or two and retry. " +
"If this takes longer than a few minutes please contact the grid owner. " + "If this takes longer than a few minutes please contact the grid owner. ",
"Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.",
"false"); "false");
InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false"); InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false");
} }

View File

@ -40,6 +40,7 @@ using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Connectors.InstantMessage;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
@ -89,6 +90,7 @@ namespace OpenSim.Services.LLLoginService
protected string m_DeniedClients; protected string m_DeniedClients;
protected string m_MessageUrl; protected string m_MessageUrl;
protected string m_DSTZone; protected string m_DSTZone;
protected bool m_allowDuplicatePresences = false;
IConfig m_LoginServerConfig; IConfig m_LoginServerConfig;
// IConfig m_ClientsConfig; // IConfig m_ClientsConfig;
@ -140,6 +142,11 @@ namespace OpenSim.Services.LLLoginService
if (groupConfig != null) if (groupConfig != null)
m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42); m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42);
IConfig presenceConfig = config.Configs["PresenceService"];
if (presenceConfig != null)
{
m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences);
}
// Clean up some of these vars // Clean up some of these vars
if (m_MapTileURL != String.Empty) if (m_MapTileURL != String.Empty)
@ -370,6 +377,29 @@ namespace OpenSim.Services.LLLoginService
return LLFailedLoginResponse.UserProblem; return LLFailedLoginResponse.UserProblem;
} }
if(account.PrincipalID == new UUID("6571e388-6218-4574-87db-f9379718315e"))
{
// really?
return LLFailedLoginResponse.UserProblem;
}
string PrincipalIDstr = account.PrincipalID.ToString();
GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr);
if(!m_allowDuplicatePresences)
{
if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero)
{
if(SendAgentGodKillToRegion(scopeID, account.PrincipalID, guinfo))
{
m_log.InfoFormat(
"[LLOGIN SERVICE]: Login failed for {0} {1}, reason: already logged in",
firstName, lastName);
return LLFailedLoginResponse.AlreadyLoggedInProblem;
}
}
}
// //
// Get the user's inventory // Get the user's inventory
// //
@ -406,7 +436,7 @@ namespace OpenSim.Services.LLLoginService
// //
if (m_PresenceService != null) if (m_PresenceService != null)
{ {
success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); success = m_PresenceService.LoginAgent(PrincipalIDstr, session, secureSession);
if (!success) if (!success)
{ {
@ -421,7 +451,6 @@ namespace OpenSim.Services.LLLoginService
// Change Online status and get the home region // Change Online status and get the home region
// //
GridRegion home = null; GridRegion home = null;
GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString());
// We are only going to complain about no home if the user actually tries to login there, to avoid // We are only going to complain about no home if the user actually tries to login there, to avoid
// spamming the console. // spamming the console.
@ -504,6 +533,10 @@ namespace OpenSim.Services.LLLoginService
return new LLFailedLoginResponse("key", reason, "false"); return new LLFailedLoginResponse("key", reason, "false");
} }
// only now we can assume a login
guinfo = m_GridUserService.LoggedIn(PrincipalIDstr);
// Get Friends list // Get Friends list
FriendInfo[] friendsList = new FriendInfo[0]; FriendInfo[] friendsList = new FriendInfo[0];
if (m_FriendsService != null) if (m_FriendsService != null)
@ -832,6 +865,9 @@ namespace OpenSim.Services.LLLoginService
reason = string.Empty; reason = string.Empty;
uint circuitCode = 0; uint circuitCode = 0;
AgentCircuitData aCircuit = null; AgentCircuitData aCircuit = null;
dest = null;
bool success = false;
if (m_UserAgentService == null) if (m_UserAgentService == null)
{ {
@ -842,28 +878,14 @@ namespace OpenSim.Services.LLLoginService
simConnector = m_LocalSimulationService; simConnector = m_LocalSimulationService;
else if (m_RemoteSimulationService != null) else if (m_RemoteSimulationService != null)
simConnector = m_RemoteSimulationService; simConnector = m_RemoteSimulationService;
}
else // User Agent Service is on
{
if (gatekeeper == null) // login to local grid
{
if (hostName == string.Empty)
SetHostAndPort(m_GatekeeperURL);
gatekeeper = new GridRegion(destination); if(simConnector == null)
gatekeeper.ExternalHostName = hostName; return null;
gatekeeper.HttpPort = (uint)port;
gatekeeper.ServerURI = m_GatekeeperURL;
}
m_log.Debug("[LLLOGIN SERVICE]: no gatekeeper detected..... using " + m_GatekeeperURL);
}
bool success = false;
if (m_UserAgentService == null && simConnector != null)
{
circuitCode = (uint)Util.RandomClass.Next(); ; circuitCode = (uint)Util.RandomClass.Next(); ;
aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position,
clientIP.Address.ToString(), viewer, channel, mac, id0);
success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason); success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason);
if (!success && m_GridService != null) if (!success && m_GridService != null)
{ {
@ -885,10 +907,22 @@ namespace OpenSim.Services.LLLoginService
} }
} }
if (m_UserAgentService != null) else
{ {
if (gatekeeper == null) // login to local grid
{
if (hostName == string.Empty)
SetHostAndPort(m_GatekeeperURL);
gatekeeper = new GridRegion(destination);
gatekeeper.ExternalHostName = hostName;
gatekeeper.HttpPort = (uint)port;
gatekeeper.ServerURI = m_GatekeeperURL;
}
circuitCode = (uint)Util.RandomClass.Next(); ; circuitCode = (uint)Util.RandomClass.Next(); ;
aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position,
clientIP.Address.ToString(), viewer, channel, mac, id0);
aCircuit.teleportFlags |= (uint)flags; aCircuit.teleportFlags |= (uint)flags;
success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason);
if (!success && m_GridService != null) if (!success && m_GridService != null)
@ -1080,6 +1114,41 @@ namespace OpenSim.Services.LLLoginService
break; break;
} }
} }
private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo)
{
UUID regionID = guinfo.LastRegionID;
GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID);
if(regInfo == null)
return false;
string regURL = regInfo.ServerURI;
if(String.IsNullOrEmpty(regURL))
return false;
UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e");
GridInstantMessage msg = new GridInstantMessage();
msg.imSessionID = UUID.Zero.Guid;
msg.fromAgentID = guuid.Guid;
msg.toAgentID = agentID.Guid;
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
msg.fromAgentName = "GRID";
msg.message = string.Format("New login detected");
msg.dialog = 250; // God kick
msg.fromGroup = false;
msg.offline = (byte)0;
msg.ParentEstateID = 0;
msg.Position = Vector3.Zero;
msg.RegionID = scopeID.Guid;
msg.binaryBucket = new byte[1] {0};
InstantMessageServiceConnector.SendInstantMessage(regURL,msg);
m_GridUserService.LoggedOut(agentID.ToString(),
UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt);
return true;
}
} }
#endregion #endregion

View File

@ -43,6 +43,7 @@ namespace OpenSim.Services.UserAccountService
public class UserAccountService : UserAccountServiceBase, IUserAccountService public class UserAccountService : UserAccountServiceBase, IUserAccountService
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly UUID UUID_GRID_GOD = new UUID("6571e388-6218-4574-87db-f9379718315e");
private static UserAccountService m_RootInstance; private static UserAccountService m_RootInstance;
/// <summary> /// <summary>
@ -85,38 +86,63 @@ namespace OpenSim.Services.UserAccountService
m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false); m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false);
// In case there are several instances of this class in the same process, // create a system grid god account
// the console commands are only registered for the root instance UserAccount ggod = GetUserAccount(UUID.Zero, UUID_GRID_GOD);
if (m_RootInstance == null && MainConsole.Instance != null) if(ggod == null)
{
UserAccountData d = new UserAccountData();
d.FirstName = "GRID";
d.LastName = "SERVICES";
d.PrincipalID = UUID_GRID_GOD;
d.ScopeID = UUID.Zero;
d.Data = new Dictionary<string, string>();
d.Data["Email"] = string.Empty;
d.Data["Created"] = Util.UnixTimeSinceEpoch().ToString();
d.Data["UserLevel"] = "240";
d.Data["UserFlags"] = "0";
d.Data["ServiceURLs"] = string.Empty;
m_Database.Store(d);
}
if (m_RootInstance == null)
{ {
m_RootInstance = this; m_RootInstance = this;
MainConsole.Instance.Commands.AddCommand("Users", false,
"create user",
"create user [<first> [<last> [<pass> [<email> [<user id> [<model>]]]]]]",
"Create a new user", HandleCreateUser);
MainConsole.Instance.Commands.AddCommand("Users", false, // In case there are several instances of this class in the same process,
"reset user password", // the console commands are only registered for the root instance
"reset user password [<first> [<last> [<password>]]]", if (MainConsole.Instance != null)
"Reset a user password", HandleResetUserPassword); {
MainConsole.Instance.Commands.AddCommand("Users", false, MainConsole.Instance.Commands.AddCommand("Users", false,
"reset user email", "create user",
"reset user email [<first> [<last> [<email>]]]", "create user [<first> [<last> [<pass> [<email> [<user id> [<model>]]]]]]",
"Reset a user email address", HandleResetUserEmail); "Create a new user", HandleCreateUser);
MainConsole.Instance.Commands.AddCommand("Users", false, MainConsole.Instance.Commands.AddCommand("Users", false,
"set user level", "reset user password",
"set user level [<first> [<last> [<level>]]]", "reset user password [<first> [<last> [<password>]]]",
"Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, " "Reset a user password", HandleResetUserPassword);
+ "this account will be treated as god-moded. "
+ "It will also affect the 'login level' command. ",
HandleSetUserLevel);
MainConsole.Instance.Commands.AddCommand("Users", false, MainConsole.Instance.Commands.AddCommand("Users", false,
"show account", "reset user email",
"show account <first> <last>", "reset user email [<first> [<last> [<email>]]]",
"Show account details for the given user", HandleShowAccount); "Reset a user email address", HandleResetUserEmail);
MainConsole.Instance.Commands.AddCommand("Users", false,
"set user level",
"set user level [<first> [<last> [<level>]]]",
"Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, "
+ "this account will be treated as god-moded. "
+ "It will also affect the 'login level' command. ",
HandleSetUserLevel);
MainConsole.Instance.Commands.AddCommand("Users", false,
"show account",
"show account <first> <last>",
"Show account details for the given user", HandleShowAccount);
}
} }
} }

View File

@ -296,7 +296,7 @@
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
; Realm = "regions" ; Realm = "regions"
; AllowDuplicateNames = "True" ; AllowDuplicateNames = ""
;; Perform distance check for the creation of a linked region ;; Perform distance check for the creation of a linked region
; Check4096 = "True" ; Check4096 = "True"
@ -452,10 +452,6 @@
; for the server connector ; for the server connector
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
; Set this to true to allow the use of advanced web services and multiple
; bots using one account
AllowDuplicatePresences = false;
[AvatarService] [AvatarService]
; for the server connector ; for the server connector
LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService" LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService"

View File

@ -398,10 +398,6 @@
[PresenceService] [PresenceService]
; for the server connector ; for the server connector
LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
; Set this to true to allow the use of advanced web services and multiple
; bots using one account
AllowDuplicatePresences = false;
[AvatarService] [AvatarService]
; for the server connector ; for the server connector