Class: Yast::SignatureCheckCallbacksClass

Inherits:
Module
  • Object
show all
Defined in:
../../src/modules/SignatureCheckCallbacks.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) AcceptFileWithoutChecksum(filename)

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()



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File '../../src/modules/SignatureCheckCallbacks.rb', line 95

def AcceptFileWithoutChecksum(filename)
  # Check signatures at all?
  if SignatureCheckDialogs.CheckSignaturesInYaST == false
    return @default_return_unchecked
  end

  dont_show_dialog_ident = "-AcceptFileWithoutChecksum-"

  # Show the popup?
  if SignatureCheckDialogs.GetShowThisPopup(
      dont_show_dialog_ident,
      filename
    )
    return SignatureCheckDialogs.UseItemWithNoChecksum(
      :file,
      filename,
      dont_show_dialog_ident
    ) 
    # Return the default value entered by user
  else
    return SignatureCheckDialogs.GetDefaultDialogReturn(
      dont_show_dialog_ident,
      filename
    )
  end
end

- (Object) AcceptUnknownDigest(filename, digest)

zypp: askUserToAccepUnknownDigest



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File '../../src/modules/SignatureCheckCallbacks.rb', line 158

def AcceptUnknownDigest(filename, digest)
  # Check signatures at all?
  if SignatureCheckDialogs.CheckSignaturesInYaST == false
    return @default_return_unchecked
  end

  dont_show_dialog_ident = "-AcceptUnknownDigest-"

  # Show the popup?
  if SignatureCheckDialogs.GetShowThisPopup(
      dont_show_dialog_ident,
      filename
    )
    return SignatureCheckDialogs.UseFileWithUnknownDigest(
      filename,
      digest,
      dont_show_dialog_ident
    )
  else
    # Return the default value entered by user
    return SignatureCheckDialogs.GetDefaultDialogReturn(
      dont_show_dialog_ident,
      filename
    )
  end
end

- (Object) AcceptUnknownGpgKey(filename, keyid, repoid)

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()



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File '../../src/modules/SignatureCheckCallbacks.rb', line 196

def AcceptUnknownGpgKey(filename, keyid, repoid)
  # Check signatures at all?
  if SignatureCheckDialogs.CheckSignaturesInYaST == false
    return @default_return_unchecked
  end

  dont_show_dialog_ident = "-AcceptUnknownGpgKey-"

  # Show the popup?
  if SignatureCheckDialogs.GetShowThisPopup(
      dont_show_dialog_ident,
      filename
    )
    # Unknown keyname == "Unknown Key"
    return SignatureCheckDialogs.ItemSignedWithUnknownSignature(
      :file,
      filename,
      keyid,
      dont_show_dialog_ident,
      repoid
    ) 
    # Return the default value entered by user
  else
    return SignatureCheckDialogs.GetDefaultDialogReturn(
      dont_show_dialog_ident,
      filename
    )
  end
end

- (Object) AcceptUnsignedFile(filename, repo_id)

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
82
83
# File '../../src/modules/SignatureCheckCallbacks.rb', line 57

def AcceptUnsignedFile(filename, repo_id)
  # Check signatures at all?
  if SignatureCheckDialogs.CheckSignaturesInYaST == false
    return @default_return_unchecked
  end

  dont_show_dialog_ident = "-AcceptUnsignedFile-"

  # Show the popup?
  if SignatureCheckDialogs.GetShowThisPopup(
      dont_show_dialog_ident,
      filename
    )
    return SignatureCheckDialogs.UseUnsignedItem(
      :file,
      filename,
      dont_show_dialog_ident,
      repo_id
    ) 
    # Return the default value entered by user
  else
    return SignatureCheckDialogs.GetDefaultDialogReturn(
      dont_show_dialog_ident,
      filename
    )
  end
end

- (Object) AcceptVerificationFailed(filename, key, repo_id)

Name of the callback handler function. Required callback prototype is boolean(string filename, map<string,any> key). The callback function should ask user whether the unsigned file can be accepted, returned true value means to accept the file.

zypp: askUserToAcceptVerificationFailed

function for CallbackAcceptVerificationFailed()



252
253
254
255
256
257
258
259
260
# File '../../src/modules/SignatureCheckCallbacks.rb', line 252

def AcceptVerificationFailed(filename, key, repo_id)
  key = deep_copy(key)
  # Check signatures at all?
  if SignatureCheckDialogs.CheckSignaturesInYaST == false
    return @default_return_unchecked
  end

  SignatureCheckDialogs.UseCorruptedItem(:file, filename, key, repo_id)
end

- (Boolean) AcceptWrongDigest(filename, requested_digest, found_digest)

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

Returns:

  • (Boolean)


126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File '../../src/modules/SignatureCheckCallbacks.rb', line 126

def AcceptWrongDigest(filename, requested_digest, found_digest)
  # Check signatures at all?
  if SignatureCheckDialogs.CheckSignaturesInYaST == false
    return @default_return_unchecked
  end

  dont_show_dialog_ident = "-AcceptWrongDigest-"

  # Show the popup?
  if SignatureCheckDialogs.GetShowThisPopup(
      dont_show_dialog_ident,
      filename
    )
    return SignatureCheckDialogs.UseFileWithWrongDigest(
      filename,
      requested_digest,
      found_digest,
      dont_show_dialog_ident
    )
  else
    # Return the default value entered by user
    return SignatureCheckDialogs.GetDefaultDialogReturn(
      dont_show_dialog_ident,
      filename
    )
  end
end

- (Object) ImportGpgKey(key, repo_id)

Name of the callback handler function. Required callback prototype is boolean(map<string,any> key). The callback function should ask user whether the key is trusted, returned true value means the key is trusted.

zypp: askUserToImportKey

function for CallbackImportGpgKey()



234
235
236
237
238
239
240
241
242
# File '../../src/modules/SignatureCheckCallbacks.rb', line 234

def ImportGpgKey(key, repo_id)
  key = deep_copy(key)
  # Check signatures at all?
  if SignatureCheckDialogs.CheckSignaturesInYaST == false
    return @default_return_unchecked
  end

  SignatureCheckDialogs.ImportGPGKeyIntoTrustedDialog(key, repo_id)
end

- (Object) main



34
35
36
37
38
39
40
41
42
43
# File '../../src/modules/SignatureCheckCallbacks.rb', line 34

def main
  textdomain "base"

  Yast.import "SignatureCheckDialogs"


  # Default return when signatures shouldn't be checked
  # @see #SignatureCheckDialogs::CheckSignaturesInYaST()
  @default_return_unchecked = true
end

- (Object) TrustedKeyAdded(key)

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()



269
270
271
272
273
274
275
276
277
278
# File '../../src/modules/SignatureCheckCallbacks.rb', line 269

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

- (Object) TrustedKeyRemoved(key)

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()



285
286
287
288
289
290
291
292
293
294
# File '../../src/modules/SignatureCheckCallbacks.rb', line 285

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