• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: a way to catch an error in do shell script CDM password
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Luther Fuller <email@hidden>
  • Date: Sun, 15 Jun 2008 14:41:22 -0500

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
  • Follow-Ups:
    • Re: a way to catch an error in do shell script CDM password
      • From: "Koshiro MITSUYA" <email@hidden>
    • Re: a way to catch an error in do shell script CDM password
      • From: Ian Goos <email@hidden>
References: 
 >a way to catch an error in do shell script CDM password (From: "Koshiro MITSUYA" <email@hidden>)

  • Prev by Date: a way to catch an error in do shell script CDM password
  • Next by Date: Spam
  • Previous by thread: a way to catch an error in do shell script CDM password
  • Next by thread: Re: a way to catch an error in do shell script CDM password
  • Index(es):
    • Date
    • Thread