From 7e3e24b3944cb59996a812a4134e3e3de41127e9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 20 Aug 2016 23:10:08 -0700 Subject: [PATCH] rpc: client login should ignore server versions. --- cmd/api-errors.go | 2 +- cmd/routers.go | 4 +++- cmd/storage-rpc-client.go | 13 +++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cmd/api-errors.go b/cmd/api-errors.go index 760dba2a7..1c7d5b293 100644 --- a/cmd/api-errors.go +++ b/cmd/api-errors.go @@ -455,7 +455,7 @@ var errorCodeResponse = map[APIErrorCode]APIError{ Description: "Request is not valid yet", HTTPStatusCode: http.StatusForbidden, }, - // FIXME: Actual XML error response also contains the header which missed in lsit of signed header parameters. + // FIXME: Actual XML error response also contains the header which missed in list of signed header parameters. ErrUnsignedHeaders: { Code: "AccessDenied", Description: "There were headers present in the request which were not signed", diff --git a/cmd/routers.go b/cmd/routers.go index 74b76489b..ce29b664b 100644 --- a/cmd/routers.go +++ b/cmd/routers.go @@ -32,7 +32,6 @@ func newObjectLayer(disks, ignoredDisks []string) (ObjectLayer, error) { // Initialize FS object layer. return newFSObjects(exportPath) } - // TODO: use dsync to block other concurrently booting up nodes. // Initialize XL object layer. objAPI, err := newXLObjects(disks, ignoredDisks) if err == errXLWriteQuorum { @@ -56,6 +55,8 @@ func newObjectLayerFactory(disks, ignoredDisks []string) func() ObjectLayer { defer nsMutex.Unlock(minioMetaBucket, formatConfigFile) objAPI, err = newObjectLayer(disks, ignoredDisks) if err != nil { + errorIf(err, "Unable to initialize object layer.") + // Purposefully do not return error, just return nil. return nil } // Migrate bucket policy from configDir to .minio.sys/buckets/ @@ -81,6 +82,7 @@ func newObjectLayerFactory(disks, ignoredDisks []string) func() ObjectLayer { err = initBucketPolicies(objAPI) fatalIf(err, "Unable to load all bucket policies") + // Success. return objAPI } } diff --git a/cmd/storage-rpc-client.go b/cmd/storage-rpc-client.go index 7c9979ce3..0fc6973ff 100644 --- a/cmd/storage-rpc-client.go +++ b/cmd/storage-rpc-client.go @@ -17,7 +17,6 @@ package cmd import ( - "errors" "io" "path" "strconv" @@ -88,9 +87,6 @@ func loginRPCClient(rpcClient *RPCClient) (tokenStr string, err error) { }, &reply); err != nil { return "", err } - if reply.ServerVersion != Version { - return "", errors.New("Server version mismatch") - } // Reply back server provided token. return reply.Token, nil } @@ -102,7 +98,7 @@ func newRPCClient(networkPath string) (StorageAPI, error) { return nil, errInvalidArgument } - // TODO validate netAddr and netPath. + // Split network path into its components. netAddr, netPath, err := splitNetPath(networkPath) if err != nil { return nil, err @@ -125,7 +121,12 @@ func newRPCClient(networkPath string) (StorageAPI, error) { // Initialize network storage. ndisk := &networkStorage{ - netScheme: "http", // TODO: fix for ssl rpc support. + netScheme: func() string { + if !isSSL() { + return "http" + } + return "https" + }(), netAddr: netAddr, netPath: netPath, rpcClient: rpcClient,