mirror of
https://github.com/minio/mc.git
synced 2025-11-14 23:42:27 +03:00
Ignore if the keys are still based on default configuration
This commit is contained in:
@@ -83,12 +83,8 @@ func (manager mcClientManager) getSourceReader(sourceURL string, sourceConfig *h
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, "", iodine.New(err, map[string]string{"failedURL": sourceURL})
|
return nil, 0, "", iodine.New(err, map[string]string{"failedURL": sourceURL})
|
||||||
}
|
}
|
||||||
// check if the bucket is valid
|
if _, err := sourceClnt.Stat(); err != nil {
|
||||||
// For object storage URL's do a StatBucket(), not necessary for fs client
|
return nil, 0, "", iodine.New(err, map[string]string{"failedURL": sourceURL})
|
||||||
if client.GetType(sourceURL) != client.Filesystem {
|
|
||||||
if _, err := sourceClnt.Stat(); err != nil {
|
|
||||||
return nil, 0, "", iodine.New(err, map[string]string{"failedURL": sourceURL})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return sourceClnt.Get()
|
return sourceClnt.Get()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,12 +34,6 @@ import (
|
|||||||
"github.com/minio-io/minio/pkg/utils/log"
|
"github.com/minio-io/minio/pkg/utils/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
mcConfigDir = ".mc/"
|
|
||||||
mcConfigWindowsDir = "mc/"
|
|
||||||
mcConfigFile = "config.json"
|
|
||||||
)
|
|
||||||
|
|
||||||
type hostConfig struct {
|
type hostConfig struct {
|
||||||
AccessKeyID string
|
AccessKeyID string
|
||||||
SecretAccessKey string
|
SecretAccessKey string
|
||||||
@@ -51,21 +45,6 @@ type configV1 struct {
|
|||||||
Hosts map[string]*hostConfig
|
Hosts map[string]*hostConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
mcCurrentConfigVersion = "1.0.0"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// do not pass accesskeyid and secretaccesskey through cli
|
|
||||||
// users should manually edit them, add a stub entry
|
|
||||||
globalAccessKeyID = "YOUR-ACCESS-KEY-ID-HERE"
|
|
||||||
globalSecretAccessKey = "YOUR-SECRET-ACCESS-KEY-HERE"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
exampleHostURL = "YOUR-EXAMPLE.COM"
|
|
||||||
)
|
|
||||||
|
|
||||||
func getMcConfigDir() (string, error) {
|
func getMcConfigDir() (string, error) {
|
||||||
u, err := user.Current()
|
u, err := user.Current()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -292,8 +271,10 @@ func getHostConfig(requestURL string) (*hostConfig, error) {
|
|||||||
return nil, iodine.New(errInvalidAuth{}, nil)
|
return nil, iodine.New(errInvalidAuth{}, nil)
|
||||||
}
|
}
|
||||||
// verify Auth key validity for all hosts
|
// verify Auth key validity for all hosts
|
||||||
if !client.IsValidAccessKey(hostCfg.AccessKeyID) || !client.IsValidSecretKey(hostCfg.SecretAccessKey) {
|
if hostCfg.AccessKeyID != globalAccessKeyID && hostCfg.SecretAccessKey != globalSecretAccessKey {
|
||||||
return nil, iodine.New(errInvalidAuthKeys{}, nil)
|
if !client.IsValidAccessKey(hostCfg.AccessKeyID) || !client.IsValidSecretKey(hostCfg.SecretAccessKey) {
|
||||||
|
return nil, iodine.New(errInvalidAuthKeys{}, nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return hostCfg, nil
|
return hostCfg, nil
|
||||||
}
|
}
|
||||||
|
|||||||
19
globals.go
19
globals.go
@@ -29,4 +29,23 @@ var (
|
|||||||
|
|
||||||
mcUserAgent = "Minio/" +
|
mcUserAgent = "Minio/" +
|
||||||
Version + " (" + os.Args[0] + "; " + runtime.GOOS + "; " + runtime.GOARCH + ")"
|
Version + " (" + os.Args[0] + "; " + runtime.GOOS + "; " + runtime.GOARCH + ")"
|
||||||
|
|
||||||
|
mcCurrentConfigVersion = "1.0.0"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
mcConfigDir = ".mc/"
|
||||||
|
mcConfigWindowsDir = "mc/"
|
||||||
|
mcConfigFile = "config.json"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// do not pass accesskeyid and secretaccesskey through cli
|
||||||
|
// users should manually edit them, add a stub entry
|
||||||
|
globalAccessKeyID = "YOUR-ACCESS-KEY-ID-HERE"
|
||||||
|
globalSecretAccessKey = "YOUR-SECRET-ACCESS-KEY-HERE"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
exampleHostURL = "YOUR-EXAMPLE.COM"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user