Blame SOURCES/audit-2.8.2-style-fix.patch

7bdd34
From 63151c4f0e9d1d037f80f10cb7809573a49da6c7 Mon Sep 17 00:00:00 2001
7bdd34
From: Steve Grubb <sgrubb@redhat.com>
7bdd34
Date: Tue, 17 Oct 2017 13:33:28 -0400
7bdd34
Subject: [PATCH] make style match rest of audit system
7bdd34
7bdd34
---
7bdd34
 src/auditd-listen.c | 176 ++++++++++++++++++++++++++--------------------------
7bdd34
 1 file changed, 88 insertions(+), 88 deletions(-)
7bdd34
7bdd34
diff --git a/src/auditd-listen.c b/src/auditd-listen.c
7bdd34
index b4dc097..7a5c2c6 100644
7bdd34
--- a/src/auditd-listen.c
7bdd34
+++ b/src/auditd-listen.c
7bdd34
@@ -114,11 +114,11 @@ static char *sockaddr_to_addr4(struct sockaddr_in *addr)
7bdd34
 
7bdd34
 static void set_close_on_exec(int fd)
7bdd34
 {
7bdd34
-	int flags = fcntl (fd, F_GETFD);
7bdd34
+	int flags = fcntl(fd, F_GETFD);
7bdd34
 	if (flags == -1)
7bdd34
 		flags = 0;
7bdd34
 	flags |= FD_CLOEXEC;
7bdd34
-	fcntl (fd, F_SETFD, flags);
7bdd34
+	fcntl(fd, F_SETFD, flags);
7bdd34
 }
7bdd34
 
7bdd34
 static void release_client(struct ev_tcp *client)
7bdd34
@@ -144,11 +144,11 @@ static void release_client(struct ev_tcp *client)
7bdd34
 
7bdd34
 static void close_client(struct ev_tcp *client)
7bdd34
 {
7bdd34
-	release_client (client);
7bdd34
-	free (client);
7bdd34
+	release_client(client);
7bdd34
+	free(client);
7bdd34
 }
7bdd34
 
7bdd34
-static int ar_write (int sock, const void *buf, int len)
7bdd34
+static int ar_write(int sock, const void *buf, int len)
7bdd34
 {
7bdd34
 	int rc = 0, w;
7bdd34
 	while (len > 0) {
7bdd34
@@ -167,7 +167,7 @@ static int ar_write (int sock, const void *buf, int len)
7bdd34
 }
7bdd34
 
7bdd34
 #ifdef USE_GSSAPI
7bdd34
-static int ar_read (int sock, void *buf, int len)
7bdd34
+static int ar_read(int sock, void *buf, int len)
7bdd34
 {
7bdd34
 	int rc = 0, r;
7bdd34
 	while (len > 0) {
7bdd34
@@ -192,13 +192,13 @@ static int ar_read (int sock, void *buf, int len)
7bdd34
    the tokens.  The protocol we use for transferring tokens is to send
7bdd34
    the length first, four bytes MSB first, then the token data.  We
7bdd34
    return nonzero on error.  */
7bdd34
-static int recv_token (int s, gss_buffer_t tok)
7bdd34
+static int recv_token(int s, gss_buffer_t tok)
7bdd34
 {
7bdd34
 	int ret;
7bdd34
 	unsigned char lenbuf[4];
7bdd34
 	unsigned int len;
7bdd34
 
7bdd34
-	ret = ar_read(s, (char *) lenbuf, 4);
7bdd34
+	ret = ar_read(s, (char *)lenbuf, 4);
7bdd34
 	if (ret < 0) {
7bdd34
 		audit_msg(LOG_ERR, "GSS-API error reading token length");
7bdd34
 		return -1;
7bdd34
@@ -220,13 +220,13 @@ static int recv_token (int s, gss_buffer_t tok)
7bdd34
 	}
7bdd34
 	tok->length = len;
7bdd34
 
7bdd34
-	tok->value = (char *) malloc(tok->length ? tok->length : 1);
7bdd34
+	tok->value = (char *)malloc(tok->length ? tok->length : 1);
7bdd34
 	if (tok->length && tok->value == NULL) {
7bdd34
 		audit_msg(LOG_ERR, "Out of memory allocating token data");
7bdd34
 		return -1;
7bdd34
 	}
7bdd34
 
7bdd34
-	ret = ar_read(s, (char *) tok->value, tok->length);
7bdd34
+	ret = ar_read(s, (char *)tok->value, tok->length);
7bdd34
 	if (ret < 0) {
7bdd34
 		audit_msg(LOG_ERR, "GSS-API error reading token data");
7bdd34
 		free(tok->value);
7bdd34
@@ -243,7 +243,7 @@ static int recv_token (int s, gss_buffer_t tok)
7bdd34
 /* Same here.  */
7bdd34
 int send_token(int s, gss_buffer_t tok)
7bdd34
 {
7bdd34
-	int     ret;
7bdd34
+	int ret;
7bdd34
 	unsigned char lenbuf[4];
7bdd34
 	unsigned int len;
7bdd34
 
7bdd34
@@ -268,7 +268,7 @@ int send_token(int s, gss_buffer_t tok)
7bdd34
 	if (ret < 0) {
7bdd34
 		audit_msg(LOG_ERR, "GSS-API error sending token data");
7bdd34
 		return -1;
7bdd34
-	} else if (ret != (int) tok->length) {
7bdd34
+	} else if (ret != (int)tok->length) {
7bdd34
 		audit_msg(LOG_ERR, "GSS-API error sending token data");
7bdd34
 		return -1;
7bdd34
 	}
7bdd34
@@ -277,14 +277,14 @@ int send_token(int s, gss_buffer_t tok)
7bdd34
 }
7bdd34
 
7bdd34
 
7bdd34
-static void gss_failure_2 (const char *msg, int status, int type)
7bdd34
+static void gss_failure_2(const char *msg, int status, int type)
7bdd34
 {
7bdd34
 	OM_uint32 message_context = 0;
7bdd34
 	OM_uint32 min_status = 0;
7bdd34
 	gss_buffer_desc status_string;
7bdd34
 
7bdd34
 	do {
7bdd34
-		gss_display_status (&min_status,
7bdd34
+		gss_display_status(&min_status,
7bdd34
 				    status,
7bdd34
 				    type,
7bdd34
 				    GSS_C_NO_OID,
7bdd34
@@ -298,11 +298,11 @@ static void gss_failure_2 (const char *msg, int status, int type)
7bdd34
 	} while (message_context != 0);
7bdd34
 }
7bdd34
 
7bdd34
-static void gss_failure (const char *msg, int major_status, int minor_status)
7bdd34
+static void gss_failure(const char *msg, int major_status, int minor_status)
7bdd34
 {
7bdd34
-	gss_failure_2 (msg, major_status, GSS_C_GSS_CODE);
7bdd34
+	gss_failure_2(msg, major_status, GSS_C_GSS_CODE);
7bdd34
 	if (minor_status)
7bdd34
-		gss_failure_2 (msg, minor_status, GSS_C_MECH_CODE);
7bdd34
+		gss_failure_2(msg, minor_status, GSS_C_MECH_CODE);
7bdd34
 }
7bdd34
 
7bdd34
 #define KCHECK(x,f) if (x) { \
7bdd34
@@ -323,7 +323,7 @@ static int server_acquire_creds(const char *service_name,
7bdd34
 	krb5_context kcontext = NULL;
7bdd34
 	int krberr;
7bdd34
 
7bdd34
-	my_service_name = strdup (service_name);
7bdd34
+	my_service_name = strdup(service_name);
7bdd34
 	name_buf.value = (char *)service_name;
7bdd34
 	name_buf.length = strlen(name_buf.value) + 1;
7bdd34
 	major_status = gss_import_name(&minor_status, &name_buf,
7bdd34
@@ -346,9 +346,9 @@ static int server_acquire_creds(const char *service_name,
7bdd34
 
7bdd34
 	(void) gss_release_name(&minor_status, &server_name);
7bdd34
 
7bdd34
-	krberr = krb5_init_context (&kcontext);
7bdd34
+	krberr = krb5_init_context(&kcontext);
7bdd34
 	KCHECK (krberr, "krb5_init_context");
7bdd34
-	krberr = krb5_get_default_realm (kcontext, &my_gss_realm);
7bdd34
+	krberr = krb5_get_default_realm(kcontext, &my_gss_realm);
7bdd34
 	KCHECK (krberr, "krb5_get_default_realm");
7bdd34
 
7bdd34
 	audit_msg(LOG_DEBUG, "GSS creds for %s acquired", service_name);
7bdd34
@@ -360,7 +360,7 @@ static int server_acquire_creds(const char *service_name,
7bdd34
    the case of Kerberos, this is where the key exchange happens.
7bdd34
    FIXME: While everything else is strictly nonblocking, this
7bdd34
    negotiation blocks.  */
7bdd34
-static int negotiate_credentials (ev_tcp *io)
7bdd34
+static int negotiate_credentials(ev_tcp *io)
7bdd34
 {
7bdd34
 	gss_buffer_desc send_tok, recv_tok;
7bdd34
 	gss_name_t client;
7bdd34
@@ -440,12 +440,12 @@ static int negotiate_credentials (ev_tcp *io)
7bdd34
 
7bdd34
 	audit_msg(LOG_INFO, "GSS-API Accepted connection from: %s",
7bdd34
 		  (char *)recv_tok.value);
7bdd34
-	io->remote_name = strdup (recv_tok.value);
7bdd34
-	io->remote_name_len = strlen (recv_tok.value);
7bdd34
+	io->remote_name = strdup(recv_tok.value);
7bdd34
+	io->remote_name_len = strlen(recv_tok.value);
7bdd34
 	gss_release_buffer(&min_stat, &recv_tok);
7bdd34
 
7bdd34
-	slashptr = strchr (io->remote_name, '/');
7bdd34
-	atptr = strchr (io->remote_name, '@');
7bdd34
+	slashptr = strchr(io->remote_name, '/');
7bdd34
+	atptr = strchr(io->remote_name, '@');
7bdd34
 
7bdd34
 	if (!slashptr || !atptr) {
7bdd34
 		audit_msg(LOG_ERR, "Invalid GSS name from remote client: %s",
7bdd34
@@ -454,14 +454,14 @@ static int negotiate_credentials (ev_tcp *io)
7bdd34
 	}
7bdd34
 
7bdd34
 	*slashptr = 0;
7bdd34
-	if (strcmp (io->remote_name, my_service_name)) {
7bdd34
+	if (strcmp(io->remote_name, my_service_name)) {
7bdd34
 		audit_msg(LOG_ERR, "Unauthorized GSS client name: %s (not %s)",
7bdd34
 			  io->remote_name, my_service_name);
7bdd34
 		return -1;
7bdd34
 	}
7bdd34
 	*slashptr = '/';
7bdd34
 
7bdd34
-	if (strcmp (atptr+1, my_gss_realm)) {
7bdd34
+	if (strcmp(atptr+1, my_gss_realm)) {
7bdd34
 		audit_msg(LOG_ERR, "Unauthorized GSS client realm: %s (not %s)",
7bdd34
 			  atptr+1, my_gss_realm);
7bdd34
 		return -1;
7bdd34
@@ -473,7 +473,7 @@ static int negotiate_credentials (ev_tcp *io)
7bdd34
 
7bdd34
 /* This is called from auditd-event after the message has been logged.
7bdd34
    The header is already filled in.  */
7bdd34
-static void client_ack (void *ack_data, const unsigned char *header,
7bdd34
+static void client_ack(void *ack_data, const unsigned char *header,
7bdd34
 	const char *msg)
7bdd34
 {
7bdd34
 	ev_tcp *io = (ev_tcp *)ack_data;
7bdd34
@@ -483,18 +483,18 @@ static void client_ack (void *ack_data, const unsigned char *header,
7bdd34
 		gss_buffer_desc utok, etok;
7bdd34
 		int rc, mlen;
7bdd34
 
7bdd34
-		mlen = strlen (msg);
7bdd34
+		mlen = strlen(msg);
7bdd34
 		utok.length = AUDIT_RMW_HEADER_SIZE + mlen;
7bdd34
-		utok.value = malloc (utok.length + 1);
7bdd34
+		utok.value = malloc(utok.length + 1);
7bdd34
 
7bdd34
-		memcpy (utok.value, header, AUDIT_RMW_HEADER_SIZE);
7bdd34
-		memcpy (utok.value+AUDIT_RMW_HEADER_SIZE, msg, mlen);
7bdd34
+		memcpy(utok.value, header, AUDIT_RMW_HEADER_SIZE);
7bdd34
+		memcpy(utok.value+AUDIT_RMW_HEADER_SIZE, msg, mlen);
7bdd34
 
7bdd34
 		/* Wrapping the message creates a token for the
7bdd34
 		   client.  Then we just have to worry about sending
7bdd34
 		   the token.  */
7bdd34
 
7bdd34
-		major_status = gss_wrap (&minor_status,
7bdd34
+		major_status = gss_wrap(&minor_status,
7bdd34
 					 io->gss_context,
7bdd34
 					 1,
7bdd34
 					 GSS_C_QOP_DEFAULT,
7bdd34
@@ -504,21 +504,21 @@ static void client_ack (void *ack_data, const unsigned char *header,
7bdd34
 		if (major_status != GSS_S_COMPLETE) {
7bdd34
 			gss_failure("encrypting message", major_status,
7bdd34
 					minor_status);
7bdd34
-			free (utok.value);
7bdd34
+			free(utok.value);
7bdd34
 			return;
7bdd34
 		}
7bdd34
 		// FIXME: What were we going to do with rc?
7bdd34
-		rc = send_token (io->io.fd, &etok);
7bdd34
-		free (utok.value);
7bdd34
+		rc = send_token(io->io.fd, &etok);
7bdd34
+		free(utok.value);
7bdd34
 		(void) gss_release_buffer(&minor_status, &etok);
7bdd34
 
7bdd34
 		return;
7bdd34
 	}
7bdd34
 #endif
7bdd34
 	// Send the header and a text error message if it exists
7bdd34
-	ar_write (io->io.fd, header, AUDIT_RMW_HEADER_SIZE);
7bdd34
+	ar_write(io->io.fd, header, AUDIT_RMW_HEADER_SIZE);
7bdd34
 	if (msg[0])
7bdd34
-		ar_write (io->io.fd, msg, strlen(msg));
7bdd34
+		ar_write(io->io.fd, msg, strlen(msg));
7bdd34
 }
7bdd34
 
7bdd34
 extern void distribute_event(struct auditd_event *e);
7bdd34
@@ -540,7 +540,7 @@ static void client_message (struct ev_tcp *io, unsigned int length,
7bdd34
 			unsigned char ack[AUDIT_RMW_HEADER_SIZE];
7bdd34
 			AUDIT_RMW_PACK_HEADER (ack, 0, AUDIT_RMW_TYPE_ACK,
7bdd34
 				0, seq);
7bdd34
-			client_ack (io, ack, "");
7bdd34
+			client_ack(io, ack, "");
7bdd34
 		} else {
7bdd34
 			struct auditd_event *e = create_event(
7bdd34
 					header+AUDIT_RMW_HEADER_SIZE,
7bdd34
@@ -552,10 +552,10 @@ static void client_message (struct ev_tcp *io, unsigned int length,
7bdd34
 	}
7bdd34
 }
7bdd34
 
7bdd34
-static void auditd_tcp_client_handler( struct ev_loop *loop,
7bdd34
-			struct ev_io *_io, int revents )
7bdd34
+static void auditd_tcp_client_handler(struct ev_loop *loop,
7bdd34
+			struct ev_io *_io, int revents)
7bdd34
 {
7bdd34
-	struct ev_tcp *io = (struct ev_tcp *) _io;
7bdd34
+	struct ev_tcp *io = (struct ev_tcp *)_io;
7bdd34
 	int i, r;
7bdd34
 	int total_this_call = 0;
7bdd34
 
7bdd34
@@ -586,18 +586,18 @@ static void auditd_tcp_client_handler( struct ev_loop *loop,
7bdd34
 	   otherwise fails, the read will return -1.  */
7bdd34
 	if (r <= 0) {
7bdd34
 		if (r < 0)
7bdd34
-			audit_msg (LOG_WARNING,
7bdd34
+			audit_msg(LOG_WARNING,
7bdd34
 				"client %s socket closed unexpectedly",
7bdd34
 				sockaddr_to_addr4(&io->addr));
7bdd34
 
7bdd34
 		/* There may have been a final message without a LF.  */
7bdd34
 		if (io->bufptr) {
7bdd34
-			client_message (io, io->bufptr, io->buffer);
7bdd34
+			client_message(io, io->bufptr, io->buffer);
7bdd34
 
7bdd34
 		}
7bdd34
 
7bdd34
-		ev_io_stop (loop, _io);
7bdd34
-		close_client (io);
7bdd34
+		ev_io_stop(loop, _io);
7bdd34
+		close_client(io);
7bdd34
 		return;
7bdd34
 	}
7bdd34
 
7bdd34
@@ -635,7 +635,7 @@ static void auditd_tcp_client_handler( struct ev_loop *loop,
7bdd34
 
7bdd34
 		/* Unwrapping the token gives us the original message,
7bdd34
 		   which we know is already a single record.  */
7bdd34
-		major_status = gss_unwrap (&minor_status, io->gss_context,
7bdd34
+		major_status = gss_unwrap(&minor_status, io->gss_context,
7bdd34
 				&etok, &utok, NULL, NULL);
7bdd34
 
7bdd34
 		if (major_status != GSS_S_COMPLETE) {
7bdd34
@@ -645,10 +645,10 @@ static void auditd_tcp_client_handler( struct ev_loop *loop,
7bdd34
 			/* client_message() wants to NUL terminate it,
7bdd34
 			   so copy it to a bigger buffer.  Plus, we
7bdd34
 			   want to add our own tag.  */
7bdd34
-			memcpy (msgbuf, utok.value, utok.length);
7bdd34
+			memcpy(msgbuf, utok.value, utok.length);
7bdd34
 			while (utok.length > 0 && msgbuf[utok.length-1] == '\n')
7bdd34
 				utok.length --;
7bdd34
-			snprintf (msgbuf + utok.length,
7bdd34
+			snprintf(msgbuf + utok.length,
7bdd34
 				MAX_AUDIT_MESSAGE_LENGTH - utok.length,
7bdd34
 				" krb5=%s", io->remote_name);
7bdd34
 			utok.length += 6 + io->remote_name_len;
7bdd34
@@ -681,7 +681,7 @@ static void auditd_tcp_client_handler( struct ev_loop *loop,
7bdd34
 			return;
7bdd34
 		
7bdd34
 		/* We have an I-byte message in buffer. Send ACK */
7bdd34
-		client_message (io, i, io->buffer);
7bdd34
+		client_message(io, i, io->buffer);
7bdd34
 
7bdd34
 	} else {
7bdd34
 		/* At this point, the buffer has IO->BUFPTR+R bytes in it.
7bdd34
@@ -701,7 +701,7 @@ static void auditd_tcp_client_handler( struct ev_loop *loop,
7bdd34
 		i++;
7bdd34
 
7bdd34
 		/* We have an I-byte message in buffer. Send ACK */
7bdd34
-		client_message (io, i, io->buffer);
7bdd34
+		client_message(io, i, io->buffer);
7bdd34
 	}
7bdd34
 
7bdd34
 	/* Now copy any remaining bytes to the beginning of the
7bdd34
@@ -730,7 +730,7 @@ static int auditd_tcpd_check(int sock)
7bdd34
 
7bdd34
 	request_init(&request, RQ_DAEMON, "auditd", RQ_FILE, sock, 0);
7bdd34
 	fromhost(&request);
7bdd34
-	if (! hosts_access(&request))
7bdd34
+	if (!hosts_access(&request))
7bdd34
 		return 1;
7bdd34
 	return 0;
7bdd34
 }
7bdd34
@@ -759,7 +759,7 @@ static int check_num_connections(struct sockaddr_in *aaddr)
7bdd34
 }
7bdd34
 
7bdd34
 static void auditd_tcp_listen_handler( struct ev_loop *loop,
7bdd34
-	struct ev_io *_io, int revents )
7bdd34
+	struct ev_io *_io, int revents)
7bdd34
 {
7bdd34
 	int one=1;
7bdd34
 	int afd;
7bdd34
@@ -770,7 +770,7 @@ static void auditd_tcp_listen_handler( struct ev_loop *loop,
7bdd34
 
7bdd34
 	/* Accept the connection and see where it's coming from.  */
7bdd34
 	aaddrlen = sizeof(aaddr);
7bdd34
-	afd = accept (_io->fd, (struct sockaddr *)&aaddr, &aaddrlen);
7bdd34
+	afd = accept(_io->fd, (struct sockaddr *)&aaddr, &aaddrlen);
7bdd34
 	if (afd == -1) {
7bdd34
         	audit_msg(LOG_ERR, "Unable to accept TCP connection");
7bdd34
 		return;
7bdd34
@@ -793,8 +793,8 @@ static void auditd_tcp_listen_handler( struct ev_loop *loop,
7bdd34
 
7bdd34
 	/* Verify it's coming from an authorized port.  We assume the firewall
7bdd34
 	 * will block attempts from unauthorized machines.  */
7bdd34
-	if (min_port > ntohs (aaddr.sin_port) ||
7bdd34
-					ntohs (aaddr.sin_port) > max_port) {
7bdd34
+	if (min_port > ntohs(aaddr.sin_port) ||
7bdd34
+					ntohs(aaddr.sin_port) > max_port) {
7bdd34
         	audit_msg(LOG_ERR, "TCP connection from %s rejected",
7bdd34
 				sockaddr_to_addr4(&aaddr));
7bdd34
 		snprintf(emsg, sizeof(emsg),
7bdd34
@@ -825,29 +825,29 @@ static void auditd_tcp_listen_handler( struct ev_loop *loop,
7bdd34
 	setsockopt(afd, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof (int));
7bdd34
 	setsockopt(afd, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, sizeof (int));
7bdd34
 	setsockopt(afd, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof (int));
7bdd34
-	set_close_on_exec (afd);
7bdd34
+	set_close_on_exec(afd);
7bdd34
 
7bdd34
 	/* Make the client data structure */
7bdd34
-	client = (struct ev_tcp *) malloc (sizeof (struct ev_tcp));
7bdd34
+	client = (struct ev_tcp *)malloc (sizeof (struct ev_tcp));
7bdd34
 	if (client == NULL) {
7bdd34
         	audit_msg(LOG_CRIT, "Unable to allocate TCP client data");
7bdd34
 		snprintf(emsg, sizeof(emsg),
7bdd34
 			"op=alloc addr=%s port=%d res=no",
7bdd34
 			sockaddr_to_ipv4(&aaddr),
7bdd34
-			ntohs (aaddr.sin_port));
7bdd34
+			ntohs(aaddr.sin_port));
7bdd34
 		send_audit_event(AUDIT_DAEMON_ACCEPT, emsg);
7bdd34
 		shutdown(afd, SHUT_RDWR);
7bdd34
 		close(afd);
7bdd34
 		return;
7bdd34
 	}
7bdd34
 
7bdd34
-	memset (client, 0, sizeof (struct ev_tcp));
7bdd34
+	memset(client, 0, sizeof (struct ev_tcp));
7bdd34
 	client->client_active = 1;
7bdd34
 
7bdd34
 	// Was watching for EV_ERROR, but libev 3.48 took it away
7bdd34
-	ev_io_init (&(client->io), auditd_tcp_client_handler, afd, EV_READ);
7bdd34
+	ev_io_init(&(client->io), auditd_tcp_client_handler, afd, EV_READ);
7bdd34
 
7bdd34
-	memcpy (&client->addr, &aaddr, sizeof (struct sockaddr_in));
7bdd34
+	memcpy(&client->addr, &aaddr, sizeof (struct sockaddr_in));
7bdd34
 
7bdd34
 #ifdef USE_GSSAPI
7bdd34
 	if (use_gss && negotiate_credentials (client)) {
7bdd34
@@ -860,7 +860,7 @@ static void auditd_tcp_listen_handler( struct ev_loop *loop,
7bdd34
 #endif
7bdd34
 
7bdd34
 	fcntl(afd, F_SETFL, O_NONBLOCK | O_NDELAY);
7bdd34
-	ev_io_start (loop, &(client->io));
7bdd34
+	ev_io_start(loop, &(client->io));
7bdd34
 
7bdd34
 	/* Add the new connection to a linked list of active clients.  */
7bdd34
 	client->next = client_chain;
7bdd34
@@ -883,7 +883,7 @@ static void auditd_set_ports(int minp, int maxp, int max_p_addr)
7bdd34
 }
7bdd34
 
7bdd34
 static void periodic_handler(struct ev_loop *loop, struct ev_periodic *per,
7bdd34
-			int revents )
7bdd34
+			int revents)
7bdd34
 {
7bdd34
 	struct daemon_conf *config = (struct daemon_conf *) per->data;
7bdd34
 	struct ev_tcp *ev, *next = NULL;
7bdd34
@@ -902,24 +902,24 @@ static void periodic_handler(struct ev_loop *loop, struct ev_periodic *per,
7bdd34
 		audit_msg(LOG_NOTICE,
7bdd34
 			"client %s idle too long - closing connection\n",
7bdd34
 			sockaddr_to_addr4(&(ev->addr)));
7bdd34
-		ev_io_stop (loop, &ev->io);
7bdd34
+		ev_io_stop(loop, &ev->io);
7bdd34
 		release_client(ev);
7bdd34
 		free(ev);
7bdd34
 	}
7bdd34
 }
7bdd34
 
7bdd34
-int auditd_tcp_listen_init ( struct ev_loop *loop, struct daemon_conf *config )
7bdd34
+int auditd_tcp_listen_init(struct ev_loop *loop, struct daemon_conf *config)
7bdd34
 {
7bdd34
 	struct addrinfo *ai, *runp;
7bdd34
 	struct addrinfo hints;
7bdd34
 	char local[16];
7bdd34
 	int one = 1, rc;
7bdd34
 
7bdd34
-	ev_periodic_init (&periodic_watcher, periodic_handler,
7bdd34
+	ev_periodic_init(&periodic_watcher, periodic_handler,
7bdd34
 			  0, config->tcp_client_max_idle, NULL);
7bdd34
 	periodic_watcher.data = config;
7bdd34
 	if (config->tcp_client_max_idle)
7bdd34
-		ev_periodic_start (loop, &periodic_watcher);
7bdd34
+		ev_periodic_start(loop, &periodic_watcher);
7bdd34
 
7bdd34
 	/* If the port is not set, that means we aren't going to
7bdd34
 	  listen for connections.  */
7bdd34
@@ -940,7 +940,7 @@ int auditd_tcp_listen_init ( struct ev_loop *loop, struct daemon_conf *config )
7bdd34
 	nlsocks = 0;
7bdd34
 	runp = ai;
7bdd34
 	while (runp && nlsocks < N_SOCKS) {
7bdd34
-		listen_socket[nlsocks] = socket (runp->ai_family,
7bdd34
+		listen_socket[nlsocks] = socket(runp->ai_family,
7bdd34
 				 runp->ai_socktype, runp->ai_protocol);
7bdd34
 		if (listen_socket[nlsocks] < 0) {
7bdd34
         		audit_msg(LOG_ERR, "Cannot create tcp listener socket");
7bdd34
@@ -950,7 +950,7 @@ int auditd_tcp_listen_init ( struct ev_loop *loop, struct daemon_conf *config )
7bdd34
 		/* This avoids problems if auditd needs to be restarted.  */
7bdd34
 		setsockopt(listen_socket[nlsocks], SOL_SOCKET, SO_REUSEADDR,
7bdd34
 				(char *)&one, sizeof (int));
7bdd34
-		set_close_on_exec (listen_socket[nlsocks]);
7bdd34
+		set_close_on_exec(listen_socket[nlsocks]);
7bdd34
 
7bdd34
 		if (bind(listen_socket[nlsocks], runp->ai_addr,
7bdd34
 						runp->ai_addrlen)) {
7bdd34
@@ -977,9 +977,9 @@ int auditd_tcp_listen_init ( struct ev_loop *loop, struct daemon_conf *config )
7bdd34
 			 p ? p->p_name: "?");
7bdd34
 		endprotoent();
7bdd34
 
7bdd34
-		ev_io_init (&tcp_listen_watcher, auditd_tcp_listen_handler,
7bdd34
+		ev_io_init(&tcp_listen_watcher, auditd_tcp_listen_handler,
7bdd34
 				listen_socket[nlsocks], EV_READ);
7bdd34
-		ev_io_start (loop, &tcp_listen_watcher);
7bdd34
+		ev_io_start(loop, &tcp_listen_watcher);
7bdd34
 non_fatal:
7bdd34
 		nlsocks++;
7bdd34
 		if (nlsocks == N_SOCKS)
7bdd34
@@ -1014,7 +1014,7 @@ int auditd_tcp_listen_init ( struct ev_loop *loop, struct daemon_conf *config )
7bdd34
 			key_file = "/etc/audit/audit.key";
7bdd34
 		setenv ("KRB5_KTNAME", key_file, 1);
7bdd34
 
7bdd34
-		if (stat (key_file, &st) == 0) {
7bdd34
+		if (stat(key_file, &st) == 0) {
7bdd34
 			if ((st.st_mode & 07777) != 0400) {
7bdd34
 				audit_msg (LOG_ERR,
7bdd34
 			 "%s is not mode 0400 (it's %#o) - compromised key?",
7bdd34
@@ -1022,7 +1022,7 @@ int auditd_tcp_listen_init ( struct ev_loop *loop, struct daemon_conf *config )
7bdd34
 				return -1;
7bdd34
 			}
7bdd34
 			if (st.st_uid != 0) {
7bdd34
-				audit_msg (LOG_ERR,
7bdd34
+				audit_msg(LOG_ERR,
7bdd34
 			 "%s is not owned by root (it's %d) - compromised key?",
7bdd34
 					   key_file, st.st_uid);
7bdd34
 				return -1;
7bdd34
@@ -1036,17 +1036,16 @@ int auditd_tcp_listen_init ( struct ev_loop *loop, struct daemon_conf *config )
7bdd34
 	return 0;
7bdd34
 }
7bdd34
 
7bdd34
-void auditd_tcp_listen_uninit ( struct ev_loop *loop,
7bdd34
-				struct daemon_conf *config )
7bdd34
+void auditd_tcp_listen_uninit(struct ev_loop *loop, struct daemon_conf *config)
7bdd34
 {
7bdd34
 #ifdef USE_GSSAPI
7bdd34
 	OM_uint32 status;
7bdd34
 #endif
7bdd34
 
7bdd34
-	ev_io_stop ( loop, &tcp_listen_watcher );
7bdd34
+	ev_io_stop(loop, &tcp_listen_watcher);
7bdd34
 	while (nlsocks >= 0) {
7bdd34
 		nlsocks--;
7bdd34
-		close ( listen_socket[nlsocks] );
7bdd34
+		close (listen_socket[nlsocks]);
7bdd34
 	}
7bdd34
 
7bdd34
 #ifdef USE_GSSAPI
7bdd34
@@ -1060,29 +1059,29 @@ void auditd_tcp_listen_uninit ( struct ev_loop *loop,
7bdd34
 		unsigned char ack[AUDIT_RMW_HEADER_SIZE];
7bdd34
 
7bdd34
 		AUDIT_RMW_PACK_HEADER (ack, 0, AUDIT_RMW_TYPE_ENDING, 0, 0);
7bdd34
-		client_ack (client_chain, ack, "");
7bdd34
-		ev_io_stop (loop, &client_chain->io);
7bdd34
-		close_client (client_chain);
7bdd34
+		client_ack(client_chain, ack, "");
7bdd34
+		ev_io_stop(loop, &client_chain->io);
7bdd34
+		close_client(client_chain);
7bdd34
 	}
7bdd34
 
7bdd34
 	if (config->tcp_client_max_idle)
7bdd34
-		ev_periodic_stop (loop, &periodic_watcher);
7bdd34
+		ev_periodic_stop(loop, &periodic_watcher);
7bdd34
 }
7bdd34
 
7bdd34
 static void periodic_reconfigure(struct daemon_conf *config)
7bdd34
 {
7bdd34
-	struct ev_loop *loop = ev_default_loop (EVFLAG_AUTO);
7bdd34
+	struct ev_loop *loop = ev_default_loop(EVFLAG_AUTO);
7bdd34
 	if (config->tcp_client_max_idle) {
7bdd34
-		ev_periodic_set (&periodic_watcher, ev_now (loop),
7bdd34
+		ev_periodic_set(&periodic_watcher, ev_now(loop),
7bdd34
 				 config->tcp_client_max_idle, NULL);
7bdd34
-		ev_periodic_start (loop, &periodic_watcher);
7bdd34
+		ev_periodic_start(loop, &periodic_watcher);
7bdd34
 	} else {
7bdd34
-		ev_periodic_stop (loop, &periodic_watcher);
7bdd34
+		ev_periodic_stop(loop, &periodic_watcher);
7bdd34
 	}
7bdd34
 }
7bdd34
 
7bdd34
-void auditd_tcp_listen_reconfigure ( struct daemon_conf *nconf,
7bdd34
-				     struct daemon_conf *oconf )
7bdd34
+void auditd_tcp_listen_reconfigure(struct daemon_conf *nconf,
7bdd34
+				     struct daemon_conf *oconf)
7bdd34
 {
7bdd34
 	use_libwrap = nconf->use_libwrap;
7bdd34
 
7bdd34
@@ -1112,3 +1111,4 @@ void auditd_tcp_listen_reconfigure ( struct daemon_conf *nconf,
7bdd34
 	// and recredential if needed.
7bdd34
 	oconf->krb5_principal = nconf->krb5_principal;
7bdd34
 }
7bdd34
+