summaryrefslogtreecommitdiffstats
path: root/src/tests/cmocka/common_mock_krb5.h
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-05-29 13:59:05 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-06-14 21:47:19 +0200
commitb1a822a16e3ef97e31d167f9e97efec06fc121dc (patch)
tree99456fbaf7b328eb42d8c4bd38c04116587c4199 /src/tests/cmocka/common_mock_krb5.h
parent298e22fc97a99994e025c0d507737d88fe6fafef (diff)
downloadsssd-b1a822a16e3ef97e31d167f9e97efec06fc121dc.tar.gz
sssd-b1a822a16e3ef97e31d167f9e97efec06fc121dc.tar.xz
sssd-b1a822a16e3ef97e31d167f9e97efec06fc121dc.zip
TESTS: Split off keytab creation into a common module
This change will make the keytab creating reusable by other tests. Reviewed-by: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'src/tests/cmocka/common_mock_krb5.h')
-rw-r--r--src/tests/cmocka/common_mock_krb5.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/tests/cmocka/common_mock_krb5.h b/src/tests/cmocka/common_mock_krb5.h
new file mode 100644
index 000000000..5d7247bef
--- /dev/null
+++ b/src/tests/cmocka/common_mock_krb5.h
@@ -0,0 +1,47 @@
+/*
+ Authors:
+ Sumit Bose <sbose@redhat.com>
+ Jakub Hrozek <jhrozek@redhat.com>
+
+ Copyright (C) 2015 Red Hat
+
+ SSSD tests: Tests keytab utilities
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __COMMON_MOCK_KRB5_H_
+#define __COMMON_MOCK_KRB5_H_
+
+#include "util/sss_krb5.h"
+#include "tests/cmocka/common_mock.h"
+
+void mock_krb5_keytab_entry(krb5_keytab_entry *kent,
+ krb5_principal principal,
+ krb5_timestamp timestamp,
+ krb5_kvno vno,
+ krb5_enctype enctype,
+ const char *key);
+
+int mock_keytab(krb5_context kctx,
+ const char *kt_path,
+ krb5_keytab_entry *kt_keys,
+ size_t nkeys);
+
+/* Dummy keys with user-selected principal */
+int mock_keytab_with_contents(TALLOC_CTX *mem_ctx,
+ const char *keytab_path,
+ const char *keytab_princ);
+
+#endif /* __COMMON_MOCK_KRB5_H_ */