lib/packetgen/plugin/smb/ntcreateandx/request.rb in packetgen-plugin-smb-0.6.1 vs lib/packetgen/plugin/smb/ntcreateandx/request.rb in packetgen-plugin-smb-0.6.2
- old
+ new
@@ -1,12 +1,12 @@
+# frozen_string_literal: true
+
# This file is part of packetgen-plugin-smb.
# See https://github.com/sdaubert/packetgen-plugin-smb for more informations
# Copyright (C) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
# This program is published under MIT license.
-# frozen_string_literal: true
-
module PacketGen::Plugin
class SMB
# Namespace for NT_CREATE_ANDX related classes
module NtCreateAndX
# SMB Command NtCreateAndX request.
@@ -126,11 +126,11 @@
define_field :byte_count, PacketGen::Types::Int16le
# @!attribute pad1
# Padding before {#filename} to align it on 16-bit boundary. Only present
# if {SMB#flags2_unicode?} is +true+.
# @return [Integer]
- define_field :pad1, PacketGen::Types::Int8, optional: ->(h) { h.packet && h.packet.smb.flags2_unicode? }
+ define_field :pad1, PacketGen::Types::Int8, optional: ->(h) { h&.packet&.smb&.flags2_unicode? }
# @!attribute filename
# A string that represents the fully qualified name of the file
# relative to the supplied TID
# @return [String]
define_field :filename, SMB::String, builder: ->(h, t) { t.new(unicode: !h.packet || h.packet.smb.flags2_unicode?) }
@@ -152,8 +152,8 @@
pad1sz = self.present?(:pad1) ? 1 : 0
bcount = pad1sz + filename_len + self[:extra_bytes].sz
self.byte_count = bcount
end
end
- end
+ end
end
end