nsadb.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. * END COPYRIGHT BLOCK **/
  6. #ifndef __nsadb_h
  7. #define __nsadb_h
  8. /*
  9. * Description (nsadb.h)
  10. *
  11. * This file describes the interface for retrieving information
  12. * from a Netscape authentication database. This facility is
  13. * built on top of the Netscape (server) database interface as
  14. * defined in nsdb.h. It represents a subclass of a more general
  15. * authentication database interface defined in nsauth.h.
  16. */
  17. #include "nserror.h" /* error frame list support */
  18. #include "nsautherr.h" /* authentication error codes */
  19. #include "nsauth.h"
  20. /* Begin private definitions */
  21. #ifdef __PRIVATE_NSADB
  22. #include "nsdb.h"
  23. #if defined(CLIENT_AUTH)
  24. #define ADBDBNAMES 3 /* number of named files */
  25. #else
  26. #define ADBDBNAMES 2 /* number of named files */
  27. #endif
  28. #define ADBUSERDBNAME "Users" /* name of user database */
  29. #define ADBGROUPDBNAME "Groups" /* name of group database */
  30. #if defined(CLIENT_AUTH)
  31. #define ADBCERTDBNAME "Certs" /* name of certificate mapping DB */
  32. #define ADBUMAPDBNAME "Certs.nm" /* name of mapped user names DB */
  33. #endif
  34. typedef struct AuthDB_s AuthDB_t;
  35. struct AuthDB_s {
  36. char * adb_dbname; /* database name */
  37. void * adb_userdb; /* handle for user database */
  38. void * adb_groupdb; /* handle for group database */
  39. #if defined(CLIENT_AUTH)
  40. void * adb_certdb; /* handle for cert mapping database */
  41. void * adb_certlock; /* lock for cert mapping database */
  42. void * adb_certnm; /* handle for username-to-certid DB */
  43. #endif
  44. int adb_flags; /* flags */
  45. };
  46. /* Definitions for adb_flags (also used on nsadbOpenXxxx() calls) */
  47. #define ADBF_NEW 0x1 /* newly created database */
  48. #define ADBF_UREAD 0x10 /* user database open for read */
  49. #define ADBF_UWRITE 0x20 /* user database open for write */
  50. #define ADBF_GREAD 0x100 /* group database open for read */
  51. #define ADBF_GWRITE 0x200 /* group database open for write */
  52. #define ADBF_CREAD 0x1000 /* cert database open for read */
  53. #define ADBF_CWRITE 0x2000 /* cert database open for write */
  54. #endif /* __PRIVATE_NSADB */
  55. NSPR_BEGIN_EXTERN_C
  56. /* Functions in nsadb.c */
  57. extern NSAPI_PUBLIC int nsadbOpen(NSErr_t * errp,
  58. char * adbname, int flags, void **rptr);
  59. extern NSAPI_PUBLIC void nsadbClose(void * authdb, int flags);
  60. extern NSAPI_PUBLIC int nsadbOpenUsers(NSErr_t * errp,
  61. void * authdb, int flags);
  62. extern NSAPI_PUBLIC int nsadbOpenGroups(NSErr_t * errp,
  63. void * authdb, int flags);
  64. extern NSAPI_PUBLIC int nsadbIdToName(NSErr_t * errp, void * authdb,
  65. USI_t id, int flags, char **rptr);
  66. extern NSAPI_PUBLIC int nsadbFindByName(NSErr_t * errp, void * authdb,
  67. char * name, int flags, void **rptr);
  68. #if defined(CLIENT_AUTH)
  69. #include "nscert.h"
  70. #endif
  71. /* Authentication database interface structure in nsadb.c */
  72. extern AuthIF_t NSADB_AuthIF;
  73. NSPR_END_EXTERN_C
  74. #endif /* __nsadb_h */