PERFORCE change 146695 for review
Vincenzo Iozzo
snagg at FreeBSD.org
Tue Aug 5 11:33:45 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=146695
Change 146695 by snagg at snagg_macosx on 2008/08/05 11:33:16
Fix a bug in open(2) tests, add rename(2) tests
Affected files ...
.. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.c#8 edit
.. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.h#6 edit
.. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_open.c#6 edit
.. //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_rename.c#1 add
Differences ...
==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.c#8 (text+ko) ====
@@ -127,7 +127,7 @@
ptr = string;
sem_post(mutex_client);
- return ptr;
+ return (ptr);
}
/*
@@ -144,7 +144,7 @@
if((string = strsep(&str, "\\!!")) != NULL)
{
str +=2;
- return str;
+ return (str);
}
}
@@ -157,19 +157,19 @@
{
char *str;
if(!strncmp(string, "END", 3))
- return -1;
+ return (-1);
str = string;
if((string = strsep(&str, ":**")) != NULL)
{
if(!strncmp(str, "**INT", 5))
- return INT_TYPE;
+ return (INT_TYPE);
if(!strncmp(str, "**CHAR",6))
- return CHAR_TYPE;
+ return (CHAR_TYPE);
if(!strncmp(str, "**STRING",8))
- return STRING_TYPE;
+ return (STRING_TYPE);
}
- return -1;
+ return (-1);
}
/*
@@ -181,16 +181,16 @@
char *val;
if(string == NULL)
- return -1;
+ return (-1);
ret = strtol(string, &val, 0);
if(!ret && errno == EINVAL)
- return -1;
+ return (-1);
if(*val == '\0')
- return ret;
+ return (ret);
- return -1;
+ return (-1);
}
/*
@@ -199,11 +199,11 @@
char get_c(char *string)
{
if(strlen(string) != sizeof(char))
- return '\0';
+ return ('\0');
else
- return string[0];
+ return (string[0]);
- return '\0';
+ return ('\0');
}
/*
@@ -244,7 +244,7 @@
fprintf(st, "\n");
count++;
if(count == 20)
- return -1;
+ return (-1);
if(exit)
break;
if(*buffer == AU_TRAILER_TOKEN)
@@ -252,7 +252,7 @@
}
fflush(st);
- return 0;
+ return (0);
}
@@ -303,7 +303,7 @@
break;
}
- return p;
+ return (p);
}
/*
@@ -320,7 +320,7 @@
if(f == NULL)
err(-1, "FOPEN");
- return f;
+ return (f);
}
void report_error(tokenstr_t tok, FILE *f)
@@ -340,10 +340,10 @@
if(ret.ret == r)
if(!ret.status)
if(!strncmp(val, "success", strlen(val)))
- return 1;
+ return (1);
else if(!strncmp(strerror(ret.status), val, strlen(val)))
- return 1;
- return 0;
+ return (1);
+ return (0);
}
/*
@@ -352,12 +352,12 @@
int check_path(au_path_t path, char *val)
{
if(!path.len)
- return -1;
+ return (-1);
if(!strncmp(path.path, val, path.len > strlen(val)? path.len: strlen(val)))
- return 1;
+ return (1);
- return 0;
+ return (0);
}
/*
@@ -366,12 +366,12 @@
int check_arg(au_arg32_t arg, long val)
{
if(!arg.len)
- return -1;
+ return (-1);
if(arg.val == val)
- return 1;
+ return (1);
- return 0;
+ return (0);
}
@@ -382,9 +382,9 @@
{
if(priv.pid == pid && priv.euid == geteuid() && priv.ruid == getuid() &&
priv.rgid == getgid() && priv.egid == getegid())
- return 1;
+ return (1);
- return 0;
+ return (0);
}
/*
@@ -394,9 +394,23 @@
{
if(priv.pid == p.pid && priv.euid == p.euid && priv.ruid == p.ruid &&
priv.rgid == p.rgid && priv.egid == p.egid)
- return 1;
+ return (1);
+
+ return (0);
+}
+
+int check_attr_path(au_attr32_t attr, char *path)
+{
+ struct stat s;
+
+ if(stat(path, &s) == -1)
+ return (0);
+
+ 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);
- return 0;
+ return (0);
}
/*
@@ -407,12 +421,13 @@
struct stat s;
if(fstat(fd, &s) == -1)
- return 0;
+ return (0);
+
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;
+ return (1);
- return 0;
+ return (0);
}
int setup_auditpipe(int pid)
@@ -437,7 +452,8 @@
if (ioctl(fd, AUDITPIPE_SET_PRESELECT_PROC, entry) < 0)
err(-1, "AUDITPIPE_SET_PRESELECT_EVENTS");
- return fd;
+
+ return (fd);
}
void close_auditpipe(int fd, int fdout)
==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/audit_pipe_regression_test_utils.h#6 (text+ko) ====
@@ -112,3 +112,5 @@
int check_arg(au_arg32_t arg, long val);
int check_priv(au_proc32ex_t priv, pid_t pid);
int check_fd(au_attr32_t attr, int fd);
+int check_ext_priv(au_proc32_t priv, struct ext_priv p);
+int check_attr_path(au_attr32_t attr, char *path);
==== //depot/projects/soc2008/snagg-audit/tools/regression/audit/audit_pipe/specific-event/audit_pipe_event_open.c#6 (text+ko) ====
@@ -93,7 +93,7 @@
write_int(O_RDONLY, "arg2");
write_int(fd, "fd");
write_int(fd, "ret");
- if (ret == -1)
+ if (fd == -1)
write_string(strerror(errno), "ret_val");
else
write_string("success", "ret_val");
@@ -105,7 +105,7 @@
write_int(O_WRONLY, "arg2");
write_int(fd, "fd");
write_int(fd, "ret");
- if (ret == -1)
+ if (fd == -1)
write_string(strerror(errno), "ret_val");
else
write_string("success", "ret_val");
@@ -119,7 +119,7 @@
write_int(0666, "arg3");
write_int(fd, "fd");
write_int(fd, "ret");
- if (ret == -1)
+ if (fd == -1)
write_string(strerror(errno), "ret_val");
else
write_string("success", "ret_val");
More information about the p4-projects
mailing list