--- /dev/null
+# Configuration for clang-format automated reformatting. -*- yaml -*-
+#
+# The canonical version of this file is maintained in the rra-c-util package,
+# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
+#
+# Copyright 2020 Russ Allbery <eagle@eyrie.org>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+#
+# SPDX-License-Identifier: FSFAP
+
+---
+Language: Cpp
+BasedOnStyle: LLVM
+AlignConsecutiveMacros: true
+AlignEscapedNewlines: Left
+AlwaysBreakAfterReturnType: AllDefinitions
+BreakBeforeBinaryOperators: NonAssignment
+BreakBeforeBraces: WebKit
+ColumnLimit: 79
+IndentPPDirectives: AfterHash
+IndentWidth: 4
+IndentWrappedFunctionNames: false
+MaxEmptyLinesToKeep: 2
+SpaceAfterCStyleCast: true
+---
# Automake makefile for wallet.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2016, 2018 Russ Allbery <eagle@eyrie.org>
+# Copyright 2016, 2018, 2020 Russ Allbery <eagle@eyrie.org>
# Copyright 2006-2008, 2010, 2013-2014
# The Board of Trustees of the Leland Stanford Junior University
#
# uninstall from Perl.
distuninstallcheck:
@:
+
+# Used by maintainers to reformat all source code using clang-format and
+# excluding some files.
+reformat:
+ find . -name '*.[ch]' \! -name snprintf.c \! -name krb5-profile.c \
+ -print | xargs clang-format-10 -style=file -i
#ifndef CLIENT_INTERNAL_H
#define CLIENT_INTERNAL_H 1
-#include <portable/macros.h>
#include <portable/krb5.h>
+#include <portable/macros.h>
#include <sys/types.h>
* people don't want to use krb5.conf for some reason.
*/
#ifndef WALLET_SERVER
-# define WALLET_SERVER NULL
+# define WALLET_SERVER NULL
#endif
#ifndef WALLET_PORT
-# define WALLET_PORT 0
+# define WALLET_PORT 0
#endif
/* Forward declarations to avoid unnecessary includes. */
} else {
merge_keytab(ctx, tempfile, file);
if (unlink(tempfile) < 0)
- syswarn("unlink of temporary keytab file %s failed",
- tempfile);
+ syswarn("unlink of temporary keytab file %s failed", tempfile);
}
}
krb5_get_init_creds_opt_set_default_flags(ctx, "wallet", princ->realm,
opts);
memset(&creds, 0, sizeof(creds));
- status = krb5_get_init_creds_password(ctx, &creds, princ, NULL,
- krb5_prompter_posix, NULL, 0, NULL, opts);
+ status = krb5_get_init_creds_password(
+ ctx, &creds, princ, NULL, krb5_prompter_posix, NULL, 0, NULL, opts);
if (status != 0)
die_krb5(ctx, status, "authentication failed");
/* Having no local realm may be intentional, so don't report an error. */
krb5_get_default_realm(ctx, &realm);
-
+
/* Load the options. */
default_string(ctx, realm, "wallet_type", "wallet", &options->type);
default_string(ctx, realm, "wallet_server", WALLET_SERVER,
#include <util/messages.h>
#ifndef KRB5_KRB4_COMPAT
-# define ANAME_SZ 40
-# define INST_SZ 40
-# define REALM_SZ 40
+# define ANAME_SZ 40
+# define INST_SZ 40
+# define REALM_SZ 40
#endif
/*
krb5_error_code ret;
size_t length;
char aname[ANAME_SZ + 1] = "";
- char inst[INST_SZ + 1] = "";
+ char inst[INST_SZ + 1] = "";
char realm[REALM_SZ + 1] = "";
char data[ANAME_SZ + 1 + INST_SZ + 1 + REALM_SZ + 1 + 1 + 8];
*
* Written by Russ Allbery <eagle@eyrie.org>
* and Jon Robertson <jonrober@stanford.edu>
- * Copyright 2018 Russ Allbery <eagle@eyrie.org>
+ * Copyright 2018, 2020 Russ Allbery <eagle@eyrie.org>
* Copyright 2010
* The Board of Trustees of the Leland Stanford Junior University
*
#include <portable/krb5.h>
#include <portable/system.h>
-#include <remctl.h>
#include <errno.h>
+#include <remctl.h>
#include <client/internal.h>
-#include <util/messages.h>
#include <util/messages-krb5.h>
+#include <util/messages.h>
/*
* Usage message. Use as a format and pass the port number and default server
/*
* Display the usage message for wallet-rekey.
*/
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
usage(int status)
{
fprintf((status == 0) ? stdout : stderr, usage_message, WALLET_PORT,
/*
* Display the usage message for wallet.
*/
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
usage(int status)
{
fprintf((status == 0) ? stdout : stderr, usage_message, WALLET_PORT,