Nobody84 / docker-samba

0 stars 0 forks source link

-e SAMBA_PARAMETER not passing correctly #3

Open DavidAUM23 opened 3 years ago

DavidAUM23 commented 3 years ago

Hello,

If I run:

sudo docker run -it --net=host \
--name smb_wsdd \
-v /shares/share1:/share1 \
-e NMBD=true \
-e PRINT_PARAMETER="yes" \
-e WSDD_PARAMETER="-w MYWKGRP -i enp0s25" \
--restart unless-stopped \
-d topdockercat/samba \
-s "public;/share1"

The container seems to be happy and working exactly as expected.

The logs look great:

Start Web Service Discovery host daemon (WSDD)
Parameter: -w MYWKGRP -i enp0s25

Start /usr/bin/samba.sh from original docker image
Parameter: -s public;/share1
[2021/02/15 20:43:27.820150,  0] ../../lib/util/become_daemon.c:135(daemon_ready)
  daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
smbd version 4.12.9 started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[2021/02/15 20:43:59.902112,  0] ../../source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
  *****

  Samba name server MYSERVERNAME is now a local master browser for workgroup MYGROUP on subnet 172.17.0.1

  *****
[2021/02/15 20:43:59.902369,  0] ../../source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
  *****

  Samba name server MYSERVERNAME is now a local master browser for workgroup MYGROUP on subnet [HOSTIP]

  *****

even though Parameter: -s public;/share1 is logged as such, without the " quotes.

If instead, I use -e SAMBA_PARAMETER like this:

sudo docker run -it --net=host \
--name smb_wsdd \
-v /shares/share1:/share1 \
-e NMBD=true \
-e PRINT_PARAMETER="yes" \
-e SAMBA_PARAMETER="-s \"public;/share1\"" \
-e WSDD_PARAMETER="-w MYWKGRP -i enp0s25" \
--restart unless-stopped \
-d topdockercat/samba 

The container begins a restart loop. The logs report:

Start Web Service Discovery host daemon (WSDD)
Parameter: -w MYWKGRP -i enp0s25

Start /usr/bin/samba.sh from original docker image
Parameter: -s "public;/share1"
/usr/bin/samba.sh: line 117: $2: unbound variable
Start Web Service Discovery host daemon (WSDD)
Parameter: -w MYWKGRP -i enp0s25

Start /usr/bin/samba.sh from original docker image
Parameter: -s "public;/share1"
/usr/bin/samba.sh: line 117: $2: unbound variable
Start Web Service Discovery host daemon (WSDD)
...
Nobody84 commented 3 years ago

This seems to be a problem with the escaped quotes. The parameter string was passed with the escaped quotes, resulting in a parsing error within samba.sh. Now the \" in the SAMBA_PARAMETER string are replaced by ". Maybe this solves the problem.

DavidAUM23 commented 3 years ago

Using the -e SAMBA_PARAMETER now yields restarting container logs:

Start Web Service Discovery host daemon (WSDD)
Parameter: -w MYWKGRP -i enp0s25

Start /usr/bin/samba.sh from original docker image
Parameter: -s "public;/share1"
/usr/bin/samba.sh: line 117: $2: unbound variable
...

Using the arguments passed after the image name now yields restarting container logs:

Start Web Service Discovery host daemon (WSDD)
Parameter: -w MYWKGRP -i enp0s25

Start /usr/bin/samba.sh from original docker image
/entrypoint.sh: line 19: syntax error: bad substitution
...