mirror of
https://github.com/minio/minio.git
synced 2025-04-16 17:00:07 -04:00
Ignore region in the case of admin API (#5919)
Admin API is not an S3 API and hence it is not required to honor server region while validating admin API calls. Fixes #2411
This commit is contained in:
parent
6a8bfcef1c
commit
c0cfe21c00
@ -66,7 +66,7 @@ var (
|
|||||||
// -----------
|
// -----------
|
||||||
// Returns Administration API version
|
// Returns Administration API version
|
||||||
func (a adminAPIHandlers) VersionHandler(w http.ResponseWriter, r *http.Request) {
|
func (a adminAPIHandlers) VersionHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
adminAPIErr := checkAdminRequestAuthType(r, globalServerConfig.GetRegion())
|
adminAPIErr := checkAdminRequestAuthType(r, "")
|
||||||
if adminAPIErr != ErrNone {
|
if adminAPIErr != ErrNone {
|
||||||
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
||||||
return
|
return
|
||||||
@ -86,7 +86,7 @@ func (a adminAPIHandlers) VersionHandler(w http.ResponseWriter, r *http.Request)
|
|||||||
// ----------
|
// ----------
|
||||||
// Returns server version and uptime.
|
// Returns server version and uptime.
|
||||||
func (a adminAPIHandlers) ServiceStatusHandler(w http.ResponseWriter, r *http.Request) {
|
func (a adminAPIHandlers) ServiceStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
adminAPIErr := checkAdminRequestAuthType(r, globalServerConfig.GetRegion())
|
adminAPIErr := checkAdminRequestAuthType(r, "")
|
||||||
if adminAPIErr != ErrNone {
|
if adminAPIErr != ErrNone {
|
||||||
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
||||||
return
|
return
|
||||||
@ -131,7 +131,7 @@ func (a adminAPIHandlers) ServiceStatusHandler(w http.ResponseWriter, r *http.Re
|
|||||||
// Restarts/Stops minio server gracefully. In a distributed setup,
|
// Restarts/Stops minio server gracefully. In a distributed setup,
|
||||||
// restarts all the servers in the cluster.
|
// restarts all the servers in the cluster.
|
||||||
func (a adminAPIHandlers) ServiceStopNRestartHandler(w http.ResponseWriter, r *http.Request) {
|
func (a adminAPIHandlers) ServiceStopNRestartHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
adminAPIErr := checkAdminRequestAuthType(r, globalServerConfig.GetRegion())
|
adminAPIErr := checkAdminRequestAuthType(r, "")
|
||||||
if adminAPIErr != ErrNone {
|
if adminAPIErr != ErrNone {
|
||||||
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
||||||
return
|
return
|
||||||
@ -223,7 +223,9 @@ type ServerInfo struct {
|
|||||||
// Get server information
|
// Get server information
|
||||||
func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Request) {
|
func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// Authenticate request
|
// Authenticate request
|
||||||
adminAPIErr := checkAdminRequestAuthType(r, globalServerConfig.GetRegion())
|
|
||||||
|
// Setting the region as empty so as the mc server info command is irrespective to the region.
|
||||||
|
adminAPIErr := checkAdminRequestAuthType(r, "")
|
||||||
if adminAPIErr != ErrNone {
|
if adminAPIErr != ErrNone {
|
||||||
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
||||||
return
|
return
|
||||||
@ -312,7 +314,7 @@ func validateLockQueryParams(vars url.Values) (string, string, time.Duration,
|
|||||||
// Lists locks held on a given bucket, prefix and duration it was held for.
|
// Lists locks held on a given bucket, prefix and duration it was held for.
|
||||||
func (a adminAPIHandlers) ListLocksHandler(w http.ResponseWriter, r *http.Request) {
|
func (a adminAPIHandlers) ListLocksHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
adminAPIErr := checkAdminRequestAuthType(r, globalServerConfig.GetRegion())
|
adminAPIErr := checkAdminRequestAuthType(r, "")
|
||||||
if adminAPIErr != ErrNone {
|
if adminAPIErr != ErrNone {
|
||||||
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
||||||
return
|
return
|
||||||
@ -363,7 +365,7 @@ func (a adminAPIHandlers) ClearLocksHandler(w http.ResponseWriter, r *http.Reque
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
adminAPIErr := checkAdminRequestAuthType(r, globalServerConfig.GetRegion())
|
adminAPIErr := checkAdminRequestAuthType(r, "")
|
||||||
if adminAPIErr != ErrNone {
|
if adminAPIErr != ErrNone {
|
||||||
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
||||||
return
|
return
|
||||||
@ -569,7 +571,7 @@ func (a adminAPIHandlers) HealHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
// Get config.json of this minio setup.
|
// Get config.json of this minio setup.
|
||||||
func (a adminAPIHandlers) GetConfigHandler(w http.ResponseWriter, r *http.Request) {
|
func (a adminAPIHandlers) GetConfigHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// Validate request signature.
|
// Validate request signature.
|
||||||
adminAPIErr := checkAdminRequestAuthType(r, globalServerConfig.GetRegion())
|
adminAPIErr := checkAdminRequestAuthType(r, "")
|
||||||
if adminAPIErr != ErrNone {
|
if adminAPIErr != ErrNone {
|
||||||
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
||||||
return
|
return
|
||||||
@ -676,7 +678,7 @@ func (a adminAPIHandlers) SetConfigHandler(w http.ResponseWriter, r *http.Reques
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate request signature.
|
// Validate request signature.
|
||||||
adminAPIErr := checkAdminRequestAuthType(r, globalServerConfig.GetRegion())
|
adminAPIErr := checkAdminRequestAuthType(r, "")
|
||||||
if adminAPIErr != ErrNone {
|
if adminAPIErr != ErrNone {
|
||||||
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
||||||
return
|
return
|
||||||
@ -773,7 +775,7 @@ func (a adminAPIHandlers) UpdateCredentialsHandler(w http.ResponseWriter,
|
|||||||
r *http.Request) {
|
r *http.Request) {
|
||||||
|
|
||||||
// Authenticate request
|
// Authenticate request
|
||||||
adminAPIErr := checkAdminRequestAuthType(r, globalServerConfig.GetRegion())
|
adminAPIErr := checkAdminRequestAuthType(r, "")
|
||||||
if adminAPIErr != ErrNone {
|
if adminAPIErr != ErrNone {
|
||||||
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
writeErrorResponseJSON(w, adminAPIErr, r.URL)
|
||||||
return
|
return
|
||||||
|
@ -382,8 +382,8 @@ func (c AdminClient) newRequest(method string, reqData requestData) (req *http.R
|
|||||||
method = "POST"
|
method = "POST"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default all requests to "us-east-1"
|
// Default all requests to ""
|
||||||
location := "us-east-1"
|
location := ""
|
||||||
|
|
||||||
// Construct a new target URL.
|
// Construct a new target URL.
|
||||||
targetURL, err := c.makeTargetURL(reqData)
|
targetURL, err := c.makeTargetURL(reqData)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user