Path: blob/main/crypto/krb5/src/plugins/kdb/db2/kdb_db2.h
34914 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/* plugins/kdb/db2/kdb_db2.h */2/*3* Copyright 1997 by the Massachusetts Institute of Technology.4* All Rights Reserved.5*6* Export of this software from the United States of America may7* require a specific license from the United States Government.8* It is the responsibility of any person or organization contemplating9* export to obtain such a license before exporting.10*11* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and12* distribute this software and its documentation for any purpose and13* without fee is hereby granted, provided that the above copyright14* notice appear in all copies and that both that copyright notice and15* this permission notice appear in supporting documentation, and that16* the name of M.I.T. not be used in advertising or publicity pertaining17* to distribution of the software without specific, written prior18* permission. Furthermore if you modify this software you must label19* your software as modified software and not distribute it in such a20* fashion that it might be confused with the original M.I.T. software.21* M.I.T. makes no representations about the suitability of22* this software for any purpose. It is provided "as is" without express23* or implied warranty.24*/2526/*27*28* KDC Database backend definitions for Berkely DB.29*/30#ifndef KRB5_KDB_DB2_H31#define KRB5_KDB_DB2_H3233#include "policy_db.h"3435typedef struct _krb5_db2_context {36krb5_boolean db_inited; /* Context initialized */37char * db_name; /* Name of database */38DB * db; /* DB handle */39krb5_boolean hashfirst; /* Try hash database type first */40char * db_lf_name; /* Name of lock file */41int db_lf_file; /* File descriptor of lock file */42int db_locks_held; /* Number of times locked */43int db_lock_mode; /* Last lock mode, e.g. greatest*/44krb5_boolean db_nb_locks; /* [Non]Blocking lock modes */45osa_adb_policy_t policy_db;46krb5_boolean tempdb;47krb5_boolean disable_last_success;48krb5_boolean disable_lockout;49krb5_boolean unlockiter;50} krb5_db2_context;5152krb5_error_code krb5_db2_init(krb5_context);53krb5_error_code krb5_db2_fini(krb5_context);54krb5_error_code krb5_db2_get_age(krb5_context, char *, time_t *);55krb5_error_code krb5_db2_get_principal(krb5_context, krb5_const_principal,56unsigned int, krb5_db_entry **);57krb5_error_code krb5_db2_put_principal(krb5_context, krb5_db_entry *,58char **db_args);59krb5_error_code krb5_db2_iterate(krb5_context, char *,60krb5_error_code (*)(krb5_pointer,61krb5_db_entry *),62krb5_pointer, krb5_flags);63krb5_error_code krb5_db2_set_nonblocking(krb5_context, krb5_boolean,64krb5_boolean *);65krb5_boolean krb5_db2_set_lockmode(krb5_context, krb5_boolean);66krb5_error_code krb5_db2_open_database(krb5_context);67krb5_error_code krb5_db2_close_database(krb5_context);6869krb5_error_code70krb5_db2_delete_principal(krb5_context context,71krb5_const_principal searchfor);7273krb5_error_code krb5_db2_lib_init(void);74krb5_error_code krb5_db2_lib_cleanup(void);75krb5_error_code krb5_db2_unlock(krb5_context);7677krb5_error_code78krb5_db2_promote_db(krb5_context kcontext, char *conf_section, char **db_args);7980krb5_error_code81krb5_db2_lock(krb5_context context, int in_mode);8283krb5_error_code84krb5_db2_open(krb5_context kcontext, char *conf_section, char **db_args,85int mode);8687krb5_error_code krb5_db2_create(krb5_context kcontext, char *conf_section,88char **db_args);8990krb5_error_code krb5_db2_destroy(krb5_context kcontext, char *conf_section,91char **db_args);9293const char *krb5_db2_err2str(krb5_context kcontext, long err_code);949596/* policy management functions */97krb5_error_code98krb5_db2_create_policy(krb5_context context, osa_policy_ent_t entry);99100krb5_error_code krb5_db2_get_policy(krb5_context kcontext,101char *name, osa_policy_ent_t *policy);102103krb5_error_code krb5_db2_put_policy(krb5_context kcontext,104osa_policy_ent_t policy);105106krb5_error_code krb5_db2_iter_policy(krb5_context kcontext, char *match_entry,107osa_adb_iter_policy_func func,108void *data);109110krb5_error_code krb5_db2_delete_policy(krb5_context kcontext, char *policy);111112113/* Thread-safety wrapper slapped on top of original implementation. */114extern k5_mutex_t *krb5_db2_mutex;115116/* lockout */117krb5_error_code118krb5_db2_lockout_check_policy(krb5_context context,119krb5_db_entry *entry,120krb5_timestamp stamp);121122krb5_error_code123krb5_db2_lockout_audit(krb5_context context,124krb5_db_entry *entry,125krb5_timestamp stamp,126krb5_error_code status);127128krb5_error_code129krb5_db2_check_policy_as(krb5_context kcontext, krb5_kdc_req *request,130krb5_db_entry *client, krb5_db_entry *server,131krb5_timestamp kdc_time, const char **status,132krb5_pa_data ***e_data);133134void135krb5_db2_audit_as_req(krb5_context kcontext, krb5_kdc_req *request,136const krb5_address *local_addr,137const krb5_address *remote_addr,138krb5_db_entry *client, krb5_db_entry *server,139krb5_timestamp authtime,140krb5_error_code error_code);141142#endif /* KRB5_KDB_DB2_H */143144145