xref: /freebsd/crypto/krb5/src/kprop/kprop.h (revision f1c4c3daccbaf3820f0e2224de53df12fc952fcc)
1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* kprop/kprop.h */
3 /*
4  * Copyright 1990,1991 by the Massachusetts Institute of Technology.
5  * All Rights Reserved.
6  *
7  * Export of this software from the United States of America may
8  *   require a specific license from the United States Government.
9  *   It is the responsibility of any person or organization contemplating
10  *   export to obtain such a license before exporting.
11  *
12  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13  * distribute this software and its documentation for any purpose and
14  * without fee is hereby granted, provided that the above copyright
15  * notice appear in all copies and that both that copyright notice and
16  * this permission notice appear in supporting documentation, and that
17  * the name of M.I.T. not be used in advertising or publicity pertaining
18  * to distribution of the software without specific, written prior
19  * permission.  Furthermore if you modify this software you must label
20  * your software as modified software and not distribute it in such a
21  * fashion that it might be confused with the original M.I.T. software.
22  * M.I.T. makes no representations about the suitability of
23  * this software for any purpose.  It is provided "as is" without express
24  * or implied warranty.
25  */
26 
27 #define KPROP_SERVICE_NAME "host"
28 #define TGT_SERVICE_NAME "krbtgt"
29 #define KPROP_SERVICE "krb5_prop"
30 #define KPROP_PORT 754
31 
32 #define KPROP_PROT_VERSION "kprop5_01"
33 
34 #define KPROP_BUFSIZ 32768
35 #define KPROP_DBSIZE_MAX_BUFSIZ 12  /* max length of an encoded DB size */
36 
37 /* pathnames are in osconf.h, included via k5-int.h */
38 
39 krb5_error_code
40 sn2princ_realm(krb5_context context, const char *hostname, const char *sname,
41                const char *realm, krb5_principal *princ_out);
42 
43 /*
44  * Encode size in four bytes (for backward compatibility) if it fits; otherwise
45  * use the larger encoding.  buf must be allocated with at least
46  * KPROP_DBSIZE_MAX_BUFSIZ bytes.
47  */
48 void encode_database_size(uint64_t size, krb5_data *buf);
49 
50 /* Decode a database size.  Return KRB5KRB_ERR_GENERIC if buf has an invalid
51  * length or did not encode a 32-bit size compactly. */
52 krb5_error_code decode_database_size(const krb5_data *buf, uint64_t *size_out);
53