summaryrefslogtreecommitdiff
path: root/client/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'client/internal.h')
-rw-r--r--client/internal.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/client/internal.h b/client/internal.h
index 6f4a991..1dcb608 100644
--- a/client/internal.h
+++ b/client/internal.h
@@ -3,7 +3,7 @@
** Internal support functions for the wallet client.
**
** Written by Russ Allbery <rra@stanford.edu>
-** Copyright 2007 Board of Trustees, Leland Stanford Jr. University
+** Copyright 2007, 2008 Board of Trustees, Leland Stanford Jr. University
**
** See LICENSE for licensing terms.
*/
@@ -11,7 +11,9 @@
#ifndef CLIENT_INTERNAL_H
#define CLIENT_INTERNAL_H 1
+#include <krb5.h>
#include <sys/types.h>
+
#include <util/util.h>
/* Forward declarations to avoid unnecessary includes. */
@@ -35,23 +37,31 @@ BEGIN_DECLS
int run_command(struct remctl *, const char **command, char **data,
size_t *length);
-/* Given a remctl object, the type for the wallet interface, the name of a
- keytab object, and a file name, call the correct wallet commands to
- download a keytab and write it to that file. If srvtab is not NULL, write
- a srvtab based on the keytab after a successful download. */
-int get_keytab(struct remctl *, const char *type, const char *name,
- const char *file, const char *srvtab);
+/* Given a remctl object, the Kerberos context, the type for the wallet
+ interface, the name of a keytab object, and a file name, call the correct
+ wallet commands to download a keytab and write it to that file. If srvtab
+ is not NULL, write a srvtab based on the keytab after a successful
+ download. */
+int get_keytab(struct remctl *, krb5_context, const char *type,
+ const char *name, const char *file, const char *srvtab);
/* Given a filename, some data, and a length, write that data to the given
file safely and atomically by creating file.new, writing the data, linking
file to file.bak, and then renaming file.new to file. */
void write_file(const char *name, const void *data, size_t length);
-/* Given a srvtab file, the Kerberos v5 principal, and the keytab file, write
- a srvtab file for the corresponding Kerberos v4 principal. */
-void write_srvtab(const char *srvtab, const char *principal,
+/* Given a Kerberos context, a srvtab file, the Kerberos v5 principal, and the
+ keytab file, write a srvtab file for the corresponding Kerberos v4
+ principal. */
+void write_srvtab(krb5_context, const char *srvtab, const char *principal,
const char *keytab);
+/* Versions of die and warn that report Kerberos errors. */
+void die_krb5(krb5_context, krb5_error_code, const char *, ...)
+ __attribute__((__noreturn__, __format__(printf, 3, 4)));
+void warn_krb5(krb5_context, krb5_error_code, const char *, ...)
+ __attribute__((__format__(printf, 3, 4)));
+
END_DECLS
#endif /* !CLIENT_INTERNAL_H */