summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorMilan Zink <mzink@redhat.com>2018-01-16 13:48:49 +0100
committerAmar Tumballi <amarts@redhat.com>2018-12-04 16:36:53 +0000
commit9b770760d94b1fc39ade01df35dd3bcf317a71ed (patch)
tree05fa045671d10d9927300d49f0103cb7c18e5c33 /extras
parente48678567a5fb01166a065f9e192b80e721e4181 (diff)
Do not blindly add volume share section to smb.conf
With this change, by default GlusterFS volume share section will no longer be added to smb.conf for client access unless user.cifs or user.smb volume set options are enabled. This also fixes the hook script to check for presence of all configuration possibilities for those volume set options like 'enable' or 'on'. Change-Id: Ibecf7fffb4507d7255d963c3b1482afb0d0db984 Signed-off-by: Milan Zink <mzink@redhat.com> Signed-off-by: Anoop C S <anoopcs@redhat.com> Fixes: bz#1575836
Diffstat (limited to 'extras')
-rwxr-xr-xextras/hook-scripts/set/post/S30samba-set.sh13
-rwxr-xr-xextras/hook-scripts/start/post/S30samba-start.sh18
2 files changed, 26 insertions, 5 deletions
diff --git a/extras/hook-scripts/set/post/S30samba-set.sh b/extras/hook-scripts/set/post/S30samba-set.sh
index c596db02381..d2a62d38026 100755
--- a/extras/hook-scripts/set/post/S30samba-set.sh
+++ b/extras/hook-scripts/set/post/S30samba-set.sh
@@ -123,9 +123,18 @@ function get_smb () {
usersmbvalue=$(grep user.smb $GLUSTERD_WORKDIR/vols/"$volname"/info |\
cut -d"=" -f2)
- if [ $usercifsvalue = "disable" ] || [ $usersmbvalue = "disable" ]; then
- uservalue="disable"
+ if [ -n "$usercifsvalue" ]; then
+ if [ "$usercifsvalue" = "disable" ] || [ "$usercifsvalue" = "off" ]; then
+ uservalue="disable"
+ fi
fi
+
+ if [ -n "$usersmbvalue" ]; then
+ if [ "$usersmbvalue" = "disable" ] || [ "$usersmbvalue" = "off" ]; then
+ uservalue="disable"
+ fi
+ fi
+
echo "$uservalue"
}
diff --git a/extras/hook-scripts/start/post/S30samba-start.sh b/extras/hook-scripts/start/post/S30samba-start.sh
index dfd9c1b46ab..2854bddfe90 100755
--- a/extras/hook-scripts/start/post/S30samba-start.sh
+++ b/extras/hook-scripts/start/post/S30samba-start.sh
@@ -111,14 +111,26 @@ function get_smb () {
usersmbvalue=$(grep user.smb "$GLUSTERD_WORKDIR"/vols/"$volname"/info |\
cut -d"=" -f2)
- if [ "$usercifsvalue" = "disable" ] || [ "$usersmbvalue" = "disable" ]; then
- uservalue="disable"
+ if [ -n "$usercifsvalue" ]; then
+ if [ "$usercifsvalue" = "enable" ] || [ "$usercifsvalue" = "on" ]; then
+ uservalue="enable"
+ fi
fi
+
+ if [ -n "$usersmbvalue" ]; then
+ if [ "$usersmbvalue" = "enable" ] || [ "$usersmbvalue" = "on" ]; then
+ uservalue="enable"
+ fi
+ fi
+
echo "$uservalue"
}
parse_args "$@"
-if [ "$(get_smb "$VOL")" = "disable" ]; then
+
+value=$(get_smb "$VOL")
+
+if [ -z "$value" ] || [ "$value" != "enable" ]; then
exit 0
fi