Re: do shell script...password...with administrator privileges: another leopard bug?
Re: do shell script...password...with administrator privileges: another leopard bug?
- Subject: Re: do shell script...password...with administrator privileges: another leopard bug?
- From: deivy petrescu <email@hidden>
- Date: Sun, 6 Jul 2008 10:31:49 -0400
On Jul 6, 2008, at 10:13, Loren Ryter wrote:
I posted this to MacScripter, but on further investigation think
this is a
Leopard bug:
The intent is to test for a valid admin password without getting an
authentication dialog from OS X.
Try this:
===
set user_pass to "ii"
try
do shell script "sudo -k"
set test_password to do shell script ("ls /private/var/root/")
password
user_pass with administrator privileges
on error myerr
log myerr
end try
===
However, instead of being trapped by "try", it puts up an
authentication
dialog anyway.
According to the dictionary for "do shell script" the description of
the
"password" parameter specifies:
"use this administrator password to avoid a password dialog"
I tried the key line like this (leaving out "with administrator
privileges")
too:
set test_password to do shell script ("ls /private/var/root/")
password
user_pass
Then "try" successfully traps with the error "permission denied" --
but then
a valid user_pass also is trapped with the same error.
====
Do I need to file another Leopard bug report here?
Is there another way to successfully test this?
Original post here:
http://bbs.macscripter.net/viewtopic.php?id=26358
Loren, as I see it there is no bug.
First, you do not need the sudo -k line.
As far as I understand it, every do shell script spawn its own
process. So you have two different shell processes.
Also, the "with administrator privileges" means sudo.
As for the error, if it happens, it does in the shell process and not
in AS. So to trap it you have to use the shell.
Although I give you that the dialog display makes my impressions seem
not quite right.
But still is the shell interacting with the UI via AS.
Deivy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden