Skip to content

Commit 58638bd

Browse files
committed
Revert "Clean password from non-printable chars"
This reverts commit 990ee19.
1 parent 7203224 commit 58638bd

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

internal/openstack/service_client.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,11 @@ import (
2222
"os"
2323
"os/exec"
2424
"strings"
25-
"unicode"
2625

2726
"github.com/gophercloud/gophercloud/v2"
2827
"github.com/gophercloud/utils/v2/openstack/clientconfig"
2928
)
3029

31-
func cleanPassword(password string) string {
32-
return strings.Map(func(r rune) rune {
33-
if unicode.IsGraphic(r) {
34-
return r
35-
}
36-
return -1
37-
}, password)
38-
}
39-
4030
// GetServiceClient returns an gophercloud ServiceClient for the given serviceType.
4131
func GetServiceClient(ctx context.Context, serviceType string) (*gophercloud.ServiceClient, error) {
4232
var authInfo *clientconfig.AuthInfo
@@ -48,7 +38,7 @@ func GetServiceClient(ctx context.Context, serviceType string) (*gophercloud.Ser
4838
return nil, err
4939
}
5040
authInfo = &clientconfig.AuthInfo{
51-
Password: cleanPassword(string(out))}
41+
Password: strings.TrimSuffix(string(out), "\n")}
5242
}
5343

5444
return GetServiceClientAuth(ctx, serviceType, authInfo)
@@ -57,8 +47,7 @@ func GetServiceClient(ctx context.Context, serviceType string) (*gophercloud.Ser
5747
// GetServiceClient returns an gophercloud ServiceClient for the given serviceType.
5848
func GetServiceClientAuth(ctx context.Context, serviceType string, authInfo *clientconfig.AuthInfo) (*gophercloud.ServiceClient, error) {
5949
if authInfo == nil {
60-
password := cleanPassword(os.Getenv("OS_PASSWORD"))
61-
authInfo = &clientconfig.AuthInfo{Password: password}
50+
authInfo = &clientconfig.AuthInfo{}
6251
}
6352
authInfo.AllowReauth = true
6453

0 commit comments

Comments
 (0)