diff --git a/net/samba3/Makefile b/net/samba3/Makefile index 124bf9b46..9743cbfa2 100644 --- a/net/samba3/Makefile +++ b/net/samba3/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=samba3 PKG_VERSION:=3.0.37 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MD5SUM:=11ed2bfef4090bd5736b194b43f67289 diff --git a/net/samba3/files/samba.config b/net/samba3/files/samba.config index 1dfe53da3..908f536e0 100644 --- a/net/samba3/files/samba.config +++ b/net/samba3/files/samba.config @@ -1,16 +1,29 @@ +# Base server settings config samba - option 'name' 'openwrt' - option 'workgroup' 'openwrt' - option 'description' 'openwrt' - option 'homes' '1' - list 'interface' 'lo' - list 'interface' 'lan' - + ## Override if desired, defaults to hostname + #option 'name' 'OpenWrt' + #option 'workgroup' 'OpenWrt' + #option 'description' 'Samba on OpenWrt' + + ## Expose user home directories, defaults to off + option 'homes' '1' + + ## Override character set, default is UTF-8 + option 'charset' 'ISO-8859-1' + + ## Override listen interfaces & addresses, + ## defaults to loopback and lan + #list 'interface' 'loopback' + #list 'interface' 'lan' + #list 'interface' '10.0.0.0/255.255.0.0' + #list 'interface' 'eth0' + +# Declare a share on /tmp config sambashare option 'name' 'tmp' option 'path' '/tmp' option 'read_only' 'no' option 'guest_ok' 'no' - option 'create_mask' '0700' + option 'create_mask' '0700' option 'dir_mask' '0700' #option 'users' 'abc' diff --git a/net/samba3/files/samba.init b/net/samba3/files/samba.init index 3e46431f5..6d755ea7e 100755 --- a/net/samba3/files/samba.init +++ b/net/samba3/files/samba.init @@ -4,42 +4,63 @@ START=60 smb_header() { - local name - local workgroup - local description - local homes local interface - - config_get name $1 name - config_get workgroup $1 workgroup - config_get description $1 description - config_get homes $1 homes - config_get interface $1 interface "lan" + config_get interface $1 interface "loopback lan" # resolve interfaces local interfaces=$( include /lib/network scan_interfaces - local net ifname; for net in $interface; do - config_get ifname "$net" ifname "$net" - echo -n "$ifname " + + local net + for net in $interface; do + local ifname + config_get ifname "$net" ifname + [ -n "$ifname" ] && { + local ipaddr netmask + config_get ipaddr "$net" ipaddr + config_get netmask "$net" netmask + [ -n "$ipaddr" ] && echo -n "$ipaddr/${netmask:-255.255.255.255} " + + local ip6addr + config_get ip6addr "$net" ip6addr + [ -n "$ip6addr" ] && echo -n "$ip6addr " + } + + echo -n "${ifname:-$net} " done ) - [ -z "$name" ] && name=openwrt - [ -z "$workgroup" ] && workgroup=openwrt - [ -z "$description" ] && description=openwrt + local name workgroup description charset + local hostname="$(uci_get system.@system[0].hostname)" + + config_get name $1 name "${hostname:-OpenWrt}" + config_get workgroup $1 workgroup "${hostname:-OpenWrt}" + config_get description $1 description "Samba on ${hostname:-OpenWrt}" + config_get charset $1 charset "UTF-8" mkdir -p /var/etc - cp /etc/samba/smb.conf.template /var/etc/smb.conf - [ -L /etc/samba/smb.conf ] || ln -nsf /var/etc/smb.conf /etc/samba/smb.conf - sed -i "s/|NAME|/$name/g" /var/etc/smb.conf - sed -i "s/|WORKGROUP|/$workgroup/g" /var/etc/smb.conf - sed -i "s/|DESCRIPTION|/$description/g" /var/etc/smb.conf - sed -i "s/|INTERFACES|/$interfaces/g" /var/etc/smb.conf - [ "$homes" == "1" ] && { - echo -e "\n[homes]\n\tcomment = Home Directories\n\tbrowseable = no\n\tread only = no\n\tcreate mode = 0750" >> /var/etc/smb.conf + sed -e "s#|NAME|#$name#g" \ + -e "s#|WORKGROUP|#$workgroup#g" \ + -e "s#|DESCRIPTION|#$description#g" \ + -e "s#|INTERFACES|#$interfaces#g" \ + -e "s#|CHARSET|#$charset#g" \ + /etc/samba/smb.conf.template > /var/etc/smb.conf + + local homes + config_get_bool homes $1 homes 0 + [ $homes -gt 0 ] && { + cat <> /var/etc/smb.conf + +[homes] + comment = Home Directories + browsable = no + read only = no + create mode = 0750 +EOT } + + [ -L /etc/samba/smb.conf ] || ln -nsf /var/etc/smb.conf /etc/samba/smb.conf } smb_add_share() { diff --git a/net/samba3/files/smb.conf.template b/net/samba3/files/smb.conf.template index 969a83ed5..0780a7312 100644 --- a/net/samba3/files/smb.conf.template +++ b/net/samba3/files/smb.conf.template @@ -7,7 +7,7 @@ passdb backend = smbpasswd obey pam restrictions = yes socket options = TCP_NODELAY - unix charset = ISO-8859-1 + unix charset = |CHARSET| preferred master = yes os level = 20 security = share