aboutsummaryrefslogtreecommitdiff
path: root/client/internal.h
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2008-01-19 00:37:31 +0000
committerRuss Allbery <rra@stanford.edu>2008-01-19 00:37:31 +0000
commitaa57ab48cc9df24ab756b5651959b36a2d81cad3 (patch)
treeff27773218cb6d2677032d18f6872dd45493b82a /client/internal.h
parent275cc7eac5d693bffec19884bf37322df59a871c (diff)
When downloading a keytab to a file that already exists, merge the new
keytab keys into that file rather than moving aside the old keytab and creating a new keytab with only the new keys. Also fix get handling in the client for all types other than keytabs. This isn't visible yet since the server doesn't yet support other types of objects.
Diffstat (limited to 'client/internal.h')
-rw-r--r--client/internal.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/client/internal.h b/client/internal.h
index 1dcb608..8595412 100644
--- a/client/internal.h
+++ b/client/internal.h
@@ -37,6 +37,14 @@ 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, object type,
+ object name, and a file (which may be NULL), send a wallet get command and
+ write the results to the provided file. If the file is NULL, write the
+ results to standard output instead. Returns 0 on success and an exit
+ status on failure. */
+int get_file(struct remctl *, const char *prefix, const char *type,
+ const char *name, const char *file);
+
/* 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
@@ -46,6 +54,10 @@ 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 with error checking, overwriting any existing contents. */
+void overwrite_file(const char *name, const void *data, size_t length);
+
+/* 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);