| 1 | /*
|
|---|
| 2 | * Unix SMB/CIFS implementation.
|
|---|
| 3 | * libnet Support
|
|---|
| 4 | * Copyright (C) Guenther Deschner 2008
|
|---|
| 5 | *
|
|---|
| 6 | * This program is free software; you can redistribute it and/or modify
|
|---|
| 7 | * it under the terms of the GNU General Public License as published by
|
|---|
| 8 | * the Free Software Foundation; either version 3 of the License, or
|
|---|
| 9 | * (at your option) any later version.
|
|---|
| 10 | *
|
|---|
| 11 | * This program is distributed in the hope that it will be useful,
|
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 14 | * GNU General Public License for more details.
|
|---|
| 15 | *
|
|---|
| 16 | * You should have received a copy of the GNU General Public License
|
|---|
| 17 | * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 | #ifdef HAVE_KRB5
|
|---|
| 21 |
|
|---|
| 22 | struct libnet_keytab_entry {
|
|---|
| 23 | const char *name;
|
|---|
| 24 | const char *principal;
|
|---|
| 25 | DATA_BLOB password;
|
|---|
| 26 | uint32_t kvno;
|
|---|
| 27 | krb5_enctype enctype;
|
|---|
| 28 | };
|
|---|
| 29 |
|
|---|
| 30 | struct libnet_keytab_context {
|
|---|
| 31 | krb5_context context;
|
|---|
| 32 | krb5_keytab keytab;
|
|---|
| 33 | const char *keytab_name;
|
|---|
| 34 | ADS_STRUCT *ads;
|
|---|
| 35 | const char *dns_domain_name;
|
|---|
| 36 | uint8_t zero_buf[16];
|
|---|
| 37 | uint32_t count;
|
|---|
| 38 | struct libnet_keytab_entry *entries;
|
|---|
| 39 | bool clean_old_entries;
|
|---|
| 40 | };
|
|---|
| 41 |
|
|---|
| 42 | /* The following definitions come from libnet/libnet_keytab.c */
|
|---|
| 43 |
|
|---|
| 44 | krb5_error_code libnet_keytab_init(TALLOC_CTX *mem_ctx,
|
|---|
| 45 | const char *keytab_name,
|
|---|
| 46 | struct libnet_keytab_context **ctx);
|
|---|
| 47 | krb5_error_code libnet_keytab_add(struct libnet_keytab_context *ctx);
|
|---|
| 48 |
|
|---|
| 49 | struct libnet_keytab_entry *libnet_keytab_search(struct libnet_keytab_context *ctx,
|
|---|
| 50 | const char *principal, int kvno,
|
|---|
| 51 | const krb5_enctype enctype,
|
|---|
| 52 | TALLOC_CTX *mem_ctx);
|
|---|
| 53 | NTSTATUS libnet_keytab_add_to_keytab_entries(TALLOC_CTX *mem_ctx,
|
|---|
| 54 | struct libnet_keytab_context *ctx,
|
|---|
| 55 | uint32_t kvno,
|
|---|
| 56 | const char *name,
|
|---|
| 57 | const char *prefix,
|
|---|
| 58 | const krb5_enctype enctype,
|
|---|
| 59 | DATA_BLOB blob);
|
|---|
| 60 | #endif /* HAVE_KRB5 */
|
|---|