home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!cs.utexas.edu!ut-emx!ibmchs!auschs!awdprime.austin.ibm.com!levell.austin.ibm.com!julie
- From: julie@levell.austin.ibm.com (Julie L. Craft)
- Newsgroups: comp.unix.aix
- Subject: Re: problem with putuserpw subroutine
- Message-ID: <1992Jul29.205410.15721@awdprime.austin.ibm.com>
- Date: 29 Jul 92 20:54:10 GMT
- References: <1992Jul23.225734.9999@slate.mines.colorado.edu> <LWVANELS.92Jul27094958@fionavar.mit.edu>
- Sender: news@awdprime.austin.ibm.com (USENET News)
- Organization: IBM, Austin
- Lines: 54
-
- In article <LWVANELS.92Jul27094958@fionavar.mit.edu> lwvanels@MIT.EDU writes:
- >bware@slate.mines.colorado.edu (Bob Ware) writes:
- >
- >> Has anyone had success using the putuserpw subroutine?
- >> The getuserpw subroutine seems to work as advertised, but the putuserpw
- >> routine always bombs with errno pointing to:
- >> Only the owner or a privileged user can perform the operation.
- >
- >It looks like there is indeed a bug; it looks like getuserpw() is doing a
- >setpwdb() to get read-only access to the auth db, and never closing it when
- >it is finished.
-
- getuserpw()
- * This is a library routine. It returns the requested attribute values
- * in malloc'd memory. A call to enduserdb() will free all the memory.
-
- We can't call enduserdb because it will free the memory just malloc'd.
-
- > Furthermore, it looks like putuserpw is trying to be smart
- >about things, and not trying to get read-write access if the database is
- >open at all. Since getuserpw left it open with read-only access, putuserpw
- >fails.
-
- If no one has called setpwdb() then putuserpw will call
- it with read/write
-
- /* open for read and write */
- if (chkpsessions() == 0)
- {
- if (setpwdb (S_READ | S_WRITE))
- return (-1);
- }
-
- >
- >There's two work-arounds for this- either explicitly call
- >setpwdb(S_READ|S_WRITE) before putuserpw(), or call endpwdb() after the call
- >to getuserpw.
- >
- > -Lucien
-
- I think the rule-o-thumb would be if you want to write to
- the database, call setpwdb yourself.
-
- >
- >----------------------------------------------------------------------------
- >Lucien Van Elsen | lwvanels@athena.mit.edu
- >MIT Athena Systems Development |
-
-
- --
- *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
- Julie Levell Craft IBM AUSTIN,TX Internet: julie@aixwiz.austin.ibm.com
- IBMNET: JULIEL at AUSVM6 2F-007/903 (512) 838-2677 (Tie 678-2677)
- "I'm not getting defensive!"
-