RE: system permissions
Posted in 2004
Topics: Triggers, Constraints & Referential Integrity
You're losing the environment when the system command is executed. Set your
environment properly in your system command before you execute echo command.
Just to test it, you could run "SYSTEM 'env > /tmp/env.out'" as a user. My
guess is that you'll get -668 error.
Vivek
-----Original Message-----
From: owner-informix-list@iiug.org [mailto:owner-informix-list@iiug.org] On
Behalf Of Matt
Sent: Tuesday, September 07, 2004 11:58 AM
To: informix-list@iiug.org
Subject: system permissions
I'm trying to create a trigger on a record for when a certain field is
updated, using a procedure. The procedure works fine when I, having
administrative powers, run it, but when any of the users try it, it gets an
error (-668). It appears that any system command causes the error. Here is
the code. If anyone has any ideas, please let me know. Thanks.
procedure grpeml
privilege owner
description "Sends e-mail to registrar when a student's group
number changes"
inputs in_id int "student id"
new_grp char(4) "new group"
old_grp char(4) "old group"
notes "Runs from trigger in prog_enr_rec when assigned"
begin procedure
DEFINE mailcall char(100);
DEFINE stuname char(30);
SELECT fullname
FROM id_rec
WHERE id_rec.id = in_id
INTO temp tmp_c;
SELECT fullname
INTO stuname
FROM tmp_c;
DROP table tmp_c;
IF (stuname is null) THEN let stuname = " ";
END IF
SYSTEM '/usr/bin/echo "This notice is to inform you that ('|| in_id
||') '|| stuname ||'" > /tmp/testmail';
SYSTEM '/usr/bin/echo "has been changed from group '|| old_grp
||' to '|| new_grp2 ||'" >> /tmp/testmail';
LET mailcall = '/usr/bin/mailx -s "Group Change Notification"
psmith@ksu.edu < /tmp/testmail';
SYSTEM mailcall;
SYSTEM '/bin/rm /tmp/testmail';
end procedure
grant
execute to (group admissions, group carsprog, group registrar)
sending to informix-list
I've run into a -668 error a few times in the past. One of the common
problems is that the user that is trying to run the SYSTEM command doesn't
have a valid home directory. Once I gave the users a proper home directory
(they all got the same one) everything worked fine.
That's why you may see it working as yourself but not as other
usernames
Cheers
Richb
On Tue, 07 Sep 2004 13:35:07 -0700, Vivek CHAUDHARY uttered forth:
>
> You're losing the environment when the system command is executed. Set your
> environment properly in your system command before you execute echo command.
> Just to test it, you could run "SYSTEM 'env > /tmp/env.out'" as a user. My
> guess is that you'll get -668 error.
>
> Vivek
>
> -----Original Message-----
> From: owner-informix-list@iiug.org [mailto:owner-informix-list@iiug.org] On
> Behalf Of Matt
> Sent: Tuesday, September 07, 2004 11:58 AM
> To: informix-list@iiug.org
> Subject: system permissions
>
>
> I'm trying to create a trigger on a record for when a certain field is
> updated, using a procedure. The procedure works fine when I, having
> administrative powers, run it, but when any of the users try it, it gets an
> error (-668). It appears that any system command causes the error. Here is
> the code. If anyone has any ideas, please let me know. Thanks.
>
> procedure grpeml
> privilege owner
> description "Sends e-mail to registrar when a student's group
> number changes"
> inputs in_id int "student id"
> new_grp char(4) "new group"
> old_grp char(4) "old group"
> notes "Runs from trigger in prog_enr_rec when assigned"
>
> begin procedure
> DEFINE mailcall char(100);
> DEFINE stuname char(30);
>
> SELECT fullname
> FROM id_rec
> WHERE id_rec.id = in_id
> INTO temp tmp_c;>
> SELECT fullname
> INTO stuname
> FROM tmp_c;>
> DROP table tmp_c;>
> IF (stuname is null) THEN let stuname = " ";
> END IF
>
> SYSTEM '/usr/bin/echo "This notice is to inform you that ('|| in_id
> ||') '|| stuname ||'" > /tmp/testmail';
> SYSTEM '/usr/bin/echo "has been changed from group '|| old_grp
> ||' to '|| new_grp2 ||'" >> /tmp/testmail';
>
> LET mailcall = '/usr/bin/mailx -s "Group Change Notification"
> psmith@ksu.edu < /tmp/testmail';
>
> SYSTEM mailcall;
>
> SYSTEM '/bin/rm /tmp/testmail';
>
> end procedure
>
> grant
> execute to (group admissions, group carsprog, group registrar)
>
>
> sending to informix-list