Re: a way to catch an error in do shell script CDM password
Re: a way to catch an error in do shell script CDM password
- Subject: Re: a way to catch an error in do shell script CDM password
- From: "Koshiro MITSUYA" <email@hidden>
- Date: Thu, 19 Jun 2008 16:18:50 +0900
Dear Lan,
Thank you for your response.
Just like you suggest, I did the comparison first and it works :)
I wanted to avoid to ask the password until the script got the right
password by SecurityAgent. This is somehow too much, I think.
The command "ls -l /private/root/" was just an example, so the file
permission is not the problem here. Sorry for the confusion.
thanks again :)
Koshiro
On Tue, Jun 17, 2008 at 1:03 AM, Ian Goos <email@hidden> wrote:
> Perhaps you can do your own comparison of the password first?
> property rightPassword : "Iheartnewyork"
> display dialog "Please enter the password:" default answer "Type it Here"
> if text returned of result ≠ rightPassword then
> display alert "Not so much the right password"
> else
> doCoolStuff()
> end if
> It's not great for security and it only works for you when you know the
> password to begin with. I believe if the script is compiled as a run only
> app the password is more difficult to obtain.
> It doesn't seem to be easy to create ease of use with high powered shell
> scripts. Maybe you can just change the permissions for the directory for
> read only access for non administrators?
> I really think you should do error code testing first too in case the
> problem isn't the password being incorrect. Maybe the directory doesn't
> exist.
> Hope it helps
> Ian
>
> On Jun 15, 2008, at 3:41 PM, Luther Fuller wrote:
>
> On Jun 15, 2008, at 12:04 PM, Koshiro MITSUYA wrote:
>
> I am trying to get the error in "do shell script CMD password with
> adminstrator privileges" when an incorrent userpassword was given. The
> code is like below.
> try
> do shell script "ls -l /private/root/" password userpassword with
> administrator privileges
> on error
> display dialog "Sorry, the password entered was not correct."
> end try
> However, it automatically runs the SecurityAgent to ask the correct
> password. Is there any way to prevent to run SecurityAgent and
> catch the error instead?
>
>
> I had a similar problem about a month ago ("When is a disk image file
> encrypted?").
> My solution was this handler ...
> on isEncrypted(imageAlias)
> set imagePath to quoted form of (POSIX path of imageAlias)
> try
> do shell script "echo -n '' | hdiutil imageinfo -stdinpass " & imagePath
> on error
> return true
> end try
> return false
> end isEncrypted
> The echo -n '' puts the empty string into stdin, then the '-stdinpass'
> option tells 'hdiutil' to get the password from stdin. This is what avoids
> the SecurityAgent password dialog. The empty string isn't the password for
> anything, so if the disk image file 'imageAlias' is encrypted, true is
> returned.
> Your problem, now, is that the 'ls' command does not have a password option
> of any kind. In fact, I wonder if the 'do shell script' is correctly formed.
> _______________________________________________
> 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
>
> _______________________________________________
> 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
>
_______________________________________________
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