Class: Yast::SignatureCheckCallbacksClass
- Inherits:
-
Module
- Object
- Module
- Yast::SignatureCheckCallbacksClass
- Includes:
- Logger
- Defined in:
- library/packages/src/modules/SignatureCheckCallbacks.rb
Instance Method Summary collapse
-
#AcceptFileWithoutChecksum(filename) ⇒ Object
Name of the callback handler function.
-
#AcceptUnknownDigest(filename, digest) ⇒ Object
zypp: askUserToAccepUnknownDigest.
-
#AcceptUnknownGpgKey(filename, keyid, repoid) ⇒ Object
Name of the callback handler function.
-
#AcceptUnsignedFile(filename, repo_id) ⇒ Object
Name of the callback handler function.
-
#AcceptVerificationFailed(filename, key, repo_id) ⇒ Object
Name of the callback handler function.
-
#AcceptWrongDigest(filename, requested_digest, found_digest) ⇒ Boolean
Callback handler function.
-
#import_gpg_key_or_disable(key, repo_id) ⇒ Object
Alternative implementation of #ImportGpgKey, used during installation, that disables the repository if the key is not trusted and enables it otherwise (a single call to Pkg.ServiceRefresh asks the user several times for the same repository, last decision must prevail).
-
#ImportGpgKey(key, repo_id) ⇒ Object
Name of the callback handler function.
- #main ⇒ Object
-
#TrustedKeyAdded(key) ⇒ Object
Name of the callback handler function.
-
#TrustedKeyRemoved(key) ⇒ Object
Name of the callback handler function.
Instance Method Details
#AcceptFileWithoutChecksum(filename) ⇒ Object
Name of the callback handler function. Required callback prototype is boolean(string filename) The callback function should ask user whether the unsigned file can be accepted, returned true value means to accept the file.
zypp: askUserToAcceptNoDigest
(+DontShowAgain functionality) -- for one run in memory
function for CallbackAcceptFileWithoutChecksum()
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 92 def AcceptFileWithoutChecksum(filename) # Check signatures at all? return @default_return_unchecked if SignatureCheckDialogs.CheckSignaturesInYaST == false dont_show_dialog_ident = "-AcceptFileWithoutChecksum-" # Show the popup? if SignatureCheckDialogs.GetShowThisPopup( dont_show_dialog_ident, filename ) SignatureCheckDialogs.UseItemWithNoChecksum( :file, filename, dont_show_dialog_ident ) # Return the default value entered by user else SignatureCheckDialogs.GetDefaultDialogReturn( dont_show_dialog_ident, filename ) end end |
#AcceptUnknownDigest(filename, digest) ⇒ Object
zypp: askUserToAccepUnknownDigest
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 150 def AcceptUnknownDigest(filename, digest) # Check signatures at all? return @default_return_unchecked if SignatureCheckDialogs.CheckSignaturesInYaST == false dont_show_dialog_ident = "-AcceptUnknownDigest-" # Show the popup? if SignatureCheckDialogs.GetShowThisPopup( dont_show_dialog_ident, filename ) SignatureCheckDialogs.UseFileWithUnknownDigest( filename, digest, dont_show_dialog_ident ) else # Return the default value entered by user SignatureCheckDialogs.GetDefaultDialogReturn( dont_show_dialog_ident, filename ) end end |
#AcceptUnknownGpgKey(filename, keyid, repoid) ⇒ Object
Name of the callback handler function. Required callback prototype is boolean(string filename, string keyid, string keyname). The callback function should ask user whether the unknown key can be accepted, returned true value means to accept the file.
zypp: askUserToAcceptUnknownKey
(+DontShowAgain functionality) -- for one run in memory
function for CallbackAcceptUnknownGpgKey()
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 185 def AcceptUnknownGpgKey(filename, keyid, repoid) # Check signatures at all? return @default_return_unchecked if SignatureCheckDialogs.CheckSignaturesInYaST == false dont_show_dialog_ident = "-AcceptUnknownGpgKey-" # Show the popup? if SignatureCheckDialogs.GetShowThisPopup( dont_show_dialog_ident, filename ) # Unknown keyname == "Unknown Key" SignatureCheckDialogs.ItemSignedWithUnknownSignature( :file, filename, keyid, dont_show_dialog_ident, repoid ) # Return the default value entered by user else SignatureCheckDialogs.GetDefaultDialogReturn( dont_show_dialog_ident, filename ) end end |
#AcceptUnsignedFile(filename, repo_id) ⇒ Object
Name of the callback handler function. Required callback prototype is boolean(string filename). The callback function should ask user whether the unsigned file can be accepted, returned true value means to accept the file.
zypp: askUserToAcceptUnsignedFile
(+DontShowAgain functionality) -- for one run in memory
function for CallbackAcceptUnsignedFile()
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 57 def AcceptUnsignedFile(filename, repo_id) # Check signatures at all? return @default_return_unchecked if SignatureCheckDialogs.CheckSignaturesInYaST == false dont_show_dialog_ident = "-AcceptUnsignedFile-" # Show the popup? if SignatureCheckDialogs.GetShowThisPopup( dont_show_dialog_ident, filename ) SignatureCheckDialogs.UseUnsignedItem( :file, filename, dont_show_dialog_ident, repo_id ) # Return the default value entered by user else SignatureCheckDialogs.GetDefaultDialogReturn( dont_show_dialog_ident, filename ) end end |
#AcceptVerificationFailed(filename, key, repo_id) ⇒ Object
Name of the callback handler function. Required callback prototype is
boolean(string filename, map
zypp: askUserToAcceptVerificationFailed
function for CallbackAcceptVerificationFailed()
252 253 254 255 256 257 258 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 252 def AcceptVerificationFailed(filename, key, repo_id) key = deep_copy(key) # Check signatures at all? return @default_return_unchecked if SignatureCheckDialogs.CheckSignaturesInYaST == false SignatureCheckDialogs.UseCorruptedItem(:file, filename, key, repo_id) end |
#AcceptWrongDigest(filename, requested_digest, found_digest) ⇒ Boolean
Callback handler function. Required callback prototype is boolean(string filename, string requested_digest, string found_digest)
. The callback function should ask user whether the wrong digest can be accepted, returned true value means to accept the file.
zypp: askUserToAcceptWrongDigest
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 120 def AcceptWrongDigest(filename, requested_digest, found_digest) # Check signatures at all? return @default_return_unchecked if SignatureCheckDialogs.CheckSignaturesInYaST == false dont_show_dialog_ident = "-AcceptWrongDigest-" # Show the popup? if SignatureCheckDialogs.GetShowThisPopup( dont_show_dialog_ident, filename ) SignatureCheckDialogs.UseFileWithWrongDigest( filename, requested_digest, found_digest, dont_show_dialog_ident ) else # Return the default value entered by user SignatureCheckDialogs.GetDefaultDialogReturn( dont_show_dialog_ident, filename ) end end |
#import_gpg_key_or_disable(key, repo_id) ⇒ Object
Alternative implementation of #ImportGpgKey, used during installation, that disables the repository if the key is not trusted and enables it otherwise (a single call to Pkg.ServiceRefresh asks the user several times for the same repository, last decision must prevail).
zypp: askUserToImportKey
function for CallbackImportGpgKey()
237 238 239 240 241 242 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 237 def import_gpg_key_or_disable(key, repo_id) trusted = ImportGpgKey(key, repo_id) log.info "Setting enabled to #{trusted} for repo #{repo_id}, due to user reply to ImportGpgKey" Pkg.SourceSetEnabled(repo_id, trusted) trusted end |
#ImportGpgKey(key, repo_id) ⇒ Object
Name of the callback handler function. Required callback prototype is
boolean(map
zypp: askUserToImportKey
function for CallbackImportGpgKey()
221 222 223 224 225 226 227 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 221 def ImportGpgKey(key, repo_id) key = deep_copy(key) # Check signatures at all? return @default_return_unchecked if SignatureCheckDialogs.CheckSignaturesInYaST == false SignatureCheckDialogs.ImportGPGKeyIntoTrustedDialog(key, repo_id) end |
#main ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 34 def main textdomain "base" Yast.import "SignatureCheckDialogs" Yast.import "Pkg" # Default return when signatures shouldn't be checked # @see #SignatureCheckDialogs::CheckSignaturesInYaST() @default_return_unchecked = true end |
#TrustedKeyAdded(key) ⇒ Object
Name of the callback handler function. Required callback prototype is void (string keyid, string keyname). The callback function should inform user that a trusted key has been added.
function for CallbackTrustedKeyAdded()
267 268 269 270 271 272 273 274 275 276 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 267 def TrustedKeyAdded(key) key = deep_copy(key) Builtins.y2milestone( "Trusted key has been added: %1 / %2 (%3)", Ops.get_string(key, "id", ""), Ops.get_string(key, "fingerprint", ""), Ops.get_string(key, "name", "") ) nil end |
#TrustedKeyRemoved(key) ⇒ Object
Name of the callback handler function. Required callback prototype is void (string keyid, string keyname). The callback function should inform user that a trusted key has been removed.
function for CallbackTrustedKeyRemoved()
283 284 285 286 287 288 289 290 291 292 |
# File 'library/packages/src/modules/SignatureCheckCallbacks.rb', line 283 def TrustedKeyRemoved(key) key = deep_copy(key) Builtins.y2milestone( "Trusted key has been removed: %1 / %2 (%3)", Ops.get_string(key, "id", ""), Ops.get_string(key, "fingerprint", ""), Ops.get_string(key, "name", "") ) nil end |