Initial commit of fixes for steam2 authenticated downloads, but there's still some issue with a change in the steam2 ticket that needs to be investigated.

pull/8/head
Ryan Stecker 14 years ago
parent 8ffff1cb7b
commit 3dbc75a343

@ -146,7 +146,7 @@ namespace DepotDownloader
if ( username != null ) if ( username != null )
{ {
ServerCache.BuildAuthServers( username ); // ServerCache.BuildAuthServers( username );
credentials = GetCredentials( ( uint )depotId, username, password ); credentials = GetCredentials( ( uint )depotId, username, password );
} }
@ -321,30 +321,6 @@ namespace DepotDownloader
static ContentServerClient.Credentials GetCredentials( uint depotId, string username, string password ) static ContentServerClient.Credentials GetCredentials( uint depotId, string username, string password )
{ {
IPEndPoint authServer = GetAuthServer();
if ( authServer == null )
{
Console.WriteLine( "Error: Unable to get authserver!" );
return null;
}
AuthServerClient asClient = new AuthServerClient();
asClient.Connect( authServer );
ClientTGT clientTgt;
byte[] serverTgt;
AuthBlob accountRecord;
Console.Write( "Logging '{0}' into Steam2... ", username );
AuthServerClient.LoginResult result = asClient.Login( username, password, out clientTgt, out serverTgt, out accountRecord );
if ( result != AuthServerClient.LoginResult.LoggedIn )
{
Console.WriteLine( "Unable to login to Steam2: {0}", result );
return null;
}
Console.WriteLine( " Done!" );
steam3 = new Steam3Session( steam3 = new Steam3Session(
new SteamUser.LogOnDetails() new SteamUser.LogOnDetails()
@ -352,16 +328,13 @@ namespace DepotDownloader
Username = username, Username = username,
Password = password, Password = password,
ClientTGT = clientTgt,
ServerTGT = serverTgt,
AccRecord = accountRecord,
}, },
depotId depotId
); );
var steam3Credentials = steam3.WaitForCredentials(); var steam3Credentials = steam3.WaitForCredentials();
if ( !steam3Credentials.HasSessionToken || steam3Credentials.AppTicket == null ) if ( !steam3Credentials.HasSessionToken || steam3Credentials.AppTicket == null || steam3Credentials.Steam2Ticket == null )
{ {
Console.WriteLine( "Unable to get steam3 credentials." ); Console.WriteLine( "Unable to get steam3 credentials." );
return null; return null;
@ -369,7 +342,7 @@ namespace DepotDownloader
ContentServerClient.Credentials credentials = new ContentServerClient.Credentials() ContentServerClient.Credentials credentials = new ContentServerClient.Credentials()
{ {
ServerTGT = serverTgt, ServerTGT = steam3Credentials.Steam2Ticket,
AppTicket = steam3Credentials.AppTicket, AppTicket = steam3Credentials.AppTicket,
SessionToken = steam3Credentials.SessionToken, SessionToken = steam3Credentials.SessionToken,
}; };

@ -17,6 +17,8 @@ namespace DepotDownloader
public ulong SessionToken { get; set; } public ulong SessionToken { get; set; }
public byte[] AppTicket { get; set; } public byte[] AppTicket { get; set; }
public byte[] Steam2Ticket { get; set; }
} }
public ReadOnlyCollection<SteamApps.LicenseListCallback.License> Licenses public ReadOnlyCollection<SteamApps.LicenseListCallback.License> Licenses
@ -97,7 +99,7 @@ namespace DepotDownloader
if ( diff > STEAM3_TIMEOUT && !bConnected ) if ( diff > STEAM3_TIMEOUT && !bConnected )
break; break;
if ( credentials.HasSessionToken && credentials.AppTicket != null && Licenses != null ) if ( credentials.HasSessionToken && credentials.AppTicket != null && Licenses != null && credentials.Steam2Ticket != null )
break; break;
if ( callback == null ) if ( callback == null )
@ -109,10 +111,7 @@ namespace DepotDownloader
bConnected = true; bConnected = true;
steamUser.LogOn( logonDetails ); steamUser.LogOn( logonDetails );
SteamID steamId = new SteamID(); Console.Write( "Logging '{0}' into Steam3...", logonDetails.Username );
steamId.SetFromSteam2( logonDetails.ClientTGT.UserID, steamClient.ConnectedUniverse );
Console.Write( "Logging '{0}' into Steam3...", steamId.Render() );
} }
if ( callback.IsType<SteamUser.LogOnCallback>() ) if ( callback.IsType<SteamUser.LogOnCallback>() )
@ -139,6 +138,9 @@ namespace DepotDownloader
Console.WriteLine( " Done!" ); Console.WriteLine( " Done!" );
Console.WriteLine( "Got Steam2 Ticket!" );
credentials.Steam2Ticket = msg.Steam2Ticket;
steamApps.GetAppOwnershipTicket( depotId ); steamApps.GetAppOwnershipTicket( depotId );
} }

Loading…
Cancel
Save