Re: getting login name in 4GL
Posted in 1996
Mike Segel wrote: > > Tim Schaefer wrote: > > > > montgomery f. tidwell wrote: > > > > > > Howdy, > > > > > > does anyone know how i can get the login name of a User > > > from within a 4GL program? > > > > > > TIA > > > -- > > > There are three kinds of people in the World. Those who > > > can count, and those who can't. > > > > > Here's two solutions for you: > > > > Create a C function: > > > [Code Deleted ....] > > > > I just tested this with the c4gl and not RDS so it should work, but your UNIX > > may vary...It may not fool rlogin, using the current rlogin id instead of > > the original user id. > > > > :-) > > > > -- > > > That was only one solution. I was being humorous...see the original posters' note on kinds of people who can count. >Why not just get the shell environment > variable? > ($LOGNAME) or ($USER). I believe that Informix has a getenv function. > No muss no fuss..... ;-) > > Or am I missing something? > > -Mikey Depends on your UNIX and how logins are handled. I used LOGNAME only to be concerned that this could be changed--you can make it whatever you want. The USER variable inside 4GL isn't always accessable, or reliable. 4GL is software provided by a VENDOR. It's not infallable. It's not always gospel. And really, I can get environment variables from UNIX too, writing C functions to do that. Write a C function. This way you know you're getting as close as possible to the right answer from UNIX. If the UNIX function is wrong, then I get in touch with the UNIX Vendor, and ask why I can't get reliable user id information from the OS. If this is flaky then my whole OS is in danger of not being secure. Auditors love to find this kind of stuff. This starts to be a problem. If UNIX is wrong, what's to say INFORMIX is going to be MORE reliable? There's a danger in relying on a data base product to provide me with extremely critical information, especially concerning potential security. Sure, maybe I'm being overly cautious, but isn't that what security is all about? You'll probably find no less than 4 UNIX C functions to look at user ids. They each behave differently, and you need to experiment with them to make sure they do what you want. But trust the data base or environment? Not hardly. I barely trust the C function. :-) -- \\\\|// (6 6) ==============================---o00--(_)--00o---============================ Tim Schaefer tschaefe@encore.com tschaefe@shadow.net Encore Computer Corp (800)726-2230 x5608 http://www.shadow.net/~tschaefe =============================================================================