forked from cromer/pamac-classic
fix an issue in parsing siglevel
This commit is contained in:
parent
f40c8f2601
commit
a357b6173e
@ -26,6 +26,7 @@ namespace Alpm {
|
|||||||
|
|
||||||
public Repo (string name) {
|
public Repo (string name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
siglevel = Signature.Level.USE_DEFAULT;
|
||||||
usage = 0;
|
usage = 0;
|
||||||
urls = {};
|
urls = {};
|
||||||
}
|
}
|
||||||
@ -108,6 +109,8 @@ namespace Alpm {
|
|||||||
handle.usesyslog = usesyslog;
|
handle.usesyslog = usesyslog;
|
||||||
handle.checkspace = checkspace;
|
handle.checkspace = checkspace;
|
||||||
handle.defaultsiglevel = defaultsiglevel;
|
handle.defaultsiglevel = defaultsiglevel;
|
||||||
|
localfilesiglevel = merge_siglevel (defaultsiglevel, localfilesiglevel);
|
||||||
|
remotefilesiglevel = merge_siglevel (defaultsiglevel, remotefilesiglevel);
|
||||||
handle.localfilesiglevel = localfilesiglevel;
|
handle.localfilesiglevel = localfilesiglevel;
|
||||||
handle.remotefilesiglevel = remotefilesiglevel;
|
handle.remotefilesiglevel = remotefilesiglevel;
|
||||||
handle.cachedirs = cachedirs;
|
handle.cachedirs = cachedirs;
|
||||||
@ -149,7 +152,6 @@ namespace Alpm {
|
|||||||
current_section = line[1:-1];
|
current_section = line[1:-1];
|
||||||
if (current_section != "options") {
|
if (current_section != "options") {
|
||||||
var repo = new Repo (current_section);
|
var repo = new Repo (current_section);
|
||||||
repo.siglevel = defaultsiglevel;
|
|
||||||
repo_order += repo;
|
repo_order += repo;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -179,10 +181,10 @@ namespace Alpm {
|
|||||||
checkspace = 1;
|
checkspace = 1;
|
||||||
else if (_key == "SigLevel")
|
else if (_key == "SigLevel")
|
||||||
defaultsiglevel = define_siglevel (defaultsiglevel, _value);
|
defaultsiglevel = define_siglevel (defaultsiglevel, _value);
|
||||||
else if (_key == "LocalSigLevel")
|
else if (_key == "LocalFileSigLevel")
|
||||||
localfilesiglevel = merge_siglevel (defaultsiglevel, define_siglevel (localfilesiglevel, _value));
|
localfilesiglevel = define_siglevel (localfilesiglevel, _value);
|
||||||
else if (_key == "RemoteSigLevel")
|
else if (_key == "RemoteFileSigLevel")
|
||||||
remotefilesiglevel = merge_siglevel (defaultsiglevel, define_siglevel (remotefilesiglevel, _value));
|
remotefilesiglevel = define_siglevel (remotefilesiglevel, _value);
|
||||||
else if (_key == "HoldPkg") {
|
else if (_key == "HoldPkg") {
|
||||||
foreach (string name in _value.split (" "))
|
foreach (string name in _value.split (" "))
|
||||||
holdpkgs.append (name);
|
holdpkgs.append (name);
|
||||||
@ -212,9 +214,11 @@ namespace Alpm {
|
|||||||
if (repo.name == current_section) {
|
if (repo.name == current_section) {
|
||||||
if (_key == "Server")
|
if (_key == "Server")
|
||||||
repo.urls += _value;
|
repo.urls += _value;
|
||||||
else if (_key == "SigLevel")
|
else if (_key == "SigLevel") {
|
||||||
repo.siglevel = define_siglevel (defaultsiglevel, _value);
|
if (repo.siglevel == Signature.Level.USE_DEFAULT)
|
||||||
else if (_key == "Usage")
|
repo.siglevel = defaultsiglevel;
|
||||||
|
repo.siglevel = define_siglevel (repo.siglevel, _value);
|
||||||
|
} else if (_key == "Usage")
|
||||||
repo.usage = define_usage (_value);
|
repo.usage = define_usage (_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,8 +310,10 @@ namespace Alpm {
|
|||||||
foreach (string directive in conf_string.split(" ")) {
|
foreach (string directive in conf_string.split(" ")) {
|
||||||
bool affect_package = false;
|
bool affect_package = false;
|
||||||
bool affect_database = false;
|
bool affect_database = false;
|
||||||
if ("Package" in directive) affect_package = true;
|
if ("Package" in directive)
|
||||||
else if ("Database" in directive) affect_database = true;
|
affect_package = true;
|
||||||
|
else if ("Database" in directive)
|
||||||
|
affect_database = true;
|
||||||
else {
|
else {
|
||||||
affect_package = true;
|
affect_package = true;
|
||||||
affect_database = true;
|
affect_database = true;
|
||||||
@ -317,9 +323,9 @@ namespace Alpm {
|
|||||||
default_level &= ~Signature.Level.PACKAGE;
|
default_level &= ~Signature.Level.PACKAGE;
|
||||||
default_level |= Signature.Level.PACKAGE_SET;
|
default_level |= Signature.Level.PACKAGE_SET;
|
||||||
}
|
}
|
||||||
if (affect_database) default_level &= ~Signature.Level.DATABASE;
|
if (affect_database)
|
||||||
}
|
default_level &= ~Signature.Level.DATABASE;
|
||||||
else if ("Optional" in directive) {
|
} else if ("Optional" in directive) {
|
||||||
if (affect_package) {
|
if (affect_package) {
|
||||||
default_level |= Signature.Level.PACKAGE;
|
default_level |= Signature.Level.PACKAGE;
|
||||||
default_level |= Signature.Level.PACKAGE_OPTIONAL;
|
default_level |= Signature.Level.PACKAGE_OPTIONAL;
|
||||||
@ -329,8 +335,7 @@ namespace Alpm {
|
|||||||
default_level |= Signature.Level.DATABASE;
|
default_level |= Signature.Level.DATABASE;
|
||||||
default_level |= Signature.Level.DATABASE_OPTIONAL;
|
default_level |= Signature.Level.DATABASE_OPTIONAL;
|
||||||
}
|
}
|
||||||
}
|
} else if ("Required" in directive) {
|
||||||
else if ("Required" in directive) {
|
|
||||||
if (affect_package) {
|
if (affect_package) {
|
||||||
default_level |= Signature.Level.PACKAGE;
|
default_level |= Signature.Level.PACKAGE;
|
||||||
default_level &= ~Signature.Level.PACKAGE_OPTIONAL;
|
default_level &= ~Signature.Level.PACKAGE_OPTIONAL;
|
||||||
@ -340,8 +345,7 @@ namespace Alpm {
|
|||||||
default_level |= Signature.Level.DATABASE;
|
default_level |= Signature.Level.DATABASE;
|
||||||
default_level &= ~Signature.Level.DATABASE_OPTIONAL;
|
default_level &= ~Signature.Level.DATABASE_OPTIONAL;
|
||||||
}
|
}
|
||||||
}
|
} else if ("TrustedOnly" in directive) {
|
||||||
else if ("TrustedOnly" in directive) {
|
|
||||||
if (affect_package) {
|
if (affect_package) {
|
||||||
default_level &= ~Signature.Level.PACKAGE_MARGINAL_OK;
|
default_level &= ~Signature.Level.PACKAGE_MARGINAL_OK;
|
||||||
default_level &= ~Signature.Level.PACKAGE_UNKNOWN_OK;
|
default_level &= ~Signature.Level.PACKAGE_UNKNOWN_OK;
|
||||||
@ -351,8 +355,7 @@ namespace Alpm {
|
|||||||
default_level &= ~Signature.Level.DATABASE_MARGINAL_OK;
|
default_level &= ~Signature.Level.DATABASE_MARGINAL_OK;
|
||||||
default_level &= ~Signature.Level.DATABASE_UNKNOWN_OK;
|
default_level &= ~Signature.Level.DATABASE_UNKNOWN_OK;
|
||||||
}
|
}
|
||||||
}
|
} else if ("TrustAll" in directive) {
|
||||||
else if ("TrustAll" in directive) {
|
|
||||||
if (affect_package) {
|
if (affect_package) {
|
||||||
default_level |= Signature.Level.PACKAGE_MARGINAL_OK;
|
default_level |= Signature.Level.PACKAGE_MARGINAL_OK;
|
||||||
default_level |= Signature.Level.PACKAGE_UNKNOWN_OK;
|
default_level |= Signature.Level.PACKAGE_UNKNOWN_OK;
|
||||||
@ -363,15 +366,15 @@ namespace Alpm {
|
|||||||
default_level |= Signature.Level.DATABASE_UNKNOWN_OK;
|
default_level |= Signature.Level.DATABASE_UNKNOWN_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else GLib.stderr.printf("unrecognized siglevel: %s\n", conf_string);
|
else
|
||||||
|
GLib.stderr.printf("unrecognized siglevel: %s\n", conf_string);
|
||||||
}
|
}
|
||||||
default_level &= ~Signature.Level.USE_DEFAULT;
|
default_level &= ~Signature.Level.USE_DEFAULT;
|
||||||
return default_level;
|
return default_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Signature.Level merge_siglevel (Signature.Level base_level, Signature.Level over_level) {
|
public Signature.Level merge_siglevel (Signature.Level base_level, Signature.Level over_level) {
|
||||||
if ((over_level & Signature.Level.USE_DEFAULT) != 0) over_level = base_level;
|
if ((over_level & Signature.Level.USE_DEFAULT) == 0) {
|
||||||
else {
|
|
||||||
if ((over_level & Signature.Level.PACKAGE_SET) == 0) {
|
if ((over_level & Signature.Level.PACKAGE_SET) == 0) {
|
||||||
over_level |= base_level & Signature.Level.PACKAGE;
|
over_level |= base_level & Signature.Level.PACKAGE;
|
||||||
over_level |= base_level & Signature.Level.PACKAGE_OPTIONAL;
|
over_level |= base_level & Signature.Level.PACKAGE_OPTIONAL;
|
||||||
|
@ -470,7 +470,7 @@ namespace Alpm {
|
|||||||
/** Installed as a dependency for another package. */
|
/** Installed as a dependency for another package. */
|
||||||
DEPEND = 1
|
DEPEND = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Location a package object was loaded from. */
|
/** Location a package object was loaded from. */
|
||||||
[CCode (cname = "alpm_pkgfrom_t", cprefix = "ALPM_PKG_FROM_")]
|
[CCode (cname = "alpm_pkgfrom_t", cprefix = "ALPM_PKG_FROM_")]
|
||||||
public enum From {
|
public enum From {
|
||||||
@ -478,7 +478,7 @@ namespace Alpm {
|
|||||||
LOCALDB,
|
LOCALDB,
|
||||||
SYNCDB
|
SYNCDB
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Method used to validate a package. */
|
/** Method used to validate a package. */
|
||||||
[CCode (cname = "alpm_pkgvalidation_t", cprefix = "ALPM_PKG_VALIDATION_")]
|
[CCode (cname = "alpm_pkgvalidation_t", cprefix = "ALPM_PKG_VALIDATION_")]
|
||||||
public enum Validation {
|
public enum Validation {
|
||||||
@ -670,7 +670,7 @@ namespace Alpm {
|
|||||||
public Status status;
|
public Status status;
|
||||||
public Validity validity;
|
public Validity validity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PGP signature verification options */
|
/** PGP signature verification options */
|
||||||
[CCode (cname = "alpm_siglevel_t", cprefix = "ALPM_SIG_")]
|
[CCode (cname = "alpm_siglevel_t", cprefix = "ALPM_SIG_")]
|
||||||
public enum Level {
|
public enum Level {
|
||||||
@ -678,18 +678,18 @@ namespace Alpm {
|
|||||||
PACKAGE_OPTIONAL = (1 << 1),
|
PACKAGE_OPTIONAL = (1 << 1),
|
||||||
PACKAGE_MARGINAL_OK = (1 << 2),
|
PACKAGE_MARGINAL_OK = (1 << 2),
|
||||||
PACKAGE_UNKNOWN_OK = (1 << 3),
|
PACKAGE_UNKNOWN_OK = (1 << 3),
|
||||||
|
|
||||||
DATABASE = (1 << 10),
|
DATABASE = (1 << 10),
|
||||||
DATABASE_OPTIONAL = (1 << 11),
|
DATABASE_OPTIONAL = (1 << 11),
|
||||||
DATABASE_MARGINAL_OK = (1 << 12),
|
DATABASE_MARGINAL_OK = (1 << 12),
|
||||||
DATABASE_UNKNOWN_OK = (1 << 13),
|
DATABASE_UNKNOWN_OK = (1 << 13),
|
||||||
|
|
||||||
PACKAGE_SET = (1 << 27),
|
PACKAGE_SET = (1 << 27),
|
||||||
PACKAGE_TRUST_SET = (1 << 28),
|
PACKAGE_TRUST_SET = (1 << 28),
|
||||||
|
|
||||||
USE_DEFAULT = (1 << 31)
|
USE_DEFAULT = (1 << 31)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PGP signature verification status return codes */
|
/** PGP signature verification status return codes */
|
||||||
[CCode (cname = "alpm_sigstatus_t", cprefix = "ALPM_SIGSTATUS_")]
|
[CCode (cname = "alpm_sigstatus_t", cprefix = "ALPM_SIGSTATUS_")]
|
||||||
public enum Status {
|
public enum Status {
|
||||||
@ -700,7 +700,7 @@ namespace Alpm {
|
|||||||
KEY_DISABLED,
|
KEY_DISABLED,
|
||||||
INVALID
|
INVALID
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PGP signature verification status return codes */
|
/** PGP signature verification status return codes */
|
||||||
[CCode (cname = "alpm_sigvalidity_t", cprefix = "ALPM_SIGVALIDITY_")]
|
[CCode (cname = "alpm_sigvalidity_t", cprefix = "ALPM_SIGVALIDITY_")]
|
||||||
public enum Validity {
|
public enum Validity {
|
||||||
|
Loading…
Reference in New Issue
Block a user