Path: blob/main/crypto/krb5/src/plugins/kdb/lmdb/klmdb-int.h
34914 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/* plugins/kdb/lmdb/klmdb-int.h - internal declarations for LMDB KDB module */2/*3* Copyright (C) 2018 by the Massachusetts Institute of Technology.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9*10* * Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12*13* * Redistributions in binary form must reproduce the above copyright14* notice, this list of conditions and the following disclaimer in15* the documentation and/or other materials provided with the16* distribution.17*18* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS21* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE22* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,23* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES24* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR25* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)26* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,27* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)28* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED29* OF THE POSSIBILITY OF SUCH DAMAGE.30*/3132#ifndef LMDB_INT_H33#define LMDB_INT_H3435/* Length of a principal lockout record (three 32-bit fields) */36#define LOCKOUT_RECORD_LEN 123738krb5_error_code klmdb_encode_princ(krb5_context context,39const krb5_db_entry *entry,40uint8_t **enc_out, size_t *len_out);41void klmdb_encode_princ_lockout(krb5_context context,42const krb5_db_entry *entry,43uint8_t buf[LOCKOUT_RECORD_LEN]);44krb5_error_code klmdb_encode_policy(krb5_context context,45const osa_policy_ent_rec *pol,46uint8_t **enc_out, size_t *len_out);4748krb5_error_code klmdb_decode_princ(krb5_context context,49const void *key, size_t key_len,50const void *enc, size_t enc_len,51krb5_db_entry **entry_out);52void klmdb_decode_princ_lockout(krb5_context context, krb5_db_entry *entry,53const uint8_t buf[LOCKOUT_RECORD_LEN]);54krb5_error_code klmdb_decode_policy(krb5_context context,55const void *key, size_t key_len,56const void *enc, size_t enc_len,57osa_policy_ent_t *pol_out);5859krb5_error_code klmdb_lockout_check_policy(krb5_context context,60krb5_db_entry *entry,61krb5_timestamp stamp);62krb5_error_code klmdb_lockout_audit(krb5_context context, krb5_db_entry *entry,63krb5_timestamp stamp,64krb5_error_code status,65krb5_boolean disable_last_success,66krb5_boolean disable_lockout);67krb5_error_code klmdb_update_lockout(krb5_context context,68krb5_db_entry *entry,69krb5_timestamp stamp,70krb5_boolean zero_fail_count,71krb5_boolean set_last_success,72krb5_boolean set_last_failure);7374krb5_error_code klmdb_get_policy(krb5_context context, char *name,75osa_policy_ent_t *policy);7677#endif /* LMDB_INT_H */787980