xref: /illumos-gate/usr/src/lib/krb5/kdb/kdb5.h (revision 2dd2efa5)
154925bf6Swillf #ifndef _KRB5_KDB5_H_
254925bf6Swillf #define _KRB5_KDB5_H_
354925bf6Swillf 
454925bf6Swillf #pragma ident	"%Z%%M%	%I%	%E% SMI"
554925bf6Swillf 
654925bf6Swillf #if HAVE_UNISTD_H
754925bf6Swillf #include <unistd.h>
854925bf6Swillf #endif
954925bf6Swillf 
1054925bf6Swillf #include <errno.h>
1154925bf6Swillf #include <utime.h>
1254925bf6Swillf #include <utime.h>
1354925bf6Swillf #include <k5-int.h>
1454925bf6Swillf #include "kdb.h"
1554925bf6Swillf 
1654925bf6Swillf #define KDB_MAX_DB_NAME 128
1754925bf6Swillf #define KDB_REALM_SECTION  "realms"
1854925bf6Swillf #define KDB_MODULE_POINTER "database_module"
1954925bf6Swillf #define KDB_MODULE_DEF_SECTION "dbdefaults"
2054925bf6Swillf #define KDB_MODULE_SECTION "dbmodules"
2154925bf6Swillf #define KDB_LIB_POINTER    "db_library"
2254925bf6Swillf #define KDB_DATABASE_CONF_FILE  DEFAULT_SECURE_PROFILE_PATH
2354925bf6Swillf #define KDB_DATABASE_ENV_PROF KDC_PROFILE_ENV
2454925bf6Swillf 
2554925bf6Swillf #define KRB5_DB_GET_DB_CONTEXT(kcontext) (((kdb5_dal_handle*) (kcontext)->db_context)->db_context)
2654925bf6Swillf #define KRB5_DB_GET_PROFILE(kcontext)  ((kcontext)->profile)
2754925bf6Swillf #define KRB5_DB_GET_REALM(kcontext)    ((kcontext)->default_realm)
2854925bf6Swillf 
2954925bf6Swillf typedef struct _kdb_vftabl{
3054925bf6Swillf     short int maj_ver;
3154925bf6Swillf     short int min_ver;
3254925bf6Swillf     int       iprop_supported;
3354925bf6Swillf 
3454925bf6Swillf     krb5_error_code (*init_library)();
3554925bf6Swillf     krb5_error_code (*fini_library)();
3654925bf6Swillf     krb5_error_code (*init_module) (krb5_context kcontext,
3754925bf6Swillf 				    char * conf_section,
3854925bf6Swillf 				    char ** db_args,
3954925bf6Swillf 				    int mode);
4054925bf6Swillf 
4154925bf6Swillf     krb5_error_code (*fini_module) (krb5_context kcontext);
4254925bf6Swillf 
4354925bf6Swillf     krb5_error_code (*db_create) (krb5_context kcontext,
4454925bf6Swillf 				  char * conf_section,
4554925bf6Swillf 				  char ** db_args);
4654925bf6Swillf 
4754925bf6Swillf     krb5_error_code (*db_destroy) (krb5_context kcontext,
4854925bf6Swillf 				   char *conf_section,
4954925bf6Swillf 				   char ** db_args);
5054925bf6Swillf 
5154925bf6Swillf     krb5_error_code (*db_get_age) (krb5_context kcontext,
5254925bf6Swillf 				   char *db_name,
5354925bf6Swillf 				   time_t *age);
5454925bf6Swillf 
5554925bf6Swillf     krb5_error_code (*db_set_option) (krb5_context kcontext,
5654925bf6Swillf 				      int option,
5754925bf6Swillf 				      void *value);
5854925bf6Swillf 
5954925bf6Swillf     krb5_error_code (*db_lock) (krb5_context kcontext,
6054925bf6Swillf 				int mode);
6154925bf6Swillf 
6254925bf6Swillf     krb5_error_code (*db_unlock) (krb5_context kcontext);
6354925bf6Swillf 
6454925bf6Swillf     krb5_error_code (*db_get_principal) (krb5_context kcontext,
6554925bf6Swillf 					 krb5_const_principal search_for,
6654925bf6Swillf 					 krb5_db_entry *entries,
6754925bf6Swillf 					 int *nentries,
6854925bf6Swillf 					 krb5_boolean *more);
6954925bf6Swillf 
7054925bf6Swillf     krb5_error_code (*db_get_principal_nolock) (krb5_context kcontext,
7154925bf6Swillf 					 krb5_const_principal search_for,
7254925bf6Swillf 					 krb5_db_entry *entries,
7354925bf6Swillf 					 int *nentries,
7454925bf6Swillf 					 krb5_boolean *more);
7554925bf6Swillf 
7654925bf6Swillf     krb5_error_code (*db_free_principal) (krb5_context kcontext,
7754925bf6Swillf 					  krb5_db_entry *entry,
7854925bf6Swillf 					  int count);
7954925bf6Swillf 
8054925bf6Swillf     krb5_error_code (*db_put_principal) (krb5_context kcontext,
8154925bf6Swillf 					 krb5_db_entry *entries,
8254925bf6Swillf 					 int *nentries,
8354925bf6Swillf 					 char **db_args);
8454925bf6Swillf 
8554925bf6Swillf     krb5_error_code (*db_delete_principal) (krb5_context kcontext,
8654925bf6Swillf 					    krb5_const_principal search_for,
8754925bf6Swillf 					    int *nentries);
8854925bf6Swillf 
89*2dd2efa5Swillf     /* Solaris Kerberos: adding support for db_args */
9054925bf6Swillf     krb5_error_code (*db_iterate) (krb5_context kcontext,
91