public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Peng Haitao <penght@cn.fujitsu.com>
To: Steve Grubb <sgrubb@redhat.com>
Cc: linux-audit@redhat.com
Subject: [PATCH] Fix the bug that use option "--session Login-Session-ID" cannot search out all matched logs
Date: Thu, 25 Nov 2010 16:06:16 +0800	[thread overview]
Message-ID: <4CEE18F8.3080703@cn.fujitsu.com> (raw)

Hello Steve,

Use option '--session Login-Session-ID' cannot search out the log which 
contains the given Login Session ID and message type is MAC_POLICY_LOAD.

For example:
# echo "type=MAC_POLICY_LOAD msg=audit(1290670949.711:413341): policy loaded auid=0 ses=218" | ausearch --session 218
<no matches>

Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
 src/ausearch-parse.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/ausearch-parse.c b/src/ausearch-parse.c
index 30a96a2..0ffea14 100755
--- a/src/ausearch-parse.c
+++ b/src/ausearch-parse.c
@@ -1551,14 +1551,14 @@ static int parse_simple_message(const lnode *n, search_items *s)
 		if (str) {
 			ptr = str + 4;
 			term = strchr(ptr, ' ');
-			if (term == NULL)
-				return 3;
-			*term = 0;
+			if (term)
+				*term = 0;
 			errno = 0;
 			s->session_id = strtoul(ptr, NULL, 10);
 			if (errno)
-				return 4;
-			*term = ' ';
+				return 3;
+			if (term)
+				*term = ' ';
 		}
 	}
 
@@ -1582,7 +1582,7 @@ static int parse_simple_message(const lnode *n, search_items *s)
 				else	// Set it back to something sane
 					term = str;
 			} else
-				return 5;
+				return 4;
 		}
 	}
 
@@ -1593,7 +1593,7 @@ static int parse_simple_message(const lnode *n, search_items *s)
 				//create
 				s->key = malloc(sizeof(slist));
 				if (s->key == NULL)
-					return 6;
+					return 5;
 				slist_create(s->key);
 			}
 			ptr = str + 4;
@@ -1612,7 +1612,7 @@ static int parse_simple_message(const lnode *n, search_items *s)
 					}
 					*term = '"';
 				} else
-					return 7;
+					return 6;
 			} else {
 				if (s->key) {
 					char *saved=NULL;
@@ -1652,7 +1652,7 @@ static int parse_simple_message(const lnode *n, search_items *s)
 			errno = 0;
 			s->success = strtoul(ptr, NULL, 10);
 			if (errno)
-				return 8;
+				return 7;
 			if (term)
 				*term = ' ';
 		}
-- 
1.7.0.1

-- 
Best Regards,
Peng Haitao

             reply	other threads:[~2010-11-25  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25  8:06 Peng Haitao [this message]
2010-12-06 16:41 ` [PATCH] Fix the bug that use option "--session Login-Session-ID" cannot search out all matched logs Steve Grubb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CEE18F8.3080703@cn.fujitsu.com \
    --to=penght@cn.fujitsu.com \
    --cc=linux-audit@redhat.com \
    --cc=sgrubb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox