├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .vscode ├── .env ├── extensions.json ├── settings.json └── tasks.json ├── CHANGELOG.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── build_helpers ├── heimdal │ └── include │ │ ├── asn1-common.h │ │ ├── asn1_err.h │ │ ├── base64.h │ │ ├── cms_asn1.h │ │ ├── com_err.h │ │ ├── com_right.h │ │ ├── crmf_asn1.h │ │ ├── der-private.h │ │ ├── der-protos.h │ │ ├── der.h │ │ ├── digest_asn1.h │ │ ├── getarg.h │ │ ├── gssapi.h │ │ ├── gssapi │ │ ├── gkrb5_err.h │ │ ├── gssapi.h │ │ ├── gssapi_krb5.h │ │ ├── gssapi_ntlm.h │ │ ├── gssapi_oid.h │ │ └── gssapi_spnego.h │ │ ├── hcrypto │ │ ├── aes.h │ │ ├── bn.h │ │ ├── des.h │ │ ├── dh.h │ │ ├── dsa.h │ │ ├── ec.h │ │ ├── ecdh.h │ │ ├── ecdsa.h │ │ ├── engine.h │ │ ├── evp-cc.h │ │ ├── evp-hcrypto.h │ │ ├── evp-openssl.h │ │ ├── evp-pkcs11.h │ │ ├── evp.h │ │ ├── hmac.h │ │ ├── md2.h │ │ ├── md4.h │ │ ├── md5.h │ │ ├── pkcs12.h │ │ ├── rand.h │ │ ├── rc2.h │ │ ├── rc4.h │ │ ├── rsa.h │ │ ├── sha.h │ │ ├── ui.h │ │ └── undef.h │ │ ├── hdb-protos.h │ │ ├── hdb.h │ │ ├── hdb_asn1.h │ │ ├── hdb_err.h │ │ ├── heim-ipc.h │ │ ├── heim_asn1.h │ │ ├── heim_err.h │ │ ├── heimbase.h │ │ ├── heimntlm-protos.h │ │ ├── heimntlm.h │ │ ├── hex.h │ │ ├── hx509-protos.h │ │ ├── hx509.h │ │ ├── hx509_err.h │ │ ├── k524_err.h │ │ ├── kadm5 │ │ ├── admin.h │ │ ├── kadm5-private.h │ │ ├── kadm5-protos.h │ │ ├── kadm5-pwcheck.h │ │ ├── kadm5_err.h │ │ └── private.h │ │ ├── kafs.h │ │ ├── kdc-protos.h │ │ ├── kdc.h │ │ ├── krb5-protos.h │ │ ├── krb5-types.h │ │ ├── krb5.h │ │ ├── krb5 │ │ ├── an2ln_plugin.h │ │ ├── ccache_plugin.h │ │ ├── db_plugin.h │ │ ├── locate_plugin.h │ │ ├── send_to_kdc_plugin.h │ │ └── windc_plugin.h │ │ ├── krb5_asn1.h │ │ ├── krb5_ccapi.h │ │ ├── krb5_err.h │ │ ├── kx509_asn1.h │ │ ├── ntlm_err.h │ │ ├── ocsp_asn1.h │ │ ├── parse_bytes.h │ │ ├── parse_time.h │ │ ├── parse_units.h │ │ ├── pkcs10_asn1.h │ │ ├── pkcs12_asn1.h │ │ ├── pkcs8_asn1.h │ │ ├── pkcs9_asn1.h │ │ ├── pkinit_asn1.h │ │ ├── resolve.h │ │ ├── rfc2459_asn1.h │ │ ├── roken-common.h │ │ ├── roken.h │ │ ├── rtbl.h │ │ ├── sl.h │ │ ├── wind.h │ │ ├── wind_err.h │ │ └── xdbm.h ├── lib.sh ├── run-ci.sh └── run-container.sh ├── pyproject.toml ├── requirements-dev.txt ├── setup.cfg ├── setup.py ├── src └── krb5 │ ├── __init__.py │ ├── _adpi.py │ ├── _ccache.pxd │ ├── _ccache.pyi │ ├── _ccache.pyx │ ├── _ccache_match.pyi │ ├── _ccache_match.pyx │ ├── _ccache_mit.pyi │ ├── _ccache_mit.pyx │ ├── _ccache_support_switch.pyi │ ├── _ccache_support_switch.pyx │ ├── _cccol.pyi │ ├── _cccol.pyx │ ├── _chpw_message_mit.pyi │ ├── _chpw_message_mit.pyx │ ├── _context.pxd │ ├── _context.pyi │ ├── _context.pyx │ ├── _context_mit.pyi │ ├── _context_mit.pyx │ ├── _creds.pxd │ ├── _creds.pyi │ ├── _creds.pyx │ ├── _creds_marshal_mit.pyi │ ├── _creds_marshal_mit.pyx │ ├── _creds_mit.pyi │ ├── _creds_mit.pyx │ ├── _creds_opt.pxd │ ├── _creds_opt.pyi │ ├── _creds_opt.pyx │ ├── _creds_opt_heimdal.pyi │ ├── _creds_opt_heimdal.pyx │ ├── _creds_opt_mit.pyi │ ├── _creds_opt_mit.pyx │ ├── _creds_opt_set_in_ccache.pyi │ ├── _creds_opt_set_in_ccache.pyx │ ├── _creds_opt_set_pac_request.pyi │ ├── _creds_opt_set_pac_request.pyx │ ├── _exceptions.pyi │ ├── _exceptions.pyx │ ├── _keyblock.pxd │ ├── _keyblock.pyi │ ├── _keyblock.pyx │ ├── _keyblock_mit.pyi │ ├── _keyblock_mit.pyx │ ├── _krb5_types.pxd │ ├── _kt.pxd │ ├── _kt.pyi │ ├── _kt.pyx │ ├── _kt_have_content.pyi │ ├── _kt_have_content.pyx │ ├── _kt_heimdal.pyi │ ├── _kt_heimdal.pyx │ ├── _kt_mit.pyi │ ├── _kt_mit.pyx │ ├── _principal.pxd │ ├── _principal.pyi │ ├── _principal.pyx │ ├── _principal_heimdal.pyi │ ├── _principal_heimdal.pyx │ ├── _set_password.pyi │ ├── _set_password.pyx │ ├── _string.pyi │ ├── _string.pyx │ ├── _string_mit.pyi │ ├── _string_mit.pyx │ ├── py.typed │ └── python_krb5.h ├── stubs └── k5test │ ├── __init__.pyi │ └── realm.pyi └── tests ├── __init__.py ├── conftest.py ├── test_ccache.py ├── test_cccol.py ├── test_changepw.py ├── test_context.py ├── test_creds.py ├── test_creds_opt.py ├── test_keyblock.py ├── test_kt.py ├── test_principal.py └── test_string.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.c 8 | *.so 9 | 10 | # Distribution / packaging 11 | .Python 12 | env/ 13 | build/ 14 | develop-eggs/ 15 | dist/ 16 | downloads/ 17 | eggs/ 18 | .eggs/ 19 | lib/ 20 | lib64/ 21 | parts/ 22 | sdist/ 23 | var/ 24 | wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | __dont_use_cython__.txt 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | .hypothesis/ 50 | .pytest_cache/ 51 | junit/ 52 | 53 | # Translations 54 | *.mo 55 | *.pot 56 | 57 | # Django stuff: 58 | *.log 59 | local_settings.py 60 | 61 | # Flask stuff: 62 | instance/ 63 | .webassets-cache 64 | 65 | # Scrapy stuff: 66 | .scrapy 67 | 68 | # Sphinx documentation 69 | docs/_build/ 70 | docs/source/ 71 | 72 | # PyBuilder 73 | target/ 74 | 75 | # Jupyter Notebook 76 | .ipynb_checkpoints 77 | 78 | # pyenv 79 | .python-version 80 | 81 | # celery beat schedule file 82 | celerybeat-schedule 83 | 84 | # SageMath parsed files 85 | *.sage.py 86 | 87 | # dotenv 88 | .env 89 | !.vscode/.env 90 | 91 | # virtualenv 92 | .venv 93 | venv/ 94 | ENV/ 95 | 96 | # Spyder project settings 97 | .spyderproject 98 | .spyproject 99 | 100 | # Rope project settings 101 | .ropeproject 102 | 103 | # mkdocs documentation 104 | /site 105 | 106 | # mypy 107 | .mypy_cache/ 108 | 109 | # IDEA Files 110 | .idea 111 | *~ 112 | 113 | # VSCode Files 114 | .vscode/launch.json 115 | 116 | # MacOS File 117 | .DS_Store 118 | 119 | # Vagrant 120 | .vagrant/ 121 | 122 | # poetry 123 | poetry.lock 124 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/psf/black 3 | rev: 22.10.0 4 | hooks: 5 | - id: black 6 | 7 | - repo: https://github.com/PyCQA/isort 8 | rev: 5.10.1 9 | hooks: 10 | - id: isort 11 | 12 | - repo: https://github.com/pre-commit/mirrors-mypy 13 | rev: v0.982 14 | hooks: 15 | - id: mypy 16 | exclude: setup.py 17 | additional_dependencies: 18 | - pytest 19 | -------------------------------------------------------------------------------- /.vscode/.env: -------------------------------------------------------------------------------- 1 | PYTHONPATH=src:$PYTHONPATH 2 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-python.python", 4 | "ms-python.vscode-pylance" 5 | ] 6 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.rulers": [ 4 | 80, 5 | 120 6 | ], 7 | "files.trimTrailingWhitespace": true, 8 | "editor.trimAutoWhitespace": true, 9 | "python.formatting.provider": "black", 10 | "python.linting.mypyEnabled": true, 11 | "python.testing.pytestArgs": [ 12 | "tests", 13 | "-vv" 14 | ], 15 | "python.testing.unittestEnabled": false, 16 | "python.testing.pytestEnabled": true, 17 | "[python]": { 18 | "editor.codeActionsOnSave": { 19 | "source.organizeImports": "explicit" 20 | }, 21 | }, 22 | "python.linting.ignorePatterns": [ 23 | "tests/**" 24 | ], 25 | "python.envFile": "${workspaceFolder}/.vscode/.env", 26 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Build", 8 | "type": "shell", 9 | "command": "python setup.py build_ext --inplace", 10 | "problemMatcher": [], 11 | "group": { 12 | "kind": "build", 13 | "isDefault": true 14 | }, 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jordan Borean, Red Hat 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include CHANGELOG.md 2 | include LICENSE 3 | exclude .coverage 4 | exclude .gitignore 5 | exclude .pre-commit-config.yaml 6 | recursive-include build_helpers * 7 | include src/krb5/*.h 8 | include src/krb5/*.pyx 9 | include src/krb5/*.pxd 10 | exclude src/krb5/*.c 11 | recursive-include stubs * 12 | recursive-include tests * 13 | recursive-exclude tests *.pyc -------------------------------------------------------------------------------- /build_helpers/heimdal/include/asn1-common.h: -------------------------------------------------------------------------------- 1 | /* $Id$ */ 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #ifndef __asn1_common_definitions__ 8 | #define __asn1_common_definitions__ 9 | 10 | #ifndef __HEIM_BASE_DATA__ 11 | #define __HEIM_BASE_DATA__ 1 12 | struct heim_base_data { 13 | size_t length; 14 | void *data; 15 | }; 16 | #endif 17 | 18 | typedef struct heim_integer { 19 | size_t length; 20 | void *data; 21 | int negative; 22 | } heim_integer; 23 | 24 | typedef struct heim_base_data heim_octet_string; 25 | 26 | typedef char *heim_general_string; 27 | typedef char *heim_utf8_string; 28 | typedef struct heim_base_data heim_printable_string; 29 | typedef struct heim_base_data heim_ia5_string; 30 | 31 | typedef struct heim_bmp_string { 32 | size_t length; 33 | uint16_t *data; 34 | } heim_bmp_string; 35 | 36 | typedef struct heim_universal_string { 37 | size_t length; 38 | uint32_t *data; 39 | } heim_universal_string; 40 | 41 | typedef char *heim_visible_string; 42 | 43 | typedef struct heim_oid { 44 | size_t length; 45 | unsigned *components; 46 | } heim_oid; 47 | 48 | typedef struct heim_bit_string { 49 | size_t length; 50 | void *data; 51 | } heim_bit_string; 52 | 53 | typedef struct heim_base_data heim_any; 54 | typedef struct heim_base_data heim_any_set; 55 | 56 | #define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \ 57 | do { \ 58 | (BL) = length_##T((S)); \ 59 | (B) = malloc((BL)); \ 60 | if((B) == NULL) { \ 61 | (R) = ENOMEM; \ 62 | } else { \ 63 | (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \ 64 | (S), (L)); \ 65 | if((R) != 0) { \ 66 | free((B)); \ 67 | (B) = NULL; \ 68 | } \ 69 | } \ 70 | } while (0) 71 | 72 | #ifdef _WIN32 73 | #ifndef ASN1_LIB 74 | #define ASN1EXP __declspec(dllimport) 75 | #else 76 | #define ASN1EXP 77 | #endif 78 | #define ASN1CALL __stdcall 79 | #else 80 | #define ASN1EXP 81 | #define ASN1CALL 82 | #endif 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/asn1_err.h: -------------------------------------------------------------------------------- 1 | /* Generated from asn1_err.et */ 2 | /* $Id$ */ 3 | 4 | #ifndef __asn1_err_h__ 5 | #define __asn1_err_h__ 6 | 7 | struct et_list; 8 | 9 | void initialize_asn1_error_table_r(struct et_list **); 10 | 11 | void initialize_asn1_error_table(void); 12 | #define init_asn1_err_tbl initialize_asn1_error_table 13 | 14 | typedef enum asn1_error_number{ 15 | ASN1_BAD_TIMEFORMAT = 1859794432, 16 | ASN1_MISSING_FIELD = 1859794433, 17 | ASN1_MISPLACED_FIELD = 1859794434, 18 | ASN1_TYPE_MISMATCH = 1859794435, 19 | ASN1_OVERFLOW = 1859794436, 20 | ASN1_OVERRUN = 1859794437, 21 | ASN1_BAD_ID = 1859794438, 22 | ASN1_BAD_LENGTH = 1859794439, 23 | ASN1_BAD_FORMAT = 1859794440, 24 | ASN1_PARSE_ERROR = 1859794441, 25 | ASN1_EXTRA_DATA = 1859794442, 26 | ASN1_BAD_CHARACTER = 1859794443, 27 | ASN1_MIN_CONSTRAINT = 1859794444, 28 | ASN1_MAX_CONSTRAINT = 1859794445, 29 | ASN1_EXACT_CONSTRAINT = 1859794446, 30 | ASN1_INDEF_OVERRUN = 1859794447, 31 | ASN1_INDEF_UNDERRUN = 1859794448, 32 | ASN1_GOT_BER = 1859794449, 33 | ASN1_INDEF_EXTRA_DATA = 1859794450 34 | } asn1_error_number; 35 | 36 | #define ERROR_TABLE_BASE_asn1 1859794432 37 | 38 | #define COM_ERR_BINDDOMAIN_asn1 "heim_com_err1859794432" 39 | 40 | #endif /* __asn1_err_h__ */ 41 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef _BASE64_H_ 37 | #define _BASE64_H_ 38 | 39 | #ifndef ROKEN_LIB_FUNCTION 40 | #ifdef _WIN32 41 | #define ROKEN_LIB_FUNCTION 42 | #define ROKEN_LIB_CALL __cdecl 43 | #else 44 | #define ROKEN_LIB_FUNCTION 45 | #define ROKEN_LIB_CALL 46 | #endif 47 | #endif 48 | 49 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 50 | rk_base64_encode(const void *, int, char **); 51 | 52 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 53 | rk_base64_decode(const char *, void *); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/com_err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | /* MIT compatible com_err library */ 37 | 38 | #ifndef __COM_ERR_H__ 39 | #define __COM_ERR_H__ 40 | 41 | #include 42 | #include 43 | 44 | #if !defined(__GNUC__) && !defined(__attribute__) 45 | #define __attribute__(X) 46 | #endif 47 | 48 | typedef void (KRB5_CALLCONV *errf) (const char *, long, const char *, va_list); 49 | 50 | KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL 51 | error_message (long); 52 | 53 | KRB5_LIB_FUNCTION int KRB5_LIB_CALL 54 | init_error_table (const char**, long, int); 55 | 56 | KRB5_LIB_FUNCTION void KRB5_LIB_CALL 57 | com_err_va (const char *, long, const char *, va_list) 58 | __attribute__ ((__format__ (__printf__, 3, 0))); 59 | 60 | KRB5_LIB_FUNCTION void KRB5_LIB_CALL 61 | com_err (const char *, long, const char *, ...) 62 | __attribute__ ((__format__ (__printf__, 3, 4))); 63 | 64 | KRB5_LIB_FUNCTION errf KRB5_LIB_CALL 65 | set_com_err_hook (errf); 66 | 67 | KRB5_LIB_FUNCTION errf KRB5_LIB_CALL 68 | reset_com_err_hook (void); 69 | 70 | KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL 71 | error_table_name (int num); 72 | 73 | KRB5_LIB_FUNCTION void KRB5_LIB_CALL 74 | add_to_error_table (struct et_list *new_table); 75 | 76 | #endif /* __COM_ERR_H__ */ 77 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/com_right.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef __COM_RIGHT_H__ 37 | #define __COM_RIGHT_H__ 38 | 39 | #ifndef KRB5_LIB 40 | #ifndef KRB5_LIB_FUNCTION 41 | #if defined(_WIN32) 42 | #define KRB5_LIB_FUNCTION __declspec(dllimport) 43 | #define KRB5_LIB_CALL __stdcall 44 | #define KRB5_LIB_VARIABLE __declspec(dllimport) 45 | #else 46 | #define KRB5_LIB_FUNCTION 47 | #define KRB5_LIB_CALL 48 | #define KRB5_LIB_VARIABLE 49 | #endif 50 | #endif 51 | #endif 52 | 53 | #ifdef _WIN32 54 | #define KRB5_CALLCONV __stdcall 55 | #else 56 | #define KRB5_CALLCONV 57 | #endif 58 | 59 | #ifdef __STDC__ 60 | #include 61 | #include 62 | #endif 63 | 64 | struct error_table { 65 | char const * const * msgs; 66 | long base; 67 | int n_msgs; 68 | }; 69 | struct et_list { 70 | struct et_list *next; 71 | struct error_table *table; 72 | }; 73 | extern struct et_list *_et_list; 74 | 75 | KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL 76 | com_right (struct et_list *list, long code); 77 | 78 | KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL 79 | com_right_r (struct et_list *list, long code, char *, size_t); 80 | 81 | KRB5_LIB_FUNCTION void KRB5_LIB_CALL 82 | initialize_error_table_r (struct et_list **, const char **, int, long); 83 | 84 | KRB5_LIB_FUNCTION void KRB5_LIB_CALL 85 | free_error_table (struct et_list *); 86 | 87 | #endif /* __COM_RIGHT_H__ */ 88 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/der-private.h: -------------------------------------------------------------------------------- 1 | /* This is a generated file */ 2 | #ifndef __der_private_h__ 3 | #define __der_private_h__ 4 | 5 | #include 6 | 7 | int 8 | _asn1_bmember_isset_bit ( 9 | const void */*data*/, 10 | unsigned int /*bit*/, 11 | size_t /*size*/); 12 | 13 | void 14 | _asn1_bmember_put_bit ( 15 | unsigned char */*p*/, 16 | const void */*data*/, 17 | unsigned int /*bit*/, 18 | size_t /*size*/, 19 | unsigned int */*bitset*/); 20 | 21 | int 22 | _asn1_copy ( 23 | const struct asn1_template */*t*/, 24 | const void */*from*/, 25 | void */*to*/); 26 | 27 | int 28 | _asn1_copy_top ( 29 | const struct asn1_template */*t*/, 30 | const void */*from*/, 31 | void */*to*/); 32 | 33 | int 34 | _asn1_decode ( 35 | const struct asn1_template */*t*/, 36 | unsigned /*flags*/, 37 | const unsigned char */*p*/, 38 | size_t /*len*/, 39 | void */*data*/, 40 | size_t */*size*/); 41 | 42 | int 43 | _asn1_decode_top ( 44 | const struct asn1_template */*t*/, 45 | unsigned /*flags*/, 46 | const unsigned char */*p*/, 47 | size_t /*len*/, 48 | void */*data*/, 49 | size_t */*size*/); 50 | 51 | int 52 | _asn1_encode ( 53 | const struct asn1_template */*t*/, 54 | unsigned char */*p*/, 55 | size_t /*len*/, 56 | const void */*data*/, 57 | size_t */*size*/); 58 | 59 | int 60 | _asn1_encode_fuzzer ( 61 | const struct asn1_template */*t*/, 62 | unsigned char */*p*/, 63 | size_t /*len*/, 64 | const void */*data*/, 65 | size_t */*size*/); 66 | 67 | void 68 | _asn1_free ( 69 | const struct asn1_template */*t*/, 70 | void */*data*/); 71 | 72 | void 73 | _asn1_free_top ( 74 | const struct asn1_template */*t*/, 75 | void */*data*/); 76 | 77 | size_t 78 | _asn1_length ( 79 | const struct asn1_template */*t*/, 80 | const void */*data*/); 81 | 82 | size_t 83 | _asn1_length_fuzzer ( 84 | const struct asn1_template */*t*/, 85 | const void */*data*/); 86 | 87 | size_t 88 | _asn1_sizeofType (const struct asn1_template */*t*/); 89 | 90 | struct tm * 91 | _der_gmtime ( 92 | time_t /*t*/, 93 | struct tm */*tm*/); 94 | 95 | int 96 | _heim_der_set_sort ( 97 | const void */*a1*/, 98 | const void */*a2*/); 99 | 100 | int 101 | _heim_fix_dce ( 102 | size_t /*reallen*/, 103 | size_t */*len*/); 104 | 105 | size_t 106 | _heim_len_int (int /*val*/); 107 | 108 | size_t 109 | _heim_len_int64 (int64_t /*val*/); 110 | 111 | size_t 112 | _heim_len_unsigned (unsigned /*val*/); 113 | 114 | size_t 115 | _heim_len_unsigned64 (uint64_t /*val*/); 116 | 117 | int 118 | _heim_time2generalizedtime ( 119 | time_t /*t*/, 120 | heim_octet_string */*s*/, 121 | int /*gtimep*/); 122 | 123 | #endif /* __der_private_h__ */ 124 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/der.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 - 2006 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef __DER_H__ 37 | #define __DER_H__ 38 | 39 | #include 40 | 41 | typedef enum { 42 | ASN1_C_UNIV = 0, 43 | ASN1_C_APPL = 1, 44 | ASN1_C_CONTEXT = 2, 45 | ASN1_C_PRIVATE = 3 46 | } Der_class; 47 | 48 | typedef enum {PRIM = 0, CONS = 1} Der_type; 49 | 50 | #define MAKE_TAG(CLASS, TYPE, TAG) (((CLASS) << 6) | ((TYPE) << 5) | (TAG)) 51 | 52 | /* Universal tags */ 53 | 54 | enum { 55 | UT_EndOfContent = 0, 56 | UT_Boolean = 1, 57 | UT_Integer = 2, 58 | UT_BitString = 3, 59 | UT_OctetString = 4, 60 | UT_Null = 5, 61 | UT_OID = 6, 62 | UT_Enumerated = 10, 63 | UT_UTF8String = 12, 64 | UT_Sequence = 16, 65 | UT_Set = 17, 66 | UT_PrintableString = 19, 67 | UT_IA5String = 22, 68 | UT_UTCTime = 23, 69 | UT_GeneralizedTime = 24, 70 | UT_UniversalString = 25, 71 | UT_VisibleString = 26, 72 | UT_GeneralString = 27, 73 | UT_BMPString = 30, 74 | /* unsupported types */ 75 | UT_ObjectDescriptor = 7, 76 | UT_External = 8, 77 | UT_Real = 9, 78 | UT_EmbeddedPDV = 11, 79 | UT_RelativeOID = 13, 80 | UT_NumericString = 18, 81 | UT_TeletexString = 20, 82 | UT_VideotexString = 21, 83 | UT_GraphicString = 25 84 | }; 85 | 86 | #define ASN1_INDEFINITE 0xdce0deed 87 | 88 | typedef struct heim_der_time_t { 89 | time_t dt_sec; 90 | unsigned long dt_nsec; 91 | } heim_der_time_t; 92 | 93 | typedef struct heim_ber_time_t { 94 | time_t bt_sec; 95 | unsigned bt_nsec; 96 | int bt_zone; 97 | } heim_ber_time_t; 98 | 99 | struct asn1_template; 100 | 101 | #include 102 | 103 | int _heim_fix_dce(size_t reallen, size_t *len); 104 | int _heim_der_set_sort(const void *, const void *); 105 | int _heim_time2generalizedtime (time_t, heim_octet_string *, int); 106 | 107 | #endif /* __DER_H__ */ 108 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/getarg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef __GETARG_H__ 37 | #define __GETARG_H__ 38 | 39 | #include 40 | 41 | #ifndef ROKEN_LIB_FUNCTION 42 | #ifdef _WIN32 43 | #define ROKEN_LIB_FUNCTION 44 | #define ROKEN_LIB_CALL __cdecl 45 | #else 46 | #define ROKEN_LIB_FUNCTION 47 | #define ROKEN_LIB_CALL 48 | #endif 49 | #endif 50 | 51 | struct getargs{ 52 | const char *long_name; 53 | char short_name; 54 | enum { arg_integer, 55 | arg_string, 56 | arg_flag, 57 | arg_negative_flag, 58 | arg_strings, 59 | arg_double, 60 | arg_collect, 61 | arg_counter 62 | } type; 63 | void *value; 64 | const char *help; 65 | const char *arg_help; 66 | }; 67 | 68 | enum { 69 | ARG_ERR_NO_MATCH = 1, 70 | ARG_ERR_BAD_ARG, 71 | ARG_ERR_NO_ARG 72 | }; 73 | 74 | typedef struct getarg_strings { 75 | int num_strings; 76 | char **strings; 77 | } getarg_strings; 78 | 79 | typedef int (*getarg_collect_func)(int short_opt, 80 | int argc, 81 | char **argv, 82 | int *goptind, 83 | int *goptarg, 84 | void *data); 85 | 86 | typedef struct getarg_collect_info { 87 | getarg_collect_func func; 88 | void *data; 89 | } getarg_collect_info; 90 | 91 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 92 | getarg(struct getargs *args, size_t num_args, 93 | int argc, char **argv, int *goptind); 94 | 95 | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 96 | arg_printusage (struct getargs *args, 97 | size_t num_args, 98 | const char *progname, 99 | const char *extra_string); 100 | 101 | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 102 | arg_printusage_i18n (struct getargs *args, 103 | size_t num_args, 104 | const char *usage, 105 | const char *progname, 106 | const char *extra_string, 107 | char *(*i18n)(const char *)); 108 | 109 | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 110 | free_getarg_strings (getarg_strings *); 111 | 112 | #endif /* __GETARG_H__ */ 113 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/gssapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef GSSAPI_H_ 37 | #define GSSAPI_H_ 38 | 39 | #include 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/gssapi/gkrb5_err.h: -------------------------------------------------------------------------------- 1 | /* Generated from ./krb5/gkrb5_err.et */ 2 | /* $Id$ */ 3 | 4 | #ifndef __gkrb5_err_h__ 5 | #define __gkrb5_err_h__ 6 | 7 | struct et_list; 8 | 9 | void initialize_gk5_error_table_r(struct et_list **); 10 | 11 | void initialize_gk5_error_table(void); 12 | #define init_gk5_err_tbl initialize_gk5_error_table 13 | 14 | typedef enum gk5_error_number{ 15 | GSS_KRB5_S_G_BAD_SERVICE_NAME = 35224064, 16 | GSS_KRB5_S_G_BAD_STRING_UID = 35224065, 17 | GSS_KRB5_S_G_NOUSER = 35224066, 18 | GSS_KRB5_S_G_VALIDATE_FAILED = 35224067, 19 | GSS_KRB5_S_G_BUFFER_ALLOC = 35224068, 20 | GSS_KRB5_S_G_BAD_MSG_CTX = 35224069, 21 | GSS_KRB5_S_G_WRONG_SIZE = 35224070, 22 | GSS_KRB5_S_G_BAD_USAGE = 35224071, 23 | GSS_KRB5_S_G_UNKNOWN_QOP = 35224072, 24 | GSS_KRB5_S_KG_CCACHE_NOMATCH = 35224192, 25 | GSS_KRB5_S_KG_KEYTAB_NOMATCH = 35224193, 26 | GSS_KRB5_S_KG_TGT_MISSING = 35224194, 27 | GSS_KRB5_S_KG_NO_SUBKEY = 35224195, 28 | GSS_KRB5_S_KG_CONTEXT_ESTABLISHED = 35224196, 29 | GSS_KRB5_S_KG_BAD_SIGN_TYPE = 35224197, 30 | GSS_KRB5_S_KG_BAD_LENGTH = 35224198, 31 | GSS_KRB5_S_KG_CTX_INCOMPLETE = 35224199, 32 | GSS_KRB5_S_KG_INPUT_TOO_LONG = 35224200 33 | } gk5_error_number; 34 | 35 | #define ERROR_TABLE_BASE_gk5 35224064 36 | 37 | #define COM_ERR_BINDDOMAIN_gk5 "heim_com_err35224064" 38 | 39 | #endif /* __gkrb5_err_h__ */ 40 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/gssapi/gssapi_ntlm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 - 2009 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef GSSAPI_NTLM_H_ 37 | #define GSSAPI_NTLM_H_ 38 | 39 | #include 40 | 41 | #endif /* GSSAPI_NTLM_H_ */ 42 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/gssapi/gssapi_spnego.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 - 2006 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef GSSAPI_SPNEGO_H_ 37 | #define GSSAPI_SPNEGO_H_ 38 | 39 | #include 40 | 41 | GSSAPI_CPP_START 42 | 43 | /* 44 | * RFC2478, SPNEGO: 45 | * The security mechanism of the initial 46 | * negotiation token is identified by the Object Identifier 47 | * iso.org.dod.internet.security.mechanism.snego (1.3.6.1.5.5.2). 48 | */ 49 | extern GSSAPI_LIB_VARIABLE gss_OID_desc __gss_spnego_mechanism_oid_desc; 50 | #define GSS_SPNEGO_MECHANISM (&__gss_spnego_mechanism_oid_desc) 51 | #define gss_mech_spnego GSS_SPNEGO_MECHANISM 52 | 53 | GSSAPI_CPP_END 54 | 55 | #endif /* GSSAPI_SPNEGO_H_ */ 56 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2004 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef HEIM_AES_H 37 | #define HEIM_AES_H 1 38 | 39 | /* symbol renaming */ 40 | #define AES_set_encrypt_key hc_AES_set_encrypt_key 41 | #define AES_set_decrypt_key hc_AES_decrypt_key 42 | #define AES_encrypt hc_AES_encrypt 43 | #define AES_decrypt hc_AES_decrypt 44 | #define AES_cbc_encrypt hc_AES_cbc_encrypt 45 | #define AES_cfb8_encrypt hc_AES_cfb8_encrypt 46 | 47 | /* 48 | * 49 | */ 50 | 51 | #define AES_BLOCK_SIZE 16 52 | #define AES_MAXNR 14 53 | 54 | #define AES_ENCRYPT 1 55 | #define AES_DECRYPT 0 56 | 57 | typedef struct aes_key { 58 | uint32_t key[(AES_MAXNR+1)*4]; 59 | int rounds; 60 | } AES_KEY; 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | int AES_set_encrypt_key(const unsigned char *, const int, AES_KEY *); 67 | int AES_set_decrypt_key(const unsigned char *, const int, AES_KEY *); 68 | 69 | void AES_encrypt(const unsigned char *, unsigned char *, const AES_KEY *); 70 | void AES_decrypt(const unsigned char *, unsigned char *, const AES_KEY *); 71 | 72 | void AES_cbc_encrypt(const unsigned char *, unsigned char *, 73 | unsigned long, const AES_KEY *, 74 | unsigned char *, int); 75 | void AES_cfb8_encrypt(const unsigned char *, unsigned char *, 76 | unsigned long, const AES_KEY *, 77 | unsigned char *, int); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif /* HEIM_AES_H */ 84 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/ec.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jborean93/pykrb5/1a3d61da1e33820164a82a583d561e6b74ddeef7/build_helpers/heimdal/include/hcrypto/ec.h -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/ecdh.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jborean93/pykrb5/1a3d61da1e33820164a82a583d561e6b74ddeef7/build_helpers/heimdal/include/hcrypto/ecdh.h -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/ecdsa.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jborean93/pykrb5/1a3d61da1e33820164a82a583d561e6b74ddeef7/build_helpers/heimdal/include/hcrypto/ecdsa.h -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/hmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef HEIM_HMAC_H 37 | #define HEIM_HMAC_H 1 38 | 39 | #include 40 | 41 | /* symbol renaming */ 42 | #define HMAC_CTX_init hc_HMAC_CTX_init 43 | #define HMAC_CTX_cleanup hc_HMAC_CTX_cleanup 44 | #define HMAC_size hc_HMAC_size 45 | #define HMAC_Init_ex hc_HMAC_Init_ex 46 | #define HMAC_Update hc_HMAC_Update 47 | #define HMAC_Final hc_HMAC_Final 48 | #define HMAC hc_HMAC 49 | 50 | /* 51 | * 52 | */ 53 | 54 | #define HMAC_MAX_MD_CBLOCK 64 55 | 56 | typedef struct hc_HMAC_CTX HMAC_CTX; 57 | 58 | struct hc_HMAC_CTX { 59 | const EVP_MD *md; 60 | ENGINE *engine; 61 | EVP_MD_CTX *ctx; 62 | size_t key_length; 63 | void *opad; 64 | void *ipad; 65 | void *buf; 66 | }; 67 | 68 | 69 | void HMAC_CTX_init(HMAC_CTX *); 70 | void HMAC_CTX_cleanup(HMAC_CTX *ctx); 71 | 72 | size_t HMAC_size(const HMAC_CTX *ctx); 73 | 74 | void HMAC_Init_ex(HMAC_CTX *, const void *, size_t, 75 | const EVP_MD *, ENGINE *); 76 | void HMAC_Update(HMAC_CTX *ctx, const void *data, size_t len); 77 | void HMAC_Final(HMAC_CTX *ctx, void *md, unsigned int *len); 78 | 79 | void * HMAC(const EVP_MD *evp_md, const void *key, size_t key_len, 80 | const void *data, size_t n, void *md, unsigned int *md_len); 81 | 82 | #endif /* HEIM_HMAC_H */ 83 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/md2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef HEIM_MD2_H 37 | #define HEIM_MD2_H 1 38 | 39 | /* symbol renaming */ 40 | #define MD2_Init hc_MD2_Init 41 | #define MD2_Update hc_MD2_Update 42 | #define MD2_Final hc_MD2_Final 43 | 44 | /* 45 | * 46 | */ 47 | 48 | #define MD2_DIGEST_LENGTH 16 49 | 50 | struct md2 { 51 | size_t len; 52 | unsigned char data[16]; /* stored unalligned data between Update's */ 53 | unsigned char checksum[16]; 54 | unsigned char state[16]; /* lower 16 bytes of X */ 55 | }; 56 | 57 | typedef struct md2 MD2_CTX; 58 | 59 | int MD2_Init (struct md2 *m); 60 | int MD2_Update (struct md2 *m, const void *p, size_t len); 61 | int MD2_Final (void *res, struct md2 *m); 62 | 63 | #endif /* HEIM_MD2_H */ 64 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/md4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef HEIM_MD4_H 37 | #define HEIM_MD4_H 1 38 | 39 | /* symbol renaming */ 40 | #define MD4_Init hc_MD4_Init 41 | #define MD4_Update hc_MD4_Update 42 | #define MD4_Final hc_MD4_Final 43 | 44 | /* 45 | * 46 | */ 47 | 48 | #define MD4_DIGEST_LENGTH 16 49 | 50 | struct md4 { 51 | unsigned int sz[2]; 52 | uint32_t counter[4]; 53 | unsigned char save[64]; 54 | }; 55 | 56 | typedef struct md4 MD4_CTX; 57 | 58 | int MD4_Init (struct md4 *m); 59 | int MD4_Update (struct md4 *m, const void *p, size_t len); 60 | int MD4_Final (void *res, struct md4 *m); 61 | 62 | #endif /* HEIM_MD4_H */ 63 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef HEIM_MD5_H 37 | #define HEIM_MD5_H 1 38 | 39 | /* symbol renaming */ 40 | #define MD5_Init hc_MD5_Init 41 | #define MD5_Update hc_MD5_Update 42 | #define MD5_Final hc_MD5_Final 43 | 44 | /* 45 | * 46 | */ 47 | 48 | #define MD5_DIGEST_LENGTH 16 49 | 50 | struct md5 { 51 | unsigned int sz[2]; 52 | uint32_t counter[4]; 53 | unsigned char save[64]; 54 | }; 55 | 56 | typedef struct md5 MD5_CTX; 57 | 58 | int MD5_Init (struct md5 *m); 59 | int MD5_Update (struct md5 *m, const void *p, size_t len); 60 | int MD5_Final (void *res, struct md5 *m); /* uint32_t res[4] */ 61 | 62 | #endif /* HEIM_MD5_H */ 63 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/pkcs12.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* 35 | * $Id$ 36 | */ 37 | 38 | #ifndef _HEIM_PKCS12_H 39 | #define _HEIM_PKCS12_H 1 40 | 41 | /* symbol renaming */ 42 | #define PKCS12_key_gen hc_PKCS12_key_gen 43 | 44 | /* 45 | * 46 | */ 47 | 48 | #include 49 | 50 | #define PKCS12_KEY_ID 1 51 | #define PKCS12_IV_ID 2 52 | 53 | int PKCS12_key_gen(const void *, size_t, const void *, 54 | size_t, int, int, size_t, void *, const EVP_MD *); 55 | 56 | 57 | #endif /* _HEIM_PKCS12_H */ 58 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/rand.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (c) 2006 Kungliga Tekniska Högskolan 4 | * (Royal Institute of Technology, Stockholm, Sweden). 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 18 | * 3. Neither the name of the Institute nor the names of its contributors 19 | * may be used to endorse or promote products derived from this software 20 | * without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 | * SUCH DAMAGE. 33 | */ 34 | 35 | /* 36 | * $Id$ 37 | */ 38 | 39 | #ifndef _HEIM_RAND_H 40 | #define _HEIM_RAND_H 1 41 | 42 | #define RAND_METHOD hc_RAND_METHOD 43 | 44 | typedef struct RAND_METHOD RAND_METHOD; 45 | 46 | #include 47 | 48 | /* symbol renaming */ 49 | #define RAND_bytes hc_RAND_bytes 50 | #define RAND_pseudo_bytes hc_RAND_pseudo_bytes 51 | #define RAND_seed hc_RAND_seed 52 | #define RAND_cleanup hc_RAND_cleanup 53 | #define RAND_add hc_RAND_add 54 | #define RAND_set_rand_method hc_RAND_set_rand_method 55 | #define RAND_get_rand_method hc_RAND_get_rand_method 56 | #define RAND_set_rand_engine hc_RAND_set_rand_engine 57 | #define RAND_file_name hc_RAND_file_name 58 | #define RAND_load_file hc_RAND_load_file 59 | #define RAND_write_file hc_RAND_write_file 60 | #define RAND_status hc_RAND_status 61 | #define RAND_fortuna_method hc_RAND_fortuna_method 62 | #define RAND_unix_method hc_RAND_unix_method 63 | #define RAND_w32crypto_method hc_RAND_w32crypto_method 64 | 65 | /* 66 | * 67 | */ 68 | 69 | struct RAND_METHOD 70 | { 71 | void (*seed)(const void *, int); 72 | int (*bytes)(unsigned char *, int); 73 | void (*cleanup)(void); 74 | void (*add)(const void *, int, double); 75 | int (*pseudorand)(unsigned char *, int); 76 | int (*status)(void); 77 | }; 78 | 79 | /* 80 | * 81 | */ 82 | 83 | int RAND_bytes(void *, size_t num); 84 | int RAND_pseudo_bytes(void *, size_t); 85 | void RAND_seed(const void *, size_t); 86 | void RAND_cleanup(void); 87 | void RAND_add(const void *, size_t, double); 88 | 89 | int RAND_set_rand_method(const RAND_METHOD *); 90 | const RAND_METHOD * 91 | RAND_get_rand_method(void); 92 | int RAND_set_rand_engine(ENGINE *); 93 | 94 | const char * 95 | RAND_file_name(char *, size_t); 96 | int RAND_load_file(const char *, size_t); 97 | int RAND_write_file(const char *); 98 | int RAND_status(void); 99 | 100 | 101 | const RAND_METHOD * RAND_fortuna_method(void); 102 | const RAND_METHOD * RAND_unix_method(void); 103 | const RAND_METHOD * RAND_w32crypto_method(void); 104 | 105 | #endif /* _HEIM_RAND_H */ 106 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/rc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | /* symbol renaming */ 37 | #define RC2_set_key hc_RC2_set_key 38 | #define RC2_encryptc hc_RC2_encryptc 39 | #define RC2_decryptc hc_RC2_decryptc 40 | #define RC2_cbc_encrypt hc_RC2_cbc_encrypt 41 | 42 | /* 43 | * 44 | */ 45 | 46 | #define RC2_ENCRYPT 1 47 | #define RC2_DECRYPT 0 48 | 49 | #define RC2_BLOCK_SIZE 8 50 | #define RC2_BLOCK RC2_BLOCK_SIZE 51 | #define RC2_KEY_LENGTH 16 52 | 53 | typedef struct rc2_key { 54 | unsigned int data[64]; 55 | } RC2_KEY; 56 | 57 | #ifdef __cplusplus 58 | extern "C" { 59 | #endif 60 | 61 | void RC2_set_key(RC2_KEY *, int, const unsigned char *,int); 62 | 63 | void RC2_encryptc(unsigned char *, unsigned char *, const RC2_KEY *); 64 | void RC2_decryptc(unsigned char *, unsigned char *, const RC2_KEY *); 65 | 66 | void RC2_cbc_encrypt(const unsigned char *, unsigned char *, long, 67 | RC2_KEY *, unsigned char *, int); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | /* symbol renaming */ 37 | #define RC4_set_key hc_RC4_set_key 38 | #define RC4 hc_RC4 39 | 40 | typedef struct rc4_key { 41 | unsigned int x, y; 42 | unsigned int state[256]; 43 | } RC4_KEY; 44 | 45 | void RC4_set_key(RC4_KEY *, const int, const unsigned char *); 46 | void RC4(RC4_KEY *, const int, const unsigned char *, unsigned char *); 47 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/sha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef HEIM_SHA_H 37 | #define HEIM_SHA_H 1 38 | 39 | /* symbol renaming */ 40 | #define SHA1_Init hc_SHA1_Init 41 | #define SHA1_Update hc_SHA1_Update 42 | #define SHA1_Final hc_SHA1_Final 43 | #define SHA256_Init hc_SHA256_Init 44 | #define SHA256_Update hc_SHA256_Update 45 | #define SHA256_Final hc_SHA256_Final 46 | #define SHA384_Init hc_SHA384_Init 47 | #define SHA384_Update hc_SHA384_Update 48 | #define SHA384_Final hc_SHA384_Final 49 | #define SHA512_Init hc_SHA512_Init 50 | #define SHA512_Update hc_SHA512_Update 51 | #define SHA512_Final hc_SHA512_Final 52 | 53 | /* 54 | * SHA-1 55 | */ 56 | 57 | #define SHA_DIGEST_LENGTH 20 58 | 59 | struct sha { 60 | unsigned int sz[2]; 61 | uint32_t counter[5]; 62 | unsigned char save[64]; 63 | }; 64 | 65 | typedef struct sha SHA_CTX; 66 | 67 | int SHA1_Init (struct sha *m); 68 | int SHA1_Update (struct sha *m, const void *v, size_t len); 69 | int SHA1_Final (void *res, struct sha *m); 70 | 71 | /* 72 | * SHA-2 256 73 | */ 74 | 75 | #define SHA256_DIGEST_LENGTH 32 76 | 77 | struct hc_sha256state { 78 | unsigned int sz[2]; 79 | uint32_t counter[8]; 80 | unsigned char save[64]; 81 | }; 82 | 83 | typedef struct hc_sha256state SHA256_CTX; 84 | 85 | int SHA256_Init (SHA256_CTX *); 86 | int SHA256_Update (SHA256_CTX *, const void *, size_t); 87 | int SHA256_Final (void *, SHA256_CTX *); 88 | 89 | /* 90 | * SHA-2 512 91 | */ 92 | 93 | #define SHA512_DIGEST_LENGTH 64 94 | 95 | struct hc_sha512state { 96 | uint64_t sz[2]; 97 | uint64_t counter[8]; 98 | unsigned char save[128]; 99 | }; 100 | 101 | typedef struct hc_sha512state SHA512_CTX; 102 | 103 | int SHA512_Init (SHA512_CTX *); 104 | int SHA512_Update (SHA512_CTX *, const void *, size_t); 105 | int SHA512_Final (void *, SHA512_CTX *); 106 | 107 | #define SHA384_DIGEST_LENGTH 48 108 | 109 | typedef struct hc_sha512state SHA384_CTX; 110 | 111 | int SHA384_Init (SHA384_CTX *); 112 | int SHA384_Update (SHA384_CTX *, const void *, size_t); 113 | int SHA384_Final (void *, SHA384_CTX *); 114 | 115 | #endif /* HEIM_SHA_H */ 116 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hcrypto/ui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef _HEIM_UI_H 37 | #define _HEIM_UI_H 1 38 | 39 | /* symbol renaming */ 40 | #define UI_UTIL_read_pw_string hc_UI_UTIL_read_pw_string 41 | 42 | int UI_UTIL_read_pw_string(char *, int, const char *, int); /* XXX */ 43 | 44 | #endif /* _HEIM_UI_H */ 45 | 46 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hdb_err.h: -------------------------------------------------------------------------------- 1 | /* Generated from hdb_err.et */ 2 | /* $Id$ */ 3 | 4 | #ifndef __hdb_err_h__ 5 | #define __hdb_err_h__ 6 | 7 | struct et_list; 8 | 9 | void initialize_hdb_error_table_r(struct et_list **); 10 | 11 | void initialize_hdb_error_table(void); 12 | #define init_hdb_err_tbl initialize_hdb_error_table 13 | 14 | typedef enum hdb_error_number{ 15 | HDB_ERR_UK_SERROR = 36150273, 16 | HDB_ERR_UK_RERROR = 36150274, 17 | HDB_ERR_NOENTRY = 36150275, 18 | HDB_ERR_DB_INUSE = 36150276, 19 | HDB_ERR_DB_CHANGED = 36150277, 20 | HDB_ERR_RECURSIVELOCK = 36150278, 21 | HDB_ERR_NOTLOCKED = 36150279, 22 | HDB_ERR_BADLOCKMODE = 36150280, 23 | HDB_ERR_CANT_LOCK_DB = 36150281, 24 | HDB_ERR_EXISTS = 36150282, 25 | HDB_ERR_BADVERSION = 36150283, 26 | HDB_ERR_NO_MKEY = 36150284, 27 | HDB_ERR_MANDATORY_OPTION = 36150285, 28 | HDB_ERR_NO_WRITE_SUPPORT = 36150286, 29 | HDB_ERR_NOT_FOUND_HERE = 36150287, 30 | HDB_ERR_MISUSE = 36150288, 31 | HDB_ERR_KVNO_NOT_FOUND = 36150289, 32 | HDB_ERR_WRONG_REALM = 36150290 33 | } hdb_error_number; 34 | 35 | #define ERROR_TABLE_BASE_hdb 36150272 36 | 37 | #define COM_ERR_BINDDOMAIN_hdb "heim_com_err36150272" 38 | 39 | #endif /* __hdb_err_h__ */ 40 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/heim-ipc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jborean93/pykrb5/1a3d61da1e33820164a82a583d561e6b74ddeef7/build_helpers/heimdal/include/heim-ipc.h -------------------------------------------------------------------------------- /build_helpers/heimdal/include/heim_asn1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2005 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __HEIM_ANY_H__ 35 | #define __HEIM_ANY_H__ 1 36 | 37 | int encode_heim_any(unsigned char *, size_t, const heim_any *, size_t *); 38 | int decode_heim_any(const unsigned char *, size_t, heim_any *, size_t *); 39 | void free_heim_any(heim_any *); 40 | size_t length_heim_any(const heim_any *); 41 | int copy_heim_any(const heim_any *, heim_any *); 42 | 43 | int encode_heim_any_set(unsigned char *, size_t, 44 | const heim_any_set *, size_t *); 45 | int decode_heim_any_set(const unsigned char *, size_t, 46 | heim_any_set *,size_t *); 47 | void free_heim_any_set(heim_any_set *); 48 | size_t length_heim_any_set(const heim_any_set *); 49 | int copy_heim_any_set(const heim_any_set *, heim_any_set *); 50 | int heim_any_cmp(const heim_any_set *, const heim_any_set *); 51 | 52 | #endif /* __HEIM_ANY_H__ */ 53 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/heim_err.h: -------------------------------------------------------------------------------- 1 | /* Generated from heim_err.et */ 2 | /* $Id$ */ 3 | 4 | #ifndef __heim_err_h__ 5 | #define __heim_err_h__ 6 | 7 | struct et_list; 8 | 9 | void initialize_heim_error_table_r(struct et_list **); 10 | 11 | void initialize_heim_error_table(void); 12 | #define init_heim_err_tbl initialize_heim_error_table 13 | 14 | typedef enum heim_error_number{ 15 | HEIM_ERR_LOG_PARSE = -1980176640, 16 | HEIM_ERR_V4_PRINC_NO_CONV = -1980176639, 17 | HEIM_ERR_SALTTYPE_NOSUPP = -1980176638, 18 | HEIM_ERR_NOHOST = -1980176637, 19 | HEIM_ERR_OPNOTSUPP = -1980176636, 20 | HEIM_ERR_EOF = -1980176635, 21 | HEIM_ERR_BAD_MKEY = -1980176634, 22 | HEIM_ERR_SERVICE_NOMATCH = -1980176633, 23 | HEIM_ERR_NOT_SEEKABLE = -1980176632, 24 | HEIM_ERR_TOO_BIG = -1980176631, 25 | HEIM_ERR_BAD_HDBENT_ENCODING = -1980176630, 26 | HEIM_ERR_RANDOM_OFFLINE = -1980176629, 27 | HEIM_PKINIT_NO_CERTIFICATE = -1980176576, 28 | HEIM_PKINIT_NO_PRIVATE_KEY = -1980176575, 29 | HEIM_PKINIT_NO_VALID_CA = -1980176574, 30 | HEIM_PKINIT_CERTIFICATE_INVALID = -1980176573, 31 | HEIM_PKINIT_PRIVATE_KEY_INVALID = -1980176572, 32 | HEIM_EAI_UNKNOWN = -1980176512, 33 | HEIM_EAI_ADDRFAMILY = -1980176511, 34 | HEIM_EAI_AGAIN = -1980176510, 35 | HEIM_EAI_BADFLAGS = -1980176509, 36 | HEIM_EAI_FAIL = -1980176508, 37 | HEIM_EAI_FAMILY = -1980176507, 38 | HEIM_EAI_MEMORY = -1980176506, 39 | HEIM_EAI_NODATA = -1980176505, 40 | HEIM_EAI_NONAME = -1980176504, 41 | HEIM_EAI_SERVICE = -1980176503, 42 | HEIM_EAI_SOCKTYPE = -1980176502, 43 | HEIM_EAI_SYSTEM = -1980176501, 44 | HEIM_NET_CONN_REFUSED = -1980176448 45 | } heim_error_number; 46 | 47 | #define ERROR_TABLE_BASE_heim -1980176640 48 | 49 | #define COM_ERR_BINDDOMAIN_heim "heim_com_err-1980176640" 50 | 51 | #endif /* __heim_err_h__ */ 52 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef _rk_HEX_H_ 37 | #define _rk_HEX_H_ 1 38 | 39 | #ifndef ROKEN_LIB_FUNCTION 40 | #ifdef _WIN32 41 | #define ROKEN_LIB_FUNCTION 42 | #define ROKEN_LIB_CALL __cdecl 43 | #else 44 | #define ROKEN_LIB_FUNCTION 45 | #define ROKEN_LIB_CALL 46 | #endif 47 | #endif 48 | 49 | #define hex_encode rk_hex_encode 50 | #define hex_decode rk_hex_decode 51 | 52 | ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 53 | hex_encode(const void *, size_t, char **); 54 | ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 55 | hex_decode(const char *, void *, size_t); 56 | 57 | #endif /* _rk_HEX_H_ */ 58 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/hx509_err.h: -------------------------------------------------------------------------------- 1 | /* Generated from hx509_err.et */ 2 | /* $Id$ */ 3 | 4 | #ifndef __hx509_err_h__ 5 | #define __hx509_err_h__ 6 | 7 | struct et_list; 8 | 9 | void initialize_hx_error_table_r(struct et_list **); 10 | 11 | void initialize_hx_error_table(void); 12 | #define init_hx_err_tbl initialize_hx_error_table 13 | 14 | typedef enum hx_error_number{ 15 | HX509_BAD_TIMEFORMAT = 569856, 16 | HX509_EXTENSION_NOT_FOUND = 569857, 17 | HX509_NO_PATH = 569858, 18 | HX509_PARENT_NOT_CA = 569859, 19 | HX509_CA_PATH_TOO_DEEP = 569860, 20 | HX509_SIG_ALG_NO_SUPPORTED = 569861, 21 | HX509_SIG_ALG_DONT_MATCH_KEY_ALG = 569862, 22 | HX509_CERT_USED_BEFORE_TIME = 569863, 23 | HX509_CERT_USED_AFTER_TIME = 569864, 24 | HX509_PRIVATE_KEY_MISSING = 569865, 25 | HX509_ALG_NOT_SUPP = 569866, 26 | HX509_ISSUER_NOT_FOUND = 569867, 27 | HX509_VERIFY_CONSTRAINTS = 569868, 28 | HX509_RANGE = 569869, 29 | HX509_NAME_CONSTRAINT_ERROR = 569870, 30 | HX509_PATH_TOO_LONG = 569871, 31 | HX509_KU_CERT_MISSING = 569872, 32 | HX509_CERT_NOT_FOUND = 569873, 33 | HX509_UNKNOWN_LOCK_COMMAND = 569874, 34 | HX509_PARENT_IS_CA = 569875, 35 | HX509_EXTRA_DATA_AFTER_STRUCTURE = 569876, 36 | HX509_PROXY_CERT_INVALID = 569877, 37 | HX509_PROXY_CERT_NAME_WRONG = 569878, 38 | HX509_NAME_MALFORMED = 569879, 39 | HX509_CERTIFICATE_MALFORMED = 569880, 40 | HX509_CERTIFICATE_MISSING_EKU = 569881, 41 | HX509_PROXY_CERTIFICATE_NOT_CANONICALIZED = 569882, 42 | HX509_CMS_FAILED_CREATE_SIGATURE = 569888, 43 | HX509_CMS_MISSING_SIGNER_DATA = 569889, 44 | HX509_CMS_SIGNER_NOT_FOUND = 569890, 45 | HX509_CMS_NO_DATA_AVAILABLE = 569891, 46 | HX509_CMS_INVALID_DATA = 569892, 47 | HX509_CMS_PADDING_ERROR = 569893, 48 | HX509_CMS_NO_RECIPIENT_CERTIFICATE = 569894, 49 | HX509_CMS_DATA_OID_MISMATCH = 569895, 50 | HX509_CRYPTO_INTERNAL_ERROR = 569920, 51 | HX509_CRYPTO_EXTERNAL_ERROR = 569921, 52 | HX509_CRYPTO_SIGNATURE_MISSING = 569922, 53 | HX509_CRYPTO_BAD_SIGNATURE = 569923, 54 | HX509_CRYPTO_SIG_NO_CONF = 569924, 55 | HX509_CRYPTO_SIG_INVALID_FORMAT = 569925, 56 | HX509_CRYPTO_OID_MISMATCH = 569926, 57 | HX509_CRYPTO_NO_PROMPTER = 569927, 58 | HX509_CRYPTO_SIGNATURE_WITHOUT_SIGNER = 569928, 59 | HX509_CRYPTO_RSA_PUBLIC_ENCRYPT = 569929, 60 | HX509_CRYPTO_RSA_PRIVATE_ENCRYPT = 569930, 61 | HX509_CRYPTO_RSA_PUBLIC_DECRYPT = 569931, 62 | HX509_CRYPTO_RSA_PRIVATE_DECRYPT = 569932, 63 | HX509_CRYPTO_ALGORITHM_BEST_BEFORE = 569933, 64 | HX509_CRYPTO_KEY_FORMAT_UNSUPPORTED = 569934, 65 | HX509_CRL_USED_BEFORE_TIME = 569952, 66 | HX509_CRL_USED_AFTER_TIME = 569953, 67 | HX509_CRL_INVALID_FORMAT = 569954, 68 | HX509_CERT_REVOKED = 569955, 69 | HX509_REVOKE_STATUS_MISSING = 569956, 70 | HX509_CRL_UNKNOWN_EXTENSION = 569957, 71 | HX509_REVOKE_WRONG_DATA = 569958, 72 | HX509_REVOKE_NOT_SAME_PARENT = 569959, 73 | HX509_CERT_NOT_IN_OCSP = 569960, 74 | HX509_LOCAL_ATTRIBUTE_MISSING = 569964, 75 | HX509_PARSING_KEY_FAILED = 569965, 76 | HX509_UNSUPPORTED_OPERATION = 569966, 77 | HX509_UNIMPLEMENTED_OPERATION = 569967, 78 | HX509_PARSING_NAME_FAILED = 569968, 79 | HX509_PKCS11_NO_SLOT = 569984, 80 | HX509_PKCS11_NO_TOKEN = 569985, 81 | HX509_PKCS11_NO_MECH = 569986, 82 | HX509_PKCS11_TOKEN_CONFUSED = 569987, 83 | HX509_PKCS11_OPEN_SESSION = 569988, 84 | HX509_PKCS11_LOGIN = 569989, 85 | HX509_PKCS11_LOAD = 569990, 86 | HX509_PKCS11_PIN_INCORRECT = 569991, 87 | HX509_PKCS11_PIN_LOCKED = 569992, 88 | HX509_PKCS11_PIN_NOT_INITIALIZED = 569993, 89 | HX509_PKCS11_PIN_EXPIRED = 569994 90 | } hx_error_number; 91 | 92 | #define ERROR_TABLE_BASE_hx 569856 93 | 94 | #define COM_ERR_BINDDOMAIN_hx "heim_com_err569856" 95 | 96 | #endif /* __hx509_err_h__ */ 97 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/k524_err.h: -------------------------------------------------------------------------------- 1 | /* Generated from k524_err.et */ 2 | /* $Id$ */ 3 | 4 | #ifndef __k524_err_h__ 5 | #define __k524_err_h__ 6 | 7 | struct et_list; 8 | 9 | void initialize_k524_error_table_r(struct et_list **); 10 | 11 | void initialize_k524_error_table(void); 12 | #define init_k524_err_tbl initialize_k524_error_table 13 | 14 | typedef enum k524_error_number{ 15 | KRB524_BADKEY = -1750206208, 16 | KRB524_BADADDR = -1750206207, 17 | KRB524_BADPRINC = -1750206206, 18 | KRB524_BADREALM = -1750206205, 19 | KRB524_V4ERR = -1750206204, 20 | KRB524_ENCFULL = -1750206203, 21 | KRB524_DECEMPTY = -1750206202, 22 | KRB524_NOTRESP = -1750206201 23 | } k524_error_number; 24 | 25 | #define ERROR_TABLE_BASE_k524 -1750206208 26 | 27 | #define COM_ERR_BINDDOMAIN_k524 "heim_com_err-1750206208" 28 | 29 | #endif /* __k524_err_h__ */ 30 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/kadm5/kadm5-pwcheck.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef KADM5_PWCHECK_H 37 | #define KADM5_PWCHECK_H 1 38 | 39 | 40 | #define KADM5_PASSWD_VERSION_V0 0 41 | #define KADM5_PASSWD_VERSION_V1 1 42 | 43 | typedef const char* (*kadm5_passwd_quality_check_func_v0)(krb5_context, 44 | krb5_principal, 45 | krb5_data*); 46 | 47 | /* 48 | * The 4th argument, is a tuning parameter for the quality check 49 | * function, the lib/caller will providing it for the password quality 50 | * module. 51 | */ 52 | 53 | typedef int 54 | (*kadm5_passwd_quality_check_func)(krb5_context context, 55 | krb5_principal principal, 56 | krb5_data *password, 57 | const char *tuning, 58 | char *message, 59 | size_t length); 60 | 61 | struct kadm5_pw_policy_check_func { 62 | const char *name; 63 | kadm5_passwd_quality_check_func func; 64 | }; 65 | 66 | struct kadm5_pw_policy_verifier { 67 | const char *name; 68 | int version; 69 | const char *vendor; 70 | const struct kadm5_pw_policy_check_func *funcs; 71 | }; 72 | 73 | #endif /* KADM5_PWCHECK_H */ 74 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/kadm5/kadm5_err.h: -------------------------------------------------------------------------------- 1 | /* Generated from kadm5_err.et */ 2 | /* $Id$ */ 3 | 4 | #ifndef __kadm5_err_h__ 5 | #define __kadm5_err_h__ 6 | 7 | struct et_list; 8 | 9 | void initialize_kadm5_error_table_r(struct et_list **); 10 | 11 | void initialize_kadm5_error_table(void); 12 | #define init_kadm5_err_tbl initialize_kadm5_error_table 13 | 14 | typedef enum kadm5_error_number{ 15 | KADM5_FAILURE = 43787520, 16 | KADM5_AUTH_GET = 43787521, 17 | KADM5_AUTH_ADD = 43787522, 18 | KADM5_AUTH_MODIFY = 43787523, 19 | KADM5_AUTH_DELETE = 43787524, 20 | KADM5_AUTH_INSUFFICIENT = 43787525, 21 | KADM5_BAD_DB = 43787526, 22 | KADM5_DUP = 43787527, 23 | KADM5_RPC_ERROR = 43787528, 24 | KADM5_NO_SRV = 43787529, 25 | KADM5_BAD_HIST_KEY = 43787530, 26 | KADM5_NOT_INIT = 43787531, 27 | KADM5_UNK_PRINC = 43787532, 28 | KADM5_UNK_POLICY = 43787533, 29 | KADM5_BAD_MASK = 43787534, 30 | KADM5_BAD_CLASS = 43787535, 31 | KADM5_BAD_LENGTH = 43787536, 32 | KADM5_BAD_POLICY = 43787537, 33 | KADM5_BAD_PRINCIPAL = 43787538, 34 | KADM5_BAD_AUX_ATTR = 43787539, 35 | KADM5_BAD_HISTORY = 43787540, 36 | KADM5_BAD_MIN_PASS_LIFE = 43787541, 37 | KADM5_PASS_Q_TOOSHORT = 43787542, 38 | KADM5_PASS_Q_CLASS = 43787543, 39 | KADM5_PASS_Q_DICT = 43787544, 40 | KADM5_PASS_REUSE = 43787545, 41 | KADM5_PASS_TOOSOON = 43787546, 42 | KADM5_POLICY_REF = 43787547, 43 | KADM5_INIT = 43787548, 44 | KADM5_BAD_PASSWORD = 43787549, 45 | KADM5_PROTECT_PRINCIPAL = 43787550, 46 | KADM5_BAD_SERVER_HANDLE = 43787551, 47 | KADM5_BAD_STRUCT_VERSION = 43787552, 48 | KADM5_OLD_STRUCT_VERSION = 43787553, 49 | KADM5_NEW_STRUCT_VERSION = 43787554, 50 | KADM5_BAD_API_VERSION = 43787555, 51 | KADM5_OLD_LIB_API_VERSION = 43787556, 52 | KADM5_OLD_SERVER_API_VERSION = 43787557, 53 | KADM5_NEW_LIB_API_VERSION = 43787558, 54 | KADM5_NEW_SERVER_API_VERSION = 43787559, 55 | KADM5_SECURE_PRINC_MISSING = 43787560, 56 | KADM5_NO_RENAME_SALT = 43787561, 57 | KADM5_BAD_CLIENT_PARAMS = 43787562, 58 | KADM5_BAD_SERVER_PARAMS = 43787563, 59 | KADM5_AUTH_LIST = 43787564, 60 | KADM5_AUTH_CHANGEPW = 43787565, 61 | KADM5_BAD_TL_TYPE = 43787566, 62 | KADM5_MISSING_CONF_PARAMS = 43787567, 63 | KADM5_BAD_SERVER_NAME = 43787568, 64 | KADM5_KS_TUPLE_NOSUPP = 43787569, 65 | KADM5_SETKEY3_ETYPE_MISMATCH = 43787570, 66 | KADM5_DECRYPT_USAGE_NOSUPP = 43787571, 67 | KADM5_POLICY_OP_NOSUPP = 43787572, 68 | KADM5_KEEPOLD_NOSUPP = 43787573, 69 | KADM5_AUTH_GET_KEYS = 43787574, 70 | KADM5_ALREADY_LOCKED = 43787575, 71 | KADM5_NOT_LOCKED = 43787576, 72 | KADM5_LOG_CORRUPT = 43787577, 73 | KADM5_LOG_NEEDS_UPGRADE = 43787578 74 | } kadm5_error_number; 75 | 76 | #define ERROR_TABLE_BASE_kadm5 43787520 77 | 78 | #define COM_ERR_BINDDOMAIN_kadm5 "heim_com_err43787520" 79 | 80 | #endif /* __kadm5_err_h__ */ 81 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/kdc-protos.h: -------------------------------------------------------------------------------- 1 | /* This is a generated file */ 2 | #ifndef __kdc_protos_h__ 3 | #define __kdc_protos_h__ 4 | #ifndef DOXY 5 | 6 | #include 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | krb5_error_code 13 | kdc_check_flags ( 14 | krb5_context /*context*/, 15 | krb5_kdc_configuration */*config*/, 16 | hdb_entry_ex */*client_ex*/, 17 | const char */*client_name*/, 18 | hdb_entry_ex */*server_ex*/, 19 | const char */*server_name*/, 20 | krb5_boolean /*is_as_req*/); 21 | 22 | krb5_error_code 23 | kdc_kx509_verify_service_principal ( 24 | krb5_context /*context*/, 25 | const char */*cname*/, 26 | krb5_principal /*sprincipal*/); 27 | 28 | void 29 | kdc_log ( 30 | krb5_context /*context*/, 31 | krb5_kdc_configuration */*config*/, 32 | int /*level*/, 33 | const char */*fmt*/, 34 | ...); 35 | 36 | char* 37 | kdc_log_msg ( 38 | krb5_context /*context*/, 39 | krb5_kdc_configuration */*config*/, 40 | int /*level*/, 41 | const char */*fmt*/, 42 | ...); 43 | 44 | char* 45 | kdc_log_msg_va ( 46 | krb5_context /*context*/, 47 | krb5_kdc_configuration */*config*/, 48 | int /*level*/, 49 | const char */*fmt*/, 50 | va_list /*ap*/); 51 | 52 | void 53 | kdc_openlog ( 54 | krb5_context /*context*/, 55 | const char */*service*/, 56 | krb5_kdc_configuration */*config*/); 57 | 58 | krb5_error_code 59 | krb5_kdc_get_config ( 60 | krb5_context /*context*/, 61 | krb5_kdc_configuration **/*config*/); 62 | 63 | krb5_error_code 64 | krb5_kdc_pk_initialize ( 65 | krb5_context /*context*/, 66 | krb5_kdc_configuration */*config*/, 67 | const char */*user_id*/, 68 | const char */*anchors*/, 69 | char **/*pool*/, 70 | char **/*revoke_list*/); 71 | 72 | krb5_error_code 73 | krb5_kdc_pkinit_config ( 74 | krb5_context /*context*/, 75 | krb5_kdc_configuration */*config*/); 76 | 77 | int 78 | krb5_kdc_process_krb5_request ( 79 | krb5_context /*context*/, 80 | krb5_kdc_configuration */*config*/, 81 | unsigned char */*buf*/, 82 | size_t /*len*/, 83 | krb5_data */*reply*/, 84 | const char */*from*/, 85 | struct sockaddr */*addr*/, 86 | int /*datagram_reply*/); 87 | 88 | int 89 | krb5_kdc_process_request ( 90 | krb5_context /*context*/, 91 | krb5_kdc_configuration */*config*/, 92 | unsigned char */*buf*/, 93 | size_t /*len*/, 94 | krb5_data */*reply*/, 95 | krb5_boolean */*prependlength*/, 96 | const char */*from*/, 97 | struct sockaddr */*addr*/, 98 | int /*datagram_reply*/); 99 | 100 | int 101 | krb5_kdc_save_request ( 102 | krb5_context /*context*/, 103 | const char */*fn*/, 104 | const unsigned char */*buf*/, 105 | size_t /*len*/, 106 | const krb5_data */*reply*/, 107 | const struct sockaddr */*sa*/); 108 | 109 | krb5_error_code 110 | krb5_kdc_set_dbinfo ( 111 | krb5_context /*context*/, 112 | struct krb5_kdc_configuration */*c*/); 113 | 114 | void 115 | krb5_kdc_update_time (struct timeval */*tv*/); 116 | 117 | krb5_error_code 118 | krb5_kdc_windc_init (krb5_context /*context*/); 119 | 120 | #ifdef __cplusplus 121 | } 122 | #endif 123 | 124 | #endif /* DOXY */ 125 | #endif /* __kdc_protos_h__ */ 126 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/kdc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997-2003 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * 5 | * Copyright (c) 2005 Andrew Bartlett 6 | * 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * 20 | * 3. Neither the name of the Institute nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | * SUCH DAMAGE. 35 | */ 36 | 37 | /* 38 | * $Id$ 39 | */ 40 | 41 | #ifndef __KDC_H__ 42 | #define __KDC_H__ 43 | 44 | #include 45 | #include 46 | 47 | enum krb5_kdc_trpolicy { 48 | TRPOLICY_ALWAYS_CHECK, 49 | TRPOLICY_ALLOW_PER_PRINCIPAL, 50 | TRPOLICY_ALWAYS_HONOUR_REQUEST 51 | }; 52 | 53 | typedef struct krb5_kdc_configuration { 54 | krb5_boolean require_preauth; /* require preauth for all principals */ 55 | time_t kdc_warn_pwexpire; /* time before expiration to print a warning */ 56 | 57 | struct HDB **db; 58 | int num_db; 59 | 60 | int num_kdc_processes; 61 | 62 | krb5_boolean encode_as_rep_as_tgs_rep; /* bug compatibility */ 63 | 64 | krb5_boolean tgt_use_strongest_session_key; 65 | krb5_boolean preauth_use_strongest_session_key; 66 | krb5_boolean svc_use_strongest_session_key; 67 | krb5_boolean use_strongest_server_key; 68 | 69 | krb5_boolean check_ticket_addresses; 70 | krb5_boolean allow_null_ticket_addresses; 71 | krb5_boolean allow_anonymous; 72 | krb5_boolean strict_nametypes; 73 | enum krb5_kdc_trpolicy trpolicy; 74 | 75 | krb5_boolean enable_pkinit; 76 | krb5_boolean pkinit_princ_in_cert; 77 | const char *pkinit_kdc_identity; 78 | const char *pkinit_kdc_anchors; 79 | const char *pkinit_kdc_friendly_name; 80 | const char *pkinit_kdc_ocsp_file; 81 | char **pkinit_kdc_cert_pool; 82 | char **pkinit_kdc_revoke; 83 | int pkinit_dh_min_bits; 84 | int pkinit_require_binding; 85 | int pkinit_allow_proxy_certs; 86 | 87 | krb5_log_facility *logf; 88 | 89 | int enable_digest; 90 | int digests_allowed; 91 | 92 | size_t max_datagram_reply_length; 93 | 94 | int enable_kx509; 95 | const char *kx509_template; 96 | const char *kx509_ca; 97 | 98 | } krb5_kdc_configuration; 99 | 100 | struct krb5_kdc_service { 101 | unsigned int flags; 102 | #define KS_KRB5 1 103 | #define KS_NO_LENGTH 2 104 | krb5_error_code (*process)(krb5_context context, 105 | krb5_kdc_configuration *config, 106 | krb5_data *req_buffer, 107 | krb5_data *reply, 108 | const char *from, 109 | struct sockaddr *addr, 110 | int datagram_reply, 111 | int *claim); 112 | }; 113 | 114 | #include 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/krb5-types.h: -------------------------------------------------------------------------------- 1 | #ifndef __krb5_types_h__ 2 | #define __krb5_types_h__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | typedef socklen_t krb5_socklen_t; 10 | #include 11 | typedef ssize_t krb5_ssize_t; 12 | 13 | typedef int krb5_socket_t; 14 | 15 | #if !defined(__has_extension) 16 | #define __has_extension(x) 0 17 | #endif 18 | 19 | #ifndef KRB5TYPES_REQUIRE_GNUC 20 | #define KRB5TYPES_REQUIRE_GNUC(m,n,p) \ 21 | (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) + __GNUC_PATCHLEVEL__) >= \ 22 | (((m) * 10000) + ((n) * 100) + (p))) 23 | #endif 24 | 25 | #ifndef HEIMDAL_DEPRECATED 26 | #if __has_extension(deprecated) || KRB5TYPES_REQUIRE_GNUC(3,1,0) 27 | #define HEIMDAL_DEPRECATED __attribute__ ((__deprecated__)) 28 | #elif defined(_MSC_VER) && (_MSC_VER>1200) 29 | #define HEIMDAL_DEPRECATED __declspec(deprecated) 30 | #else 31 | #define HEIMDAL_DEPRECATED 32 | #endif 33 | #endif 34 | 35 | #ifndef HEIMDAL_PRINTF_ATTRIBUTE 36 | #if __has_extension(format) || KRB5TYPES_REQUIRE_GNUC(3,1,0) 37 | #define HEIMDAL_PRINTF_ATTRIBUTE(x) __attribute__ ((__format__ x)) 38 | #else 39 | #define HEIMDAL_PRINTF_ATTRIBUTE(x) 40 | #endif 41 | #endif 42 | 43 | #ifndef HEIMDAL_NORETURN_ATTRIBUTE 44 | #if __has_extension(noreturn) || KRB5TYPES_REQUIRE_GNUC(3,1,0) 45 | #define HEIMDAL_NORETURN_ATTRIBUTE __attribute__ ((__noreturn__)) 46 | #else 47 | #define HEIMDAL_NORETURN_ATTRIBUTE 48 | #endif 49 | #endif 50 | 51 | #ifndef HEIMDAL_UNUSED_ATTRIBUTE 52 | #if __has_extension(unused) || KRB5TYPES_REQUIRE_GNUC(3,1,0) 53 | #define HEIMDAL_UNUSED_ATTRIBUTE __attribute__ ((__unused__)) 54 | #else 55 | #define HEIMDAL_UNUSED_ATTRIBUTE 56 | #endif 57 | #endif 58 | 59 | #ifndef HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE 60 | #if __has_extension(warn_unused_result) || KRB5TYPES_REQUIRE_GNUC(3,3,0) 61 | #define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE __attribute__ ((__warn_unused_result__)) 62 | #else 63 | #define HEIMDAL_WARN_UNUSED_RESULT_ATTRIBUTE 64 | #endif 65 | #endif 66 | 67 | #endif /* __krb5_types_h__ */ 68 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/krb5/an2ln_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef HEIMDAL_KRB5_AN2LN_PLUGIN_H 37 | #define HEIMDAL_KRB5_AN2LN_PLUGIN_H 1 38 | 39 | #define KRB5_PLUGIN_AN2LN "an2ln" 40 | #define KRB5_PLUGIN_AN2LN_VERSION_0 0 41 | 42 | typedef krb5_error_code (KRB5_LIB_CALL *set_result_f)(void *, const char *); 43 | 44 | /** @struct krb5plugin_an2ln_ftable_desc 45 | * 46 | * @brief Description of the krb5_aname_to_lname(3) plugin facility. 47 | * 48 | * The krb5_aname_to_lname(3) function is pluggable. The plugin is 49 | * named KRB5_PLUGIN_AN2LN ("an2ln"), with a single minor version, 50 | * KRB5_PLUGIN_AN2LN_VERSION_0 (0). 51 | * 52 | * The plugin for krb5_aname_to_lname(3) consists of a data symbol 53 | * referencing a structure of type krb5plugin_an2ln_ftable, with four 54 | * fields: 55 | * 56 | * @param init Plugin initialization function (see krb5-plugin(7)) 57 | * 58 | * @param minor_version The plugin minor version number (0) 59 | * 60 | * @param fini Plugin finalization function 61 | * 62 | * @param an2ln Plugin aname_to_lname function 63 | * 64 | * The an2ln field is the plugin entry point that performs the 65 | * traditional aname_to_lname operation however the plugin desires. It 66 | * is invoked in no particular order relative to other an2ln plugins, 67 | * but it has a 'rule' argument that indicates which plugin is intended 68 | * to act on the rule. The plugin an2ln function must return 69 | * KRB5_PLUGIN_NO_HANDLE if the rule is not applicable to it. 70 | * 71 | * The plugin an2ln function has the following arguments, in this order: 72 | * 73 | * -# plug_ctx, the context value output by the plugin's init function 74 | * -# context, a krb5_context 75 | * -# rule, the aname_to_lname rule being evaluated (from krb5.conf(5)) 76 | * -# aname, the krb5_principal to be mapped to an lname 77 | * -# set_res_f, a function the plugin must call to set its result 78 | * -# set_res_ctx, the first argument to set_res_f (the second is the result lname string) 79 | * 80 | * @ingroup krb5_support 81 | */ 82 | typedef struct krb5plugin_an2ln_ftable_desc { 83 | int minor_version; 84 | krb5_error_code (KRB5_LIB_CALL *init)(krb5_context, void **); 85 | void (KRB5_LIB_CALL *fini)(void *); 86 | krb5_error_code (KRB5_LIB_CALL *an2ln)(void *, krb5_context, const char *, 87 | krb5_const_principal, set_result_f, void *); 88 | } krb5plugin_an2ln_ftable; 89 | 90 | #endif /* HEIMDAL_KRB5_AN2LN_PLUGIN_H */ 91 | 92 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/krb5/ccache_plugin.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Copyright (c) 2010, Secure Endpoints Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 20 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 21 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 28 | * OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | **********************************************************************/ 31 | 32 | #ifndef HEIMDAL_KRB5_CCACHE_PLUGIN_H 33 | #define HEIMDAL_KRB5_CCACHE_PLUGIN_H 1 34 | 35 | #include 36 | 37 | #define KRB5_PLUGIN_CCACHE "ccache_ops" 38 | 39 | #endif /* HEIMDAL_KRB5_CCACHE_PLUGIN_H */ 40 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/krb5/db_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Secure Endpoints Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 20 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 21 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 28 | * OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* $Id$ */ 32 | 33 | #ifndef HEIMDAL_KRB5_DB_PLUGIN_H 34 | #define HEIMDAL_KRB5_DB_PLUGIN_H 1 35 | 36 | #define KRB5_PLUGIN_DB "krb5_db_plug" 37 | #define KRB5_PLUGIN_DB_VERSION_0 0 38 | 39 | /** @struct krb5plugin_db_ftable_desc 40 | * 41 | * @brief Description of the krb5 DB plugin facility. 42 | * 43 | * The krb5_aname_to_lname(3) function's DB rule is pluggable. The 44 | * plugin is named KRB5_PLUGIN_DB ("krb5_db_plug"), with a single minor 45 | * version, KRB5_PLUGIN_DB_VERSION_0 (0). 46 | * 47 | * The plugin consists of a data symbol referencing a structure of type 48 | * krb5plugin_db_ftable_desc, with three fields: 49 | * 50 | * @param init Plugin initialization function (see krb5-plugin(7)) 51 | * 52 | * @param minor_version The plugin minor version number (0) 53 | * 54 | * @param fini Plugin finalization function 55 | * 56 | * The init entry point is expected to call heim_db_register(). The 57 | * fini entry point is expected to do nothing. 58 | * 59 | * @ingroup krb5_support 60 | */ 61 | typedef struct krb5plugin_db_ftable_desc { 62 | int minor_version; 63 | krb5_error_code (KRB5_LIB_CALL *init)(krb5_context, void **); 64 | void (KRB5_LIB_CALL *fini)(void *); 65 | } krb5plugin_db_ftable; 66 | 67 | #endif /* HEIMDAL_KRB5_DB_PLUGIN_H */ 68 | 69 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/krb5/locate_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Portions Copyright (c) 2010 Apple Inc. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * 3. Neither the name of the Institute nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 | * SUCH DAMAGE. 34 | */ 35 | 36 | /* $Id$ */ 37 | 38 | #ifndef HEIMDAL_KRB5_LOCATE_PLUGIN_H 39 | #define HEIMDAL_KRB5_LOCATE_PLUGIN_H 1 40 | 41 | #define KRB5_PLUGIN_LOCATE "service_locator" 42 | #define KRB5_PLUGIN_LOCATE_VERSION 1 43 | #define KRB5_PLUGIN_LOCATE_VERSION_0 0 44 | #define KRB5_PLUGIN_LOCATE_VERSION_1 1 45 | #define KRB5_PLUGIN_LOCATE_VERSION_2 2 46 | 47 | enum locate_service_type { 48 | locate_service_kdc = 1, 49 | locate_service_master_kdc, 50 | locate_service_kadmin, 51 | locate_service_krb524, 52 | locate_service_kpasswd 53 | }; 54 | 55 | typedef krb5_error_code 56 | (*krb5plugin_service_locate_lookup) (void *, unsigned long, enum locate_service_type, 57 | const char *, int, int, 58 | int (*)(void *,int,struct sockaddr *), 59 | void *); 60 | 61 | #define KRB5_PLF_ALLOW_HOMEDIR 1 62 | 63 | typedef krb5_error_code 64 | (*krb5plugin_service_locate_lookup_old) (void *, enum locate_service_type, 65 | const char *, int, int, 66 | int (*)(void *,int,struct sockaddr *), 67 | void *); 68 | 69 | 70 | typedef struct krb5plugin_service_locate_ftable { 71 | int minor_version; 72 | krb5_error_code (*init)(krb5_context, void **); 73 | void (*fini)(void *); 74 | krb5plugin_service_locate_lookup_old old_lookup; 75 | krb5plugin_service_locate_lookup lookup; /* version 2 */ 76 | } krb5plugin_service_locate_ftable; 77 | 78 | #endif /* HEIMDAL_KRB5_LOCATE_PLUGIN_H */ 79 | 80 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/krb5/send_to_kdc_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef HEIMDAL_KRB5_SEND_TO_KDC_PLUGIN_H 37 | #define HEIMDAL_KRB5_SEND_TO_KDC_PLUGIN_H 1 38 | 39 | #include 40 | 41 | #define KRB5_PLUGIN_SEND_TO_KDC "send_to_kdc" 42 | 43 | #define KRB5_PLUGIN_SEND_TO_KDC_VERSION_0 0 44 | #define KRB5_PLUGIN_SEND_TO_KDC_VERSION_2 2 45 | #define KRB5_PLUGIN_SEND_TO_KDC_VERSION KRB5_PLUGIN_SEND_TO_KDC_VERSION_2 46 | 47 | typedef krb5_error_code 48 | (*krb5plugin_send_to_kdc_func)(krb5_context, 49 | void *, 50 | krb5_krbhst_info *, 51 | time_t timeout, 52 | const krb5_data *, 53 | krb5_data *); 54 | typedef krb5_error_code 55 | (*krb5plugin_send_to_realm_func)(krb5_context, 56 | void *, 57 | krb5_const_realm, 58 | time_t timeout, 59 | const krb5_data *, 60 | krb5_data *); 61 | 62 | 63 | typedef struct krb5plugin_send_to_kdc_ftable { 64 | int minor_version; 65 | krb5_error_code (*init)(krb5_context, void **); 66 | void (*fini)(void *); 67 | krb5plugin_send_to_kdc_func send_to_kdc; 68 | krb5plugin_send_to_realm_func send_to_realm; /* added in version 2 */ 69 | } krb5plugin_send_to_kdc_ftable; 70 | 71 | #endif /* HEIMDAL_KRB5_SEND_TO_KDC_PLUGIN_H */ 72 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/krb5/windc_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef HEIMDAL_KRB5_PAC_PLUGIN_H 37 | #define HEIMDAL_KRB5_PAC_PLUGIN_H 1 38 | 39 | #include 40 | 41 | /* 42 | * The PAC generate function should allocate a krb5_pac using 43 | * krb5_pac_init and fill in the PAC structure for the principal using 44 | * krb5_pac_add_buffer. 45 | * 46 | * The PAC verify function should verify all components in the PAC 47 | * using krb5_pac_get_types and krb5_pac_get_buffer for all types. 48 | * 49 | * Check client access function check if the client is authorized. 50 | */ 51 | 52 | struct hdb_entry_ex; 53 | 54 | typedef krb5_error_code 55 | (*krb5plugin_windc_pac_generate)(void *, krb5_context, 56 | struct hdb_entry_ex *, krb5_pac *); 57 | 58 | typedef krb5_error_code 59 | (*krb5plugin_windc_pac_verify)(void *, krb5_context, 60 | const krb5_principal, /* new ticket client */ 61 | const krb5_principal, /* delegation proxy */ 62 | struct hdb_entry_ex *,/* client */ 63 | struct hdb_entry_ex *,/* server */ 64 | struct hdb_entry_ex *,/* krbtgt */ 65 | krb5_pac *); 66 | 67 | typedef krb5_error_code 68 | (*krb5plugin_windc_client_access)( 69 | void *, krb5_context, 70 | krb5_kdc_configuration *config, 71 | hdb_entry_ex *, const char *, 72 | hdb_entry_ex *, const char *, 73 | KDC_REQ *, METHOD_DATA *); 74 | 75 | 76 | #define KRB5_WINDC_PLUGIN_MINOR 6 77 | #define KRB5_WINDC_PLUGING_MINOR KRB5_WINDC_PLUGIN_MINOR 78 | 79 | typedef struct krb5plugin_windc_ftable { 80 | int minor_version; 81 | krb5_error_code (*init)(krb5_context, void **); 82 | void (*fini)(void *); 83 | krb5plugin_windc_pac_generate pac_generate; 84 | krb5plugin_windc_pac_verify pac_verify; 85 | krb5plugin_windc_client_access client_access; 86 | } krb5plugin_windc_ftable; 87 | 88 | #endif /* HEIMDAL_KRB5_PAC_PLUGIN_H */ 89 | 90 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/ntlm_err.h: -------------------------------------------------------------------------------- 1 | /* Generated from ntlm_err.et */ 2 | 3 | #ifndef __ntlm_err_h__ 4 | #define __ntlm_err_h__ 5 | 6 | struct et_list; 7 | 8 | void initialize_ntlm_error_table_r(struct et_list **); 9 | 10 | void initialize_ntlm_error_table(void); 11 | #define init_ntlm_err_tbl initialize_ntlm_error_table 12 | 13 | typedef enum ntlm_error_number{ 14 | HNTLM_ERR_DECODE = -1561745664, 15 | HNTLM_ERR_INVALID_LENGTH = -1561745663, 16 | HNTLM_ERR_CRYPTO = -1561745662, 17 | HNTLM_ERR_RAND = -1561745661, 18 | HNTLM_ERR_AUTH = -1561745660, 19 | HNTLM_ERR_TIME_SKEW = -1561745659, 20 | HNTLM_ERR_OEM = -1561745658, 21 | HNTLM_ERR_MISSING_NAME_SEPARATOR = -1561745657, 22 | HNTLM_ERR_MISSING_BUFFER = -1561745656, 23 | HNTLM_ERR_INVALID_APOP = -1561745655, 24 | HNTLM_ERR_INVALID_CRAM_MD5 = -1561745654, 25 | HNTLM_ERR_INVALID_DIGEST_MD5 = -1561745653, 26 | HNTLM_ERR_INVALID_DIGEST_MD5_RSPAUTH = -1561745652, 27 | HNTLM_ERR_INVALID_CHANNEL_BINDINGS = -1561745651, 28 | HNTLM_ERR_INVALID_MIC = -1561745650, 29 | HNTLM_ERR_INVALID_SESSIONKEY = -1561745649, 30 | HNTLM_ERR_NOT_CONFIGURED = -1561745600, 31 | HNTLM_ERR_INVALID_CHALLANGE = -1561745599, 32 | HNTLM_ERR_INVALID_LMv1_RESPONSE = -1561745598, 33 | HNTLM_ERR_INVALID_NT_RESPONSE = -1561745597, 34 | HNTLM_ERR_INVALID_LMv2_RESPONSE = -1561745596, 35 | HNTLM_ERR_INVALID_NTv1_RESPONSE = -1561745595, 36 | HNTLM_ERR_INVALID_NTv2_RESPONSE = -1561745594, 37 | HNTLM_ERR_INVALID_NTv1_ANSWER = -1561745593, 38 | HNTLM_ERR_INVALID_NTv2_ANSWER = -1561745592, 39 | HNTLM_ERR_INVALID_SESSION_KEY = -1561745591, 40 | HNTLM_ERR_INVALID_NO_GUEST = -1561745590, 41 | HNTLM_ERR_NO_NETR_CONFIGURED = -1561745589, 42 | HSCRAM_ERR_INVALID_MESSAGE = -1561745536, 43 | HSCRAM_ERR_INVALID_PROOF = -1561745535, 44 | HSCRAM_ERR_INVALID_ROLE = -1561745534 45 | } ntlm_error_number; 46 | 47 | #define ERROR_TABLE_BASE_ntlm -1561745664 48 | 49 | #define COM_ERR_BINDDOMAIN_ntlm "heim_com_err-1561745664" 50 | 51 | #endif /* __ntlm_err_h__ */ 52 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/parse_bytes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 - 2001 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef __PARSE_BYTES_H__ 37 | #define __PARSE_BYTES_H__ 38 | 39 | #ifndef ROKEN_LIB_FUNCTION 40 | #ifdef _WIN32 41 | #define ROKEN_LIB_FUNCTION 42 | #define ROKEN_LIB_CALL __cdecl 43 | #else 44 | #define ROKEN_LIB_FUNCTION 45 | #define ROKEN_LIB_CALL 46 | #endif 47 | #endif 48 | 49 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 50 | parse_bytes (const char *s, const char *def_unit); 51 | 52 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 53 | unparse_bytes (int t, char *s, size_t len); 54 | 55 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 56 | unparse_bytes_short (int t, char *s, size_t len); 57 | 58 | #endif /* __PARSE_BYTES_H__ */ 59 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/parse_time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef __PARSE_TIME_H__ 37 | #define __PARSE_TIME_H__ 38 | 39 | #ifndef ROKEN_LIB_FUNCTION 40 | #ifdef _WIN32 41 | #define ROKEN_LIB_FUNCTION 42 | #define ROKEN_LIB_CALL __cdecl 43 | #else 44 | #define ROKEN_LIB_FUNCTION 45 | #define ROKEN_LIB_CALL 46 | #endif 47 | #endif 48 | 49 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 50 | parse_time (const char *s, const char *def_unit); 51 | 52 | ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 53 | unparse_time (int t, char *s, size_t len); 54 | 55 | ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL 56 | unparse_time_approx (int t, char *s, size_t len); 57 | 58 | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 59 | print_time_table (FILE *f); 60 | 61 | #endif /* __PARSE_TIME_H__ */ 62 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/parse_units.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef __PARSE_UNITS_H__ 37 | #define __PARSE_UNITS_H__ 38 | 39 | #include 40 | #include 41 | 42 | #ifndef ROKEN_LIB_FUNCTION 43 | #ifdef _WIN32 44 | #define ROKEN_LIB_FUNCTION 45 | #define ROKEN_LIB_CALL __cdecl 46 | #else 47 | #define ROKEN_LIB_FUNCTION 48 | #define ROKEN_LIB_CALL 49 | #endif 50 | #endif 51 | 52 | struct units { 53 | const char *name; 54 | unsigned mult; 55 | }; 56 | 57 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 58 | parse_units (const char *s, const struct units *units, 59 | const char *def_unit); 60 | 61 | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 62 | print_units_table (const struct units *units, FILE *f); 63 | 64 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 65 | parse_flags (const char *s, const struct units *units, 66 | int orig); 67 | 68 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 69 | unparse_units (int num, const struct units *units, char *s, size_t len); 70 | 71 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 72 | unparse_units_approx (int num, const struct units *units, char *s, 73 | size_t len); 74 | 75 | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 76 | unparse_flags (int num, const struct units *units, char *s, size_t len); 77 | 78 | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 79 | print_flags_table (const struct units *units, FILE *f); 80 | 81 | #endif /* __PARSE_UNITS_H__ */ 82 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/sl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 - 2004 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef _SL_H 37 | #define _SL_H 38 | 39 | #define SL_BADCOMMAND -1 40 | 41 | typedef int (*cmd_func)(int, char **); 42 | 43 | struct sl_cmd { 44 | const char *name; 45 | cmd_func func; 46 | const char *usage; 47 | const char *help; 48 | }; 49 | 50 | typedef struct sl_cmd SL_cmd; 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | void sl_help (SL_cmd *, int argc, char **argv); 57 | int sl_loop (SL_cmd *, const char *prompt); 58 | int sl_command_loop (SL_cmd *cmds, const char *prompt, void **data); 59 | int sl_command (SL_cmd *cmds, int argc, char **argv); 60 | int sl_make_argv(char*, int*, char***); 61 | void sl_apropos (SL_cmd *cmd, const char *topic); 62 | SL_cmd *sl_match (SL_cmd *cmds, char *cmd, int exactp); 63 | void sl_slc_help (SL_cmd *cmds, int argc, char **argv); 64 | void sl_did_you_mean(SL_cmd *cmds, const char *match); 65 | 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* _SL_H */ 72 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/wind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | #ifndef _WIND_H_ 37 | #define _WIND_H_ 38 | 39 | #include 40 | #include 41 | 42 | #include 43 | 44 | typedef unsigned int wind_profile_flags; 45 | 46 | #define WIND_PROFILE_NAME 0x00000001 47 | #define WIND_PROFILE_SASL 0x00000002 48 | #define WIND_PROFILE_LDAP 0x00000004 49 | #define WIND_PROFILE_LDAP_CASE 0x00000008 50 | 51 | #define WIND_PROFILE_LDAP_CASE_EXACT_ATTRIBUTE 0x00010000 52 | #define WIND_PROFILE_LDAP_CASE_EXACT_ASSERTION 0x00020000 53 | #define WIND_PROFILE_LDAP_NUMERIC 0x00040000 54 | #define WIND_PROFILE_LDAP_TELEPHONE 0x00080000 55 | 56 | 57 | /* flags to wind_ucs2read/wind_ucs2write */ 58 | #define WIND_RW_LE 1 59 | #define WIND_RW_BE 2 60 | #define WIND_RW_BOM 4 61 | 62 | int wind_stringprep(const uint32_t *, size_t, 63 | uint32_t *, size_t *, 64 | wind_profile_flags); 65 | int wind_profile(const char *, wind_profile_flags *); 66 | 67 | int wind_punycode_label_toascii(const uint32_t *, size_t, 68 | char *, size_t *); 69 | 70 | int wind_utf8ucs4(const char *, uint32_t *, size_t *); 71 | int wind_utf8ucs4_length(const char *, size_t *); 72 | 73 | int wind_ucs4utf8(const uint32_t *, size_t, char *, size_t *); 74 | int wind_ucs4utf8_length(const uint32_t *, size_t, size_t *); 75 | 76 | int wind_utf8ucs2(const char *, uint16_t *, size_t *); 77 | int wind_utf8ucs2_length(const char *, size_t *); 78 | 79 | int wind_ucs2utf8(const uint16_t *, size_t, char *, size_t *); 80 | int wind_ucs2utf8_length(const uint16_t *, size_t, size_t *); 81 | 82 | 83 | int wind_ucs2read(const void *, size_t, unsigned int *, uint16_t *, size_t *); 84 | int wind_ucs2write(const uint16_t *, size_t, unsigned int *, void *, size_t *); 85 | 86 | #endif /* _WIND_H_ */ 87 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/wind_err.h: -------------------------------------------------------------------------------- 1 | /* Generated from wind_err.et */ 2 | /* $Id$ */ 3 | 4 | #ifndef __wind_err_h__ 5 | #define __wind_err_h__ 6 | 7 | struct et_list; 8 | 9 | void initialize_wind_error_table_r(struct et_list **); 10 | 11 | void initialize_wind_error_table(void); 12 | #define init_wind_err_tbl initialize_wind_error_table 13 | 14 | typedef enum wind_error_number{ 15 | WIND_ERR_NONE = -969269760, 16 | WIND_ERR_NO_PROFILE = -969269759, 17 | WIND_ERR_OVERRUN = -969269758, 18 | WIND_ERR_UNDERUN = -969269757, 19 | WIND_ERR_LENGTH_NOT_MOD2 = -969269756, 20 | WIND_ERR_LENGTH_NOT_MOD4 = -969269755, 21 | WIND_ERR_INVALID_UTF8 = -969269754, 22 | WIND_ERR_INVALID_UTF16 = -969269753, 23 | WIND_ERR_INVALID_UTF32 = -969269752, 24 | WIND_ERR_NO_BOM = -969269751, 25 | WIND_ERR_NOT_UTF16 = -969269750 26 | } wind_error_number; 27 | 28 | #define ERROR_TABLE_BASE_wind -969269760 29 | 30 | #define COM_ERR_BINDDOMAIN_wind "heim_com_err-969269760" 31 | 32 | #endif /* __wind_err_h__ */ 33 | -------------------------------------------------------------------------------- /build_helpers/heimdal/include/xdbm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan 3 | * (Royal Institute of Technology, Stockholm, Sweden). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the Institute nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | /* $Id$ */ 35 | 36 | /* Generic *dbm include file */ 37 | 38 | #ifndef __XDBM_H__ 39 | #define __XDBM_H__ 40 | 41 | #if HAVE_DB_NDBM 42 | #define DB_DBM_HSEARCH 1 43 | #include 44 | #elif HAVE_NDBM 45 | #if defined(HAVE_GDBM_NDBM_H) 46 | #include 47 | #elif defined(HAVE_NDBM_H) 48 | #include 49 | #endif 50 | #endif /* HAVE_NDBM */ 51 | 52 | #endif /* __XDBM_H__ */ 53 | -------------------------------------------------------------------------------- /build_helpers/lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | lib::setup::debian_requirements() { 5 | echo "Installing Debian based pre-requisites" 6 | export DEBIAN_FRONTEND=noninteractive 7 | apt-get update 8 | 9 | if [ x"$KRB5_PROVIDER" = "xheimdal" ]; then 10 | echo "Installing Heimdal packages for Debian" 11 | apt-get -y install \ 12 | heimdal-{clients,dev,kdc} 13 | 14 | export PATH="/usr/lib/heimdal-servers:${PATH}" 15 | 16 | else 17 | echo "Installing MIT Kerberos packages for Debian" 18 | apt-get -y install \ 19 | krb5-{user,kdc,admin-server,multidev} \ 20 | libkrb5-dev 21 | fi 22 | } 23 | 24 | lib::setup::system_requirements() { 25 | if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then 26 | echo "::group::Installing System Requirements" 27 | fi 28 | 29 | if [ -f /etc/debian_version ]; then 30 | lib::setup::debian_requirements 31 | 32 | elif [ "$(uname)" == "Darwin" ]; then 33 | echo "No system requirements required for macOS" 34 | 35 | else 36 | echo "Distro not found!" 37 | false 38 | fi 39 | 40 | if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then 41 | echo "::endgroup::" 42 | fi 43 | } 44 | 45 | lib::setup::python_requirements() { 46 | if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then 47 | echo "::group::Installing Python Requirements" 48 | fi 49 | 50 | echo "Installing krb5" 51 | 52 | # Getting the version is important so that pip prioritises our local dist 53 | python -m pip install build 54 | KRB5_VERSION="$( python -c "import build.util; print(build.util.project_wheel_metadata('.').get('Version'))" )" 55 | 56 | python -m pip install krb5=="${KRB5_VERSION}" \ 57 | --find-links "file://${PWD}/dist" \ 58 | --verbose 59 | 60 | echo "Installing dev dependencies" 61 | python -m pip install -r requirements-dev.txt 62 | 63 | if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then 64 | echo "::endgroup::" 65 | fi 66 | } 67 | 68 | lib::sanity::run() { 69 | if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then 70 | echo "::group::Running Sanity Checks" 71 | fi 72 | 73 | python -m black . --check 74 | python -m isort . --check-only 75 | python -m mypy . 76 | 77 | if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then 78 | echo "::endgroup::" 79 | fi 80 | } 81 | 82 | lib::tests::run() { 83 | if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then 84 | echo "::group::Running Tests" 85 | fi 86 | 87 | python -m pytest -v --junitxml junit/test-results.xml 88 | 89 | if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then 90 | echo "::endgroup::" 91 | fi 92 | } 93 | -------------------------------------------------------------------------------- /build_helpers/run-ci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | # Set by GHA setup-python 4 | if [[ -n "${pythonLocation}" ]]; then 5 | PATH="${pythonLocation}/bin:${PATH}" 6 | fi 7 | 8 | source ./build_helpers/lib.sh 9 | lib::setup::system_requirements 10 | lib::setup::python_requirements 11 | lib::sanity::run 12 | lib::tests::run 13 | -------------------------------------------------------------------------------- /build_helpers/run-container.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | # KRB5_PROVIDER and DEBIAN_VERSION can be set to run tests against different 4 | # versions. A full test suite before release should be run with 5 | # DEBIAN_VERSION=10 KRB5_PROVIDER=mit build_helpers/run-container.sh 6 | # DEBIAN_VERSION=10 KRB5_PROVIDER=heimdal build_helpers/run-container.sh 7 | # DEBIAN_VERSION=11 KRB5_PROVIDER=mit build_helpers/run-container.sh 8 | # DEBIAN_VERSION=12 KRB5_PROVIDER=mit build_helpers/run-container.sh 9 | 10 | export DEBIAN_VERSION="${DEBIAN_VERSION:-10}" 11 | 12 | docker run \ 13 | --rm \ 14 | --interactive \ 15 | --hostname test.krbtest.com \ 16 | --volume "$( pwd )":/tmp/build:z \ 17 | --workdir /tmp/build \ 18 | --env KRB5_PROVIDER=${KRB5_PROVIDER:-mit} \ 19 | --env DEBIAN_VERSION=${DEBIAN_VERSION} \ 20 | debian:${DEBIAN_VERSION} /bin/bash -ex -c 'source /dev/stdin' << 'EOF' 21 | 22 | source ./build_helpers/lib.sh 23 | lib::setup::system_requirements 24 | 25 | apt-get -y install \ 26 | python3 \ 27 | python3-{dev,pip,venv} 28 | 29 | . /etc/os-release 30 | if [ "$VERSION_ID" = "10" ]; then 31 | ln -s /usr/bin/python3 /usr/bin/python 32 | else 33 | python3 -m venv .venv 34 | source .venv/bin/activate 35 | fi 36 | 37 | python -m pip install build 38 | python -m build 39 | lib::setup::python_requirements 40 | 41 | # Ensure we don't pollute the local dir + mypy doesn't like this 42 | rm -rf dist 43 | rm -rf build 44 | 45 | lib::sanity::run 46 | 47 | export PYTEST_ADDOPTS="--color=yes" 48 | lib::tests::run 49 | EOF 50 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "Cython >= 0.29.32, < 4.0.0", # 0.29.31 includes noexcept keyword support 4 | "setuptools >= 42.0.0", # Supports license_files 5 | ] 6 | build-backend = "setuptools.build_meta" 7 | 8 | # FUTURE: Mandate newer setuptools to use pyproject.toml configuration 9 | # Currently it fails when using older pip versions that are still used by some 10 | # Linux distributions with: 11 | # WARNING: Generating metadata for package krb5 produced metadata for project name unknown. Fix your #egg=krb5 fragments. 12 | 13 | [tool.black] 14 | line-length = 120 15 | include = '\.pyi?$' 16 | exclude = ''' 17 | /( 18 | \.git 19 | | \.hg 20 | | \.mypy_cache 21 | | \.tox 22 | | \.venv 23 | | _build 24 | | buck-out 25 | | build 26 | | dist 27 | )/ 28 | ''' 29 | 30 | [tool.isort] 31 | profile = "black" 32 | 33 | [tool.mypy] 34 | # mypy doesn't seem to like pyenv and extra typeshed libraries 35 | exclude = "setup.py" 36 | mypy_path = "$MYPY_CONFIG_FILE_DIR/src:$MYPY_CONFIG_FILE_DIR/stubs" 37 | show_error_codes = true 38 | show_column_numbers = true 39 | disallow_any_unimported = true 40 | disallow_untyped_calls = true 41 | disallow_untyped_defs = true 42 | disallow_incomplete_defs = true 43 | check_untyped_defs = true 44 | disallow_untyped_decorators = true 45 | no_implicit_reexport = true 46 | warn_redundant_casts = true 47 | warn_unused_ignores = true 48 | 49 | [tool.pytest.ini_options] 50 | testpaths = "tests" 51 | addopts = "--import-mode=importlib" 52 | 53 | [tool.tox] 54 | legacy_tox_ini = """ 55 | [tox] 56 | envlist = sanity,py36,py37,py38,py39,py310 57 | skip_missing_interpreters = true 58 | isolated_build = True 59 | 60 | [testenv] 61 | deps = 62 | -r{toxinidir}/requirements-dev.txt 63 | 64 | commands = 65 | python -m pytest -v 66 | 67 | [testenv:sanity] 68 | commands = 69 | python -m black . --check 70 | python -m isort . --check-only 71 | python -m mypy . 72 | """ 73 | -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | black==22.10.0 2 | isort==5.10.1 3 | k5test>=0.10.4 # Needed for MITRealm.start_kadmind env default 4 | mypy==0.982 5 | pre-commit 6 | pytest 7 | tox 8 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = krb5 3 | version = 0.8.0 4 | url = https://github.com/jborean93/pykrb5 5 | author = Jordan Borean 6 | author_email = jborean93@gmail.com 7 | license = MIT 8 | license_files = LICENSE 9 | description = Kerberos API bindings for Python 10 | long_description = file: README.md 11 | long_description_content_type = text/markdown 12 | keywords = 13 | krb5 14 | kerberos 15 | classifiers = 16 | Development Status :: 4 - Beta 17 | License :: OSI Approved :: MIT License 18 | Programming Language :: Python :: 3 19 | Programming Language :: Python :: 3.8 20 | Programming Language :: Python :: 3.9 21 | Programming Language :: Python :: 3.10 22 | Programming Language :: Python :: 3.11 23 | Programming Language :: Python :: 3.12 24 | Programming Language :: Python :: 3.13 25 | 26 | [options] 27 | package_dir = 28 | =src 29 | packages = find: 30 | include_package_data = True 31 | python_requires = >= 3.8 32 | 33 | [options.packages.find] 34 | where = src 35 | 36 | [options.package_data] 37 | krb5 = 38 | py.typed 39 | *.pyi 40 | 41 | [options.exclude_package_data] 42 | krb5 = 43 | *.pxd 44 | *.pyx 45 | *.h 46 | -------------------------------------------------------------------------------- /src/krb5/_adpi.py: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2024 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from __future__ import annotations 5 | 6 | import enum 7 | import struct 8 | import typing 9 | 10 | FORMAT = "!HIIIQQ" 11 | 12 | 13 | class ADPolicyInfoProp(enum.IntFlag): 14 | COMPLEX = 0x00000001 15 | NO_ANON_CHANGEv = 0x00000002 16 | NO_CLEAR_CHANGE = 0x00000004 17 | LOCKOUT_ADMINS = 0x00000008 18 | STORE_CLEARTEXT = 0x00000010 19 | REFUSE_CHANGE = 0x00000020 20 | 21 | 22 | class ADPolicyInfo(typing.NamedTuple): 23 | """The structure containing the reasons for failed password change attempt. 24 | Should be used to inform the end user how to meet the policy requirements. 25 | This is specific to Active Directory and is returned as the 26 | `server_response` by :meth:`set_password()` and 27 | :meth:`set_password_using_ccache()`. 28 | 29 | When using MIT library, this structure may be encoded back to bytes and 30 | passed to :meth:`chpw_message()` to obtain a human readable response. 31 | With Heimdal, it is required to provide a custom implementation based 32 | on the known fields below. 33 | 34 | The structure contains the following fields:\n 35 | - `properties` - Password policy bit flags (see below) 36 | - `min_length` - Minimal password length 37 | - `history` - Number of passwords that this system remembers 38 | - `max_age` - Maximum password age in 100 nanosecond units 39 | - `min_age` - Minimum password age in 100 nanosecond units 40 | 41 | The only known property flag is `COMPLEX` which means that the password must 42 | meet certain character variety and not contain the user's name. 43 | To convert `max_age` and `min_age` to seconds, divide them by 10,000,000. 44 | """ 45 | 46 | properties: ADPolicyInfoProp 47 | min_length: int 48 | history: int 49 | max_age: int 50 | min_age: int 51 | 52 | @classmethod 53 | def from_bytes(cls, data: bytes) -> ADPolicyInfo: 54 | """Decode AD policy result from byte string 55 | 56 | Args: 57 | data: Serialized AD policy `server_response` 58 | 59 | Returns: 60 | ADPolicyInfo: Decoded AD policy result strcture 61 | 62 | Raises: 63 | ValueError: Invalid data length or wrong signature 64 | """ 65 | if len(data) != struct.calcsize(FORMAT): 66 | raise ValueError("Invalid data length") 67 | signature, min_length, history, flags, max_age, min_age = struct.unpack(FORMAT, data) 68 | if signature != 0x0000: 69 | raise ValueError("Invalid signature") 70 | return cls( 71 | min_length=min_length, 72 | history=history, 73 | max_age=max_age, 74 | min_age=min_age, 75 | properties=ADPolicyInfoProp(flags), 76 | ) 77 | -------------------------------------------------------------------------------- /src/krb5/_ccache.pxd: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context cimport Context 5 | from krb5._krb5_types cimport * 6 | 7 | 8 | cdef class CCache: 9 | cdef Context ctx 10 | cdef krb5_ccache raw 11 | -------------------------------------------------------------------------------- /src/krb5/_ccache_match.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._ccache import CCache 5 | from krb5._context import Context 6 | from krb5._principal import Principal 7 | 8 | def cc_cache_match( 9 | context: Context, 10 | principal: Principal, 11 | ) -> CCache: 12 | """Find a credential cache for the specified principal. 13 | 14 | Find a cache within the collection whose default principal is the same as 15 | the one specified. 16 | 17 | Args: 18 | context: Krb5 context. 19 | principal: The principal to find in the collection cache. 20 | 21 | Returns: 22 | CCache: The opened credential cache for the principal specified. 23 | """ 24 | -------------------------------------------------------------------------------- /src/krb5/_ccache_match.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._exceptions import Krb5Error 5 | 6 | from krb5._ccache cimport CCache 7 | from krb5._context cimport Context 8 | from krb5._krb5_types cimport * 9 | from krb5._principal cimport Principal 10 | 11 | 12 | cdef extern from "python_krb5.h": 13 | # Added in MIT krb5 1.10 14 | krb5_error_code krb5_cc_cache_match( 15 | krb5_context context, 16 | krb5_principal client, 17 | krb5_ccache *cache_out, 18 | ) nogil 19 | 20 | 21 | 22 | def cc_cache_match( 23 | Context context not None, 24 | Principal principal not None, 25 | ) -> CCache: 26 | ccache = CCache(context) 27 | cdef krb5_error_code err = 0 28 | 29 | err = krb5_cc_cache_match(context.raw, principal.raw, &ccache.raw) 30 | if err: 31 | raise Krb5Error(context, err) 32 | 33 | return ccache 34 | -------------------------------------------------------------------------------- /src/krb5/_ccache_mit.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._ccache import CCache 5 | from krb5._context import Context 6 | 7 | def cc_dup( 8 | context: Context, 9 | cache: CCache, 10 | ) -> CCache: 11 | """Duplicate ccache handle. 12 | 13 | Create a new handle referring to the same cache referenced. The new cache 14 | can be closed independently. 15 | 16 | Args: 17 | context: Krb5 context. 18 | cache: The credential cache to duplicate. 19 | 20 | Returns: 21 | CCache: The duplicated ccache. 22 | """ 23 | -------------------------------------------------------------------------------- /src/krb5/_ccache_mit.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._exceptions import Krb5Error 5 | 6 | from krb5._ccache cimport CCache 7 | from krb5._context cimport Context 8 | from krb5._krb5_types cimport * 9 | 10 | 11 | cdef extern from "python_krb5.h": 12 | krb5_error_code krb5_cc_dup( 13 | krb5_context context, 14 | krb5_ccache in_cc, 15 | krb5_ccache *out, 16 | ) nogil 17 | 18 | 19 | def cc_dup( 20 | Context context not None, 21 | CCache cache not None, 22 | ) -> CCache: 23 | dup = CCache(context) 24 | cdef krb5_error_code err = 0 25 | 26 | err = krb5_cc_dup(context.raw, cache.raw, &dup.raw) 27 | if err: 28 | raise Krb5Error(context, err) 29 | 30 | return dup 31 | -------------------------------------------------------------------------------- /src/krb5/_ccache_support_switch.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context import Context 5 | 6 | def cc_support_switch( 7 | context: Context, 8 | cache_type: bytes, 9 | ) -> bool: 10 | """Check whether the cache type supports switching. 11 | 12 | Checks whether the credential cache type specified supports switching the 13 | primary cache in its colleciton using :meth:`cc_switch`. 14 | 15 | Args: 16 | context: Krb5 context. 17 | cache_type: The credential cache type, like ``FILE``, ``DIR``, etc to 18 | check whether it supports switching or not. 19 | 20 | Returns: 21 | bool: The cache type supports switching. 22 | """ 23 | -------------------------------------------------------------------------------- /src/krb5/_ccache_support_switch.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._exceptions import Krb5Error 5 | 6 | from krb5._context cimport Context 7 | from krb5._krb5_types cimport * 8 | 9 | 10 | cdef extern from "python_krb5.h": 11 | # Added in MIT 1.10 12 | krb5_boolean krb5_cc_support_switch( 13 | krb5_context context, 14 | const char *type, 15 | ) nogil 16 | 17 | 18 | def cc_support_switch( 19 | Context context not None, 20 | const unsigned char[:] cache_type not None, 21 | ) -> bool: 22 | cdef const char *type_ptr = NULL 23 | if len(cache_type): 24 | type_ptr = &cache_type[0] 25 | else: 26 | raise ValueError("cache_type cannot be an empty byte string") 27 | 28 | return bool(krb5_cc_support_switch(context.raw, type_ptr)) 29 | -------------------------------------------------------------------------------- /src/krb5/_cccol.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | from krb5._ccache import CCache 7 | from krb5._context import Context 8 | 9 | def cccol_iter( 10 | context: Context, 11 | ) -> typing.Iterator[CCache]: 12 | """Iterate over credential caches. 13 | 14 | Iterates over all known credential caches independent of type. 15 | 16 | Args: 17 | context: Krb5 context. 18 | 19 | Returns: 20 | Iterator[CCache]: An iterator of credential caches. 21 | """ 22 | -------------------------------------------------------------------------------- /src/krb5/_cccol.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | from krb5._exceptions import Krb5Error 7 | 8 | from krb5._ccache cimport CCache 9 | from krb5._context cimport Context 10 | from krb5._krb5_types cimport * 11 | 12 | 13 | cdef extern from "python_krb5.h": 14 | krb5_error_code krb5_cccol_cursor_free( 15 | krb5_context context, 16 | krb5_cccol_cursor *cursor 17 | ) nogil 18 | 19 | krb5_error_code krb5_cccol_cursor_new( 20 | krb5_context context, 21 | krb5_cccol_cursor *cursor, 22 | ) nogil 23 | 24 | krb5_error_code krb5_cccol_cursor_next( 25 | krb5_context context, 26 | krb5_cccol_cursor cursor, 27 | krb5_ccache *ccache, 28 | ) nogil 29 | 30 | krb5_error_code KRB5_CC_END 31 | 32 | 33 | def cccol_iter( 34 | Context context not None, 35 | ) -> typing.Iterator[CCache]: 36 | cdef krb5_error_code err = 0 37 | cdef krb5_context ctx = context.raw 38 | cdef krb5_cccol_cursor cursor 39 | 40 | err = krb5_cccol_cursor_new(ctx, &cursor) 41 | if err: 42 | raise Krb5Error(context, err) 43 | 44 | try: 45 | while True: 46 | ccache = CCache(context) 47 | err = krb5_cccol_cursor_next(ctx, cursor, &ccache.raw) 48 | if err == KRB5_CC_END: # Heimdal 49 | break 50 | elif err: 51 | raise Krb5Error(context, err) 52 | elif ccache.raw == NULL: # MIT 53 | break 54 | 55 | yield ccache 56 | 57 | finally: 58 | err = krb5_cccol_cursor_free(ctx, &cursor) 59 | if err: 60 | raise Krb5Error(context, err) 61 | -------------------------------------------------------------------------------- /src/krb5/_chpw_message_mit.pyi: -------------------------------------------------------------------------------- 1 | from krb5._context import Context 2 | 3 | def chpw_message(context: Context, server_response: bytes) -> bytes: 4 | """This function processes the byte sequence returned as the 5 | `server_response` by :meth:`set_password()` and 6 | :meth:`set_password_using_ccache()` functions, and returns a human readable 7 | byte string. 8 | 9 | Note that `gettext` library is used to translate the strings according 10 | to locale settings. For the list of existing translations, pls. refer 11 | to MIT krb5 source code. Not all translations may be available on your 12 | system. Caller is responsible for decoding the string according to 13 | locale settings. 14 | 15 | Args: 16 | context: Krb5 context. 17 | server_response: The `server_response` bytes received from the KDC. 18 | 19 | Returns: 20 | bytes: The human readable bytes string. 21 | """ 22 | -------------------------------------------------------------------------------- /src/krb5/_chpw_message_mit.pyx: -------------------------------------------------------------------------------- 1 | import typing 2 | 3 | from krb5._exceptions import Krb5Error 4 | 5 | from libc.string cimport strlen 6 | 7 | from krb5._context cimport Context 8 | from krb5._krb5_types cimport * 9 | 10 | 11 | cdef extern from "python_krb5.h": 12 | krb5_error_code krb5_chpw_message( 13 | krb5_context context, 14 | const krb5_data *server_string, 15 | char **message_out 16 | ) nogil 17 | 18 | void krb5_free_string( 19 | krb5_context context, 20 | char *string 21 | ) nogil 22 | 23 | def chpw_message( 24 | Context context not None, 25 | const unsigned char[:] server_string not None, 26 | ) -> bytes: 27 | cdef krb5_error_code err = 0 28 | cdef krb5_data server_string_raw 29 | cdef char *message_out = NULL 30 | 31 | try: 32 | if len(server_string) == 0: 33 | pykrb5_set_krb5_data(&server_string_raw, 0, "") 34 | else: 35 | pykrb5_set_krb5_data(&server_string_raw, len(server_string), &server_string[0]) 36 | 37 | err = krb5_chpw_message(context.raw, &server_string_raw, &message_out) 38 | 39 | if err: 40 | raise Krb5Error(context, err) 41 | 42 | if message_out is NULL: 43 | return b"" 44 | else: 45 | message_len = strlen(message_out) 46 | return message_out[:message_len] 47 | 48 | finally: 49 | krb5_free_string(context.raw, message_out) -------------------------------------------------------------------------------- /src/krb5/_context.pxd: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._krb5_types cimport * 5 | 6 | 7 | cdef class Context: 8 | cdef krb5_context raw 9 | -------------------------------------------------------------------------------- /src/krb5/_context.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | class Context: 7 | """Kerberos Library Context 8 | 9 | This class represents a library context object. 10 | """ 11 | 12 | def init_context() -> Context: 13 | """Create a krb5 library context. 14 | 15 | Creates a krb5 library context. 16 | 17 | Returns: 18 | Context: The opened krb5 library context. 19 | """ 20 | 21 | def get_default_realm( 22 | context: Context, 23 | ) -> bytes: 24 | """Get default realm for the specified context. 25 | 26 | Returns the default realm of the context passed in. 27 | 28 | Args: 29 | context: Krb5 context. 30 | 31 | Returns: 32 | bytes: The default realm of the context. 33 | """ 34 | 35 | def set_default_realm( 36 | context: Context, 37 | realm: typing.Optional[bytes], 38 | ) -> None: 39 | """Override the default realm for the specified context. 40 | 41 | Sets the default realm of the passed in context to the value specified. Use 42 | ``None`` to clear out the existing explicit setting. 43 | 44 | Args: 45 | context: Krb5 context. 46 | realm: The realm to set as the default realm. 47 | """ 48 | 49 | def timeofday( 50 | context: Context, 51 | ) -> int: 52 | """Return the adjusted time. 53 | 54 | Return the adjusted time. 55 | 56 | Args: 57 | context: Krb5 context. 58 | 59 | Returns: 60 | The current time as seen by the KDC in seconds. 61 | """ 62 | 63 | def us_timeofday( 64 | context: Context, 65 | ) -> typing.Tuple[int, int]: 66 | """Return the adjusted time with microseconds. 67 | 68 | Return the adjusted time with microseconds. 69 | 70 | Args: 71 | context: Krb5 context. 72 | 73 | Returns: 74 | The current time as seen by the KDC in seconds and microseconds. 75 | """ 76 | 77 | def set_real_time( 78 | context: Context, 79 | seconds: int, 80 | microseconds: int, 81 | ) -> None: 82 | """Set the time offset to the difference between the system time and the specified time. 83 | 84 | Set the time offset of the context to the difference between the system time 85 | and the specified time. 86 | 87 | Args: 88 | context: Krb5 context. 89 | seconds: The seconds of the current time as seen by the KDC. 90 | microseconds: The microseconds of the current time as seen by the KDC or -1. 91 | """ 92 | -------------------------------------------------------------------------------- /src/krb5/_context_mit.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | from krb5._context import Context 7 | 8 | def init_secure_context() -> Context: 9 | """Create a secure krb5 library context. 10 | 11 | Create a context structure, using only system configuration files. All 12 | information passed through environment variables are ignored. 13 | 14 | Returns: 15 | Context: The opened krb5 library context. 16 | """ 17 | 18 | def get_time_offsets( 19 | context: Context, 20 | ) -> typing.Tuple[int, int]: 21 | """Return the time offset of the specified context. 22 | 23 | Returns the time offset of the specified context. 24 | 25 | Args: 26 | context: Krb5 context. 27 | 28 | Returns: 29 | The seconds and microseconds of the time offset. 30 | """ 31 | -------------------------------------------------------------------------------- /src/krb5/_context_mit.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | from krb5._context cimport Context 7 | from krb5._exceptions import Krb5Error 8 | from krb5._krb5_types cimport * 9 | 10 | 11 | cdef extern from "python_krb5.h": 12 | krb5_error_code krb5_init_secure_context( 13 | krb5_context *context, 14 | ) nogil 15 | 16 | krb5_error_code krb5_get_time_offsets( 17 | krb5_context context, 18 | krb5_timestamp *seconds, 19 | int32_t *microseconds 20 | ) nogil 21 | 22 | 23 | def init_secure_context() -> Context: 24 | context = Context() 25 | krb5_init_secure_context(&context.raw) 26 | 27 | return context 28 | 29 | 30 | def get_time_offsets( 31 | Context context not None, 32 | ) -> typing.Tuple[int, int]: 33 | cdef krb5_error_code = 0 34 | 35 | cdef krb5_timestamp seconds 36 | cdef int32_t microseconds 37 | err = krb5_get_time_offsets(context.raw, &seconds, µseconds) 38 | if err: 39 | raise Krb5Error(context, err) 40 | 41 | return seconds, microseconds 42 | -------------------------------------------------------------------------------- /src/krb5/_creds.pxd: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context cimport Context 5 | from krb5._krb5_types cimport * 6 | 7 | 8 | cdef class Creds: 9 | cdef Context ctx 10 | cdef int free_contents 11 | cdef krb5_creds* _raw 12 | cdef int _free_raw 13 | 14 | cdef void* set_raw_from_lib(Creds self, krb5_creds* raw) 15 | cdef krb5_creds *get_pointer(Creds self) 16 | 17 | 18 | cdef class InitCredsContext: 19 | cdef Context ctx 20 | cdef krb5_init_creds_context raw 21 | 22 | 23 | cdef class Krb5Prompt: 24 | pass 25 | -------------------------------------------------------------------------------- /src/krb5/_creds_marshal_mit.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2024 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from __future__ import annotations 5 | 6 | from krb5._context import Context 7 | from krb5._creds import Creds 8 | 9 | def marshal_credentials( 10 | context: Context, 11 | creds: Creds, 12 | ) -> bytes: 13 | """Serialize creds. 14 | 15 | Serialize credentials in the format used by the FILE ccache format 16 | (version 4) and KCM ccache protocol. 17 | 18 | This is only present when compiled against MIT 1.20 or newer. 19 | 20 | Args: 21 | context: Krb5 context. 22 | creds: Credentials to serialize. 23 | 24 | Returns: 25 | bytes: The serialized credentials. 26 | """ 27 | 28 | def unmarshal_credentials( 29 | context: Context, 30 | data: bytes, 31 | ) -> Creds: 32 | """Deserialize creds. 33 | 34 | Deserialize credentials from the format used by the FILE ccache format 35 | (version 4) and KCM ccache protocol. 36 | 37 | This is only present when compiled against MIT 1.20 or newer. 38 | 39 | Args: 40 | context: Krb5 context. 41 | data: serialized credentials. 42 | 43 | Returns: 44 | Creds: The unserialized credentials. 45 | """ 46 | -------------------------------------------------------------------------------- /src/krb5/_creds_marshal_mit.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | # These APIs were added in MIT 1.20, to be compat with 1.18 we need to define 5 | # them separately. 6 | 7 | import collections 8 | import typing 9 | 10 | from krb5._exceptions import Krb5Error 11 | 12 | from krb5._ccache cimport CCache 13 | from krb5._context cimport Context 14 | from krb5._creds cimport Creds 15 | from krb5._creds_opt cimport GetInitCredsOpt 16 | from krb5._krb5_types cimport * 17 | from krb5._principal cimport Principal 18 | 19 | 20 | cdef extern from "python_krb5.h": 21 | krb5_error_code krb5_marshal_credentials( 22 | krb5_context context, 23 | krb5_creds *creds, 24 | krb5_data **data 25 | ) nogil 26 | 27 | krb5_error_code krb5_unmarshal_credentials( 28 | krb5_context context, 29 | krb5_data *data, 30 | krb5_creds **creds, 31 | ) nogil 32 | 33 | void krb5_free_data( 34 | krb5_context context, 35 | krb5_data *val, 36 | ) nogil 37 | 38 | def marshal_credentials( 39 | Context context not None, 40 | Creds creds not None, 41 | ) -> bytes: 42 | cdef krb5_error_code err = 0 43 | cdef krb5_data *data = NULL 44 | cdef size_t length 45 | cdef char *value 46 | 47 | try: 48 | err = krb5_marshal_credentials(context.raw, creds.get_pointer(), &data) 49 | 50 | if err: 51 | raise Krb5Error(context, err) 52 | 53 | pykrb5_get_krb5_data(data, &length, &value) 54 | 55 | if length == 0: 56 | data_bytes = b"" 57 | else: 58 | data_bytes = value[:length] 59 | 60 | return data_bytes 61 | 62 | finally: 63 | if NULL != data: 64 | krb5_free_data(context.raw, data) 65 | 66 | def unmarshal_credentials( 67 | Context context not None, 68 | const unsigned char[:] data not None, 69 | ) -> Creds: 70 | cdef krb5_error_code err = 0 71 | cdef krb5_creds* raw_creds = NULL 72 | cdef krb5_data data_raw 73 | 74 | if len(data) == 0: 75 | pykrb5_set_krb5_data(&data_raw, 0, "") 76 | else: 77 | pykrb5_set_krb5_data(&data_raw, len(data), &data[0]) 78 | 79 | err = krb5_unmarshal_credentials(context.raw, &data_raw, &raw_creds) 80 | if err: 81 | raise Krb5Error(context, err) 82 | 83 | creds = Creds(context) 84 | creds.set_raw_from_lib(raw_creds) 85 | 86 | return creds 87 | -------------------------------------------------------------------------------- /src/krb5/_creds_mit.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | from krb5._ccache import CCache 7 | from krb5._context import Context 8 | from krb5._creds import Creds 9 | from krb5._creds_opt import GetInitCredsOpt 10 | from krb5._principal import Principal 11 | 12 | class EtypeInfo(typing.NamedTuple): 13 | etype: int 14 | salt: typing.Optional[bytes] 15 | s2kparams: typing.Optional[bytes] 16 | 17 | def get_validated_creds( 18 | context: Context, 19 | client: Principal, 20 | ccache: CCache, 21 | in_tkt_service: typing.Optional[bytes] = None, 22 | ) -> Creds: 23 | """Get validated credentials from the KDC for a postdated ticket. 24 | 25 | Args: 26 | context: Krb5 context. 27 | client: Client principal name. 28 | ccache: The cache to get the existing credentials from. 29 | in_tkt_service: Server principal string or None. 30 | """ 31 | 32 | def get_etype_info( 33 | context: Context, 34 | principal: Principal, 35 | opt: typing.Optional[GetInitCredsOpt] = None, 36 | ) -> EtypeInfo: 37 | """Retrieve the enctype, salt and s2kparams for a principal from the KDC. 38 | 39 | Args: 40 | context: Krb5 context. 41 | principal: Principal to fetch the information for. 42 | opt: Options to use (e.g. for FAST armoring). 43 | 44 | Returns: 45 | A named tuple containing the enctype, the salt and the s2kparams. 46 | 47 | If the KDC provides no etype-info, the returned salt is None. 48 | 49 | If there are no s2kparams in the provided etype-info, s2kparams is None. 50 | """ 51 | -------------------------------------------------------------------------------- /src/krb5/_creds_mit.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import collections 5 | import typing 6 | 7 | from krb5._exceptions import Krb5Error 8 | 9 | from krb5._ccache cimport CCache 10 | from krb5._context cimport Context 11 | from krb5._creds cimport Creds 12 | from krb5._creds_opt cimport GetInitCredsOpt 13 | from krb5._krb5_types cimport * 14 | from krb5._principal cimport Principal 15 | 16 | 17 | cdef extern from "python_krb5.h": 18 | krb5_error_code krb5_get_validated_creds( 19 | krb5_context context, 20 | krb5_creds *creds, 21 | krb5_principal client, 22 | krb5_ccache ccache, 23 | const char *in_tkt_service, 24 | ) nogil 25 | 26 | krb5_error_code krb5_get_etype_info( 27 | krb5_context context, 28 | krb5_principal principal, 29 | krb5_get_init_creds_opt *opt, 30 | krb5_enctype *enctype_out, 31 | krb5_data *salt_out, 32 | krb5_data *s2kparams_ou, 33 | ) nogil 34 | 35 | EtypeInfo = collections.namedtuple('EtypeInfo', [ 36 | 'etype', 37 | 'salt', 38 | 's2kparams', 39 | ]) 40 | 41 | def get_validated_creds( 42 | Context context not None, 43 | Principal client not None, 44 | CCache ccache not None, 45 | const unsigned char[:] in_tkt_service = None, 46 | ) -> Creds: 47 | creds = Creds(context) 48 | cdef krb5_error_code err = 0 49 | 50 | cdef const char *in_tkt_service_ptr = NULL 51 | if in_tkt_service is not None and len(in_tkt_service): 52 | in_tkt_service_ptr = &in_tkt_service[0] 53 | 54 | err = krb5_get_validated_creds( 55 | context.raw, 56 | creds.get_pointer(), 57 | client.raw, 58 | ccache.raw, 59 | in_tkt_service_ptr) 60 | if err: 61 | raise Krb5Error(context, err) 62 | 63 | creds.free_contents = 1 64 | 65 | return creds 66 | 67 | def get_etype_info( 68 | Context context not None, 69 | Principal principal not None, 70 | GetInitCredsOpt opt = None, 71 | ) -> EtypeInfo: 72 | cdef krb5_error_code err = 0 73 | 74 | cdef krb5_get_init_creds_opt *options = NULL 75 | if opt: 76 | options = opt.raw 77 | 78 | cdef krb5_enctype enctype 79 | cdef krb5_data salt 80 | cdef krb5_data s2kparams 81 | 82 | with nogil: 83 | err = krb5_get_etype_info( 84 | context.raw, 85 | principal.raw, 86 | options, 87 | &enctype, 88 | &salt, 89 | &s2kparams, 90 | ) 91 | if err: 92 | raise Krb5Error(context, err) 93 | 94 | cdef size_t length 95 | cdef char *value 96 | 97 | pykrb5_get_krb5_data(&salt, &length, &value) 98 | if length == 0: 99 | if enctype == 0: # ENCTYPE_NULL 100 | # If enctype is ENCTYPE_NULL and the salt is empty this means that 101 | # the KDC provided no etype-info. Return None in this case. 102 | salt_bytes = None 103 | else: 104 | salt_bytes = b"" 105 | else: 106 | salt_bytes = value[:length] 107 | pykrb5_free_data_contents(context.raw, &salt) 108 | 109 | pykrb5_get_krb5_data(&s2kparams, &length, &value) 110 | if length == 0: 111 | # This means that the KDC provided an etype-info without s2kparams 112 | # (PA-ETYPE-INFO instead of PA-ETYPE-INFO2). 113 | # Return None instead of b'' in this case so that the value can be 114 | # passed directly to krb.c_string_to_key() 115 | s2kparams_bytes = None 116 | else: 117 | s2kparams_bytes = value[:length] 118 | pykrb5_free_data_contents(context.raw, &s2kparams) 119 | 120 | return EtypeInfo(enctype, salt_bytes, s2kparams_bytes) 121 | -------------------------------------------------------------------------------- /src/krb5/_creds_opt.pxd: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context cimport Context 5 | from krb5._krb5_types cimport * 6 | 7 | 8 | cdef class GetInitCredsOpt: 9 | cdef Context ctx 10 | cdef krb5_get_init_creds_opt *raw 11 | -------------------------------------------------------------------------------- /src/krb5/_creds_opt_heimdal.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | from krb5._context import Context 7 | from krb5._creds_opt import GetInitCredsOpt 8 | 9 | def get_init_creds_opt_set_default_flags( 10 | context: Context, 11 | opt: GetInitCredsOpt, 12 | appname: typing.Optional[bytes] = None, 13 | realm: typing.Optional[bytes] = None, 14 | ) -> None: 15 | """Set default configuration file flags. 16 | 17 | Set all the values in the options to the default values for the app and 18 | realm. 19 | 20 | Args: 21 | context: Krb5 context. 22 | ccache: The credential cache to set as the output. 23 | appname: The application name to get the default values for. 24 | realm: The realm as a fallback from appname. 25 | """ 26 | -------------------------------------------------------------------------------- /src/krb5/_creds_opt_heimdal.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._exceptions import Krb5Error 5 | 6 | from krb5._context cimport Context 7 | from krb5._creds_opt cimport GetInitCredsOpt 8 | from krb5._krb5_types cimport * 9 | 10 | 11 | cdef extern from "python_krb5.h": 12 | void krb5_get_init_creds_opt_set_default_flags( 13 | krb5_context context, 14 | const char *appname, 15 | const char *realm, 16 | krb5_get_init_creds_opt *opt, 17 | ) nogil 18 | 19 | 20 | def get_init_creds_opt_set_default_flags( 21 | Context context not None, 22 | GetInitCredsOpt opt not None, 23 | const unsigned char[:] appname = None, 24 | const unsigned char[:] realm = None, 25 | ) -> None: 26 | cdef const char *appname_ptr = NULL 27 | if appname is not None and len(appname): 28 | appname_ptr = &appname[0] 29 | 30 | cdef const char *realm_ptr = NULL 31 | if realm is not None and len(realm): 32 | realm_ptr = &realm[0] 33 | 34 | krb5_get_init_creds_opt_set_default_flags(context.raw, appname_ptr, realm_ptr, opt.raw) 35 | -------------------------------------------------------------------------------- /src/krb5/_creds_opt_mit.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import enum 5 | import typing 6 | 7 | from krb5._ccache import CCache 8 | from krb5._context import Context 9 | from krb5._creds_opt import GetInitCredsOpt 10 | 11 | class FastFlags(enum.IntEnum): 12 | """Flags used to control :meth:`get_init_creds_opt_set_fast_flags`.""" 13 | 14 | none: FastFlags = ... #: No flags set. 15 | required: FastFlags = ... #: Require KDC to support FAST. 16 | 17 | def get_init_creds_opt_set_fast_ccache( 18 | context: Context, 19 | opt: GetInitCredsOpt, 20 | ccache: CCache, 21 | ) -> None: 22 | """Set FAST armor cache in options using an explicit CCache. 23 | 24 | Sets the location of the FAST armor ccache in the initial credential 25 | options. This is like :meth:`get_init_creds_opt_set_fast_ccache_name` 26 | except the ccache is provided as a CCache object rather than by name. 27 | 28 | Args: 29 | context: Krb5 context. 30 | opt: The initial credential options. 31 | ccache: The credential cache to set. 32 | """ 33 | 34 | def get_init_creds_opt_set_fast_ccache_name( 35 | context: Context, 36 | opt: GetInitCredsOpt, 37 | name: bytes, 38 | ) -> None: 39 | """Set FAST armor ccache in options using a name. 40 | 41 | Sets the location of the FAST armor ccache in initial credential options, 42 | This cache should contain the armor ticket to protect an initial credential 43 | exchange using the FAST protocol extension. 44 | 45 | Setting this option causes FAST to be used if the KDC supports it. Use 46 | :meth:`get_init_creds_opt_set_fast_flags` to mandate that FAST be used. 47 | 48 | Args: 49 | context: Krb5 context. 50 | opt: The initial credential options. 51 | name: The name of the credential cache. 52 | """ 53 | 54 | def get_init_creds_opt_set_fast_flags( 55 | context: Context, 56 | opt: GetInitCredsOpt, 57 | flags: typing.Union[int, FastFlags], 58 | ) -> None: 59 | """Set FAST flags in initial credential options. 60 | 61 | Sets the FAST flags in the initial credential options. 62 | 63 | Args: 64 | context: Krb5 context. 65 | opt: The initial credential options. 66 | flags: The flags to set. 67 | """ 68 | 69 | def get_init_creds_opt_set_out_ccache( 70 | context: Context, 71 | opt: GetInitCredsOpt, 72 | ccache: CCache, 73 | ) -> None: 74 | """Set output credential cache in options. 75 | 76 | Sets the output credential cache in the credential option structure. 77 | 78 | Args: 79 | context: Krb5 context. 80 | opt: The initial credential options. 81 | ccache: The credential cache to set as the output. 82 | """ 83 | 84 | def get_init_creds_opt_set_pa( 85 | context: Context, 86 | opt: GetInitCredsOpt, 87 | attr: bytes, 88 | value: bytes, 89 | ) -> None: 90 | """Supply options for preauth in initial credential options. 91 | 92 | This function allows the caller to supply options for preauthentication. 93 | The values of attr and value are supplied to each preauthentication module 94 | available within context. 95 | 96 | Args: 97 | context: Krb5 ontext. 98 | opt: The initial credential options. 99 | attr: The preauthentication option name. 100 | value: The preauthentication option value. 101 | """ 102 | -------------------------------------------------------------------------------- /src/krb5/_creds_opt_mit.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import enum 5 | 6 | from krb5._exceptions import Krb5Error 7 | 8 | from krb5._ccache cimport CCache 9 | from krb5._context cimport Context 10 | from krb5._creds_opt cimport GetInitCredsOpt 11 | from krb5._krb5_types cimport * 12 | 13 | 14 | cdef extern from "python_krb5.h": 15 | krb5_error_code krb5_get_init_creds_opt_set_fast_ccache( 16 | krb5_context context, 17 | krb5_get_init_creds_opt *opt, 18 | krb5_ccache ccache, 19 | ) nogil 20 | 21 | krb5_error_code krb5_get_init_creds_opt_set_fast_flags( 22 | krb5_context context, 23 | krb5_get_init_creds_opt *opt, 24 | krb5_int32 flags, 25 | ) nogil 26 | 27 | krb5_error_code krb5_get_init_creds_opt_set_fast_ccache_name( 28 | krb5_context context, 29 | krb5_get_init_creds_opt *opt, 30 | const char *fast_ccache_name, 31 | ) nogil 32 | 33 | krb5_error_code krb5_get_init_creds_opt_set_out_ccache( 34 | krb5_context context, 35 | krb5_get_init_creds_opt *opt, 36 | krb5_ccache ccache, 37 | ) nogil 38 | 39 | krb5_error_code krb5_get_init_creds_opt_set_pa( 40 | krb5_context context, 41 | krb5_get_init_creds_opt *opt, 42 | const char *attr, 43 | const char *value, 44 | ) nogil 45 | 46 | int32_t KRB5_FAST_REQUIRED 47 | 48 | 49 | class FastFlags(enum.IntEnum): 50 | none = 0 51 | required = KRB5_FAST_REQUIRED 52 | 53 | 54 | def get_init_creds_opt_set_fast_ccache( 55 | Context context not None, 56 | GetInitCredsOpt opt not None, 57 | CCache ccache not None, 58 | ) -> None: 59 | cdef krb5_error_code err = 0 60 | 61 | err = krb5_get_init_creds_opt_set_fast_ccache(context.raw, opt.raw, ccache.raw) 62 | if err: 63 | raise Krb5Error(context, err) 64 | 65 | 66 | def get_init_creds_opt_set_fast_flags( 67 | Context context not None, 68 | GetInitCredsOpt opt not None, 69 | krb5_int32 flags, 70 | ) -> None: 71 | cdef krb5_error_code err = 0 72 | 73 | err = krb5_get_init_creds_opt_set_fast_flags(context.raw, opt.raw, flags) 74 | if err: 75 | raise Krb5Error(context, err) 76 | 77 | 78 | def get_init_creds_opt_set_fast_ccache_name( 79 | Context context not None, 80 | GetInitCredsOpt opt not None, 81 | const unsigned char[:] name not None, 82 | ) -> None: 83 | cdef krb5_error_code err = 0 84 | 85 | cdef const char *name_ptr = NULL 86 | if len(name): 87 | name_ptr = &name[0] 88 | else: 89 | raise ValueError("CCache name must be set") 90 | 91 | err = krb5_get_init_creds_opt_set_fast_ccache_name(context.raw, opt.raw, name_ptr) 92 | if err: 93 | raise Krb5Error(context, err) 94 | 95 | 96 | def get_init_creds_opt_set_out_ccache( 97 | Context context not None, 98 | GetInitCredsOpt opt not None, 99 | CCache ccache not None, 100 | ) -> None: 101 | cdef krb5_error_code err = 0 102 | 103 | err = krb5_get_init_creds_opt_set_out_ccache(context.raw, opt.raw, ccache.raw) 104 | if err: 105 | raise Krb5Error(context, err) 106 | 107 | 108 | def get_init_creds_opt_set_pa( 109 | Context context not None, 110 | GetInitCredsOpt opt not None, 111 | const unsigned char[:] attr not None, 112 | const unsigned char[:] value not None, 113 | ) -> None: 114 | cdef krb5_error_code err = 0 115 | 116 | cdef char *attr_ptr 117 | if len(attr): 118 | attr_ptr = &attr[0] 119 | else: 120 | raise ValueError("attr must be set") 121 | 122 | cdef char *value_ptr 123 | if len(value): 124 | value_ptr = &value[0] 125 | else: 126 | raise ValueError("value must be set") 127 | 128 | err = krb5_get_init_creds_opt_set_pa(context.raw, opt.raw, attr_ptr, value_ptr) 129 | if err: 130 | raise Krb5Error(context, err) 131 | -------------------------------------------------------------------------------- /src/krb5/_creds_opt_set_in_ccache.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._ccache import CCache 5 | from krb5._context import Context 6 | from krb5._creds_opt import GetInitCredsOpt 7 | 8 | def get_init_creds_opt_set_in_ccache( 9 | context: Context, 10 | opt: GetInitCredsOpt, 11 | ccache: CCache, 12 | ) -> None: 13 | """Set an input credential cache in initial credential options. 14 | 15 | If an input credential cache is set, then the krb5_get_init_creds family of 16 | APIs will read settings from it. Setting an input ccache is desirable when 17 | the application wishes to perform authentication in the same way (using the 18 | same preauthentication mechanisms, and making the same non-security 19 | sensitive choices) as the previous authentication attempt, which stored 20 | information in the passed-in cache. 21 | 22 | Args: 23 | context: Krb5 context. 24 | opt: The initial credential options. 25 | ccache: The credential cache to set. 26 | """ 27 | -------------------------------------------------------------------------------- /src/krb5/_creds_opt_set_in_ccache.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._exceptions import Krb5Error 5 | 6 | from krb5._ccache cimport CCache 7 | from krb5._context cimport Context 8 | from krb5._creds_opt cimport GetInitCredsOpt 9 | from krb5._krb5_types cimport * 10 | 11 | 12 | cdef extern from "python_krb5.h": 13 | krb5_error_code krb5_get_init_creds_opt_set_in_ccache( 14 | krb5_context context, 15 | krb5_get_init_creds_opt *opt, 16 | krb5_ccache ccache, 17 | ) nogil 18 | 19 | 20 | def get_init_creds_opt_set_in_ccache( 21 | Context context not None, 22 | GetInitCredsOpt opt not None, 23 | CCache ccache not None, 24 | ) -> None: 25 | cdef krb5_error_code err = 0 26 | 27 | err = krb5_get_init_creds_opt_set_in_ccache(context.raw, opt.raw, ccache.raw) 28 | if err: 29 | raise Krb5Error(context, err) 30 | -------------------------------------------------------------------------------- /src/krb5/_creds_opt_set_pac_request.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context import Context 5 | from krb5._creds_opt import GetInitCredsOpt 6 | 7 | def get_init_creds_opt_set_pac_request( 8 | context: Context, 9 | opt: GetInitCredsOpt, 10 | req_pac: bool, 11 | ) -> None: 12 | """Ask KDC to include or not include a PAC in the ticket. 13 | 14 | If this option is set, the AS request will include a PAC-REQUEST pa-data 15 | item explicitly asking the KDC to either include or include a privilege 16 | attribute certificate in the ticket authorization data. By default, no 17 | request is made; typically the KDC will default to including a PAC if it 18 | supports them. 19 | 20 | Args: 21 | context: Krb5 context. 22 | opt: The initial credential options. 23 | canonicalize: Whether to set or unset the canonicalize option. 24 | """ 25 | -------------------------------------------------------------------------------- /src/krb5/_creds_opt_set_pac_request.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | from krb5._exceptions import Krb5Error 7 | 8 | from krb5._context cimport Context 9 | from krb5._creds_opt cimport GetInitCredsOpt 10 | from krb5._krb5_types cimport * 11 | 12 | 13 | cdef extern from "python_krb5.h": 14 | krb5_error_code krb5_get_init_creds_opt_set_pac_request( 15 | krb5_context context, 16 | krb5_get_init_creds_opt *opt, 17 | krb5_boolean req_pac, 18 | ) nogil 19 | 20 | 21 | def get_init_creds_opt_set_pac_request( 22 | Context context not None, 23 | GetInitCredsOpt opt not None, 24 | req_pac: bool, 25 | ) -> None: 26 | cdef int value = 1 if req_pac else 0 27 | 28 | krb5_get_init_creds_opt_set_pac_request(context.raw, opt.raw, value) 29 | -------------------------------------------------------------------------------- /src/krb5/_exceptions.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context import Context 5 | 6 | class Krb5Error(Exception): 7 | """Base Keberos Error class.""" 8 | 9 | def __init__( 10 | self, 11 | context: Context, 12 | err_code: int, 13 | ) -> None: ... 14 | err_code: int #: The Kerberos error code. 15 | -------------------------------------------------------------------------------- /src/krb5/_exceptions.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from libc.stdint cimport int32_t 5 | 6 | from krb5._context cimport Context 7 | from krb5._krb5_types cimport * 8 | 9 | 10 | cdef extern from "python_krb5.h": 11 | const char *krb5_get_error_message( 12 | krb5_context ctx, 13 | krb5_error_code code, 14 | ) nogil 15 | 16 | void krb5_free_error_message( 17 | krb5_context ctx, 18 | const char *msg, 19 | ) nogil 20 | 21 | krb5_error_code KRB5_KT_NAME_TOOLONG 22 | # krb5_error_code KRB5_CONFIG_NOTENUFSPACE 23 | 24 | 25 | cdef str get_error_message( 26 | krb5_context ctx, 27 | krb5_error_code err, 28 | ): 29 | cdef const char *err_msg = NULL 30 | 31 | err_msg = krb5_get_error_message(ctx, err) 32 | try: 33 | return err_msg.decode('utf-8') 34 | 35 | finally: 36 | krb5_free_error_message(ctx, err_msg) 37 | 38 | 39 | class Krb5Error(Exception): 40 | 41 | def __init__( 42 | self, 43 | context: Context, 44 | err_code: int, 45 | ) -> None: 46 | self.err_code = err_code 47 | 48 | msg = get_error_message(context.raw, err_code) 49 | super().__init__(f"{msg} {self.err_code}") 50 | -------------------------------------------------------------------------------- /src/krb5/_keyblock.pxd: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context cimport Context 5 | from krb5._krb5_types cimport * 6 | 7 | 8 | cdef class KeyBlock: 9 | cdef Context ctx 10 | cdef krb5_keyblock *raw 11 | cdef int needs_free 12 | -------------------------------------------------------------------------------- /src/krb5/_keyblock.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | from krb5._context import Context 7 | 8 | class KeyBlock: 9 | """Kerberos KeyBlock 10 | 11 | This class represents the contents of a key. 12 | 13 | Args: 14 | context: Krb5 context. 15 | """ 16 | 17 | def __len__(self) -> int: ... 18 | @property 19 | def data(self) -> bytes: 20 | """The keyblock data.""" 21 | @property 22 | def enctype(self) -> int: 23 | """The keyblock encryption type.""" 24 | 25 | def init_keyblock( 26 | context: Context, 27 | enctype: int, 28 | key: typing.Optional[bytes], 29 | ) -> KeyBlock: 30 | """Initialize a Key Block. 31 | 32 | Initalize a new keyblock and copy the key into the contents of that block. 33 | The key can be None or an empty byte string to represent the contents are 34 | not allocated. 35 | 36 | Args: 37 | context: Krb5 context. 38 | enctype: The encryption type of the keyblock. 39 | key: The data to place in the keyblock or None for an empty block. 40 | 41 | Returns: 42 | KeyBlock: The initialized keyblock. 43 | """ 44 | 45 | def copy_keyblock( 46 | context: Context, 47 | keyblock: KeyBlock, 48 | ) -> KeyBlock: 49 | """Copy a keyblock. 50 | 51 | Create a copy of the keyblock specified. 52 | 53 | Args: 54 | context: Krb5 context. 55 | keyblock: The keyblock to copy. 56 | 57 | Returns: 58 | KeyBlock: The copy of the keyblock. 59 | """ 60 | -------------------------------------------------------------------------------- /src/krb5/_keyblock_mit.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import typing 5 | 6 | from krb5._context import Context 7 | from krb5._keyblock import KeyBlock 8 | 9 | def c_string_to_key( 10 | context: Context, 11 | enctype: int, 12 | string: bytes, 13 | salt: bytes, 14 | s2kparams: typing.Optional[bytes] = None, 15 | ) -> KeyBlock: 16 | """Convert a password string to a key. 17 | 18 | Convert a password string and a salt value plus optional S2K parameters 19 | to a keyblock with a certain encryption type. For getting the salt value, 20 | encryption type and the S2K parameters the method :meth:`get_etype_info` 21 | can be used. 22 | 23 | Args: 24 | context: Krb5 context. 25 | enctype: The encryption type to be used. 26 | string: The password string. 27 | salt: The salt string. 28 | s2kparams: The S2K parameters. 29 | 30 | Returns: 31 | KeyBlock: The keyblock. 32 | """ 33 | -------------------------------------------------------------------------------- /src/krb5/_keyblock_mit.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._exceptions import Krb5Error 5 | from krb5._keyblock import init_keyblock 6 | 7 | from krb5._context cimport Context 8 | from krb5._keyblock cimport KeyBlock 9 | from krb5._krb5_types cimport * 10 | 11 | 12 | cdef extern from "python_krb5.h": 13 | krb5_error_code krb5_c_string_to_key( 14 | krb5_context context, 15 | krb5_enctype enctype, 16 | const krb5_data *string, 17 | const krb5_data *salt, 18 | krb5_keyblock *key, 19 | ) nogil 20 | 21 | krb5_error_code krb5_c_string_to_key_with_params( 22 | krb5_context context, 23 | krb5_enctype enctype, 24 | const krb5_data *string, 25 | const krb5_data *salt, 26 | const krb5_data *params, 27 | krb5_keyblock *key, 28 | ) nogil 29 | 30 | 31 | def c_string_to_key( 32 | Context context not None, 33 | krb5_enctype enctype, 34 | const unsigned char[:] string, 35 | const unsigned char[:] salt, 36 | const unsigned char[:] s2kparams = None, 37 | ) -> KeyBlock: 38 | cdef krb5_error_code err = 0 39 | cdef size_t length = 0 40 | 41 | cdef KeyBlock kb = init_keyblock(context, enctype, None) 42 | 43 | cdef krb5_data string_raw 44 | if len(string) == 0: 45 | pykrb5_set_krb5_data(&string_raw, 0, "") 46 | else: 47 | pykrb5_set_krb5_data(&string_raw, len(string), &string[0]) 48 | 49 | cdef krb5_data salt_raw 50 | if len(salt) == 0: 51 | pykrb5_set_krb5_data(&salt_raw, 0, "") 52 | else: 53 | pykrb5_set_krb5_data(&salt_raw, len(salt), &salt[0]) 54 | 55 | cdef krb5_data s2kparams_raw 56 | if s2kparams is None: 57 | err = krb5_c_string_to_key(context.raw, enctype, &string_raw, &salt_raw, kb.raw) 58 | else: 59 | if len(s2kparams) == 0: 60 | pykrb5_set_krb5_data(&s2kparams_raw, 0, "") 61 | else: 62 | pykrb5_set_krb5_data(&s2kparams_raw, len(s2kparams), &s2kparams[0]) 63 | 64 | err = krb5_c_string_to_key_with_params(context.raw, enctype, &string_raw, &salt_raw, &s2kparams_raw, kb.raw) 65 | 66 | if err: 67 | raise Krb5Error(context, err) 68 | 69 | return kb 70 | -------------------------------------------------------------------------------- /src/krb5/_kt.pxd: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context cimport Context 5 | from krb5._krb5_types cimport * 6 | 7 | 8 | cdef class KeyTab: 9 | cdef Context ctx 10 | cdef krb5_keytab raw 11 | 12 | 13 | cdef class KeyTabEntry: 14 | cdef Context ctx 15 | cdef krb5_keytab_entry raw 16 | cdef int needs_free 17 | -------------------------------------------------------------------------------- /src/krb5/_kt_have_content.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context import Context 5 | from krb5._kt import KeyTab 6 | 7 | def kt_have_content( 8 | context: Context, 9 | keytab: KeyTab, 10 | ) -> bool: 11 | """Check if a keytab exists and contains entries. 12 | 13 | Checks if the keytab passed in exists and contains entries. 14 | 15 | Args: 16 | context: Krb5 context. 17 | keytab: They keytab to query. 18 | 19 | Returns: 20 | bool: Whether the keytab exists and contains entries. 21 | """ 22 | -------------------------------------------------------------------------------- /src/krb5/_kt_have_content.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._exceptions import Krb5Error 5 | 6 | from krb5._context cimport Context 7 | from krb5._krb5_types cimport * 8 | from krb5._kt cimport KeyTab 9 | 10 | 11 | cdef extern from "python_krb5.h": 12 | # Added in MIT 1.11 13 | krb5_error_code krb5_kt_have_content( 14 | krb5_context context, 15 | krb5_keytab keytab, 16 | ) nogil 17 | 18 | 19 | def kt_have_content( 20 | Context context not None, 21 | KeyTab keytab not None, 22 | ) -> bool: 23 | cdef krb5_error_code err = 0 24 | 25 | err = krb5_kt_have_content(context.raw, keytab.raw) 26 | 27 | return err == 0 28 | -------------------------------------------------------------------------------- /src/krb5/_kt_heimdal.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context import Context 5 | from krb5._kt import KeyTab 6 | 7 | def kt_get_full_name( 8 | context: Context, 9 | keytab: KeyTab, 10 | ) -> bytes: 11 | """Retrieve the full name of the keytab. 12 | 13 | Retrieves the full name of the keytab in the form ``type:residual``. 14 | 15 | Args: 16 | Context: Krb5 context. 17 | keytab: The keytab to query. 18 | 19 | Returns: 20 | bytes: The fullname of the keytab. 21 | """ 22 | -------------------------------------------------------------------------------- /src/krb5/_kt_heimdal.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._exceptions import Krb5Error 5 | 6 | from krb5._context cimport Context 7 | from krb5._krb5_types cimport * 8 | from krb5._kt cimport KeyTab 9 | 10 | 11 | cdef extern from "python_krb5.h": 12 | krb5_error_code krb5_kt_get_full_name( 13 | krb5_context context, 14 | krb5_keytab keytab, 15 | char **str, 16 | ) nogil 17 | 18 | krb5_error_code krb5_xfree( 19 | void *ptr, 20 | ) nogil 21 | 22 | krb5_error_code KRB5_KT_PREFIX_MAX_LEN 23 | 24 | 25 | def kt_get_full_name( 26 | Context context not None, 27 | KeyTab keytab not None, 28 | ) -> bytes: 29 | cdef krb5_error_code err = 0 30 | cdef char *str = NULL 31 | 32 | err = krb5_kt_get_full_name(context.raw, keytab.raw, &str) 33 | if err: 34 | raise Krb5Error(context, err) 35 | 36 | try: 37 | return str 38 | finally: 39 | krb5_xfree(str) 40 | -------------------------------------------------------------------------------- /src/krb5/_kt_mit.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context import Context 5 | from krb5._kt import KeyTab 6 | 7 | def kt_client_default( 8 | context: Context, 9 | ) -> KeyTab: 10 | """Resolve the default client key table. 11 | 12 | Get a handle to the default client key tab. 13 | 14 | Args: 15 | context: Krb5 context. 16 | 17 | Returns: 18 | KeyTab: The default client keytab. 19 | """ 20 | 21 | def kt_dup( 22 | context: Context, 23 | keytab: KeyTab, 24 | ) -> KeyTab: 25 | """Duplicate keytab handle. 26 | 27 | Duplicates the referenced keytab. The new handle can be closed 28 | independently to the referenced keytab. 29 | 30 | Args: 31 | context: Krb5 context. 32 | keytab: The keytab to duplicate. 33 | 34 | Returns: 35 | KeyTab: The duplicated keytab. 36 | """ 37 | -------------------------------------------------------------------------------- /src/krb5/_kt_mit.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._exceptions import Krb5Error 5 | 6 | from krb5._context cimport Context 7 | from krb5._krb5_types cimport * 8 | from krb5._kt cimport KeyTab 9 | 10 | 11 | cdef extern from "python_krb5.h": 12 | krb5_error_code krb5_kt_client_default( 13 | krb5_context context, 14 | krb5_keytab *keytab_out, 15 | ) nogil 16 | 17 | krb5_error_code krb5_kt_dup( 18 | krb5_context context, 19 | krb5_keytab in_kt, 20 | krb5_keytab *out, 21 | ) nogil 22 | 23 | 24 | def kt_client_default( 25 | Context context not None, 26 | ) -> KeyTab: 27 | kt = KeyTab(context) 28 | cdef krb5_error_code err = 0 29 | 30 | err = krb5_kt_client_default(context.raw, &kt.raw) 31 | if err: 32 | raise Krb5Error(context, err) 33 | 34 | return kt 35 | 36 | 37 | def kt_dup( 38 | Context context not None, 39 | KeyTab keytab not None, 40 | ) -> KeyTab: 41 | out_kt = KeyTab(context) 42 | cdef krb5_error_code err = 0 43 | 44 | err = krb5_kt_dup(context.raw, keytab.raw, &out_kt.raw) 45 | if err: 46 | raise Krb5Error(context, err) 47 | 48 | return out_kt 49 | -------------------------------------------------------------------------------- /src/krb5/_principal.pxd: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context cimport Context 5 | from krb5._krb5_types cimport * 6 | 7 | 8 | cdef class Principal: 9 | cdef Context ctx 10 | cdef krb5_principal raw 11 | cdef int needs_free 12 | cdef int _parse_flags 13 | -------------------------------------------------------------------------------- /src/krb5/_principal_heimdal.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context import Context 5 | from krb5._principal import Principal 6 | 7 | def principal_get_realm( 8 | context: Context, 9 | principal: Principal, 10 | ) -> bytes: 11 | """Get the realm of the principal. 12 | 13 | Gets the realm portion of the principal name passed in. 14 | 15 | Args: 16 | context: Krb5 context. 17 | principal: Krb5 principal to get the realm for. 18 | 19 | Returns: 20 | bytes: The realm portion of the principal specified. 21 | """ 22 | -------------------------------------------------------------------------------- /src/krb5/_principal_heimdal.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context cimport Context 5 | from krb5._krb5_types cimport * 6 | from krb5._principal cimport Principal 7 | 8 | 9 | cdef extern from "python_krb5.h": 10 | const char *krb5_principal_get_realm( 11 | krb5_context context, 12 | krb5_const_principal principal 13 | ) nogil 14 | 15 | 16 | def principal_get_realm( 17 | Context context not None, 18 | Principal principal not None, 19 | ) -> bytes: 20 | return krb5_principal_get_realm(context.raw, principal.raw) 21 | -------------------------------------------------------------------------------- /src/krb5/_string.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from krb5._context import Context 5 | 6 | def enctype_to_string( 7 | context: Context, 8 | enctype: int, 9 | ) -> str: 10 | """Convert an encryption type to a string. 11 | 12 | Converts the encryption type identifier to the string name representation. 13 | 14 | Note: 15 | This API is marked as public but should not be called directly in MIT. 16 | 17 | Note: 18 | The Heimdal and MIT implementation return quite different values. It is 19 | recommended to use :meth:`enctype_to_name` if available on MIT to get 20 | a common value back. 21 | 22 | Args: 23 | context: Krb5 context. 24 | enctype: The encryption type identifier to convert. 25 | 26 | Returns: 27 | str: The encryption type name. 28 | """ 29 | 30 | def string_to_enctype( 31 | context: Context, 32 | string: str, 33 | ) -> int: 34 | """Convert string to encryption type. 35 | 36 | Converts a string to an encryption type integer. 37 | 38 | Args: 39 | context: Krb5 context. 40 | string: The string to convert from. 41 | 42 | Returns: 43 | int: The encryption type. 44 | """ 45 | -------------------------------------------------------------------------------- /src/krb5/_string.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from libc.stdlib cimport free 5 | 6 | from krb5._exceptions import Krb5Error 7 | 8 | from krb5._context cimport Context 9 | from krb5._krb5_types cimport * 10 | 11 | 12 | cdef extern from "python_krb5.h": 13 | # Heimdal and MIT differ in their implementations 14 | """ 15 | krb5_error_code krb5_enctype_to_string_generic( 16 | krb5_context context, 17 | krb5_enctype enctype, 18 | char **buffer 19 | ) 20 | { 21 | // Heimdal takes in a context and sets an output pointer 22 | #if defined(HEIMDAL_XFREE) 23 | return krb5_enctype_to_string(context, enctype, buffer); 24 | #else 25 | char *tmp = malloc(100); 26 | if (tmp == NULL) 27 | { 28 | return ENOMEM; 29 | } 30 | *buffer = tmp; 31 | 32 | return krb5_enctype_to_string(enctype, tmp, 100); 33 | #endif 34 | } 35 | 36 | krb5_error_code krb5_string_to_enctype_generic( 37 | krb5_context context, 38 | char *string, 39 | krb5_enctype *enctypep 40 | ) 41 | { 42 | // MIT does not have a context overload 43 | #if defined(HEIMDAL_XFREE) 44 | return krb5_string_to_enctype(context, string, enctypep); 45 | #else 46 | return krb5_string_to_enctype(string, enctypep); 47 | #endif 48 | } 49 | """ 50 | 51 | krb5_error_code krb5_enctype_to_string_generic( 52 | krb5_context context, 53 | krb5_enctype enctype, 54 | char **buffer, 55 | ) nogil 56 | 57 | krb5_error_code krb5_string_to_enctype_generic( 58 | krb5_context context, 59 | char *string, 60 | krb5_enctype *enctypep, 61 | ) nogil 62 | 63 | 64 | def enctype_to_string( 65 | Context context not None, 66 | krb5_enctype enctype, 67 | ) -> str: 68 | cdef krb5_error_code err = 0 69 | cdef char *buffer = NULL 70 | 71 | err = krb5_enctype_to_string_generic(context.raw, enctype, &buffer) 72 | if err: 73 | raise Krb5Error(context, err) 74 | 75 | try: 76 | return buffer.decode("utf-8") 77 | finally: 78 | free(buffer) 79 | 80 | 81 | def string_to_enctype( 82 | Context context not None, 83 | str string, 84 | ) -> int: 85 | cdef krb5_enctype enctype = 0 86 | cdef krb5_error_code err = 0 87 | b_string = string.encode("utf-8") 88 | cdef char *string_ptr = b_string 89 | 90 | err = krb5_string_to_enctype_generic(context.raw, string_ptr, &enctype) 91 | if err: 92 | raise Krb5Error(context, err) 93 | 94 | return enctype 95 | -------------------------------------------------------------------------------- /src/krb5/_string_mit.pyi: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | def enctype_to_name( 5 | enctype: int, 6 | shortest: bool = False, 7 | ) -> str: 8 | """Convert an encryption type to a name or alias. 9 | 10 | Converts the encryption type identifier to either the full canonical name 11 | or the types shortest alias. 12 | 13 | Note: 14 | This API is marked as public but should not be called directly in MIT. 15 | 16 | Args: 17 | enctype: The encryption type identifier to convert. 18 | shortest: Return the shortest alias if `True` otherwise return the full 19 | canonical name. 20 | 21 | Returns: 22 | str: The encryption type name. 23 | 24 | Raises: 25 | ValueError: If the encryption type is invalid 26 | """ 27 | -------------------------------------------------------------------------------- /src/krb5/_string_mit.pyx: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | from libc.stdlib cimport free, malloc 5 | 6 | from krb5._exceptions import Krb5Error 7 | 8 | from krb5._krb5_types cimport * 9 | 10 | 11 | cdef extern from "python_krb5.h": 12 | krb5_error_code krb5_enctype_to_name( 13 | krb5_enctype enctype, 14 | krb5_boolean shortest, 15 | char *buffer, 16 | size_t buflen, 17 | ) nogil 18 | 19 | 20 | def enctype_to_name( 21 | krb5_enctype enctype, 22 | krb5_boolean shortest = False, 23 | ) -> str: 24 | cdef krb5_error_code err = 0 25 | cdef void *buffer = malloc(100) 26 | if buffer == NULL: 27 | raise MemoryError() 28 | 29 | err = krb5_enctype_to_name(enctype, shortest, buffer, 100) 30 | if err: 31 | raise ValueError("Invalid encryption type") 32 | 33 | try: 34 | return (buffer).decode("utf-8") 35 | finally: 36 | free(buffer) 37 | -------------------------------------------------------------------------------- /src/krb5/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jborean93/pykrb5/1a3d61da1e33820164a82a583d561e6b74ddeef7/src/krb5/py.typed -------------------------------------------------------------------------------- /src/krb5/python_krb5.h: -------------------------------------------------------------------------------- 1 | #include "krb5.h" 2 | 3 | #if defined(HEIMDAL_XFREE) 4 | typedef krb5_times pykrb5_ticket_times; 5 | #else 6 | typedef krb5_ticket_times pykrb5_ticket_times; 7 | #endif 8 | 9 | // Heimdal does not define this 10 | #ifndef KRB5_KT_NAME_TOOLONG 11 | #define KRB5_KT_NAME_TOOLONG 1 12 | #endif 13 | 14 | // MIT does not define this 15 | #ifndef KRB5_KT_PREFIX_MAX_LEN 16 | #define KRB5_KT_PREFIX_MAX_LEN -1 17 | #endif 18 | 19 | // Heimdal does not define this 20 | #ifndef KRB5_TC_SUPPORTED_KTYPES 21 | #define KRB5_TC_SUPPORTED_KTYPES 0 22 | #endif 23 | -------------------------------------------------------------------------------- /stubs/k5test/__init__.pyi: -------------------------------------------------------------------------------- 1 | from k5test.realm import K5Realm as K5Realm 2 | -------------------------------------------------------------------------------- /stubs/k5test/realm.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, List 2 | 3 | class K5Realm: 4 | def __new__(cls, *args: Any, **kwargs: Any) -> K5Realm: ... 5 | tmpdir: str 6 | is_existing: bool 7 | realm: str 8 | portbase: int 9 | user_princ: str 10 | admin_princ: str 11 | host_princ: str 12 | nfs_princ: str 13 | krbtgt_princ: str 14 | keytab: str 15 | client_keytab: str 16 | ccache: str 17 | kadmin_ccache: str 18 | env: Dict[str, str] 19 | def __init__( 20 | self, 21 | realm: str = ..., 22 | portbase: int = ..., 23 | krb5_conf: Dict[str, str] | None = ..., 24 | kdc_conf: Dict[str, str] | None = ..., 25 | create_kdb: bool = ..., 26 | krbtgt_keysalt: str | None = ..., 27 | create_user: bool = ..., 28 | get_creds: bool = ..., 29 | create_host: bool = ..., 30 | start_kdc: bool = ..., 31 | start_kadmind: bool = ..., 32 | existing: str | None = ..., 33 | **paths: str, 34 | ) -> None: ... 35 | @property 36 | def provider(self) -> str: ... 37 | def create_kdb(self) -> None: ... 38 | def addprinc( 39 | self, 40 | princname: str, 41 | password: str | None = ..., 42 | ) -> None: ... 43 | def change_password( 44 | self, 45 | principal: str, 46 | password: str | None = ..., 47 | keysalt: str | None = ..., 48 | ) -> None: ... 49 | def extract_keytab( 50 | self, 51 | princname: str, 52 | keytab: str, 53 | ) -> None: ... 54 | def kinit( 55 | self, 56 | princname: str, 57 | password: str | None = ..., 58 | flags: List[str] | None = ..., 59 | verbose: bool = ..., 60 | **keywords: Any, 61 | ) -> str: ... 62 | def klist( 63 | self, 64 | ccache: str | None = ..., 65 | **keywords: Any, 66 | ) -> str: ... 67 | def klist_keytab( 68 | self, 69 | keytab: str | None = ..., 70 | **keywords: Any, 71 | ) -> str: ... 72 | def prep_kadmin( 73 | self, 74 | princname: str | None = ..., 75 | pw: str | None = ..., 76 | flags: List[str] | None = ..., 77 | ) -> str: ... 78 | def run_kadmin( 79 | self, 80 | query: str | List[str], 81 | **keywords: Any, 82 | ) -> str: ... 83 | def run_kadminl( 84 | self, 85 | query: str | List[str], 86 | **keywords: Any, 87 | ) -> Any: ... 88 | def start_kdc( 89 | self, 90 | args: List[str] | None = ..., 91 | env: Dict[str, str] | None = ..., 92 | ) -> None: ... 93 | def start_kadmind( 94 | self, 95 | env: Dict[str, str] | None = ..., 96 | ) -> None: ... 97 | @property 98 | def hostname(self) -> str: ... 99 | def run( 100 | self, 101 | args: List[str], 102 | env: Dict[str, str] | None = ..., 103 | input: str | None = ..., 104 | expected_code: int = ..., 105 | ) -> str: ... 106 | def __del__(self) -> None: ... 107 | def kprop_port(self) -> int: ... 108 | def server_port(self) -> int: ... 109 | def stop_kdc(self) -> None: ... 110 | def stop_kadmind(self) -> None: ... 111 | def stop(self) -> None: ... 112 | def password( 113 | self, 114 | name: str, 115 | ) -> str: ... 116 | def special_env( 117 | self, 118 | name: str, 119 | has_kdc_conf: bool, 120 | krb5_conf: Dict[str, str] | None = ..., 121 | kdc_conf: Dict[str, str] | None = ..., 122 | ) -> Dict[str, str]: ... 123 | def kill_daemons(self) -> None: ... 124 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jborean93/pykrb5/1a3d61da1e33820164a82a583d561e6b74ddeef7/tests/__init__.py -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import os 5 | import typing 6 | 7 | import k5test 8 | import pytest 9 | 10 | import krb5 11 | 12 | 13 | # This could be extensive to do per function so just do it once and share that 14 | @pytest.fixture(scope="session") 15 | def realm() -> typing.Iterator[k5test.K5Realm]: 16 | test_realm = k5test.K5Realm() 17 | 18 | try: 19 | original_env: typing.Dict[str, typing.Optional[str]] = {} 20 | for k in test_realm.env.keys(): 21 | original_env[k] = os.environ.pop(k, None) 22 | 23 | try: 24 | os.environ.update(test_realm.env) 25 | 26 | yield test_realm 27 | 28 | finally: 29 | for k, v in original_env.items(): 30 | if v: 31 | os.environ[k] = v 32 | else: 33 | del os.environ[k] 34 | 35 | finally: 36 | test_realm.stop() 37 | del test_realm 38 | 39 | 40 | @pytest.fixture(autouse=True) 41 | def requires_api(request: typing.Any) -> None: 42 | marker = request.node.get_closest_marker("requires_api") 43 | if marker: 44 | api_name = marker.args[0] 45 | if not hasattr(krb5, api_name): 46 | pytest.skip(f"KRB5 API {api_name} not available on current environment") 47 | 48 | return 49 | 50 | 51 | def pytest_configure(config: typing.Any) -> None: 52 | config.addinivalue_line( 53 | "markers", 54 | "requires_api(name): skip tests that don't have the required KRB5 API installed", 55 | ) 56 | -------------------------------------------------------------------------------- /tests/test_cccol.py: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import krb5 5 | 6 | 7 | def test_cccol_iter() -> None: 8 | ctx = krb5.init_context() 9 | ccache = krb5.cc_new_unique(ctx, b"MEMORY") 10 | krb5.cc_initialize(ctx, ccache, krb5.parse_name_flags(ctx, b"username@DOMAIN.COM")) 11 | assert ccache.principal is not None 12 | krb5.cc_set_default_name(ctx, (ccache.cache_type or b"") + b":" + (ccache.name or b"")) 13 | 14 | # MIT and Heimdal differ in the amounts returns, just make sure at least the MEMORY one is there 15 | actual = list(krb5.cccol_iter(ctx)) 16 | assert len(actual) > 0 17 | for cache in actual: 18 | assert isinstance(cache, krb5.CCache) 19 | 20 | mem_ccache = next(iter([c for c in actual if c.cache_type == b"MEMORY"])) 21 | assert isinstance(mem_ccache, krb5.CCache) 22 | assert mem_ccache.cache_type == b"MEMORY" 23 | assert mem_ccache.name == ccache.name 24 | assert mem_ccache.principal is not None 25 | assert mem_ccache.principal.name == ccache.principal.name 26 | -------------------------------------------------------------------------------- /tests/test_context.py: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2021 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import os 5 | import time 6 | 7 | import k5test 8 | import pytest 9 | 10 | import krb5 11 | 12 | 13 | def test_init_context() -> None: 14 | context = krb5.init_context() 15 | assert context is not None 16 | assert isinstance(context, krb5.Context) 17 | assert str(context) == "Krb5Context" 18 | 19 | 20 | def test_set_default_realm(realm: k5test.K5Realm) -> None: 21 | ctx = krb5.init_context() 22 | 23 | default = krb5.get_default_realm(ctx) 24 | assert default == realm.realm.encode() 25 | 26 | krb5.set_default_realm(ctx, b"NEW.REALM") 27 | default = krb5.get_default_realm(ctx) 28 | assert default == b"NEW.REALM" 29 | 30 | krb5.set_default_realm(ctx, None) 31 | default = krb5.get_default_realm(ctx) 32 | assert default == realm.realm.encode() 33 | 34 | 35 | def test_set_real_time() -> None: 36 | ctx = krb5.init_context() 37 | 38 | diff = krb5.timeofday(ctx) - time.time() 39 | assert diff > -5 40 | assert diff < 5 41 | 42 | now = krb5.us_timeofday(ctx) 43 | diff = now[0] * 1000000 + now[1] - int(time.time() * 1e6) 44 | assert diff > -5000000 45 | assert diff < 5000000 46 | 47 | krb5.set_real_time(ctx, int(time.time()) + 100, 0) 48 | diff = krb5.timeofday(ctx) - time.time() 49 | assert diff > 95 50 | assert diff < 105 51 | 52 | krb5.set_real_time(ctx, int(time.time()), -1) 53 | diff = krb5.timeofday(ctx) - time.time() 54 | assert diff > -5 55 | assert diff < 5 56 | 57 | 58 | @pytest.mark.requires_api("get_time_offsets") 59 | def test_get_time_offsets() -> None: 60 | ctx = krb5.init_context() 61 | 62 | sec, usec = krb5.get_time_offsets(ctx) 63 | assert sec == 0 64 | assert usec == 0 65 | 66 | krb5.set_real_time(ctx, int(time.time()) + 100, 0) 67 | sec, usec = krb5.get_time_offsets(ctx) 68 | assert sec > 95 69 | assert sec < 105 70 | 71 | krb5.set_real_time(ctx, int(time.time()), -1) 72 | sec, usec = krb5.get_time_offsets(ctx) 73 | assert sec > -5 74 | assert sec < 5 75 | 76 | 77 | @pytest.mark.requires_api("init_secure_context") 78 | def test_init_secure_context() -> None: 79 | context = krb5.init_secure_context() 80 | assert context is not None 81 | assert isinstance(context, krb5.Context) 82 | assert str(context) == "Krb5Context" 83 | -------------------------------------------------------------------------------- /tests/test_keyblock.py: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import pytest 5 | 6 | import krb5 7 | 8 | 9 | def test_init_keyblock_empty() -> None: 10 | ctx = krb5.init_context() 11 | kb = krb5.init_keyblock(ctx, 0, None) 12 | 13 | assert len(kb) == 0 14 | assert kb.enctype == 0 15 | assert kb.data == b"" 16 | assert str(kb) == "KeyBlock 0" 17 | assert repr(kb) == "KeyBlock(enctype=0, length=0)" 18 | 19 | 20 | def test_init_keyblock_data() -> None: 21 | ctx = krb5.init_context() 22 | kb = krb5.init_keyblock(ctx, 17, b"\xff" * 16) 23 | 24 | assert len(kb) == 16 25 | assert kb.enctype == 17 26 | assert kb.data == b"\xff" * 16 27 | assert str(kb) == "KeyBlock 17" 28 | assert repr(kb) == "KeyBlock(enctype=17, length=16)" 29 | 30 | 31 | @pytest.mark.requires_api("c_string_to_key") 32 | def test_c_string_to_key() -> None: 33 | ctx = krb5.init_context() 34 | 35 | salt = b"EXAMPLE.COMtestuser" 36 | password = b"Some Password" 37 | 38 | kb = krb5.c_string_to_key(ctx, 17, salt, password) 39 | assert kb.enctype == 17 40 | assert len(kb) == 16 41 | assert kb.data == b"\xd2\x153\xcd\xd9\x7fR\xe6\x11U]7\xac\x12[\xf6" 42 | 43 | kb = krb5.c_string_to_key(ctx, 17, salt, password, b"\x00\x00\x10\x00") 44 | assert kb.enctype == 17 45 | assert len(kb) == 16 46 | assert kb.data == b"\xd2\x153\xcd\xd9\x7fR\xe6\x11U]7\xac\x12[\xf6" 47 | 48 | kb = krb5.c_string_to_key(ctx, 18, salt, password, b"\x00\x00\x10\x00") 49 | assert kb.enctype == 18 50 | assert len(kb) == 32 51 | assert kb.data == b"\x0b\x12\x05\xb0\xc4\xe7\x0e\xf1\xbf\xf5\xeaJ\x1a\x80?~@m\x7f\xcakPk\x08\xa6\x99\x15\xd6s\r&(" 52 | 53 | kb = krb5.c_string_to_key(ctx, 18, salt, password, b"\x00\x01\x23\x45") 54 | assert kb.enctype == 18 55 | assert len(kb) == 32 56 | assert ( 57 | kb.data 58 | == b"\x11\xcc\x10\x0e\xff$\xc1SL^d\x00\xe2\x83\x08\xefxM\x12\x92\x18:\x1c\x9b\xd2w\xf5\xfd\xb9\x13\xe5\xd1" 59 | ) 60 | -------------------------------------------------------------------------------- /tests/test_string.py: -------------------------------------------------------------------------------- 1 | # Copyright: (c) 2022 Jordan Borean (@jborean93) 2 | # MIT License (see LICENSE or https://opensource.org/licenses/MIT) 3 | 4 | import k5test 5 | import pytest 6 | 7 | import krb5 8 | 9 | 10 | def test_enctype_to_string(realm: k5test.K5Realm) -> None: 11 | expected = "AES-256 CTS mode with 96-bit SHA-1 HMAC" if realm.provider == "mit" else "aes256-cts-hmac-sha1-96" 12 | ctx = krb5.init_context() 13 | name = krb5.enctype_to_string(ctx, 18) 14 | assert name == expected 15 | 16 | 17 | def test_enctype_to_string_invalid(realm: k5test.K5Realm) -> None: 18 | ctx = krb5.init_context() 19 | 20 | expected_msg = "Invalid argument" if realm.provider == "mit" else "encryption type \\d+ not supported" 21 | with pytest.raises(krb5.Krb5Error, match=expected_msg): 22 | krb5.enctype_to_string(ctx, 1024) 23 | 24 | 25 | def test_string_to_enctype() -> None: 26 | ctx = krb5.init_context() 27 | enctype = krb5.string_to_enctype(ctx, "aes256-cts-hmac-sha1-96") 28 | assert enctype == 18 29 | 30 | 31 | def test_string_to_enctype_invalid(realm: k5test.K5Realm) -> None: 32 | ctx = krb5.init_context() 33 | expected_msg = "Invalid argument" if realm.provider == "mit" else "encryption type invalid not supported" 34 | with pytest.raises(krb5.Krb5Error, match=expected_msg): 35 | krb5.string_to_enctype(ctx, "invalid") 36 | 37 | 38 | @pytest.mark.requires_api("enctype_to_name") 39 | def test_string_to_name() -> None: 40 | name = krb5.enctype_to_name(18) 41 | assert name == "aes256-cts-hmac-sha1-96" 42 | 43 | 44 | @pytest.mark.requires_api("enctype_to_name") 45 | def test_string_to_name_shortest() -> None: 46 | name = krb5.enctype_to_name(18, shortest=True) 47 | assert name == "aes256-cts" 48 | --------------------------------------------------------------------------------