Skip to content

Commit a284e42

Browse files
committed
Reformat with clang-format-10
1 parent 8eb384d commit a284e42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+915
-930
lines changed

kafs/kafs.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#include <fcntl.h>
5151
#include <signal.h>
5252
#ifdef HAVE_SYS_IOCCOM_H
53-
# include <sys/ioccom.h>
53+
# include <sys/ioccom.h>
5454
#endif
5555
#include <sys/ioctl.h>
5656
#include <sys/stat.h>
@@ -69,17 +69,17 @@ static int k_syscall(long, long, long, long, long, int *);
6969
* The included file must provide a k_syscall implementation.
7070
*/
7171
#if defined(HAVE_KAFS_DARWIN8)
72-
# include <kafs/sys-darwin8.c>
72+
# include <kafs/sys-darwin8.c>
7373
#elif defined(HAVE_KAFS_DARWIN10)
74-
# include <kafs/sys-darwin10.c>
74+
# include <kafs/sys-darwin10.c>
7575
#elif defined(HAVE_KAFS_LINUX)
76-
# include <kafs/sys-linux.c>
76+
# include <kafs/sys-linux.c>
7777
#elif defined(HAVE_KAFS_SOLARIS)
78-
# include <kafs/sys-solaris.c>
78+
# include <kafs/sys-solaris.c>
7979
#elif defined(HAVE_KAFS_SYSCALL)
80-
# include <kafs/sys-syscall.c>
80+
# include <kafs/sys-syscall.c>
8181
#else
82-
# error "Unknown AFS system call implementation"
82+
# error "Unknown AFS system call implementation"
8383
#endif
8484

8585
/*

kafs/sys-linux.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* SPDX-License-Identifier: MIT
3939
*/
4040

41-
/*
41+
/*
4242
* The struct passed to ioctl to do an AFS system call. Definition taken from
4343
* the afs/afs_args.h OpenAFS header.
4444
*/

pam-util/args.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
#include <config.h>
4343
#ifdef HAVE_KRB5
44-
# include <portable/krb5.h>
44+
# include <portable/krb5.h>
4545
#endif
4646
#include <portable/pam.h>
4747
#include <portable/system.h>

pam-util/args.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
#include <config.h>
4444
#ifdef HAVE_KRB5
45-
# include <portable/krb5.h>
45+
# include <portable/krb5.h>
4646
#endif
4747
#include <portable/pam.h>
4848
#include <portable/stdbool.h>
@@ -51,15 +51,15 @@
5151
struct pam_config;
5252

5353
struct pam_args {
54-
pam_handle_t *pamh; /* Pointer back to the PAM handle. */
55-
struct pam_config *config; /* Per-module PAM configuration. */
56-
bool debug; /* Log debugging information. */
57-
bool silent; /* Do not pass text to the application. */
58-
const char *user; /* User being authenticated. */
54+
pam_handle_t *pamh; /* Pointer back to the PAM handle. */
55+
struct pam_config *config; /* Per-module PAM configuration. */
56+
bool debug; /* Log debugging information. */
57+
bool silent; /* Do not pass text to the application. */
58+
const char *user; /* User being authenticated. */
5959

6060
#ifdef HAVE_KRB5
61-
krb5_context ctx; /* Context for Kerberos operations. */
62-
char *realm; /* Kerberos realm for configuration. */
61+
krb5_context ctx; /* Context for Kerberos operations. */
62+
char *realm; /* Kerberos realm for configuration. */
6363
#endif
6464
};
6565

pam-util/logging.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
#include <config.h>
3838
#ifdef HAVE_KRB5
39-
# include <portable/krb5.h>
39+
# include <portable/krb5.h>
4040
#endif
4141
#include <portable/pam.h>
4242
#include <portable/system.h>
@@ -47,7 +47,7 @@
4747
#include <pam-util/logging.h>
4848

4949
#ifndef LOG_AUTHPRIV
50-
# define LOG_AUTHPRIV LOG_AUTH
50+
# define LOG_AUTHPRIV LOG_AUTH
5151
#endif
5252

5353
/* Used for iterating through arrays. */
@@ -79,7 +79,7 @@ static const struct {
7979
* Utility function to format a message into newly allocated memory, reporting
8080
* an error via syslog if vasprintf fails.
8181
*/
82-
static char * __attribute__((__format__(printf, 1, 0)))
82+
static char *__attribute__((__format__(printf, 1, 0)))
8383
format(const char *fmt, va_list args)
8484
{
8585
char *msg;
@@ -296,8 +296,7 @@ putil_log_failure(struct pam_args *pargs, const char *fmt, ...)
296296
* authenticated if known, followed by a colon and the formatted Kerberos
297297
* error.
298298
*/
299-
__attribute__((__format__(printf, 4, 0)))
300-
static void
299+
__attribute__((__format__(printf, 4, 0))) static void
301300
log_krb5(struct pam_args *pargs, int priority, int status, const char *fmt,
302301
va_list args)
303302
{

pam-util/logging.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <config.h>
3737
#include <portable/macros.h>
3838
#ifdef HAVE_KRB5
39-
# include <portable/krb5.h>
39+
# include <portable/krb5.h>
4040
#endif
4141
#include <portable/pam.h>
4242

@@ -105,16 +105,16 @@ END_DECLS
105105

106106
/* __func__ is C99, but not provided by all implementations. */
107107
#if (__STDC_VERSION__ < 199901L) && !defined(__func__)
108-
# if (__GNUC__ >= 2)
109-
# define __func__ __FUNCTION__
110-
# else
111-
# define __func__ "<unknown>"
112-
# endif
108+
# if (__GNUC__ >= 2)
109+
# define __func__ __FUNCTION__
110+
# else
111+
# define __func__ "<unknown>"
112+
# endif
113113
#endif
114114

115115
/* Macros to record entry and exit from the main PAM functions. */
116-
#define ENTRY(args, flags) \
117-
if (args->debug) \
116+
#define ENTRY(args, flags) \
117+
if (args->debug) \
118118
putil_log_entry((args), __func__, (flags));
119119
/* clang-format off */
120120
#define EXIT(args, pamret) \

pam-util/options.c

+14-14
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
#include <config.h>
3838
#ifdef HAVE_KRB5
39-
# include <portable/krb5.h>
39+
# include <portable/krb5.h>
4040
#endif
4141
#include <portable/system.h>
4242

@@ -208,9 +208,9 @@ default_boolean(struct pam_args *args, const char *section, const char *realm,
208208
const char *opt, bool *result)
209209
{
210210
int tmp;
211-
#ifdef HAVE_KRB5_REALM
211+
# ifdef HAVE_KRB5_REALM
212212
krb5_const_realm rdata = realm;
213-
#else
213+
# else
214214
krb5_data realm_struct;
215215
const krb5_data *rdata;
216216

@@ -222,7 +222,7 @@ default_boolean(struct pam_args *args, const char *section, const char *realm,
222222
realm_struct.data = (void *) realm;
223223
realm_struct.length = (unsigned int) strlen(realm);
224224
}
225-
#endif
225+
# endif
226226

227227
/*
228228
* The MIT version of krb5_appdefault_boolean takes an int * and the
@@ -247,9 +247,9 @@ default_number(struct pam_args *args, const char *section, const char *realm,
247247
char *tmp = NULL;
248248
char *end;
249249
long value;
250-
#ifdef HAVE_KRB5_REALM
250+
# ifdef HAVE_KRB5_REALM
251251
krb5_const_realm rdata = realm;
252-
#else
252+
# else
253253
krb5_data realm_struct;
254254
const krb5_data *rdata;
255255

@@ -261,7 +261,7 @@ default_number(struct pam_args *args, const char *section, const char *realm,
261261
realm_struct.data = (void *) realm;
262262
realm_struct.length = (unsigned int) strlen(realm);
263263
}
264-
#endif
264+
# endif
265265

266266
krb5_appdefault_string(args->ctx, section, rdata, opt, "", &tmp);
267267
if (tmp != NULL && tmp[0] != '\0') {
@@ -290,9 +290,9 @@ default_time(struct pam_args *args, const char *section, const char *realm,
290290
char *tmp = NULL;
291291
krb5_deltat value;
292292
krb5_error_code retval;
293-
#ifdef HAVE_KRB5_REALM
293+
# ifdef HAVE_KRB5_REALM
294294
krb5_const_realm rdata = realm;
295-
#else
295+
# else
296296
krb5_data realm_struct;
297297
const krb5_data *rdata;
298298

@@ -304,7 +304,7 @@ default_time(struct pam_args *args, const char *section, const char *realm,
304304
realm_struct.data = (void *) realm;
305305
realm_struct.length = (unsigned int) strlen(realm);
306306
}
307-
#endif
307+
# endif
308308

309309
krb5_appdefault_string(args->ctx, section, rdata, opt, "", &tmp);
310310
if (tmp != NULL && tmp[0] != '\0') {
@@ -334,9 +334,9 @@ default_string(struct pam_args *args, const char *section, const char *realm,
334334
const char *opt, char **result)
335335
{
336336
char *value = NULL;
337-
#ifdef HAVE_KRB5_REALM
337+
# ifdef HAVE_KRB5_REALM
338338
krb5_const_realm rdata = realm;
339-
#else
339+
# else
340340
krb5_data realm_struct;
341341
const krb5_data *rdata;
342342

@@ -348,7 +348,7 @@ default_string(struct pam_args *args, const char *section, const char *realm,
348348
realm_struct.data = (void *) realm;
349349
realm_struct.length = (unsigned int) strlen(realm);
350350
}
351-
#endif
351+
# endif
352352

353353
krb5_appdefault_string(args->ctx, section, rdata, opt, "", &value);
354354
if (value != NULL) {
@@ -493,7 +493,7 @@ option_compare(const void *key, const void *member)
493493
if (p == NULL)
494494
return strcmp(string, option->name);
495495
else {
496-
length = (size_t) (p - string);
496+
length = (size_t)(p - string);
497497
if (length == 0)
498498
return -1;
499499
result = strncmp(string, option->name, length);

pam-util/options.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#include <config.h>
4242
#ifdef HAVE_KRB5
43-
# include <portable/krb5.h>
43+
# include <portable/krb5.h>
4444
#endif
4545
#include <portable/macros.h>
4646
#include <portable/stdbool.h>
@@ -151,8 +151,7 @@ BEGIN_DECLS
151151
* putil_args_parse(), since neither of those functions set defaults.
152152
*/
153153
bool putil_args_defaults(struct pam_args *, const struct option options[],
154-
size_t optlen)
155-
__attribute__((__nonnull__));
154+
size_t optlen) __attribute__((__nonnull__));
156155

157156
/*
158157
* Fill out options from krb5.conf. Takes the PAM args structure, the name of

pam-util/vector.c

+6-8
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ split_multi_count(const char *string, const char *seps)
211211
* partial results.
212212
*/
213213
struct vector *
214-
vector_split_multi(const char *string, const char *seps,
215-
struct vector *vector)
214+
vector_split_multi(const char *string, const char *seps, struct vector *vector)
216215
{
217216
const char *p, *start;
218217
size_t i, count;
@@ -232,7 +231,7 @@ vector_split_multi(const char *string, const char *seps,
232231
for (start = string, p = string, i = 0; *p != '\0'; p++)
233232
if (strchr(seps, *p) != NULL) {
234233
if (start != p) {
235-
vector->strings[i] = strndup(start, (size_t) (p - start));
234+
vector->strings[i] = strndup(start, (size_t)(p - start));
236235
if (vector->strings[i] == NULL)
237236
goto fail;
238237
i++;
@@ -241,7 +240,7 @@ vector_split_multi(const char *string, const char *seps,
241240
start = p + 1;
242241
}
243242
if (start != p) {
244-
vector->strings[i] = strndup(start, (size_t) (p - start));
243+
vector->strings[i] = strndup(start, (size_t)(p - start));
245244
if (vector->strings[i] == NULL)
246245
goto fail;
247246
vector->count++;
@@ -268,7 +267,7 @@ vector_exec(const char *path, struct vector *vector)
268267
if (!vector_resize(vector, vector->count + 1))
269268
return -1;
270269
vector->strings[vector->count] = NULL;
271-
return execv(path, (char * const *) vector->strings);
270+
return execv(path, (char *const *) vector->strings);
272271
}
273272

274273

@@ -280,12 +279,11 @@ vector_exec(const char *path, struct vector *vector)
280279
*/
281280
int
282281
vector_exec_env(const char *path, struct vector *vector,
283-
const char * const env[])
282+
const char *const env[])
284283
{
285284
if (vector->allocated == vector->count)
286285
if (!vector_resize(vector, vector->count + 1))
287286
return -1;
288287
vector->strings[vector->count] = NULL;
289-
return execve(path, (char * const *) vector->strings,
290-
(char * const *) env);
288+
return execve(path, (char *const *) vector->strings, (char *const *) env);
291289
}

pam-util/vector.h

+3-6
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ BEGIN_DECLS
5252
#pragma GCC visibility push(hidden)
5353

5454
/* Create a new, empty vector. Returns NULL on memory allocation failure. */
55-
struct vector *vector_new(void)
56-
__attribute__((__malloc__));
55+
struct vector *vector_new(void) __attribute__((__malloc__));
5756

5857
/*
5958
* Create a new vector that's a copy of an existing vector. Returns NULL on
@@ -74,16 +73,14 @@ bool vector_add(struct vector *, const char *string)
7473
* in vector_add if it's known in advance how many entries there will be.
7574
* Returns false on failure to allocate memory.
7675
*/
77-
bool vector_resize(struct vector *, size_t size)
78-
__attribute__((__nonnull__));
76+
bool vector_resize(struct vector *, size_t size) __attribute__((__nonnull__));
7977

8078
/*
8179
* Reset the number of elements to zero, freeing all of the strings for a
8280
* regular vector, but not freeing the strings array (to cut down on memory
8381
* allocations if the vector will be reused).
8482
*/
85-
void vector_clear(struct vector *)
86-
__attribute__((__nonnull__));
83+
void vector_clear(struct vector *) __attribute__((__nonnull__));
8784

8885
/* Free the vector and all resources allocated for it. */
8986
void vector_free(struct vector *);

0 commit comments

Comments
 (0)