win32/sspi: Use `start_with?` to see prefix

This commit is contained in:
Nobuyoshi Nakada 2024-05-03 22:48:41 +09:00
Родитель 25eb9bded8
Коммит f5d9d9b5f8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3582D74E1FEE4465
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -283,12 +283,12 @@ module Win32
# Nil token OK, just set it to empty string # Nil token OK, just set it to empty string
token = "" if token.nil? token = "" if token.nil?
if token.include? "Negotiate" if token.start_with? "Negotiate"
# If the Negotiate prefix is passed in, assume we are seeing "Negotiate <token>" and get the token. # If the Negotiate prefix is passed in, assume we are seeing "Negotiate <token>" and get the token.
token = token.split(" ").last token = token.split(" ", 2).last
end end
if token.include? B64_TOKEN_PREFIX if token.start_with? B64_TOKEN_PREFIX
# indicates base64 encoded token # indicates base64 encoded token
token = token.strip.unpack1("m") token = token.strip.unpack1("m")
end end
@ -309,7 +309,7 @@ module Win32
clean_up unless @cleaned_up clean_up unless @cleaned_up
end end
private private
def clean_up def clean_up
# free structures allocated # free structures allocated