private.h revision 178825
160786Sps/*
2221715Sdelphij * Copyright (c) 1997-2000 Kungliga Tekniska H�gskolan
360786Sps * (Royal Institute of Technology, Stockholm, Sweden).
460786Sps * All rights reserved.
560786Sps *
660786Sps * Redistribution and use in source and binary forms, with or without
760786Sps * modification, are permitted provided that the following conditions
860786Sps * are met:
960786Sps *
1060786Sps * 1. Redistributions of source code must retain the above copyright
1160786Sps *    notice, this list of conditions and the following disclaimer.
1260786Sps *
1360786Sps * 2. Redistributions in binary form must reproduce the above copyright
1460786Sps *    notice, this list of conditions and the following disclaimer in the
1560786Sps *    documentation and/or other materials provided with the distribution.
1660786Sps *
1760786Sps * 3. Neither the name of the Institute nor the names of its contributors
1860786Sps *    may be used to endorse or promote products derived from this software
1960786Sps *    without specific prior written permission.
2060786Sps *
2160786Sps * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
2260786Sps * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2360786Sps * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24128345Stjr * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
2560786Sps * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2660786Sps * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2760786Sps * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2860786Sps * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2960786Sps * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3060786Sps * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31170256Sdelphij * SUCH DAMAGE.
32170256Sdelphij */
3360786Sps
3460786Sps/* $Id: private.h 22211 2007-12-07 19:27:27Z lha $ */
35221715Sdelphij
36221715Sdelphij#ifndef __kadm5_privatex_h__
37221715Sdelphij#define __kadm5_privatex_h__
38221715Sdelphij
39221715Sdelphijstruct kadm_func {
40221715Sdelphij    kadm5_ret_t (*chpass_principal) (void *, krb5_principal, const char*);
41221715Sdelphij    kadm5_ret_t (*create_principal) (void*, kadm5_principal_ent_t,
42221715Sdelphij				     uint32_t, const char*);
43221715Sdelphij    kadm5_ret_t (*delete_principal) (void*, krb5_principal);
44221715Sdelphij    kadm5_ret_t (*destroy) (void*);
45221715Sdelphij    kadm5_ret_t (*flush) (void*);
46221715Sdelphij    kadm5_ret_t (*get_principal) (void*, krb5_principal,
47221715Sdelphij				  kadm5_principal_ent_t, uint32_t);
48221715Sdelphij    kadm5_ret_t (*get_principals) (void*, const char*, char***, int*);
49221715Sdelphij    kadm5_ret_t (*get_privs) (void*, uint32_t*);
50221715Sdelphij    kadm5_ret_t (*modify_principal) (void*, kadm5_principal_ent_t, uint32_t);
51221715Sdelphij    kadm5_ret_t (*randkey_principal) (void*, krb5_principal,
52221715Sdelphij				      krb5_keyblock**, int*);
53221715Sdelphij    kadm5_ret_t (*rename_principal) (void*, krb5_principal, krb5_principal);
54221715Sdelphij    kadm5_ret_t (*chpass_principal_with_key) (void *, krb5_principal,
55221715Sdelphij					      int, krb5_key_data *);
56221715Sdelphij};
57221715Sdelphij
58221715Sdelphij/* XXX should be integrated */
59221715Sdelphijtypedef struct kadm5_common_context {
60221715Sdelphij    krb5_context context;
61221715Sdelphij    krb5_boolean my_context;
62221715Sdelphij    struct kadm_func funcs;
63221715Sdelphij    void *data;
6460786Sps}kadm5_common_context;
6560786Sps
6660786Spstypedef struct kadm5_log_peer {
6760786Sps    int fd;
6860786Sps    char *name;
6960786Sps    krb5_auth_context ac;
7060786Sps    struct kadm5_log_peer *next;
7160786Sps} kadm5_log_peer;
72128345Stjr
7360786Spstypedef struct kadm5_log_context {
7460786Sps    char *log_file;
7560786Sps    int log_fd;
7660786Sps    uint32_t version;
7760786Sps    struct sockaddr_un socket_name;
7860786Sps    int socket_fd;
7960786Sps} kadm5_log_context;
8060786Sps
8160786Spstypedef struct kadm5_server_context {
8260786Sps    krb5_context context;
8360786Sps    krb5_boolean my_context;
8460786Sps    struct kadm_func funcs;
8560786Sps    /* */
8660786Sps    kadm5_config_params config;
8760786Sps    HDB *db;
8860786Sps    krb5_principal caller;
8960786Sps    unsigned acl_flags;
9060786Sps    kadm5_log_context log_context;
9160786Sps} kadm5_server_context;
9260786Sps
9360786Spstypedef struct kadm5_client_context {
9460786Sps    krb5_context context;
9560786Sps    krb5_boolean my_context;
9660786Sps    struct kadm_func funcs;
9760786Sps    /* */
9860786Sps    krb5_auth_context ac;
9960786Sps    char *realm;
100221715Sdelphij    char *admin_server;
10160786Sps    int kadmind_port;
10260786Sps    int sock;
10360786Sps    char *client_name;
10460786Sps    char *service_name;
10560786Sps    krb5_prompter_fct prompter;
10660786Sps    const char *keytab;
10760786Sps    krb5_ccache ccache;
10860786Sps    kadm5_config_params *realm_params;
10960786Sps}kadm5_client_context;
11060786Sps
11160786Spstypedef struct kadm5_ad_context {
11260786Sps    krb5_context context;
11360786Sps    krb5_boolean my_context;
11460786Sps    struct kadm_func funcs;
11560786Sps    /* */
11660786Sps    kadm5_config_params config;
11760786Sps    krb5_principal caller;
11860786Sps    krb5_ccache ccache;
11960786Sps    char *client_name;
12060786Sps    char *realm;
12160786Sps    void *ldap_conn;
12260786Sps    char *base_dn;
12360786Sps} kadm5_ad_context;
12460786Sps
12560786Spsenum kadm_ops {
12660786Sps    kadm_get,
12760786Sps    kadm_delete,
12860786Sps    kadm_create,
12960786Sps    kadm_rename,
13060786Sps    kadm_chpass,
13160786Sps    kadm_modify,
13260786Sps    kadm_randkey,
13360786Sps    kadm_get_privs,
13460786Sps    kadm_get_princs,
13560786Sps    kadm_chpass_with_key,
13660786Sps    kadm_nop
13760786Sps};
13860786Sps
13960786Sps#define KADMIN_APPL_VERSION "KADM0.1"
14060786Sps#define KADMIN_OLD_APPL_VERSION "KADM0.0"
14160786Sps
14260786Sps#include "kadm5-private.h"
14360786Sps
14460786Sps#endif /* __kadm5_privatex_h__ */
14560786Sps