From aa57ab48cc9df24ab756b5651959b36a2d81cad3 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sat, 19 Jan 2008 00:37:31 +0000 Subject: 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. --- client/internal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'client/internal.h') 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 @@ -45,6 +53,10 @@ int run_command(struct remctl *, const char **command, char **data, 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. */ -- cgit v1.2.3