1
0
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:
Harshavardhana
2015-04-23 21:00:54 -07:00
parent ac26070fed
commit 34d2ca98a3
3 changed files with 25 additions and 29 deletions

View File

@@ -83,13 +83,9 @@ func (manager mcClientManager) getSourceReader(sourceURL string, sourceConfig *h
if err != nil {
return nil, 0, "", iodine.New(err, map[string]string{"failedURL": sourceURL})
}
// check if the bucket is valid
// For object storage URL's do a StatBucket(), not necessary for fs client
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()
}

View File

@@ -34,12 +34,6 @@ import (
"github.com/minio-io/minio/pkg/utils/log"
)
const (
mcConfigDir = ".mc/"
mcConfigWindowsDir = "mc/"
mcConfigFile = "config.json"
)
type hostConfig struct {
AccessKeyID string
SecretAccessKey string
@@ -51,21 +45,6 @@ type configV1 struct {
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) {
u, err := user.Current()
if err != nil {
@@ -292,9 +271,11 @@ func getHostConfig(requestURL string) (*hostConfig, error) {
return nil, iodine.New(errInvalidAuth{}, nil)
}
// verify Auth key validity for all hosts
if hostCfg.AccessKeyID != globalAccessKeyID && hostCfg.SecretAccessKey != globalSecretAccessKey {
if !client.IsValidAccessKey(hostCfg.AccessKeyID) || !client.IsValidSecretKey(hostCfg.SecretAccessKey) {
return nil, iodine.New(errInvalidAuthKeys{}, nil)
}
}
return hostCfg, nil
}
}

View File

@@ -29,4 +29,23 @@ var (
mcUserAgent = "Minio/" +
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"
)