Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ssu] Allow resolving store repos on unregistered devices
  • Loading branch information
Bernd Wachter committed Nov 12, 2013
1 parent 509179b commit aede9a2
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions ssuurlresolver/ssuurlresolver.cpp
Expand Up @@ -128,28 +128,27 @@ void SsuUrlResolver::run(){
// resolve base url
resolvedUrl = ssu.repoUrl(repo, isRnd, repoParameters);

QString credentialsScope = ssu.credentialsScope(repo, isRnd);
// only do credentials magic on secure connections
if (resolvedUrl.startsWith("https://") && ssu.isRegistered()){
if (resolvedUrl.startsWith("https://") && !credentialsScope.isEmpty() &&
(ssu.isRegistered() || credentialsScope == "store")){
// TODO: check for credentials scope required for repository; check if the file exists;
// compare with configuration, and dump credentials to file if necessary
ssuLog->print(LOG_DEBUG, QString("Requesting credentials for '%1' with RND status %2...").arg(repo).arg(isRnd));
QString credentialsScope = ssu.credentialsScope(repo, isRnd);
if (!credentialsScope.isEmpty()){
// personal store repositories as well as the ones listed in the
// store-auth-repos domain setting use store credentials. Refresh
// here, as we only know after checking scope if we need to have
// store credentials at all
if (credentialsScope == "store"){
ssu.updateStoreCredentials();
if (ssu.error())
error (ssu.lastError());
}
headerList.append(QString("credentials=%1").arg(credentialsScope));
writeZyppCredentialsIfNeeded(credentialsScope);
} else
ssuLog->print(LOG_DEBUG, "Skipping credential update due to missing credentials scope");
}

// personal store repositories as well as the ones listed in the
// store-auth-repos domain setting use store credentials. Refresh
// here, as we only know after checking scope if we need to have
// store credentials at all
if (credentialsScope == "store"){
ssu.updateStoreCredentials();
if (ssu.error())
error (ssu.lastError());
}
headerList.append(QString("credentials=%1").arg(credentialsScope));
writeZyppCredentialsIfNeeded(credentialsScope);
} else
ssuLog->print(LOG_DEBUG, QString("Skipping credential for %1 with scope %2").arg(repo).arg(credentialsScope));

if (!headerList.isEmpty() && !resolvedUrl.isEmpty()){
resolvedUrl = QString("%1?%2")
Expand Down

0 comments on commit aede9a2

Please sign in to comment.