| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
As a general security consideration, privileged commands should do as little as possible and do highly specific things. This minimizes the chance a mistake or exploit can cause more damage than it should.
In this case, you probably should resolve the glob ("*") first while unprivileged, and then call a sequence of highly specific "rm" commands with the results.
The standard C library in <glob.h> (among other approaches) handles "*". Run "man 3 glob" in a terminal for more information on the glob() function.
e.g. glob("test*.txt") might yield test1.txt and test2.txt. With those results, you could generate commands like: "rm test1.txt" "rm test2.txt" (or simply "rm test1.txt test2.txt").
Why are you telling him to run shell commands/scripts with AuthorizationExecuteWithPrivileges()? Awfully dangerous.
And a malicious user could create a file named "-rf .." in the target directory. Using your suggestion, that would turn into a privileged execution of the command "rm -rf .." -- not as bad as the dreaded "rm -rf /", but still quite destructive.
Kevin G. _______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden
| References: | |
| >How to pass parameter including match symbol like "*" to command executed by AuthorizationExecuteWithPrivileges? (From: judiexu <email@hidden>) | |
| >Re: How to pass parameter including match symbol like "*" to command executed by AuthorizationExecuteWithPrivileges? (From: email@hidden) | |
| >Re: How to pass parameter including match symbol like "*" to command executed by AuthorizationExecuteWithPrivileges? (From: "Mark Wagner" <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.