Skip to content

Commit 69c08ef

Browse files
committed
Code hygiene fixes
Fixes if 32 bit size and a couple misc adjustments
1 parent 74fdd9f commit 69c08ef

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

audisp/plugins/remote/audisp-remote.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,8 @@ static int send_token(int s, gss_buffer_t tok)
747747
unsigned char lenbuf[4];
748748
unsigned int len;
749749

750-
if (tok->length > 0xffffffffUL)
750+
if (sizeof(tok->length) > sizeof(uint32_t) &&
751+
tok->length > 0xffffffffUL)
751752
return -1;
752753

753754
len = tok->length;

auplugin/auplugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ int auplugin_setvbuf_r(auplugin_fgets_state_t *st, void *buf, size_t buff_size,
9595

9696
/* auplugin family of functions prototypes */
9797
int auplugin_init(int inbound_fd, unsigned queue_size, int q_flags,
98-
const char *path);
98+
const char *path) __wur;
9999
void auplugin_stop(void);
100100
void auplugin_event_loop(auplugin_callback_ptr callback);
101101
int auplugin_event_feed(auparse_callback_ptr callback,

common/common.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@
4545
#ifndef __has_attribute
4646
# define __has_attribute(x) 0
4747
#endif
48+
#ifndef __attribute_const__
49+
# define __attribute_const__
50+
#endif
51+
#ifndef __attribute_pure__
52+
# define __attribute_pure__
53+
#endif
54+
#ifndef __nonnull
55+
# define __nonnull(params)
56+
#endif
4857

4958
/* Wrapper macros for optional atomics
5059
* Note: ATOMIC_INT and ATOMIC_UNSIGNED are defined in config.h */
@@ -71,7 +80,7 @@ AUDIT_HIDDEN_START
7180

7281
char *audit_strsplit_r(char *s, char **savedpp);
7382
char *audit_strsplit(char *s);
74-
int audit_is_last_record(int type);
83+
int audit_is_last_record(int type) __attribute_const__;
7584

7685
extern const char *SINGLE;
7786
extern const char *HALT;

src/auditd-event.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void cleanup_event(struct auditd_event *e);
5252
void format_event(struct auditd_event *e);
5353
void enqueue_event(struct auditd_event *e);
5454
void handle_event(struct auditd_event *e);
55+
void distribute_event(struct auditd_event *e);
5556
struct auditd_event *create_event(const char *msg, ack_func_type ack_func,
5657
void *ack_data, uint32_t sequence_id);
5758

src/auditd-listen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ static int send_token(int s, gss_buffer_t tok)
262262
unsigned char lenbuf[4];
263263
unsigned int len;
264264

265-
if (tok->length > 0xffffffffUL)
265+
if (sizeof(tok->length) > sizeof(uint32_t) &&
266+
tok->length > 0xffffffffUL)
266267
return -1;
267268
len = tok->length;
268269
lenbuf[0] = (len >> 24) & 0xff;
@@ -553,7 +554,6 @@ static void client_ack(void *ack_data, const unsigned char *header,
553554
ar_write(io->io.fd, msg, strlen(msg));
554555
}
555556

556-
extern void distribute_event(struct auditd_event *e);
557557
static void client_message (struct ev_tcp *io, unsigned int length,
558558
unsigned char *header)
559559
{

0 commit comments

Comments
 (0)