KCG Error Range Check

I’m trying to build a samba message popup client…
I built a script which works perfectly when i run it from the terminal.


msg="tell application "Finder"
  display dialog "Hello $2 from $3 message $4" buttons {"OK"}
end tell"

case $1 in
h | help | -h | -help)
/bin/echo "Useage:"
/bin/echo "  buildpopup -msg args"
/usr/bin/osascript -e "$msg"

But if I call it via /etc/smb.conf:

 message command = /bin/buildpopup -msg %f %m %s &

and try to send a message:

 smbclient -M tibook

I get an error in my system.log:

/usr/bin/osascript: kCGErrorRangeCheck : Window Server communications from outside of session allowed for root and console user only

Any ideas on this one?

It may be balking because the command is running as root, but the machine is logged in as your user. (Though the error message itself says root should be allowed.) One solution is to list all the users that are running the Finder:

Then use “su $USER -c command.sh” to run your command as each of these users.

Looking at your script again, it looks like you might already have the username in the “message command” line. Just incorporate the su bit before /bin/buildpopup (though you may have to experiment with quoting to get things working just right).

cool, thanx. I’m at a win machine right now and can’t test, but keep you informed about how it turns out. :slight_smile:

too bad. it doesn’t rellay work.
the script would expect a password:

su: pam_authenticate: Authentication failure

is there any way I can send it along?
Wouldn’t worry about security since this is my own powerbook and i’m behind firewalls anyway…

I really really woul like to have samba messaging integrated here, since my server sends those msgs when I get phone calls :slight_smile:
It’s kind of like what the Addressbook does when connected to a bluetooth-phone - but with ISDN :slight_smile: