Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 936080
Collapse All | Expand All

(-)a/audisp/audispd-llist.c (-5 / +5 lines)
Lines 69-83 unsigned int plist_count_active(const conf_llist *l) Link Here
69
	return cnt;
69
	return cnt;
70
}
70
}
71
71
72
void plist_append(conf_llist *l, plugin_conf_t *p)
72
int plist_append(conf_llist *l, plugin_conf_t *p)
73
{
73
{
74
	lnode* newnode;
74
	lnode* newnode;
75
75
76
	newnode = malloc(sizeof(lnode));
76
	newnode = malloc(sizeof(lnode));
77
	if (newnode == NULL) {
77
	if (newnode == NULL)
78
		printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
78
		return 1;
79
		return;
80
	}
81
79
82
	if (p) {
80
	if (p) {
83
		void *pp = malloc(sizeof(struct plugin_conf));
81
		void *pp = malloc(sizeof(struct plugin_conf));
Lines 98-103 void plist_append(conf_llist *l, plugin_conf_t *p) Link Here
98
	// make newnode current
96
	// make newnode current
99
	l->cur = newnode;
97
	l->cur = newnode;
100
	l->cnt++;
98
	l->cnt++;
99
100
	return 0;
101
}
101
}
102
102
103
void plist_clear(conf_llist* l)
103
void plist_clear(conf_llist* l)
(-)a/audisp/audispd-llist.h (-2 / +2 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
* audispd-llist.h - Header file for ausearch-conf_llist.c
2
* audispd-llist.h - Header file for ausearch-conf_llist.c
3
* Copyright (c) 2007,2013 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2007,2013 Red Hat Inc.
4
* All Rights Reserved.
4
* All Rights Reserved.
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
Lines 51-57 unsigned int plist_count_active(const conf_llist *l); Link Here
51
void plist_last(conf_llist *l);
51
void plist_last(conf_llist *l);
52
lnode *plist_next(conf_llist *l);
52
lnode *plist_next(conf_llist *l);
53
static inline lnode *plist_get_cur(conf_llist *l) { return l->cur; }
53
static inline lnode *plist_get_cur(conf_llist *l) { return l->cur; }
54
void plist_append(conf_llist *l, plugin_conf_t *p);
54
int plist_append(conf_llist *l, plugin_conf_t *p);
55
void plist_clear(conf_llist* l);
55
void plist_clear(conf_llist* l);
56
void plist_mark_all_unchecked(conf_llist* l);
56
void plist_mark_all_unchecked(conf_llist* l);
57
lnode *plist_find_unchecked(conf_llist* l);
57
lnode *plist_find_unchecked(conf_llist* l);
(-)a/auparse/normalize-llist.c (-6 / +6 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
 * normalize-llist.c - Minimal linked list library
2
 * normalize-llist.c - Minimal linked list library
3
 * Copyright (c) 2016-17 Red Hat Inc., Durham, North Carolina.
3
 * Copyright (c) 2016-17 Red Hat Inc.
4
 * All Rights Reserved. 
4
 * All Rights Reserved. 
5
 *
5
 *
6
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
Lines 61-75 data_node *cllist_next(cllist *l) Link Here
61
	return l->cur;
61
	return l->cur;
62
}
62
}
63
63
64
void cllist_append(cllist *l, uint32_t num, void *data)
64
// Returns 0 on success and 1 on error
65
int cllist_append(cllist *l, uint32_t num, void *data)
65
{
66
{
66
	data_node *newnode;
67
	data_node *newnode;
67
68
68
	newnode = malloc(sizeof(data_node));
69
	newnode = malloc(sizeof(data_node));
69
	if (newnode == NULL) {
70
	if (newnode == NULL)
70
		printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
71
		return 1;
71
		return;
72
	}
73
72
74
	newnode->num = num;
73
	newnode->num = num;
75
	newnode->data = data;
74
	newnode->data = data;
Lines 84-88 void cllist_append(cllist *l, uint32_t num, void *data) Link Here
84
	// make newnode current
83
	// make newnode current
85
	l->cur = newnode;
84
	l->cur = newnode;
86
	l->cnt++;
85
	l->cnt++;
86
	return 0;
87
}
87
}
88
88
(-)a/auparse/normalize-llist.h (-2 / +2 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
 * normalize-llist.h - Header file for normalize-llist.c
2
 * normalize-llist.h - Header file for normalize-llist.c
3
 * Copyright (c) 2016-17 Red Hat Inc., Durham, North Carolina.
3
 * Copyright (c) 2016-17 Red Hat Inc.
4
 * All Rights Reserved.
4
 * All Rights Reserved.
5
 *
5
 *
6
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
Lines 53-59 AUDIT_HIDDEN_START Link Here
53
void cllist_create(cllist *l, void (*cleanup)(void *));
53
void cllist_create(cllist *l, void (*cleanup)(void *));
54
void cllist_clear(cllist* l);
54
void cllist_clear(cllist* l);
55
data_node *cllist_next(cllist *l);
55
data_node *cllist_next(cllist *l);
56
void cllist_append(cllist *l, uint32_t num, void *data);
56
int cllist_append(cllist *l, uint32_t num, void *data);
57
57
58
AUDIT_HIDDEN_END
58
AUDIT_HIDDEN_END
59
59
(-)a/auparse/normalize.c (-5 / +9 lines)
Lines 179-185 static unsigned int add_subj_attr(auparse_state_t *au, const char *str, Link Here
179
	if ((auparse_find_field(au, str))) {
179
	if ((auparse_find_field(au, str))) {
180
		attr = set_record(0, rnum);
180
		attr = set_record(0, rnum);
181
		attr = set_field(attr, auparse_get_field_num(au));
181
		attr = set_field(attr, auparse_get_field_num(au));
182
		cllist_append(&D.actor.attr, attr, NULL);
182
		if (cllist_append(&D.actor.attr, attr, NULL))
183
			return 1;
183
		return 0;
184
		return 0;
184
	} else
185
	} else
185
		auparse_goto_record_num(au, rnum);
186
		auparse_goto_record_num(au, rnum);
Lines 224-230 static unsigned int add_obj_attr(auparse_state_t *au, const char *str, Link Here
224
	if ((auparse_find_field(au, str))) {
225
	if ((auparse_find_field(au, str))) {
225
		attr = set_record(0, rnum);
226
		attr = set_record(0, rnum);
226
		attr = set_field(attr, auparse_get_field_num(au));
227
		attr = set_field(attr, auparse_get_field_num(au));
227
		cllist_append(&D.thing.attr, attr, NULL);
228
		if (cllist_append(&D.thing.attr, attr, NULL))
229
			return 1;
228
		return 0;
230
		return 0;
229
	} else
231
	} else
230
		auparse_goto_record_num(au, rnum);
232
		auparse_goto_record_num(au, rnum);
Lines 360-380 static void collect_id_obj2(auparse_state_t *au, const char *syscall) Link Here
360
	}
362
	}
361
}
363
}
362
364
363
static void collect_path_attrs(auparse_state_t *au)
365
static int collect_path_attrs(auparse_state_t *au)
364
{
366
{
365
	value_t attr;
367
	value_t attr;
366
	unsigned int rnum = auparse_get_record_num(au);
368
	unsigned int rnum = auparse_get_record_num(au);
367
369
368
	auparse_first_field(au);
370
	auparse_first_field(au);
369
	if (add_obj_attr(au, "mode", rnum))
371
	if (add_obj_attr(au, "mode", rnum))
370
		return;	// Failed opens don't have anything else
372
		return 1;	// Failed opens don't have anything else
371
373
372
	// All the rest of the fields matter
374
	// All the rest of the fields matter
373
	while ((auparse_next_field(au))) {
375
	while ((auparse_next_field(au))) {
374
		attr = set_record(0, rnum);
376
		attr = set_record(0, rnum);
375
		attr = set_field(attr, auparse_get_field_num(au));
377
		attr = set_field(attr, auparse_get_field_num(au));
376
		cllist_append(&D.thing.attr, attr, NULL);
378
		if (cllist_append(&D.thing.attr, attr, NULL))
379
			return 1;
377
	}
380
	}
381
	return 0;
378
}
382
}
379
383
380
static void collect_cwd_attrs(auparse_state_t *au)
384
static void collect_cwd_attrs(auparse_state_t *au)
(-)a/src/auditctl-llist.c (-9 / +9 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
* ausearch-llist.c - Minimal linked list library
2
* ausearch-llist.c - Minimal linked list library
3
* Copyright (c) 2005 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2005 Red Hat Inc.
4
* All Rights Reserved. 
4
* All Rights Reserved.
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
7
* terms of the GNU General Public License as published by the Free
7
* terms of the GNU General Public License as published by the Free
Lines 15-21 Link Here
15
*
15
*
16
* You should have received a copy of the GNU General Public License
16
* You should have received a copy of the GNU General Public License
17
* along with this program; see the file COPYING. If not, write to the
17
* along with this program; see the file COPYING. If not, write to the
18
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor 
18
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
19
* Boston, MA 02110-1335, USA.
19
* Boston, MA 02110-1335, USA.
20
*
20
*
21
* Authors:
21
* Authors:
Lines 59-77 lnode *list_next(llist *l) Link Here
59
	return l->cur;
59
	return l->cur;
60
}
60
}
61
61
62
void list_append(llist *l, struct audit_rule_data *r, size_t sz)
62
int list_append(llist *l, struct audit_rule_data *r, size_t sz)
63
{
63
{
64
	lnode* newnode;
64
	lnode* newnode;
65
65
66
	newnode = malloc(sizeof(lnode));
66
	newnode = malloc(sizeof(lnode));
67
	if (newnode == NULL) {
67
	if (newnode == NULL)
68
		printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
68
		return 1;
69
		return;
70
	}
71
69
72
	if (r) {
70
	if (r) {
73
		void *rr = malloc(sz);
71
		void *rr = malloc(sz);
74
		if (rr) 
72
		if (rr)
75
			memcpy(rr, r, sz);
73
			memcpy(rr, r, sz);
76
		newnode->r = rr;
74
		newnode->r = rr;
77
	} else
75
	} else
Lines 89-94 void list_append(llist *l, struct audit_rule_data *r, size_t sz) Link Here
89
	// make newnode current
87
	// make newnode current
90
	l->cur = newnode;
88
	l->cur = newnode;
91
	l->cnt++;
89
	l->cnt++;
90
91
	return 0;
92
}
92
}
93
93
94
void list_clear(llist* l)
94
void list_clear(llist* l)
(-)a/src/auditctl-llist.h (-2 / +2 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
* auditctl-llist.h - Header file for ausearch-llist.c
2
* auditctl-llist.h - Header file for ausearch-llist.c
3
* Copyright (c) 2005 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2005 Red Hat Inc.
4
* All Rights Reserved.
4
* All Rights Reserved.
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
Lines 50-56 void list_first(llist *l); Link Here
50
void list_last(llist *l);
50
void list_last(llist *l);
51
lnode *list_next(llist *l);
51
lnode *list_next(llist *l);
52
static inline lnode *list_get_cur(llist *l) { return l->cur; }
52
static inline lnode *list_get_cur(llist *l) { return l->cur; }
53
void list_append(llist *l, struct audit_rule_data *r, size_t sz);
53
int list_append(llist *l, struct audit_rule_data *r, size_t sz);
54
void list_clear(llist* l);
54
void list_clear(llist* l);
55
55
56
#endif
56
#endif
(-)a/src/ausearch-avc.c (-8 / +8 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
* ausearch-avc.c - Minimal linked list library for avcs
2
* ausearch-avc.c - Minimal linked list library for avcs
3
* Copyright (c) 2006,2008,2014 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2006,2008,2014 Red Hat Inc.
4
* All Rights Reserved. 
4
* All Rights Reserved.
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
7
* terms of the GNU General Public License as published by the Free
7
* terms of the GNU General Public License as published by the Free
Lines 15-21 Link Here
15
*
15
*
16
* You should have received a copy of the GNU General Public License
16
* You should have received a copy of the GNU General Public License
17
* along with this program; see the file COPYING. If not, write to the
17
* along with this program; see the file COPYING. If not, write to the
18
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor 
18
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
19
* Boston, MA 02110-1335, USA.
19
* Boston, MA 02110-1335, USA.
20
*
20
*
21
* Authors:
21
* Authors:
Lines 62-76 static void alist_last(alist *l) Link Here
62
	l->cur = cur;
62
	l->cur = cur;
63
}
63
}
64
64
65
void alist_append(alist *l, anode *node)
65
int alist_append(alist *l, anode *node)
66
{
66
{
67
	anode* newnode;
67
	anode* newnode;
68
68
69
	newnode = malloc(sizeof(anode));
69
	newnode = malloc(sizeof(anode));
70
	if (newnode == NULL) {
70
	if (newnode == NULL)
71
		printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
71
		return 1;
72
		return;
73
	}
74
72
75
	if (node->scontext)
73
	if (node->scontext)
76
		newnode->scontext = node->scontext;
74
		newnode->scontext = node->scontext;
Lines 108-113 void alist_append(alist *l, anode *node) Link Here
108
	// make newnode current
106
	// make newnode current
109
	l->cur = newnode;
107
	l->cur = newnode;
110
	l->cnt++;
108
	l->cnt++;
109
110
	return 0;
111
}
111
}
112
112
113
int alist_find_subj(alist *l)
113
int alist_find_subj(alist *l)
(-)a/src/ausearch-avc.h (-2 / +2 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
* ausearch-avc.h - Header file for ausearch-string.c
2
* ausearch-avc.h - Header file for ausearch-string.c
3
* Copyright (c) 2006,2008 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2006,2008 Red Hat Inc.
4
* All Rights Reserved.
4
* All Rights Reserved.
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
Lines 54-60 void alist_create(alist *l); Link Here
54
static inline void alist_first(alist *l) { l->cur = l->head; }
54
static inline void alist_first(alist *l) { l->cur = l->head; }
55
anode *alist_next(alist *l);
55
anode *alist_next(alist *l);
56
static inline anode *alist_get_cur(alist *l) { return l->cur; }
56
static inline anode *alist_get_cur(alist *l) { return l->cur; }
57
void alist_append(alist *l, anode *node);
57
int alist_append(alist *l, anode *node);
58
void anode_init(anode *an);
58
void anode_init(anode *an);
59
void anode_clear(anode *an);
59
void anode_clear(anode *an);
60
void alist_clear(alist* l);
60
void alist_clear(alist* l);
(-)a/src/ausearch-int.c (-6 / +6 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
* ausearch-int.c - Minimal linked list library for integers
2
* ausearch-int.c - Minimal linked list library for integers
3
* Copyright (c) 2005,2008 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2005,2008 Red Hat Inc.
4
* All Rights Reserved. 
4
* All Rights Reserved. 
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
Lines 41-55 int_node *ilist_next(ilist *l) Link Here
41
	return l->cur;
41
	return l->cur;
42
}
42
}
43
43
44
void ilist_append(ilist *l, int num, unsigned int hits, int aux)
44
int ilist_append(ilist *l, int num, unsigned int hits, int aux)
45
{
45
{
46
	int_node* newnode;
46
	int_node* newnode;
47
47
48
	newnode = malloc(sizeof(int_node));
48
	newnode = malloc(sizeof(int_node));
49
	if (newnode == NULL) {
49
	if (newnode == NULL)
50
		printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
50
		return 1;
51
		return;
52
	}
53
51
54
	newnode->num = num;
52
	newnode->num = num;
55
	newnode->hits = hits;
53
	newnode->hits = hits;
Lines 65-70 void ilist_append(ilist *l, int num, unsigned int hits, int aux) Link Here
65
	// make newnode current
63
	// make newnode current
66
	l->cur = newnode;
64
	l->cur = newnode;
67
	l->cnt++;
65
	l->cnt++;
66
67
	return 0;
68
}
68
}
69
69
70
void ilist_clear(ilist* l)
70
void ilist_clear(ilist* l)
(-)a/src/ausearch-int.h (-2 / +2 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
* ausearch-int.h - Header file for ausearch-int.c
2
* ausearch-int.h - Header file for ausearch-int.c
3
* Copyright (c) 2005,2008 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2005,2008 Red Hat Inc.
4
* All Rights Reserved.
4
* All Rights Reserved.
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
Lines 48-54 void ilist_create(ilist *l); Link Here
48
static inline void ilist_first(ilist *l) { l->cur = l->head; }
48
static inline void ilist_first(ilist *l) { l->cur = l->head; }
49
int_node *ilist_next(ilist *l);
49
int_node *ilist_next(ilist *l);
50
static inline int_node *ilist_get_cur(ilist *l) { return l->cur; }
50
static inline int_node *ilist_get_cur(ilist *l) { return l->cur; }
51
void ilist_append(ilist *l, int num, unsigned int hits, int aux);
51
int ilist_append(ilist *l, int num, unsigned int hits, int aux);
52
void ilist_clear(ilist* l);
52
void ilist_clear(ilist* l);
53
53
54
/* append a number if its not already on the list */
54
/* append a number if its not already on the list */
(-)a/src/ausearch-llist.c (-7 / +7 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
* ausearch-llist.c - Minimal linked list library
2
* ausearch-llist.c - Minimal linked list library
3
* Copyright (c) 2005-2008,2011,2016 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2005-2008,2011,2016 Red Hat Inc.
4
* Copyright (c) 2011 IBM Corp.
4
* Copyright (c) 2011 IBM Corp.
5
* All Rights Reserved. 
5
* All Rights Reserved. 
6
*
6
*
Lines 102-116 lnode *list_prev(llist *l) Link Here
102
	return l->cur;
102
	return l->cur;
103
}
103
}
104
104
105
void list_append(llist *l, lnode *node)
105
int list_append(llist *l, lnode *node)
106
{
106
{
107
	lnode* newnode;
107
	lnode* newnode;
108
108
109
	newnode = malloc(sizeof(lnode));
109
	newnode = malloc(sizeof(lnode));
110
	if (newnode == NULL) {
110
	if (newnode == NULL)
111
		printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
111
		return 1;
112
		return;
113
	}
114
112
115
	if (node->message)
113
	if (node->message)
116
		newnode->message = node->message;
114
		newnode->message = node->message;
Lines 123-129 void list_append(llist *l, lnode *node) Link Here
123
	newnode->type = node->type;
121
	newnode->type = node->type;
124
	newnode->a0 = node->a0;
122
	newnode->a0 = node->a0;
125
	newnode->a1 = node->a1;
123
	newnode->a1 = node->a1;
126
	newnode->item = l->cnt; 
124
	newnode->item = l->cnt;
127
	newnode->next = NULL;
125
	newnode->next = NULL;
128
126
129
	// if we are at top, fix this up
127
	// if we are at top, fix this up
Lines 135-140 void list_append(llist *l, lnode *node) Link Here
135
	// make newnode current
133
	// make newnode current
136
	l->cur = newnode;
134
	l->cur = newnode;
137
	l->cnt++;
135
	l->cnt++;
136
137
	return 0;
138
}
138
}
139
139
140
int list_find_item(llist *l, unsigned int i)
140
int list_find_item(llist *l, unsigned int i)
(-)a/src/ausearch-llist.h (-1 / +1 lines)
Lines 107-113 void list_last(llist *l); Link Here
107
lnode *list_next(llist *l);
107
lnode *list_next(llist *l);
108
lnode *list_prev(llist *l);
108
lnode *list_prev(llist *l);
109
static inline lnode *list_get_cur(llist *l) { return l->cur; }
109
static inline lnode *list_get_cur(llist *l) { return l->cur; }
110
void list_append(llist *l, lnode *node);
110
int list_append(llist *l, lnode *node);
111
void list_clear(llist* l);
111
void list_clear(llist* l);
112
int list_get_event(llist* l, event *e);
112
int list_get_event(llist* l, event *e);
113
113
(-)a/src/ausearch-nvpair.c (-6 / +6 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
* ausearch-nvpair.c - Minimal linked list library for name-value pairs
2
* ausearch-nvpair.c - Minimal linked list library for name-value pairs
3
* Copyright (c) 2006-08 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2006-08 Red Hat Inc.
4
* All Rights Reserved. 
4
* All Rights Reserved. 
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
Lines 42-54 nvnode *search_list_next(nvlist *l) Link Here
42
	return l->cur;
42
	return l->cur;
43
}
43
}
44
44
45
void search_list_append(nvlist *l, nvnode *node)
45
int search_list_append(nvlist *l, nvnode *node)
46
{
46
{
47
	nvnode* newnode = malloc(sizeof(nvnode));
47
	nvnode* newnode = malloc(sizeof(nvnode));
48
	if (newnode == NULL) {
48
	if (newnode == NULL)
49
		printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
49
		return 1;
50
		return;
51
	}
52
50
53
	newnode->name = node->name;
51
	newnode->name = node->name;
54
	newnode->val = node->val;
52
	newnode->val = node->val;
Lines 66-71 void search_list_append(nvlist *l, nvnode *node) Link Here
66
	// make newnode current
64
	// make newnode current
67
	l->cur = newnode;
65
	l->cur = newnode;
68
	l->cnt++;
66
	l->cnt++;
67
68
	return 0;
69
}
69
}
70
70
71
int search_list_find_val(nvlist *l, long val)
71
int search_list_find_val(nvlist *l, long val)
(-)a/src/ausearch-nvpair.h (-2 / +2 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
* ausearch-nvpair.h - Header file for ausearch-nvpair.c
2
* ausearch-nvpair.h - Header file for ausearch-nvpair.c
3
* Copyright (c) 2006-08 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2006-08 Red Hat Inc.
4
* All Rights Reserved.
4
* All Rights Reserved.
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
Lines 48-54 void search_list_create(nvlist *l); Link Here
48
static inline void search_list_first(nvlist *l) { l->cur = l->head; }
48
static inline void search_list_first(nvlist *l) { l->cur = l->head; }
49
nvnode *search_list_next(nvlist *l);
49
nvnode *search_list_next(nvlist *l);
50
static inline nvnode *search_list_get_cur(nvlist *l) { return l->cur; }
50
static inline nvnode *search_list_get_cur(nvlist *l) { return l->cur; }
51
void search_list_append(nvlist *l, nvnode *node);
51
int search_list_append(nvlist *l, nvnode *node);
52
void search_list_clear(nvlist* l);
52
void search_list_clear(nvlist* l);
53
53
54
/* Given a numeric index, find that record. */
54
/* Given a numeric index, find that record. */
(-)a/src/ausearch-string.c (-5 / +5 lines)
Lines 44-58 snode *slist_next(slist *l) Link Here
44
	return l->cur;
44
	return l->cur;
45
}
45
}
46
46
47
void slist_append(slist *l, snode *node)
47
int slist_append(slist *l, snode *node)
48
{
48
{
49
	snode* newnode;
49
	snode* newnode;
50
50
51
	newnode = malloc(sizeof(snode));
51
	newnode = malloc(sizeof(snode));
52
	if (newnode == NULL) {
52
	if (newnode == NULL)
53
		printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
53
		return 1;
54
		return;
55
	}
56
54
57
	if (node->str)
55
	if (node->str)
58
		newnode->str = node->str;
56
		newnode->str = node->str;
Lines 79-84 void slist_append(slist *l, snode *node) Link Here
79
	// make newnode current
77
	// make newnode current
80
	l->cur = newnode;
78
	l->cur = newnode;
81
	l->cnt++;
79
	l->cnt++;
80
81
	return 0;
82
}
82
}
83
83
84
void slist_clear(slist* l)
84
void slist_clear(slist* l)
(-)a/src/ausearch-string.h (-1 / +1 lines)
Lines 49-55 void slist_create(slist *l); Link Here
49
static inline void slist_first(slist *l) { l->cur = l->head; }
49
static inline void slist_first(slist *l) { l->cur = l->head; }
50
snode *slist_next(slist *l);
50
snode *slist_next(slist *l);
51
static inline snode *slist_get_cur(slist *l) { return l->cur; }
51
static inline snode *slist_get_cur(slist *l) { return l->cur; }
52
void slist_append(slist *l, snode *node);
52
int slist_append(slist *l, snode *node);
53
void slist_clear(slist* l);
53
void slist_clear(slist* l);
54
54
55
/* append a string if its not already on the list */
55
/* append a string if its not already on the list */
(-)a/tools/aulastlog/aulastlog-llist.c (-9 / +9 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
* aulastlog-llist.c - Minimal linked list library
2
* aulastlog-llist.c - Minimal linked list library
3
* Copyright (c) 2008 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2008 Red Hat Inc..
4
* All Rights Reserved. 
4
* All Rights Reserved.
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
7
* terms of the GNU General Public License as published by the Free
7
* terms of the GNU General Public License as published by the Free
Lines 15-21 Link Here
15
*
15
*
16
* You should have received a copy of the GNU General Public License
16
* You should have received a copy of the GNU General Public License
17
* along with this program; see the file COPYING. If not, write to the
17
* along with this program; see the file COPYING. If not, write to the
18
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor 
18
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
19
* Boston, MA 02110-1335, USA.
19
* Boston, MA 02110-1335, USA.
20
*
20
*
21
* Authors:
21
* Authors:
Lines 41-55 lnode *list_next(llist *l) Link Here
41
	return l->cur;
41
	return l->cur;
42
}
42
}
43
43
44
void list_append(llist *l, lnode *node)
44
int list_append(llist *l, lnode *node)
45
{
45
{
46
	lnode* newnode;
46
	lnode* newnode;
47
47
48
	newnode = malloc(sizeof(lnode));
48
	newnode = malloc(sizeof(lnode));
49
	if (newnode == NULL) {
49
	if (newnode == NULL)
50
		printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
50
		return 1;
51
		return;
52
	}
53
51
54
	newnode->sec = node->sec;
52
	newnode->sec = node->sec;
55
	newnode->uid = node->uid;
53
	newnode->uid = node->uid;
Lines 62-68 void list_append(llist *l, lnode *node) Link Here
62
		newnode->term = strdup(node->term);
60
		newnode->term = strdup(node->term);
63
	else
61
	else
64
		newnode->term = NULL;
62
		newnode->term = NULL;
65
	newnode->item = l->cnt; 
63
	newnode->item = l->cnt;
66
	newnode->next = NULL;
64
	newnode->next = NULL;
67
65
68
	// if we are at top, fix this up
66
	// if we are at top, fix this up
Lines 74-79 void list_append(llist *l, lnode *node) Link Here
74
	// make newnode current
72
	// make newnode current
75
	l->cur = newnode;
73
	l->cur = newnode;
76
	l->cnt++;
74
	l->cnt++;
75
76
	return 0;
77
}
77
}
78
78
79
void list_clear(llist* l)
79
void list_clear(llist* l)
(-)a/tools/aulastlog/aulastlog-llist.h (-2 / +2 lines)
Lines 1-6 Link Here
1
/*
1
/*
2
* aulastlog-llist.h - Header file for aulastlog-llist.c
2
* aulastlog-llist.h - Header file for aulastlog-llist.c
3
* Copyright (c) 2008 Red Hat Inc., Durham, North Carolina.
3
* Copyright (c) 2008 Red Hat Inc.
4
* All Rights Reserved.
4
* All Rights Reserved.
5
*
5
*
6
* This software may be freely redistributed and/or modified under the
6
* This software may be freely redistributed and/or modified under the
Lines 53-59 static inline void list_first(llist *l) { l->cur = l->head; } Link Here
53
lnode *list_next(llist *l);
53
lnode *list_next(llist *l);
54
static inline lnode *list_get_cur(llist *l) { return l->cur; }
54
static inline lnode *list_get_cur(llist *l) { return l->cur; }
55
static inline unsigned int list_get_cnt(llist *l) { return l->cnt; }
55
static inline unsigned int list_get_cnt(llist *l) { return l->cnt; }
56
void list_append(llist *l, lnode *node);
56
int list_append(llist *l, lnode *node);
57
void list_clear(llist* l);
57
void list_clear(llist* l);
58
int list_update_login(llist* l, time_t t);
58
int list_update_login(llist* l, time_t t);
59
int list_update_host(llist* l, const char *h);
59
int list_update_host(llist* l, const char *h);

Return to bug 936080