podman image scp syntax correction
[NO NEW TESTS NEEDED] image scp was reading the localhost syntax too loosely causing some errors with domains or hosts containing the word localhost. Fixed that and added a few lines to make sure the pure localhost connections do not touch sshd resolves #13021 Signed-off-by: cdoern <cdoern@redhat.com>
This commit is contained in:
parent
7fc8bf4a42
commit
56d95172f1
|
|
@ -147,6 +147,17 @@ func scp(cmd *cobra.Command, args []string) (finalErr error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allLocal := true // if we are all localhost, do not validate connections but if we are using one localhost and one non we need to use sshd
|
||||||
|
for _, val := range cliConnections {
|
||||||
|
if !strings.Contains(val, "@localhost::") {
|
||||||
|
allLocal = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if allLocal {
|
||||||
|
cliConnections = []string{}
|
||||||
|
}
|
||||||
|
|
||||||
var serv map[string]config.Destination
|
var serv map[string]config.Destination
|
||||||
serv, err = GetServiceInformation(cliConnections, cfg)
|
serv, err = GetServiceInformation(cliConnections, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,13 @@ func parseImageSCPArg(arg string) (*entities.ImageScpOptions, []string, error) {
|
||||||
cliConnections := []string{}
|
cliConnections := []string{}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case strings.Contains(arg, "@localhost"): // image transfer between users
|
case strings.Contains(arg, "@localhost::"): // image transfer between users
|
||||||
location.User = strings.Split(arg, "@")[0]
|
location.User = strings.Split(arg, "@")[0]
|
||||||
location, err = validateImagePortion(location, arg)
|
location, err = validateImagePortion(location, arg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
cliConnections = append(cliConnections, arg)
|
||||||
case strings.Contains(arg, "::"):
|
case strings.Contains(arg, "::"):
|
||||||
location, err = validateImagePortion(location, arg)
|
location, err = validateImagePortion(location, arg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue