PERFORCE change 146551 for review
Vincenzo Iozzo
snagg at FreeBSD.org
Sun Aug 3 19:35:21 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=146551
Change 146551 by snagg at snagg_macosx on 2008/08/03 19:34:21
Added test for close(2) and fixed a bug while checking error value
Affected files ...
.. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.c#6 edit
.. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_close.c#1 add
.. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_open.c#4 edit
.. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setgid.c#2 edit
.. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setuid.c#2 edit
Differences ...
==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.c#6 (text+ko) ====
@@ -338,8 +338,10 @@
int check_ret(au_ret32_t ret, int r, char *val)
{
if(ret.ret == r)
- //if(!strncmp(ret.status, val, strlen(ret.status) > strlen(val)?
- // strlen(ret.status): strlen(val)))
+ if(!ret.status)
+ if(!strncmp(val, "success", strlen(val)))
+ return 1;
+ else if(!strncmp(strerror(ret.status), val, strlen(val)))
return 1;
return 0;
}
@@ -393,7 +395,7 @@
if(fstat(fd, &s) == -1)
return 0;
- if(attr.mode == s.st_mode && attr.uid == s.st_uid && attr.gid == s.st_gid &&
+ if(attr.mode == (s.st_mode & ALLPERMS) && attr.uid == s.st_uid && attr.gid == s.st_gid &&
attr.nid == s.st_ino && attr.dev == s.st_dev)
return 1;
==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_open.c#4 (text+ko) ====
@@ -93,7 +93,10 @@
write_int(O_RDONLY, "arg2");
write_int(fd, "fd");
write_int(fd, "ret");
- write_string(strerror(errno), "ret_val");
+ if (ret == -1)
+ write_string(strerror(errno), "ret_val");
+ else
+ write_string("success", "ret_val");
write_end();
close(fd);
@@ -102,7 +105,10 @@
write_int(O_WRONLY, "arg2");
write_int(fd, "fd");
write_int(fd, "ret");
- write_string(strerror(errno), "ret_val");
+ if (ret == -1)
+ write_string(strerror(errno), "ret_val");
+ else
+ write_string("success", "ret_val");
write_end();
close(fd);
@@ -113,7 +119,10 @@
write_int(0666, "arg3");
write_int(fd, "fd");
write_int(fd, "ret");
- write_string(strerror(errno), "ret_val");
+ if (ret == -1)
+ write_string(strerror(errno), "ret_val");
+ else
+ write_string("success", "ret_val");
write_end();
close(fd);
@@ -311,7 +320,6 @@
}
close_auditpipe(fd, fdout);
end_channel();
- dump(path);
f = init_log(pid);
validate(f, head, path, pid);
fclose(f);
==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setgid.c#2 (text+ko) ====
@@ -87,13 +87,19 @@
ret = setgid(0);
write_int(0, "gid");
write_int(ret, "ret");
- write_string(strerror(errno), "ret_val");
+ if (ret == -1)
+ write_string(strerror(errno), "ret_val");
+ else
+ write_string("success", "ret_val");
write_end();
ret = setgid(1000);
write_int(1000, "gid");
write_int(ret, "ret");
- write_string(strerror(errno), "ret_val");
+ if (ret == -1)
+ write_string(strerror(errno), "ret_val");
+ else
+ write_string("success", "ret_val");
write_end();
end_channel();
@@ -148,7 +154,7 @@
}
bytesread += tok.len;
- /* Check only open syscals */
+ /* Check only setgid syscals */
if(tok.tt.hdr32.e_type == 205)
to_parse = VALID;
==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_setuid.c#2 (text+ko) ====
@@ -87,13 +87,19 @@
ret = setuid(1001);
write_int(1001, "uid");
write_int(ret, "ret");
- write_string(strerror(errno), "ret_val");
+ if (ret == -1)
+ write_string(strerror(errno), "ret_val");
+ else
+ write_string("success", "ret_val");
write_end();
ret = setuid(0);
write_int(0, "uid");
write_int(ret, "ret");
- write_string(strerror(errno), "ret_val");
+ if (ret == -1)
+ write_string(strerror(errno), "ret_val");
+ else
+ write_string("success", "ret_val");
write_end();
end_channel();
@@ -148,7 +154,7 @@
}
bytesread += tok.len;
- /* Check only open syscals */
+ /* Check only setuid syscals */
if(tok.tt.hdr32.e_type == 200)
to_parse = VALID;
More information about the p4-projects
mailing list