From 205d88b20451302cde6c22879dc167afb8b86b65 Mon Sep 17 00:00:00 2001 From: a Date: Fri, 22 Dec 2023 09:12:52 +0200 Subject: [PATCH] + used std::chrono to set the expiration time of the ticket instead of hardcoded numbers, for clarity. isn't 24 hours a very long time? + set TimeSinceStartup from the new startup_timer, which starts counting when the .dll/.so is loaded in memory, currently using the amount of seconds, not sure if this is correct though --- dll/auth.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dll/auth.cpp b/dll/auth.cpp index 837b1a82..1993647b 100644 --- a/dll/auth.cpp +++ b/dll/auth.cpp @@ -80,9 +80,9 @@ Auth_Data Auth_Manager::getTicketData( void *pTicket, int cbMaxTicket, uint32 *p ticket_data.Ticket.InternalIP = IP4_AS_DWORD_LITTLE_ENDIAN(127, 0, 0, 1); ticket_data.Ticket.AlwaysZero = 0; const auto curTime = std::chrono::system_clock::now(); - const auto GenDate = std::chrono::duration_cast(curTime.time_since_epoch()).count(); - ticket_data.Ticket.TicketGeneratedDate = GenDate; - uint32_t expTime = GenDate+100000; + const auto GenDate = std::chrono::duration_cast(curTime.time_since_epoch()); + ticket_data.Ticket.TicketGeneratedDate = (uint32_t)GenDate.count(); + uint32_t expTime = (uint32_t)(GenDate + std::chrono::hours(24)).count(); ticket_data.Ticket.TicketGeneratedExpireDate = expTime; ticket_data.Ticket.Licenses.resize(0); ticket_data.Ticket.Licenses.push_back(0); @@ -105,10 +105,10 @@ Auth_Data Auth_Manager::getTicketData( void *pTicket, int cbMaxTicket, uint32 *p ticket_data.HasGC = true; ticket_data.GC.GCToken = generate_random_int(); ticket_data.GC.id = settings->get_local_steam_id(); - ticket_data.GC.ticketGenDate = GenDate; - ticket_data.GC.TimeSinceStartup = generate_random_int(); + ticket_data.GC.ticketGenDate = (uint32_t)GenDate.count(); ticket_data.GC.ExternalIP = IP4_AS_DWORD_LITTLE_ENDIAN(127, 0, 0, 1); ticket_data.GC.InternalIP = IP4_AS_DWORD_LITTLE_ENDIAN(127, 0, 0, 1); + ticket_data.GC.TimeSinceStartup = (uint32_t)std::chrono::duration_cast(curTime - startup_time).count(); ticket_data.GC.TicketGeneratedCount = 1; } std::vector ser = ticket_data.Serialize();