]> eyrie.org Git - kerberos/wallet.git/commitdiff
Reformat all C code with clang-format-10
authorRuss Allbery <eagle@eyrie.org>
Mon, 18 May 2020 03:21:59 +0000 (20:21 -0700)
committerRuss Allbery <eagle@eyrie.org>
Mon, 18 May 2020 03:21:59 +0000 (20:21 -0700)
.clang-format [new file with mode: 0644]
Makefile.am
client/internal.h
client/keytab.c
client/krb5.c
client/options.c
client/srvtab.c
client/wallet-rekey.c
client/wallet.c

diff --git a/.clang-format b/.clang-format
new file mode 100644 (file)
index 0000000..993594c
--- /dev/null
@@ -0,0 +1,29 @@
+# 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
+---
index ba7b1bebfd5955cf31c1b43d91acca5c34c065e7..d5e46a870ed11d090649ee1ffe8b839b00439e00 100644 (file)
@@ -1,7 +1,7 @@
 # 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
 #
@@ -320,3 +320,9 @@ check-cppcheck:
 # 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
index 1aed874a92765048ebbde4fb96cc84afdc45ed64..2a97dedfda9a7a0fc9175cf05a7a251841d0c426 100644 (file)
@@ -12,8 +12,8 @@
 #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. */
index ed1bdb971b54df6a2e7d0e573a16414b0cfcdb63..5bceec59e384c4ac9e3205cd5c653100b7faef74 100644 (file)
@@ -248,8 +248,7 @@ rekey_keytab(struct remctl *r, krb5_context ctx, const char *type,
         } 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);
         }
     }
 
index f0c0ff13da3dac457534adaced7e2d9c1f6ed27f..42e20ea7f1da6af733e1b9d4b34ee314694db51a 100644 (file)
@@ -47,8 +47,8 @@ kinit(krb5_context ctx, const char *principal)
     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");
 
index 7b1f04e42e9e060e0decd5b8749fc0c89c8586ab..1a85196ed465bda5367a4f19ee3311d82a09cc1c 100644 (file)
@@ -124,7 +124,7 @@ default_options(krb5_context ctx, struct options *options)
 
     /* 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,
index 5fd39dcf51b3861f1ba2bbff0aa57ce89fdf5500..30fb69b9e891fc2c5cd8e0206ecb03d2eb5bfbf9 100644 (file)
@@ -18,9 +18,9 @@
 #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
 
 /*
@@ -51,7 +51,7 @@ write_srvtab(krb5_context ctx, const char *srvtab, const char *principal,
     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];
 
index 2aedf579ac70eec9f6dca02e15ec6e45a3c3e089..13e25a8e78ba0f53a621180a8b79ce5279e36247 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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
@@ -41,7 +41,7 @@ Options:\n\
 /*
  * 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,
index 435f0001af1f975d203907f3db87e1093d538301..cb4ba3d69bc6abc43674b760ada524d8b0484e34 100644 (file)
@@ -46,7 +46,7 @@ Options:\n\
 /*
  * 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,