mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Ensure usernames with at symbols handled (#1558)
Domain usernames may use '@' as part of the username, which requires encoding to be able to be used within an URI.
This commit is contained in:
@@ -782,7 +782,7 @@ module VagrantPlugins
|
||||
finalize_id_ssh_key_file
|
||||
|
||||
uri += '+ssh://'
|
||||
uri += "#{@username}@" if @username && @username != UNSET_VALUE
|
||||
uri += "#{URI.encode_www_form_component(@username)}@" if @username && @username != UNSET_VALUE
|
||||
|
||||
uri += (@host && @host != UNSET_VALUE ? @host : 'localhost')
|
||||
|
||||
|
||||
@@ -197,6 +197,13 @@ describe VagrantPlugins::ProviderLibvirt::Config do
|
||||
:env => {'LIBVIRT_DEFAULT_URI' => 'qemu:///custom'},
|
||||
}
|
||||
],
|
||||
[ # when username explicitly set with @ symbol for domains
|
||||
{:username => 'my_user@my_domain', :host => 'remote'},
|
||||
{:uri => %r{qemu://remote/(system|session)}, :username => 'my_user@my_domain'},
|
||||
{
|
||||
:env => {'LIBVIRT_DEFAULT_URI' => 'qemu:///custom'},
|
||||
}
|
||||
],
|
||||
[ # when username explicitly set with host but without ssh
|
||||
{:username => 'my_user', :host => 'remote'},
|
||||
{:uri => %r{qemu://remote/(system|session)}, :username => 'my_user'},
|
||||
|
||||
Reference in New Issue
Block a user