• [6.8.3] Share Name Validation


    kubed_zero
    • Minor

    I was doing some testing on edge cases for a plugin I maintain. This issue is reproducible simply by trying to create a share on a running system. 

     

    I tried to create a share with the following name:

    Weird? [naming] & stuff / other stuff

    As expected, Unraid gave me the following error:

    You cannot use the following within share names : \ / * < > | "

    I removed the forward slash and tried again with the following new, supposedly compliant share name:

    Weird? [naming] & stuff  other stuff

    This time when pushing "Add Share" it hung on Processing Request for a little while, and then took me to a new page with the following error: 

    Share Weird? [naming] has been deleted.

     

    Pushing the Done button on that page, I was taken to my Shares overview, where I currently see the share "Weird? [naming] & stuff other stuff" as if it weren't actually deleted

     

    However, looking at the syslog, I see the following output. Samba seems to repeatedly restart and fopen seems to be having problems:

     

    Sep 19 11:42:56 Tower emhttpd: error: put_config_idx, 619: Invalid argument (22): fopen: /boot/config/shares/Weird? [naming] & stuff  other stuff.cfg
    Sep 19 11:42:56 Tower emhttpd: shcmd (1310): mkdir '/mnt/user/Weird? [naming] & stuff  other stuff'
    Sep 19 11:43:06 Tower emhttpd: shcmd (1311): chmod 0777 '/mnt/user/Weird? [naming] & stuff  other stuff'
    Sep 19 11:43:06 Tower emhttpd: shcmd (1312): chown 'nobody':'users' '/mnt/user/Weird? [naming] & stuff  other stuff'
    Sep 19 11:43:06 Tower emhttpd: error: put_config_idx, 619: Invalid argument (22): fopen: /boot/config/shares/Weird? [naming] & stuff  other stuff.cfg
    Sep 19 11:43:06 Tower emhttpd: Starting services...
    Sep 19 11:43:06 Tower emhttpd: error: put_config_idx, 619: Invalid argument (22): fopen: /boot/config/shares/Weird? [naming] & stuff  other stuff.cfg
    Sep 19 11:43:06 Tower emhttpd: Starting services...
    Sep 19 11:43:06 Tower emhttpd: shcmd (1319): /etc/rc.d/rc.samba restart
    Sep 19 11:43:08 Tower root: Starting Samba:  /usr/sbin/smbd -D
    Sep 19 11:43:08 Tower root:                  /usr/sbin/nmbd -D
    Sep 19 11:43:08 Tower root:                  /usr/sbin/wsdd 
    Sep 19 11:43:08 Tower root:                  /usr/sbin/winbindd -D
    Sep 19 11:43:08 Tower emhttpd: shcmd (1325): /etc/rc.d/rc.samba restart
    Sep 19 11:43:11 Tower root: Starting Samba:  /usr/sbin/smbd -D
    Sep 19 11:43:11 Tower root:                  /usr/sbin/nmbd -D
    Sep 19 11:43:11 Tower root:                  /usr/sbin/wsdd 
    Sep 19 11:43:11 Tower root:                  /usr/sbin/winbindd -D
    Sep 19 11:43:11 Tower emhttpd: Starting services...
    Sep 19 11:43:11 Tower emhttpd: shcmd (1342): /etc/rc.d/rc.samba restart
    Sep 19 11:43:13 Tower root: Starting Samba:  /usr/sbin/smbd -D
    Sep 19 11:43:13 Tower root:                  /usr/sbin/nmbd -D
    Sep 19 11:43:13 Tower root:                  /usr/sbin/wsdd 
    Sep 19 11:43:13 Tower root:                  /usr/sbin/winbindd -D
    Sep 19 11:43:13 Tower emhttpd: error: put_config_idx, 619: Invalid argument (22): fopen: /boot/config/shares/Weird? [naming] & stuff  other stuff.cfg
    Sep 19 11:43:13 Tower emhttpd: Starting services...
    Sep 19 11:43:13 Tower emhttpd: error: put_config_idx, 619: Invalid argument (22): fopen: /boot/config/shares/Weird? [naming] & stuff  other stuff.cfg
    Sep 19 11:43:13 Tower emhttpd: Starting services...
    Sep 19 11:43:13 Tower emhttpd: shcmd (1358): /etc/rc.d/rc.samba restart
    Sep 19 11:43:16 Tower root: Starting Samba:  /usr/sbin/smbd -D
    Sep 19 11:43:16 Tower root:                  /usr/sbin/nmbd -D
    Sep 19 11:43:16 Tower root:                  /usr/sbin/wsdd 
    Sep 19 11:43:16 Tower root:                  /usr/sbin/winbindd -D
    Sep 19 11:43:16 Tower emhttpd: shcmd (1364): /etc/rc.d/rc.samba restart
    Sep 19 11:43:18 Tower root: Starting Samba:  /usr/sbin/smbd -D
    Sep 19 11:43:18 Tower root:                  /usr/sbin/nmbd -D
    Sep 19 11:43:18 Tower root:                  /usr/sbin/wsdd 
    Sep 19 11:43:18 Tower root:                  /usr/sbin/winbindd -D

     

     

    In terms of bugs, I think there are a couple. Possibly better validation is needed on Share name input, the Share Deleted warning didn't actually appear to delete the share, the Share Deleted warning didn't print the entire name. That said, the folder creation still worked,  the shares.ini file seemed to get updated as normal, I was able to edit it relatively normally (save for the long loading times) and I was able to delete without issue. 

     

    While this is a bug, it appears relatively minor, at least for my use case. 

     

    Edit: I tried with $ and # in the share name as well and they were considered valid as well




    User Feedback

    Recommended Comments

    It's a catch-22 situation.  In this case, its because of the limitations of FAT-32 on the flash drive.  The share does get created correctly, but its the settings for it that can't be changed or modified.

     

    A similar situation arises if you create "share1" and "SHARE1".  So far as Unraid is concerned, each is a different share.  But, the settings would be messed because FAT32 can't differentiate a file share1.cfg and SHARE1.cfg

     

    Has existed forever.  While not impossible to fix, complications arise because of this in how do you actually name the file on the flash drive.  You can't just substitute characters because the substitution may clash with another share that is named like that already.

     

    That being said, probably the next rev of Unraid will disallow the "?" within a share name 

    Link to comment

    If the primary means of configuring Unraid (the web interface) can easily create corner cases that the boot media can't support, should the UI consider that limitation and make adjustments as necessary? As you noted, substitution could just open up another can of works with regard to how this is supported. Other approaches are to leave it as it is with known exposed corner cases that break the UI/functionality, or further limit the UI so those corner cases can't be reached. 

     

    There are  probably more important things to fix, all things considered, but at absolute least I'd hope there would be a warning in the UI saying that share naming containing certain characters could cause complicated conditions (😊) to arise. 

    • Like 1
    Link to comment

    Put it this way.

     

    A while ago I implemented code to handle these edge cases with regards to naming of docker containers.

     

    It introduced a number of problems and the easy solution was to revert back to the original code as no one noticed the edge case I was trying to solve.

     

    The code change I just submitted should handle the all explicitly disallowed characters on the flash.   The other edge cases are very rare (if anyone would even set up SHARE1 and share1 with differing permissions) 

     

    It is an issue, but as you said priorities aren't always in line with something that may only come up once every 10 years, and only if the user has no common sense

    • Like 1
    Link to comment


    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Restore formatting

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Status Definitions

     

    Open = Under consideration.

     

    Solved = The issue has been resolved.

     

    Solved version = The issue has been resolved in the indicated release version.

     

    Closed = Feedback or opinion better posted on our forum for discussion. Also for reports we cannot reproduce or need more information. In this case just add a comment and we will review it again.

     

    Retest = Please retest in latest release.


    Priority Definitions

     

    Minor = Something not working correctly.

     

    Urgent = Server crash, data loss, or other showstopper.

     

    Annoyance = Doesn't affect functionality but should be fixed.

     

    Other = Announcement or other non-issue.