home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / aix / 8332 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  2.5 KB

  1. 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
  2. From: julie@levell.austin.ibm.com (Julie L. Craft)
  3. Newsgroups: comp.unix.aix
  4. Subject: Re: problem with putuserpw subroutine
  5. Message-ID: <1992Jul29.205410.15721@awdprime.austin.ibm.com>
  6. Date: 29 Jul 92 20:54:10 GMT
  7. References: <1992Jul23.225734.9999@slate.mines.colorado.edu> <LWVANELS.92Jul27094958@fionavar.mit.edu>
  8. Sender: news@awdprime.austin.ibm.com (USENET News)
  9. Organization: IBM, Austin
  10. Lines: 54
  11.  
  12. In article <LWVANELS.92Jul27094958@fionavar.mit.edu> lwvanels@MIT.EDU writes:
  13. >bware@slate.mines.colorado.edu (Bob Ware) writes:
  14. >
  15. >>   Has anyone had success using the putuserpw subroutine?  
  16. >>   The getuserpw subroutine seems to work as advertised, but the putuserpw
  17. >>   routine always bombs with errno pointing to:
  18. >>       Only the owner or a privileged user can perform the operation.
  19. >
  20. >It looks like there is indeed a bug; it looks like getuserpw() is doing a
  21. >setpwdb() to get read-only access to the auth db, and never closing it when
  22. >it is finished.  
  23.     
  24. getuserpw()
  25.  *   This is a library routine. It returns the requested attribute values
  26.  *   in malloc'd memory. A call to enduserdb() will free all the memory.
  27.  
  28. We can't call enduserdb because it will free the memory just malloc'd.
  29.  
  30. > Furthermore, it looks like putuserpw is trying to be smart
  31. >about things, and not trying to get read-write access if the database is
  32. >open at all.  Since getuserpw left it open with read-only access, putuserpw
  33. >fails.
  34.  
  35.     If no one has called setpwdb() then putuserpw will call
  36.     it with read/write
  37.  
  38.             /* open for read and write */
  39.         if (chkpsessions() == 0)
  40.         {
  41.                 if (setpwdb (S_READ | S_WRITE))
  42.                         return (-1);
  43.         }
  44.  
  45. >
  46. >There's two work-arounds for this- either explicitly call
  47. >setpwdb(S_READ|S_WRITE) before putuserpw(), or call endpwdb() after the call
  48. >to getuserpw.
  49. >
  50. >        -Lucien
  51.  
  52.     I think the rule-o-thumb would be if you want to write to
  53.     the database, call setpwdb yourself.
  54.  
  55. >
  56. >----------------------------------------------------------------------------
  57. >Lucien Van Elsen               | lwvanels@athena.mit.edu
  58. >MIT Athena Systems Development |
  59.  
  60.  
  61. -- 
  62. *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
  63. Julie Levell Craft IBM AUSTIN,TX  Internet: julie@aixwiz.austin.ibm.com
  64. IBMNET: JULIEL at AUSVM6 2F-007/903  (512) 838-2677 (Tie 678-2677)
  65. "I'm not getting defensive!"
  66.