Skip to content
This repository was archived by the owner on Oct 29, 2023. It is now read-only.

Commit 98204e3

Browse files
committed
Fixes Issue#30 "--rpl-user and --db-user should not allow root"
1 parent 4080a8e commit 98204e3

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

Changelog

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
1.8.4 11-Aug-2018
2+
- Fixed Issue #30 "--rpl-user and --db-user should not allow root"
13
1.8.3 05-Aug-2018
24
- Fixed Issue #26 "Port management glitch"
35
1.8.2 05-Aug-2018

cmd/single.go

+12
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ func check_if_abridged_version(version, basedir string) string {
9696
return version
9797
}
9898

99+
func check_for_root_value(value, label, default_val string) {
100+
if value == "root" {
101+
common.Exit(1, fmt.Sprintf("option --%s cannot be 'root'", label),
102+
"The 'root' user will be initialized regardless,",
103+
"using the same password defined for the default db-user.",
104+
fmt.Sprintf("The default user for this option is '%s'.", default_val))
105+
}
106+
}
107+
99108
func FillSdef(cmd *cobra.Command, args []string) sandbox.SandboxDef {
100109
var sd sandbox.SandboxDef
101110

@@ -190,6 +199,9 @@ func FillSdef(cmd *cobra.Command, args []string) sandbox.SandboxDef {
190199
sd.DbPassword, _ = flags.GetString(defaults.DbPasswordLabel)
191200
sd.RplUser, _ = flags.GetString(defaults.RplUserLabel)
192201

202+
check_for_root_value(sd.DbUser, defaults.DbUserLabel, defaults.DbUserValue)
203+
check_for_root_value(sd.RplUser, defaults.RplUserLabel, defaults.RplUserValue)
204+
193205
sd.RplPassword, _ = flags.GetString(defaults.RplPasswordLabel)
194206
sd.RemoteAccess, _ = flags.GetString(defaults.RemoteAccessLabel)
195207
sd.BindAddress, _ = flags.GetString(defaults.BindAddressLabel)

common/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package common
1717

18-
var VersionDef string = "1.8.3" // 2018-08-05
18+
var VersionDef string = "1.8.4" // 2018-08-11
1919

2020
// Compatible version is the version used to mark compatible archives (templates, configuration).
2121
// It is usually major.minor.0, except when we are at version 0.x, when

test/go-unit-tests.sh

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ testdir=$(dirname $0)
33
cd $testdir
44
cd ..
55
maindir=$PWD
6-
ls
76

87
function check_exit_code {
98
exit_code=$?

0 commit comments

Comments
 (0)