krb5.h

来自「一个FTP下载的源代码。代码质量非常高」· C头文件 代码 · 共 1,815 行 · 第 1/5 页

H
1,815
字号
    int sequence_count;
    passwd_phrase_element FAR * FAR *element;
} krb5_pwd_data;

/* these need to be here so the typedefs are available for the prototypes */

/*
 * begin "safepriv.h"
 */

#define KRB5_AUTH_CONTEXT_DO_TIME	0x00000001
#define KRB5_AUTH_CONTEXT_RET_TIME	0x00000002
#define KRB5_AUTH_CONTEXT_DO_SEQUENCE	0x00000004
#define KRB5_AUTH_CONTEXT_RET_SEQUENCE	0x00000008
#define KRB5_AUTH_CONTEXT_PERMIT_ALL	0x00000010
 
typedef struct krb5_replay_data { 
    krb5_timestamp	timestamp; 
    krb5_int32		usec;
    krb5_int32		seq; 
} krb5_replay_data;

/* flags for krb5_auth_con_genaddrs() */
#define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR		0x00000001
#define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR		0x00000002
#define KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR	0x00000004
#define KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR	0x00000008

/*
 * end "safepriv.h"
 */


/*
 * begin "ccache.h"
 */

typedef	krb5_pointer	krb5_cc_cursor;	/* cursor for sequential lookup */

typedef struct _krb5_ccache {
    krb5_magic magic;
    struct _krb5_cc_ops FAR *ops;
    krb5_pointer data;
} FAR *krb5_ccache;

typedef struct _krb5_cc_ops {
    krb5_magic magic;
    char FAR *prefix;
    char FAR * (KRB5_CALLCONV *get_name) KRB5_NPROTOTYPE((krb5_context, krb5_ccache));
    krb5_error_code (KRB5_CALLCONV *resolve) KRB5_NPROTOTYPE((krb5_context, krb5_ccache FAR *,
					    const char FAR *));
    krb5_error_code (KRB5_CALLCONV *gen_new) KRB5_NPROTOTYPE((krb5_context, krb5_ccache FAR *));
    krb5_error_code (KRB5_CALLCONV *init) KRB5_NPROTOTYPE((krb5_context, krb5_ccache,
					    krb5_principal));
    krb5_error_code (KRB5_CALLCONV *destroy) KRB5_NPROTOTYPE((krb5_context, krb5_ccache));
    krb5_error_code (KRB5_CALLCONV *close) KRB5_NPROTOTYPE((krb5_context, krb5_ccache));
    krb5_error_code (KRB5_CALLCONV *store) KRB5_NPROTOTYPE((krb5_context, krb5_ccache,
					    krb5_creds FAR *));
    krb5_error_code (KRB5_CALLCONV *retrieve) KRB5_NPROTOTYPE((krb5_context, krb5_ccache,
					    krb5_flags, krb5_creds FAR *,
					    krb5_creds FAR *));
    krb5_error_code (KRB5_CALLCONV *get_princ) KRB5_NPROTOTYPE((krb5_context, krb5_ccache,
					    krb5_principal FAR *));
    krb5_error_code (KRB5_CALLCONV *get_first) KRB5_NPROTOTYPE((krb5_context, krb5_ccache,
					    krb5_cc_cursor FAR *));
    krb5_error_code (KRB5_CALLCONV *get_next) KRB5_NPROTOTYPE((krb5_context, krb5_ccache,
					    krb5_cc_cursor FAR *, krb5_creds FAR *));
    krb5_error_code (KRB5_CALLCONV *end_get) KRB5_NPROTOTYPE((krb5_context, krb5_ccache,
					    krb5_cc_cursor FAR *));
    krb5_error_code (KRB5_CALLCONV *remove_cred) KRB5_NPROTOTYPE((krb5_context, krb5_ccache,
					    krb5_flags, krb5_creds FAR *));
    krb5_error_code (KRB5_CALLCONV *set_flags) KRB5_NPROTOTYPE((krb5_context, krb5_ccache,
					    krb5_flags));
} krb5_cc_ops;

/* for retrieve_cred */
#define	KRB5_TC_MATCH_TIMES		0x00000001
#define	KRB5_TC_MATCH_IS_SKEY		0x00000002
#define	KRB5_TC_MATCH_FLAGS		0x00000004
#define	KRB5_TC_MATCH_TIMES_EXACT	0x00000008
#define	KRB5_TC_MATCH_FLAGS_EXACT	0x00000010
#define	KRB5_TC_MATCH_AUTHDATA		0x00000020
#define	KRB5_TC_MATCH_SRV_NAMEONLY	0x00000040
#define	KRB5_TC_MATCH_2ND_TKT		0x00000080
#define	KRB5_TC_MATCH_KTYPE		0x00000100
#define KRB5_TC_SUPPORTED_KTYPES	0x00000200

/* for set_flags and other functions */
#define KRB5_TC_OPENCLOSE		0x00000001

#define krb5_cc_initialize(context, cache, principal)			krb5_x ((cache)->ops->init,(context, cache, principal))
#define krb5_cc_gen_new(context, cache)					krb5_x ((*cache)->ops->gen_new,(context, cache))
#define krb5_cc_destroy(context, cache)					krb5_x ((cache)->ops->destroy,(context, cache))
#define krb5_cc_close(context, cache)					krb5_x ((cache)->ops->close,(context, cache))
#define krb5_cc_store_cred(context, cache, creds)			krb5_x ((cache)->ops->store,(context, cache, creds))
#define krb5_cc_retrieve_cred(context, cache, flags, mcreds, creds)	krb5_x ((cache)->ops->retrieve,(context, cache, flags, mcreds, creds))
#define krb5_cc_get_principal(context, cache, principal)		krb5_x ((cache)->ops->get_princ,(context, cache, principal))
#define krb5_cc_start_seq_get(context, cache, cursor)			krb5_x ((cache)->ops->get_first,(context, cache, cursor))
#define krb5_cc_next_cred(context, cache, cursor, creds)		krb5_x ((cache)->ops->get_next,(context, cache, cursor, creds))
#define krb5_cc_end_seq_get(context, cache, cursor)			krb5_x ((cache)->ops->end_get,(context, cache, cursor))
#define krb5_cc_remove_cred(context, cache, flags, creds)		krb5_x ((cache)->ops->remove_cred,(context, cache,flags, creds))
#define krb5_cc_set_flags(context, cache, flags)			krb5_x ((cache)->ops->set_flags,(context, cache, flags))
#define krb5_cc_get_name(context, cache)				krb5_xc((cache)->ops->get_name,(context, cache))
#define krb5_cc_get_type(context, cache)				((cache)->ops->prefix)

extern krb5_cc_ops *krb5_cc_dfl_ops;

/*
 * end "ccache.h"
 */

/*
 * begin "rcache.h"
 */

typedef struct krb5_rc_st {
    krb5_magic magic;
    struct _krb5_rc_ops FAR *ops;
    krb5_pointer data;
} FAR *krb5_rcache;

typedef struct _krb5_donot_replay {
    krb5_magic magic;
    char FAR *server;			/* null-terminated */
    char FAR *client;			/* null-terminated */
    krb5_int32 cusec;
    krb5_timestamp ctime;
} krb5_donot_replay;

typedef struct _krb5_rc_ops {
    krb5_magic magic;
    char FAR *type;
    krb5_error_code (KRB5_CALLCONV *init)
	KRB5_NPROTOTYPE((krb5_context, krb5_rcache,krb5_deltat)); /* create */
    krb5_error_code (KRB5_CALLCONV *recover)
	KRB5_NPROTOTYPE((krb5_context, krb5_rcache)); /* open */
    krb5_error_code (KRB5_CALLCONV *destroy)
	KRB5_NPROTOTYPE((krb5_context, krb5_rcache));
    krb5_error_code (KRB5_CALLCONV *close)
	KRB5_NPROTOTYPE((krb5_context, krb5_rcache));
    krb5_error_code (KRB5_CALLCONV *store)
	KRB5_NPROTOTYPE((krb5_context, krb5_rcache,krb5_donot_replay FAR *));
    krb5_error_code (KRB5_CALLCONV *expunge)
	KRB5_NPROTOTYPE((krb5_context, krb5_rcache));
    krb5_error_code (KRB5_CALLCONV *get_span)
	KRB5_NPROTOTYPE((krb5_context, krb5_rcache,krb5_deltat FAR *));
    char FAR *(KRB5_CALLCONV *get_name)
	KRB5_NPROTOTYPE((krb5_context, krb5_rcache));
    krb5_error_code (KRB5_CALLCONV *resolve)
	KRB5_NPROTOTYPE((krb5_context, krb5_rcache, char FAR *));
} krb5_rc_ops;

krb5_error_code krb5_rc_default 
	KRB5_PROTOTYPE((krb5_context,
		krb5_rcache FAR *));
krb5_error_code krb5_rc_register_type 
	KRB5_PROTOTYPE((krb5_context,
		krb5_rc_ops FAR *));
krb5_error_code krb5_rc_resolve_type 
	KRB5_PROTOTYPE((krb5_context,
		krb5_rcache FAR *,char FAR *));
krb5_error_code krb5_rc_resolve_full 
	KRB5_PROTOTYPE((krb5_context,
		krb5_rcache FAR *,char FAR *));
char FAR * krb5_rc_get_type 
	KRB5_PROTOTYPE((krb5_context,
		krb5_rcache));
char FAR * krb5_rc_default_type 
	KRB5_PROTOTYPE((krb5_context));
char FAR * krb5_rc_default_name 
	KRB5_PROTOTYPE((krb5_context));
krb5_error_code krb5_auth_to_rep 
	KRB5_PROTOTYPE((krb5_context,
		krb5_tkt_authent FAR *,
		krb5_donot_replay FAR *));


#define krb5_rc_initialize(context, id, span) krb5_x((id)->ops->init,(context, id, span))
#define krb5_rc_recover(context, id) krb5_x((id)->ops->recover,(context, id))
#define krb5_rc_destroy(context, id) krb5_x((id)->ops->destroy,(context, id))
#define krb5_rc_close(context, id) krb5_x((id)->ops->close,(context, id))
#define krb5_rc_store(context, id, dontreplay) krb5_x((id)->ops->store,(context, id, dontreplay))
#define krb5_rc_expunge(context, id) krb5_x((id)->ops->expunge,(context, id))
#define krb5_rc_get_lifespan(context, id, spanp) krb5_x((id)->ops->get_span,(context, id, spanp))
#define krb5_rc_get_name(context, id) krb5_xc((id)->ops->get_name,(context, id))
#define krb5_rc_resolve(context, id, name) krb5_x((id)->ops->resolve,(context, id, name))

extern krb5_rc_ops krb5_rc_dfl_ops;

/*
 * end "rcache.h"
 */

/*
 * begin "keytab.h"
 */


/* XXX */
#define MAX_KEYTAB_NAME_LEN 1100 /* Long enough for MAXPATHLEN + some extra */

typedef krb5_pointer krb5_kt_cursor;	/* XXX */

typedef struct krb5_keytab_entry_st {
    krb5_magic magic;
    krb5_principal principal;	/* principal of this key */
    krb5_timestamp timestamp;	/* time entry written to keytable */
    krb5_kvno vno;		/* key version number */
    krb5_keyblock key;		/* the secret key */
} krb5_keytab_entry;


typedef struct _krb5_kt {
    krb5_magic magic;
    struct _krb5_kt_ops FAR *ops;
    krb5_pointer data;
} FAR *krb5_keytab;


typedef struct _krb5_kt_ops {
    krb5_magic magic;
    char FAR *prefix;
    /* routines always present */
    krb5_error_code (KRB5_CALLCONV *resolve) 
	KRB5_NPROTOTYPE((krb5_context,
		 krb5_const char FAR *,
		 krb5_keytab FAR *));
    krb5_error_code (KRB5_CALLCONV *get_name) 
	KRB5_NPROTOTYPE((krb5_context,
		 krb5_keytab,
		 char FAR *,
		 int));
    krb5_error_code (KRB5_CALLCONV *close) 
	KRB5_NPROTOTYPE((krb5_context,
		 krb5_keytab));
    krb5_error_code (KRB5_CALLCONV *get) 
	KRB5_NPROTOTYPE((krb5_context,
		 krb5_keytab,
		 krb5_const_principal,
		 krb5_kvno,
		 krb5_enctype,
		 krb5_keytab_entry FAR *));
    krb5_error_code (KRB5_CALLCONV *start_seq_get) 
	KRB5_NPROTOTYPE((krb5_context,
		 krb5_keytab,
		 krb5_kt_cursor FAR *));	
    krb5_error_code (KRB5_CALLCONV *get_next) 
	KRB5_NPROTOTYPE((krb5_context,
		 krb5_keytab,
		 krb5_keytab_entry FAR *,
		 krb5_kt_cursor FAR *));
    krb5_error_code (KRB5_CALLCONV *end_get) 
	KRB5_NPROTOTYPE((krb5_context,
		 krb5_keytab,
		 krb5_kt_cursor FAR *));
    /* routines to be included on extended version (write routines) */
    krb5_error_code (KRB5_CALLCONV *add) 
	KRB5_NPROTOTYPE((krb5_context,
		 krb5_keytab,
		 krb5_keytab_entry FAR *));
    krb5_error_code (KRB5_CALLCONV *remove) 
	KRB5_NPROTOTYPE((krb5_context,
		 krb5_keytab,
		  krb5_keytab_entry FAR *));

    /* Handle for serializer */
    void * serializer;
} krb5_kt_ops;

#define krb5_kt_get_type(context, keytab) ((keytab)->ops->prefix)
#define krb5_kt_get_name(context, keytab, name, namelen) krb5_x((keytab)->ops->get_name,(context, keytab,name,namelen))
#define krb5_kt_close(context, keytab) krb5_x((keytab)->ops->close,(context, keytab))
#define krb5_kt_get_entry(context, keytab, principal, vno, enctype, entry) krb5_x((keytab)->ops->get,(context, keytab, principal, vno, enctype, entry))
#define krb5_kt_start_seq_get(context, keytab, cursor) krb5_x((keytab)->ops->start_seq_get,(context, keytab, cursor))
#define krb5_kt_next_entry(context, keytab, entry, cursor) krb5_x((keytab)->ops->get_next,(context, keytab, entry, cursor))
#define krb5_kt_end_seq_get(context, keytab, cursor) krb5_x((keytab)->ops->end_get,(context, keytab, cursor))
/* remove and add are functions, so that they can return NOWRITE
   if not a writable keytab */


extern krb5_kt_ops krb5_kt_dfl_ops;

/*
 * end "keytab.h"
 */

/*
 * begin "func-proto.h"
 */

KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_init_context
	KRB5_PROTOTYPE((krb5_context FAR *));
KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_init_secure_context
	KRB5_PROTOTYPE((krb5_context FAR *));
KRB5_DLLIMP void KRB5_CALLCONV krb5_free_context
	KRB5_PROTOTYPE((krb5_context));

krb5_error_code krb5_set_default_in_tkt_ktypes
	KRB5_PROTOTYPE((krb5_context,
		krb5_const krb5_enctype *));
krb5_error_code krb5_get_default_in_tkt_ktypes
	KRB5_PROTOTYPE((krb5_context,
		krb5_enctype **));

krb5_error_code krb5_set_default_tgs_ktypes
	KRB5_PROTOTYPE((krb5_context,
		krb5_const krb5_enctype *));
krb5_error_code KRB5_CALLCONV krb5_get_tgs_ktypes
	KRB5_PROTOTYPE((krb5_context,
		krb5_const_principal,
		krb5_enctype **));

krb5_error_code krb5_get_permitted_enctypes
	KRB5_PROTOTYPE((krb5_context, krb5_enctype **));
void KRB5_CALLCONV krb5_free_ktypes
	KRB5_PROTOTYPE ((krb5_context, krb5_enctype *));

krb5_boolean krb5_is_permitted_enctype
	KRB5_PROTOTYPE((krb5_context, krb5_enctype));

/* libkrb.spec */
krb5_error_code krb5_kdc_rep_decrypt_proc
	KRB5_PROTOTYPE((krb5_context,
		krb5_const krb5_keyblock *,
		krb5_const_pointer,
		krb5_kdc_rep * ));
KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_decrypt_tkt_part
	KRB5_PROTOTYPE((krb5_context,
		krb5_const krb5_keyblock FAR *,
		krb5_ticket FAR * ));
krb5_error_code krb5_get_cred_from_kdc
	KRB5_PROTOTYPE((krb5_context,
		krb5_ccache,		/* not const, as reading may save
					   state */
		krb5_creds *,
		krb5_creds **,
		krb5_creds *** ));
krb5_error_code krb5_get_cred_from_kdc_validate
	KRB5_PROTOTYPE((krb5_context,
		krb5_ccache,		/* not const, as reading may save
					   state */
		krb5_creds *,
		krb5_creds **,
		krb5_creds *** ));
krb5_error_code krb5_get_cred_from_kdc_renew
	KRB5_PROTOTYPE((krb5_context,
		krb5_ccache,		/* not const, as reading may save
					   state */
		krb5_creds *,
		krb5_creds **,
		krb5_creds *** ));
KRB5_DLLIMP void KRB5_CALLCONV krb5_free_tgt_creds
	KRB5_PROTOTYPE((krb5_context,
		krb5_creds FAR * FAR* )); /* XXX too hard to do with const */

#define	KRB5_GC_USER_USER	1	/* want user-user ticket */
#define	KRB5_GC_CACHED		2	/* want cached ticket only */

KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_get_credentials
	KRB5_PROTOTYPE((krb5_context,
		krb5_const krb5_flags,
		krb5_ccache,
		krb5_creds FAR *,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?