Path: utzoo!utgpu!watmath!att!dptg!rutgers!tut.cis.ohio-state.edu!ucbvax!hplabs!pyramid!infmx!aland From: aland@infmx.UUCP (Dr. Scump) Newsgroups: comp.databases Subject: Re: Informix Isql Protection Summary: USER is an SQL keyword, not an env variable Keywords: user-menu Message-ID: <2238@infmx.UUCP> Date: 30 Aug 89 04:25:24 GMT References: <4266@uhccux.uhcc.hawaii.edu> <463@techwood.UUCP> <101@csnz.co.nz> Reply-To: aland@infmx.UUCP (alan denney) Organization: INFORMIX Professional Services ("Peace thru Normalization") Lines: 43 In article <101@csnz.co.nz> paul@csnz.co.nz (Paul Gillingwater) writes: >In article <463@techwood.UUCP> johnw@techwood.UUCP (John Wheeler) writes: >... >Depends on the student's knowledge of UNIX, and whether they get >at the shell. I suspect the USER variable might be set up >in the .profile -- which could be edited. Alternatively, you >could do something like: > >USER=`id | sed -e 's/[^(]*(\([^)]*\).*/\1/'` >export USER > >which is harder to forge. Don't put it in the .profile, but in >the wrapper for Informix. >-- >Paul Gillingwater, Computer Sciences of New Zealand Limited Perhaps "USER" needs some clarification here. USER is not an environment variable; it is a figurative pseudo-constant (?) in our SQL dialect. The keyword USER returns the user name in character string format; it is obtained by taking the uid and getting the name from /etc/passwd, *not* from something like logname(). Example: find all table privilege entries granted to you: select * from systabauth where grantee = user; This is also handy for getting the current user name into a variable in a 4GL or ESQL program. Given the character variable curr_user: select unique user into curr_user from systables; ^ need ':' or '$' here in ESQL, of course Hope this clarifies things. Another one of these "figurative variables" (that any better?) is the keyword TODAY, which evaluates to the current date in DATE datatype format. -- Alan S. Denney @ Informix Software, Inc. {pyramid|uunet}!infmx!aland "I want to live! -------------------------------------------- as an honest man, Disclaimer: These opinions are mine alone. to get all I deserve If I am caught or killed, the secretary and to give all I can." will disavow any knowledge of my actions. - S. Vega