Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Samba regression from 3.8-14.03 #1385

Closed
Mazo opened this issue Jul 9, 2016 · 9 comments
Closed

Fix Samba regression from 3.8-14.03 #1385

Mazo opened this issue Jul 9, 2016 · 9 comments

Comments

@Mazo
Copy link
Contributor

Mazo commented Jul 9, 2016

See thread here from another user: https://forum.rockstor.com/t/3-8-14-03-broke-samba/1726

        Traceback (most recent call last):

File "/opt/rockstor/src/rockstor/rest_framework_custom/generic_view.py", line 40, in _handle_exception
yield
File "/opt/rockstor/src/rockstor/smart_manager/views/samba_service.py", line 44, in get
config = get_global_config()
File "/opt/rockstor/src/rockstor/system/samba.py", line 179, in get_global_config
config[fields[0].strip()] = fields[1].strip()
IndexError: list index out of range

@phillxnet
Copy link
Member

@Mazo Thanks for reporting this, I'm having a quick look now and think it's the indented comments within the [global] section of /etc/samba/smb.conf thats causing a simple parsing error.
Currently working on a fix and should be available pretty soon.

phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Jul 9, 2016
@phillxnet
Copy link
Member

With the above logging commit we get the following:

[09/Jul/2016 18:38:10] DEBUG [system.samba:182] FIELDS = ['workgroup ', ' mygroup']
[09/Jul/2016 18:38:10] DEBUG [system.samba:183] LEN OF FIELDS = 2
[09/Jul/2016 18:38:10] DEBUG [system.samba:182] FIELDS = ['server string ', ' Samba Server Version %v']
[09/Jul/2016 18:38:10] DEBUG [system.samba:183] LEN OF FIELDS = 2
[09/Jul/2016 18:38:10] DEBUG [system.samba:182] FIELDS = [';\tnetbios name ', ' MYSERVER']
[09/Jul/2016 18:38:10] DEBUG [system.samba:183] LEN OF FIELDS = 2
[09/Jul/2016 18:38:10] DEBUG [system.samba:182] FIELDS = [';\tinterfaces ', ' lo eth0 192.168.12.2/24 192.168.13.2/24']
[09/Jul/2016 18:38:10] DEBUG [system.samba:183] LEN OF FIELDS = 2
[09/Jul/2016 18:38:10] DEBUG [system.samba:182] FIELDS = [';\thosts allow ', ' 127. 192.168.12. 192.168.13.']
[09/Jul/2016 18:38:10] DEBUG [system.samba:183] LEN OF FIELDS = 2
[09/Jul/2016 18:38:10] DEBUG [system.samba:182] FIELDS = [';\tmax protocol ', ' SMB2']
[09/Jul/2016 18:38:10] DEBUG [system.samba:183] LEN OF FIELDS = 2
[09/Jul/2016 18:38:10] DEBUG [system.samba:182] FIELDS = ['# log files split per-machine:']
[09/Jul/2016 18:38:10] DEBUG [system.samba:183] LEN OF FIELDS = 1
[09/Jul/2016 18:38:10] ERROR [storageadmin.util:47] exception: list index out of range
Traceback (most recent call last):
  File "/opt/rockstor/src/rockstor/rest_framework_custom/generic_view.py", line 40, in _handle_exception
    yield
  File "/opt/rockstor/src/rockstor/smart_manager/views/samba_service.py", line 44, in get
    config = get_global_config()
  File "/opt/rockstor/src/rockstor/system/samba.py", line 186, in get_global_config
    config[fields[0].strip()] = fields[1].strip()
IndexError: list index out of range
[09/Jul/2016 18:38:10] DEBUG [storageadmin.util:48] Current Rockstor version: 3.8-14.03

Hence the failed parsing on indented remarks.

phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Jul 9, 2016
…r#1385

When reading from the /etc/samba/smb.conf file to populate
the new custom config [global] section we need a final check on the
field count to avoid tripping up on for example empty options or just
indented remarks.
@phillxnet
Copy link
Member

@schakrava With the 'final field count sanity check' patch:
phillxnet@4ddd2aa
the new code did retrieve [global] options and display them in the new custom options box and didn't trip up on the indented remarks but upon submitting samba config the existing /etc/samba/smb.conf file was found to be empty.

Handing over to you on this one as I suspect you know what's happened on this one already.

@phillxnet
Copy link
Member

Extracted "Custom global configuration" displayed with testing channel released code once all indented remarks are removed ie lines such as:

        # log files split per-machine:
        # maximum size of 50KB per log file, then rotate:

Looks like this (note the indent and last line with spaces):

              ; max protocol = SMB2
              ; map hidden = no
              ; add machine script = /usr/sbin/useradd -n -c "Workstation (%u)" -M -d /nohome -s /bin/false "%u"
              ; printcap name = lpstat
              ; logon path = 
              ; domain logons = yes
              ; map archive = no
              load printers = yes
              ; security = user
              ; domain master = yes
              ; delete user script = /usr/sbin/userdel "%u"
              ; add user script = /usr/sbin/useradd "%u" -n -g users
              ; wins support = yes
              ; map system = no
              ; passdb backend = tdbsam
              ; delete user from group script = /usr/sbin/userdel "%u" "%g"
              ; local master = no
              passdb backend = tdbsam
              ; delete group script = /usr/sbin/groupdel "%g"
              workgroup = MYGROUP
              cups options = raw
              ; realm = MY_REALM
              ; password server = <NT-Server-Name>
              max log size = 50
              log file = /var/log/samba/log.%m
              ; wins proxy = yes
              ; hosts allow = 127. 192.168.12. 192.168.13.
              ; dns proxy = yes
              ; wins server = w.x.y.z
              ; os level = 33
              server string = Samba Server Version %v
              ; add group script = /usr/sbin/groupadd "%g"
              ; logon script = %u.bat
              ; map read only = no
              ; store dos attributes = yes
              ; interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
              ; printing = cups
              security = user
              ; preferred master = yes
              ; netbios name = MYSERVER

@phillxnet
Copy link
Member

Submitting the above, which results from removing the indented remarks then results in an empty smb.conf. Was looking for a user applicable edit of config as a quick work around on released testing channel code but looks like there more to this one that I initially though.

phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Jul 9, 2016
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Jul 9, 2016
A recent refactoring has orphaned this variable, previously
this was passed as a parameter.
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Jul 9, 2016
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Jul 9, 2016
@phillxnet
Copy link
Member

@schakrava pr ready for testing and review.

Please update the following forum thread with significant development on this issue:
https://forum.rockstor.com/t/3-8-14-03-broke-samba/1726

@schakrava
Copy link
Member

Thanks @Mazo and @phillxnet and my apologies for sloppy changes to begin with.

@schakrava
Copy link
Member

Fixed by #1386

@phillxnet
Copy link
Member

The indicated forum thread has now been updated.

@schakrava schakrava changed the title 3.8-14.03 broke Samba Fix Samba regression from 3.8-14.03 Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants