aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2013-02-27 14:54:05 -0800
committerRuss Allbery <rra@stanford.edu>2013-02-27 16:52:57 -0800
commit93e566f6f9ae8a767d2188ad1fb1520c9c2d303a (patch)
tree470252615c14d94be07cf1c985cca4cee54c5b8e /client
parent4d11772001f65264bf714711550acdbb05900f4c (diff)
Drop use of concat in favor of xasprintf
Change-Id: I6a84920b0c0dc1849af8a34ecf8f3fb70b45e17c Reviewed-on: https://gerrit.stanford.edu/843 Reviewed-by: Russ Allbery <rra@stanford.edu> Tested-by: Russ Allbery <rra@stanford.edu>
Diffstat (limited to 'client')
-rw-r--r--client/file.c5
-rw-r--r--client/keytab.c9
2 files changed, 6 insertions, 8 deletions
diff --git a/client/file.c b/client/file.c
index c171969..511c995 100644
--- a/client/file.c
+++ b/client/file.c
@@ -16,7 +16,6 @@
#include <sys/stat.h>
#include <client/internal.h>
-#include <util/concat.h>
#include <util/messages.h>
#include <util/xmalloc.h>
@@ -83,8 +82,8 @@ write_file(const char *name, const void *data, size_t length)
{
char *temp, *backup;
- temp = concat(name, ".new", (char *) 0);
- backup = concat(name, ".bak", (char *) 0);
+ xasprintf(&temp, "%s.new", name);
+ xasprintf(&backup, "%s.bak", name);
overwrite_file(temp, data, length);
if (access(name, F_OK) == 0) {
if (access(backup, F_OK) == 0)
diff --git a/client/keytab.c b/client/keytab.c
index 0a3e419..d7106e1 100644
--- a/client/keytab.c
+++ b/client/keytab.c
@@ -15,7 +15,6 @@
#include <remctl.h>
#include <client/internal.h>
-#include <util/concat.h>
#include <util/messages-krb5.h>
#include <util/messages.h>
#include <util/xmalloc.h>
@@ -107,7 +106,7 @@ merge_keytab(krb5_context ctx, const char *newfile, const char *file)
krb5_error_code status;
memset(&entry, 0, sizeof(entry));
- oldfile = concat("WRFILE:", file, (char *) 0);
+ xasprintf(&oldfile, "WRFILE:%s", file);
status = krb5_kt_resolve(ctx, oldfile, &old);
if (status != 0)
die_krb5(ctx, status, "cannot open keytab %s", file);
@@ -189,7 +188,7 @@ get_keytab(struct remctl *r, krb5_context ctx, const char *type,
return 255;
}
if (access(file, F_OK) == 0) {
- tempfile = concat(file, ".new", (char *) 0);
+ xasprintf(&tempfile, "%s.new", file);
overwrite_file(tempfile, data, length);
if (srvtab != NULL)
write_srvtab(ctx, srvtab, name, tempfile);
@@ -225,7 +224,7 @@ rekey_keytab(struct remctl *r, krb5_context ctx, const char *type,
bool error = false, rekeyed = false;
struct principal_name *names, *current;
- tempfile = concat(file, ".new", (char *) 0);
+ xasprintf(&tempfile, "%s.new", file);
krb5_get_default_realm(ctx, &realm);
names = keytab_principals(ctx, file, realm);
for (current = names; current != NULL; current = current->next) {
@@ -260,7 +259,7 @@ rekey_keytab(struct remctl *r, krb5_context ctx, const char *type,
} else {
if (error) {
data = read_file(file, &length);
- backupfile = concat(file, ".old", (char *) 0);
+ xasprintf(&backupfile, "%s.old", file);
overwrite_file(backupfile, data, length);
warn("partial failure to rekey keytab %s, old keytab left in %s",
file, backupfile);