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

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