Closed dukesrg closed 9 years ago
For all three files there is a similar code to chown if uid != 0 and gid != 0: os.chown(xmpPath, uid, gid) XMP seems to be written initially with UID/SSID=0, so see no difference. I'll remove zero check and test
Tested with removed UID/GID zero check, worked fine on my QNAP (Linux version 3.4.6 (root@NasX86-12) (gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2))). Will be commited later with the changes on QNAP-QTS package
Do you know why the "uid != 0 and gid != 0" was there in the first place?
Ok, I get it now. "0" is the default, meaning uid and gid are "unset". Like null. Ok, I think we need to make it so that uid = self.server.config.getint('EyeFiServer','upload_uid') returns "-1" or "None" if upload_uid is unset in the config file. Then we can put the check back in.
I suspected it was something like default. For the original instance mode it make sence but not for the daemon mode.
Ah, we set it to "0" by default in the file, so it is always there. If I comment it out "config.getint" throws an exception
Can we just put -1 there for the default UID/GID?
However it's not a good idea to set it by default just because WEB GUI have no value for that
hehe, yeah that's exactly what I'm doing now, having -1 as the default. Then the default in the .ini can be that it is commented out
I'm not sure how this affects the web ui as I've never used the web UI. I'll push my changes to a branch and you can see the change and we'll go from there.
In the WEB GUI combobox is used to select uid/guid. It is preloaded with the names from passwd/group, so I'll need to make some changes in cgi. I still have no idea how eyefi user was used be default whily my daemon is running, because this user was created for ftp uploads and never linked with the eyefiserver daemon :)
Have a look at my commit, I created a branch for it: bugfix/14-file-owner-problem
The changes only in .py and .conf, right? Well the script works fine, uid/gid is set. However those settings can't be saved until commented. Can you commit to master only .py changes but keep default zeroes in .conf? I just assume one who wants to use a WEB GUI should not modify .conf manually, but one who experienced/needs to run in instance mode will edit .conf anyway.
Sure, see latest commit. So you tested it? Go ahead and merge to master, or let me know if you are ok with this and I can merge to master.
Yes I've just tested successfully.Got admin/admins (0/0) with the commented one, which is as it should be IMO. And the selected UID/GID if uncomment. You can commit .py to master if agreed to keep .conf as it is now, i.e. with zeroes by default.
Just noticed, if file UID=0, it is not set, properly. I have by default admin/admininstrators (UID/GID=0), The owner/group for .jpg and .log became eyefi/administrators (UID=502/GID=0). but XMP have no this rights issue. As soon as GID/SID changes, all three files get the correct GID.