diff --git a/builtin/logical/database/dbs/mysql.go b/builtin/logical/database/dbs/mysql.go index 0ff015415..0d8be2a47 100644 --- a/builtin/logical/database/dbs/mysql.go +++ b/builtin/logical/database/dbs/mysql.go @@ -2,6 +2,7 @@ package dbs import ( "database/sql" + "fmt" "strings" "github.com/hashicorp/vault/helper/strutil" @@ -41,6 +42,10 @@ func (m *MySQL) CreateUser(statements Statements, username, password, expiration return err } + if statements.CreationStatements == "" { + return fmt.Errorf("Empty creation statements") + } + // Start a transaction tx, err := db.Begin() if err != nil { diff --git a/builtin/logical/database/path_config_connection.go b/builtin/logical/database/path_config_connection.go index 085113fe9..c2fc085ae 100644 --- a/builtin/logical/database/path_config_connection.go +++ b/builtin/logical/database/path_config_connection.go @@ -197,22 +197,22 @@ func (b *databaseBackend) pathConnectionWrite(req *logical.Request, data *framew b.connections[name] = db } - /* - // Don't check the connection_url if verification is disabled - verifyConnection := data.Get("verify_connection").(bool) - if verifyConnection { - // Verify the string - db, err := sql.Open("postgres", connURL) - if err != nil { - return logical.ErrorResponse(fmt.Sprintf( - "Error validating connection info: %s", err)), nil - } - defer db.Close() - if err := db.Ping(); err != nil { - return logical.ErrorResponse(fmt.Sprintf( - "Error validating connection info: %s", err)), nil - } + /* TODO: + // Don't check the connection_url if verification is disabled + verifyConnection := data.Get("verify_connection").(bool) + if verifyConnection { + // Verify the string + db, err := sql.Open("postgres", connURL) + if err != nil { + return logical.ErrorResponse(fmt.Sprintf( + "Error validating connection info: %s", err)), nil } + defer db.Close() + if err := db.Ping(); err != nil { + return logical.ErrorResponse(fmt.Sprintf( + "Error validating connection info: %s", err)), nil + } + } */ // Store it diff --git a/builtin/logical/database/secret_creds.go b/builtin/logical/database/secret_creds.go index 90b88082e..e39525a18 100644 --- a/builtin/logical/database/secret_creds.go +++ b/builtin/logical/database/secret_creds.go @@ -11,18 +11,8 @@ const SecretCredsType = "creds" func secretCreds(b *databaseBackend) *framework.Secret { return &framework.Secret{ - Type: SecretCredsType, - Fields: map[string]*framework.FieldSchema{ - "username": &framework.FieldSchema{ - Type: framework.TypeString, - Description: "Username", - }, - - "password": &framework.FieldSchema{ - Type: framework.TypeString, - Description: "Password", - }, - }, + Type: SecretCredsType, + Fields: map[string]*framework.FieldSchema{}, Renew: b.secretCredsRenew, Revoke: b.secretCredsRevoke,