Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to pass parameter including match symbol like "*" to command executed by AuthorizationExecuteWithPrivileges?



Why are you telling him to run shell commands/scripts with AuthorizationExecuteWithPrivileges()? Awfully dangerous.


-- m-s


On 29 Aug, 2007, at 02:42, email@hidden wrote:

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").


Kevin G.



for example, "rm test*.txt"

Thanks!


网 易 Yeah.net 免 费 邮 箱 全 新 改 版,珍 藏 帐 号 开 放,快 来 抢 注 >>
_______________________________________________
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


This email sent to email@hidden

_______________________________________________
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/mikey-san% 40bungie.org


This email sent to email@hidden

_______________________________________________ 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

This email sent to 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)



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.