CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/proto/kerberos/pac/error.rb
Views: 11766
1
# frozen_string_literal: true
2
3
module Rex
4
module Proto
5
module Kerberos
6
module Pac
7
module Error
8
# Generic Pac Error
9
class PacError < StandardError
10
def initialize(msg = 'Invalid PAC')
11
super
12
end
13
end
14
15
# To be raised when a PAC object does not contain one or more specific Info Buffers
16
class MissingInfoBuffer < PacError
17
18
# @return [Array<Integer>] The ul types of the missing info buffers
19
attr_accessor :ul_types
20
21
# @param [String, nil] msg
22
# @param [Array<Integer>] ul_types The ul types of the missing info buffers.
23
def initialize(msg = nil, ul_types:)
24
@ul_types = ul_types
25
super(msg || generate_message)
26
end
27
28
# @return [String] A message created containing the names of the missing buffers.
29
def generate_message
30
missing_buffer_names = @ul_types.map do |ul_type|
31
Rex::Proto::Kerberos::Pac::Krb5PacElementType.const_name(ul_type)
32
end
33
"Missing Info Buffer(s): #{missing_buffer_names.join(', ')}"
34
end
35
end
36
end
37
end
38
end
39
end
40
end
41
42