Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mstan!tli From: tli@Morgan.COM ( IBM) Newsgroups: comp.unix.aix Subject: Re: Password Verification Message-ID: <3543@s5.Morgan.COM> Date: 18 Jun 91 21:30:51 GMT References: <16390@smoke.brl.mil> <3533@s5.Morgan.COM> <3470@mtecv2.mty.itesm.mx> Organization: IBM Corporation, NYC Lines: 51 >Yes ! yes ! yes and more yes ! >One more time AIX is the problem....... > >IBM : Why not to do it standard ???? > >Why so many troubles ??? Let me explain my modifications. tli>modified xlock.c getPassword() to read: tli> tli>XWindowAttributes xgwa; tli>int y, /* moved the int declaration aft xgwa */ tli> left, tli> done; I want to keep the declarations together, so I moved them. My customer do not want to depend on the env var USERNAME; therefore, I used getuid() to see who is executing this prog. tli>#ifdef _AIX tli> uid_t uuid; tli> char user[10]; tli> uuid = getuid(); tli> pw = getpwuid(uuid); tli> strcpy(user,pw->pw_name); tli> strcpy(userpass, pw->pw_passwd); tli>#else tli> char *user = getenv(USERNAME); tli>#endif tli>.. tli>.. tli>.. tli>/* added if not def since user and userpass was set at start of getPassword */ As the comment states, I did not have to call getpwnam(), since I got all the information I need from the first #ifdef _AIX. tli>#ifndef _AIX tli> pw = getpwnam(user); tli> strcpy(userpass, pw->pw_passwd); tli>#endif tli> =============================================================== Thomas Y. Li Email: tli@nycvmic4.iinus1.ibm.com IBM Corporation tli%nycvmic4@iinus1.ibm.com 33 Maiden Lane 10th Floor tli@morgan.com New York, NY 10038 (212) 493-2516 T/L 340 VNET: tli at nycvmic4