Skip to content

Commit

Permalink
CIFS bind IP's got borked when the form for it changed. This fixes that.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Hixson committed Mar 4, 2015
1 parent 22704a8 commit 744a3ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
13 changes: 8 additions & 5 deletions gui/services/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,14 @@ def __init__(self, *args, **kwargs):
self.data['cifs_srv_bindip'].split(',')
)
self.fields['cifs_srv_bindip'].choices = list(choices.IPChoices())
self.fields['cifs_srv_bindip'].initial = (
self.instance.cifs_srv_bindip.encode('utf-8').split(',')
if self.instance.id and self.instance.cifs_srv_bindip
else ''
)
if self.instance.id and self.instance.cifs_srv_bindip:
bindips = []
for ip in self.instance.cifs_srv_bindip:
bindips.append(ip.encode('utf-8'))

self.fields['cifs_srv_bindip'].initial = (bindips)
else:
self.fields['cifs_srv_bindip'].initial = ('')

def __check_octet(self, v):
try:
Expand Down
7 changes: 4 additions & 3 deletions src/freenas/usr/local/libexec/nas/generate_smb4_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,7 @@ def add_domaincontroller_conf(smb4_conf):

ipv4_addrs = []
if cifs.cifs_srv_bindip:
interfaces = cifs.cifs_srv_bindip.split(',')
for i in interfaces:
for i in cifs.cifs_srv_bindip:
try:
socket.inet_aton(i)
ipv4_addrs.append(i)
Expand Down Expand Up @@ -692,7 +691,7 @@ def generate_smb4_conf(smb4_conf, role):
if cifs.cifs_srv_bindip:
interfaces = []

bindips = cifs.cifs_srv_bindip.replace(',', ' ')
bindips = string.join(cifs.cifs_srv_bindip, ' ')
if role != 'dc':
bindips = "127.0.0.1 %s" % bindips

Expand All @@ -701,6 +700,7 @@ def generate_smb4_conf(smb4_conf, role):
for bindip in bindips:
if not bindip:
continue
bindip = bindip.strip()
iface = n.get_interface(bindip)
if iface and n.is_carp_interface(iface):
parent_iface = n.get_parent_interface(iface)
Expand Down Expand Up @@ -900,6 +900,7 @@ def generate_smb4_shares(smb4_shares):
confset1(smb4_shares, "shadow:localtime = yes")
confset1(smb4_shares, "shadow:format = auto-%%Y%%m%%d.%%H%%M-%s%s" % (
task.task_ret_count, task.task_ret_unit[0]))
confset1(smb4_shares, "shadow:snapdirseverywhere = yes")

if vfs_objects:
confset2(smb4_shares, "vfs objects = %s", ' '.join(vfs_objects).encode('utf8'))
Expand Down

0 comments on commit 744a3ad

Please sign in to comment.