private void IOnNodeFetched(ENetError result, pnVaultNode node, object param) { pnAuth2Cli_VaultNodeFetched reply = new pnAuth2Cli_VaultNodeFetched(); reply.fTransID = (uint)param; if (result == ENetError.kNetSuccess && node != null && fPermissions < pnAcctPerms.CCR) { switch (node.NodeType) { case ENodeType.kNodeAdmin: case ENodeType.kNodeCCR: case ENodeType.kNodeGameServer: case ENodeType.kNodeInvalid: case ENodeType.kNodeUNUSED: case ENodeType.kNodeVaultServer: case ENodeType.kNodeVNodeMgrHigh: case ENodeType.kNodeVNodeMgrLow: reply.fResult = ENetError.kNetErrVaultNodeAccessViolation; break; case ENodeType.kNodeAgeInfoList: pnVaultAgeInfoListNode ages = new pnVaultAgeInfoListNode(node); if (ages.FolderType == EStandardNode.kPublicAgesFolder) reply.fResult = ENetError.kNetErrVaultNodeAccessViolation; break; case ENodeType.kNodeFolder: // Yay, moar switching pnVaultFolderNode folder = new pnVaultFolderNode(node); switch (folder.FolderType) { case EStandardNode.kAllAgeGlobalSDLNodesFolder: case EStandardNode.kGameScoresFolder: // Currently unused case EStandardNode.kVaultMgrGlobalDataFolder: reply.fResult = ENetError.kNetErrVaultNodeAccessViolation; break; } break; case ENodeType.kNodePlayer: if (fPlayerID != node.CreatorID) reply.fResult = ENetError.kNetErrVaultNodeAccessViolation; break; case ENodeType.kNodePlayerInfoList: pnVaultPlayerInfoListNode players = new pnVaultPlayerInfoListNode(node); switch (players.FolderType) { case EStandardNode.kAllPlayersFolder: case EStandardNode.kCCRPlayersFolder: // Currently unused reply.fResult = ENetError.kNetErrVaultNodeAccessViolation; break; } break; case ENodeType.kNodeSDL: pnVaultSDLNode sdl = new pnVaultSDLNode(node); if (sdl.StateIdent != EStandardNode.kAgeInstanceSDLNode) reply.fResult = ENetError.kNetErrVaultNodeAccessViolation; break; default: reply.fResult = result; break; } } else reply.fResult = result; if (result == ENetError.kNetSuccess) reply.fNode = node; reply.Send(fStream); }
private void IFindNode() { pnCli2Auth_VaultNodeFind req = new pnCli2Auth_VaultNodeFind(); req.Read(fStream); // Why find a node if you know the NodeID? bool allowed = (req.fPattern[pnVaultNodeFields.NodeIdx] == null); // Don't allow regular users to search for important nodes... if (fPermissions < pnAcctPerms.CCR && allowed) { switch (req.fPattern.NodeType) { case ENodeType.kNodeAdmin: case ENodeType.kNodeCCR: case ENodeType.kNodeGameServer: case ENodeType.kNodeInvalid: case ENodeType.kNodePlayer: case ENodeType.kNodeSDL: // Easy way to find AgeGlobalSDLs case ENodeType.kNodeUNUSED: case ENodeType.kNodeVaultServer: case ENodeType.kNodeVNodeMgrHigh: case ENodeType.kNodeVNodeMgrLow: allowed = false; break; case ENodeType.kNodeAgeInfoList: pnVaultAgeInfoListNode ages = new pnVaultAgeInfoListNode(req.fPattern); if (ages.FolderType == EStandardNode.kPublicAgesFolder) // Currently unused allowed = false; break; case ENodeType.kNodeFolder: // Yay, moar switching pnVaultFolderNode folder = new pnVaultFolderNode(req.fPattern); switch (folder.FolderType) { case EStandardNode.kAllAgeGlobalSDLNodesFolder: case EStandardNode.kGameScoresFolder: // Currently unused case EStandardNode.kVaultMgrGlobalDataFolder: allowed = false; break; } break; case ENodeType.kNodePlayerInfoList: pnVaultPlayerInfoListNode players = new pnVaultPlayerInfoListNode(req.fPattern); switch (players.FolderType) { case EStandardNode.kAllPlayersFolder: case EStandardNode.kCCRPlayersFolder: // Currently unused allowed = false; break; } break; } } if (allowed) // FIXME: VaultCli hangs after the callack is fired. fVaultCli.FindNode(req.fPattern, new pnCallback(new pnVaultNodeFound(IOnNodeFound), req.fTransID)); else { pnAuth2Cli_VaultNodeFindReply reply = new pnAuth2Cli_VaultNodeFindReply(); reply.fResult = ENetError.kNetErrInvalidParameter; reply.fTransID = req.fTransID; reply.Send(fStream); } }
private uint? ICreateStdNode(EStandardNode type, uint cIdx, Guid cGuid) { pnVaultNodeAccess vna = null; switch (type) { case EStandardNode.kAgeDevicesFolder: case EStandardNode.kAgeJournalsFolder: case EStandardNode.kAgeTypeJournalFolder: case EStandardNode.kAllAgeGlobalSDLNodesFolder: // If you create this, I'll kill you. case EStandardNode.kAvatarClosetFolder: case EStandardNode.kAvatarOutfitFolder: case EStandardNode.kChronicleFolder: case EStandardNode.kDeviceInboxFolder: case EStandardNode.kGameScoresFolder: case EStandardNode.kGlobalInboxFolder: case EStandardNode.kInboxFolder: case EStandardNode.kPlayerInviteFolder: case EStandardNode.kVaultMgrGlobalDataFolder: vna = new pnVaultFolderNode(); ((pnVaultFolderNode)vna).FolderType = type; break; case EStandardNode.kAgeMembersFolder: case EStandardNode.kAgeOwnersFolder: case EStandardNode.kAllPlayersFolder: case EStandardNode.kBuddyListFolder: case EStandardNode.kCanVisitFolder: case EStandardNode.kCCRPlayersFolder: // If you create this, I'll REALLY kill you. case EStandardNode.kHoodMembersFolder: case EStandardNode.kIgnoreListFolder: case EStandardNode.kPeopleIKnowAboutFolder: vna = new pnVaultPlayerInfoListNode(); ((pnVaultPlayerInfoListNode)vna).FolderType = type; break; case EStandardNode.kAgesICanVisitFolder: case EStandardNode.kAgesIOwnFolder: case EStandardNode.kChildAgesFolder: case EStandardNode.kPublicAgesFolder: // If you create this, I'll resurrect you to kill you again. case EStandardNode.kSubAgesFolder: vna = new pnVaultAgeInfoListNode(); ((pnVaultAgeInfoListNode)vna).FolderType = type; break; case EStandardNode.kSystemNode: vna = new pnVaultSystemNode(); break; default: Warn("Tried to Create a SimpleStdNode for: " + type.ToString()); return new uint?(); } if (cIdx != 0) vna.CreatorID = cIdx; if (cGuid != Guid.Empty) vna.CreatorUuid = cGuid; try { ICreateNode(vna.BaseNode); } catch (pnDbException e) { Error(e, "Failed to Create a SimpleStdNode"); return new uint?(); } return new uint?(vna.NodeID); }