Code Monkey home page Code Monkey logo

Comments (16)

synhershko avatar synhershko commented on July 26, 2024

Interesting. The new files are being written with the admin privileges, and thats probably what blocks the non-admins. Can you update the app as a non-admin?

from nappupdate.

jderoij avatar jderoij commented on July 26, 2024

Hello,

I have a simular problem. The self-update works file for non-admin the first time.
When the update runs they must give the admin password and the update goes well.
But a second update won't work because the file has now a lock. I think only a admin can update it than.
How to fix this.

from nappupdate.

synhershko avatar synhershko commented on July 26, 2024

What do you mean by "a second time"? does restarting the app / PC help?

from nappupdate.

jderoij avatar jderoij commented on July 26, 2024

Thanks for the fast response

Sorry: a new update
no restarting doesn't help (app and pc)

So first update 1.0 to 1.1 works when given admin password
Update from 1.1 to 1.2 (week later) fails.

the file has a lock icon after update to 1.1

from nappupdate.

jderoij avatar jderoij commented on July 26, 2024

It looks like that the file to be updated(because it's in c:\program files) need admin rights to update. After the update the file can only be execute by a admin.

from nappupdate.

synhershko avatar synhershko commented on July 26, 2024

Thanks for the clarification. If you could provide a way to reproduce this that would be great.

from nappupdate.

jderoij avatar jderoij commented on July 26, 2024

I have code a quickfix, not usably for all users, the file is writen without rights for the group users

In the FileUpdateTask.cs function public override TaskExecutionStatus Execute(bool coldRun)
after: File.Move(_tempFile, _destinationFile); ~rulenumber 120

DirectoryInfo dInfo = new DirectoryInfo(_destinationFile);
DirectorySecurity dSecurity = dInfo.GetAccessControl();
dSecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null), FileSystemRights.ReadAndExecute, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.NoPropagateInherit, AccessControlType.Allow));
dInfo.SetAccessControl(dSecurity);

This give's the user group rights on the file

I think the problem is, that the file is updated by the runas users and has his privaliges and not the user privaliges

from nappupdate.

synhershko avatar synhershko commented on July 26, 2024

Instead of this, I believe the new file being writte needs to get the same perms as the file being overriddenthings

from nappupdate.

jderoij avatar jderoij commented on July 26, 2024

That is much better! will that be in a release soon?

from nappupdate.

synhershko avatar synhershko commented on July 26, 2024

@jderoij can you send a pull request for this? sorry a bit swamped at the moment

from nappupdate.

vbjay avatar vbjay commented on July 26, 2024

The way around this is to check if the current user has write access to the files. If not, make the updater run elevated.

from nappupdate.

ianwall avatar ianwall commented on July 26, 2024

This one causes me a lot of problems. I'm happy to do a PR to add this to FileUpdateTask.cs:

// Copy _detinationFile access rights to _tempFile before Move.
FileInfo fiDest = new FileInfo(_destinationFile);
FileInfo fiSrc = new FileInfo(_tempFile);
FileSecurity ac = fiDest.GetAccessControl();
ac.SetAccessRuleProtection(true, true);
fiSrc.SetAccessControl(ac);

?

from nappupdate.

robinwassen avatar robinwassen commented on July 26, 2024

@ianwall What problem does that code solve?

from nappupdate.

ianwall avatar ianwall commented on July 26, 2024

The one this thread is about - i.e. after an update the file permissions are changed to include s specific user, rather than 'users', so the next update fails. This copies the original files permissions, rather than adding 'Users' to the files as per @jderoij's quickfix.

from nappupdate.

robinwassen avatar robinwassen commented on July 26, 2024

@ianwall Sounds like a proper solution. A PR would be appriciated.

from nappupdate.

robinwassen avatar robinwassen commented on July 26, 2024

This has been resolved thanks to @ianwall and will be included in the next release.

from nappupdate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.