diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-04 19:15:55 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-06-04 19:15:55 +0000 |
commit | 30ea024923ba650bdffbc84efb645461059fb038 (patch) | |
tree | 22a49747f9214bea78955875511189dbd725a950 /bin/systrace | |
parent | bcd109d0e846e759b204588f696c9d03455f43c5 (diff) |
KNF
Diffstat (limited to 'bin/systrace')
-rw-r--r-- | bin/systrace/filter.c | 12 | ||||
-rw-r--r-- | bin/systrace/intercept-translate.c | 10 | ||||
-rw-r--r-- | bin/systrace/intercept.c | 10 | ||||
-rw-r--r-- | bin/systrace/lex.l | 10 | ||||
-rw-r--r-- | bin/systrace/openbsd-syscalls.c | 8 | ||||
-rw-r--r-- | bin/systrace/policy.c | 10 | ||||
-rw-r--r-- | bin/systrace/systrace.c | 12 | ||||
-rw-r--r-- | bin/systrace/systrace.h | 6 | ||||
-rw-r--r-- | bin/systrace/util.c | 27 |
9 files changed, 52 insertions, 53 deletions
diff --git a/bin/systrace/filter.c b/bin/systrace/filter.c index e27a8b1968c..237df9146de 100644 --- a/bin/systrace/filter.c +++ b/bin/systrace/filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filter.c,v 1.2 2002/06/04 19:07:04 provos Exp $ */ +/* $OpenBSD: filter.c,v 1.3 2002/06/04 19:15:54 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -162,7 +162,7 @@ filter_policyrecord(struct policy *policy, struct filter *filter, strlcpy(filter->name, name, sizeof(filter->name)); strlcpy(filter->emulation, emulation, sizeof(filter->emulation)); - + TAILQ_INSERT_TAIL(&policy->filters, filter, policy_next); policy->nfilters++; @@ -246,7 +246,7 @@ filter_prepolicy(int fd, struct policy *policy) short action, future; /* Commit all matching pre-filters */ - for (filter = TAILQ_FIRST(&policy->prefilters); + for (filter = TAILQ_FIRST(&policy->prefilters); filter; filter = TAILQ_FIRST(&policy->prefilters)) { future = ICPOLICY_ASK; @@ -406,7 +406,7 @@ filter_fnmatch(struct intercept_translate *tl, struct logic *logic) { int res; char *line; - + if (tl->trans_size == 0) return (0); @@ -421,7 +421,7 @@ int filter_substrmatch(struct intercept_translate *tl, struct logic *logic) { char *line; - + if ((line = intercept_translate_print(tl)) == NULL) return (0); @@ -432,7 +432,7 @@ int filter_negsubstrmatch(struct intercept_translate *tl, struct logic *logic) { char *line; - + if ((line = intercept_translate_print(tl)) == NULL) return (0); diff --git a/bin/systrace/intercept-translate.c b/bin/systrace/intercept-translate.c index 4bd1be11a1c..f95d4548a84 100644 --- a/bin/systrace/intercept-translate.c +++ b/bin/systrace/intercept-translate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intercept-translate.c,v 1.1 2002/06/04 17:20:04 provos Exp $ */ +/* $OpenBSD: intercept-translate.c,v 1.2 2002/06/04 19:15:54 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -62,7 +62,7 @@ extern struct intercept_system intercept; /* Takes a translation structure and retrieves the right data */ int -intercept_translate(struct intercept_translate *trans, +intercept_translate(struct intercept_translate *trans, int fd, pid_t pid, int off, void *args, int argsize) { void *addr, *addr2; @@ -123,7 +123,7 @@ ic_get_filename(struct intercept_translate *trans, int fd, pid_t pid, char buf[MAXPATHLEN]; char *path, *name; int len; - + name = intercept_filename(fd, pid, addr); if (name == NULL) return (-1); @@ -149,7 +149,7 @@ ic_get_string(struct intercept_translate *trans, int fd, pid_t pid, void *addr) { char *name; int len; - + name = intercept_get_string(fd, pid, addr); if (name == NULL) return (-1); @@ -171,7 +171,7 @@ ic_get_linkname(struct intercept_translate *trans, int fd, pid_t pid, { char *name; int len; - + name = intercept_filename(fd, pid, addr); if (name == NULL) return (-1); diff --git a/bin/systrace/intercept.c b/bin/systrace/intercept.c index 9679e0029c6..5d3903bc5c6 100644 --- a/bin/systrace/intercept.c +++ b/bin/systrace/intercept.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intercept.c,v 1.2 2002/06/04 19:07:04 provos Exp $ */ +/* $OpenBSD: intercept.c,v 1.3 2002/06/04 19:15:54 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -83,7 +83,7 @@ int pidcompare(struct intercept_pid *a, struct intercept_pid *b) { int diff = a->pid - b->pid; - + if (diff == 0) return (0); if (diff > 0) @@ -289,8 +289,8 @@ intercept_open(void) int fd; fd = intercept.open(); - if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) - warn("fcntl(O_NONBLOCK)"); + if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) + warn("fcntl(O_NONBLOCK)"); return (fd); } @@ -515,7 +515,7 @@ intercept_child_info(pid_t opid, pid_t npid) return; inpid = intercept_getpid(npid); - + inpid->policynr = ipid->policynr; if (ipid->name != NULL) inpid->name = strdup(ipid->name); diff --git a/bin/systrace/lex.l b/bin/systrace/lex.l index 24c45efe68f..b8828f615dc 100644 --- a/bin/systrace/lex.l +++ b/bin/systrace/lex.l @@ -90,11 +90,11 @@ true { return TRUE; } return CMDSTRING; } \[ { return LSQBRACE; } \] { return RSQBRACE; } -\ { ; } -\n { ;} -\t { ; } -"#".*\n { ; } -. { yyerror("illegal token"); } +\ { ; } +\n { ; } +\t { ; } +"#".*\n { ; } +. { yyerror("illegal token"); } %% #ifndef yywrap int yywrap() { return 1; } diff --git a/bin/systrace/openbsd-syscalls.c b/bin/systrace/openbsd-syscalls.c index 53a80a11ff9..afd19f32a49 100644 --- a/bin/systrace/openbsd-syscalls.c +++ b/bin/systrace/openbsd-syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openbsd-syscalls.c,v 1.3 2002/06/04 19:09:45 provos Exp $ */ +/* $OpenBSD: openbsd-syscalls.c,v 1.4 2002/06/04 19:15:54 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -181,7 +181,7 @@ obsd_getpid(pid_t pid) if ((icpid->data = malloc(sizeof(struct obsd_data))) == NULL) err(1, "%s:%d: malloc", __func__, __LINE__); - + data = icpid->data; data->current = &emulations[0]; data->commit = NULL; @@ -441,7 +441,7 @@ obsd_read(int fd) current = data->current; - switch(msg.msg_type) { + switch (msg.msg_type) { case SYSTR_MSG_ASK: code = msg.msg_data.msg_ask.code; sysname = obsd_syscall_name(msg.msg_pid, code); @@ -473,7 +473,7 @@ obsd_read(int fd) case SYSTR_MSG_EMUL: memcpy(name, msg.msg_data.msg_emul.emul, SYSTR_EMULEN); name[SYSTR_EMULEN] = '\0'; - + if (obsd_set_emulation(msg.msg_pid, name) == -1) errx(1, "%s:%d: set_emulation(%s)", __func__, __LINE__, name); diff --git a/bin/systrace/policy.c b/bin/systrace/policy.c index a7140352992..951623bad32 100644 --- a/bin/systrace/policy.c +++ b/bin/systrace/policy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: policy.c,v 1.2 2002/06/04 19:07:04 provos Exp $ */ +/* $OpenBSD: policy.c,v 1.3 2002/06/04 19:15:54 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -71,7 +71,7 @@ int polnrcompare(struct policy *a, struct policy *b) { int diff = a->policynr - b->policynr; - + if (diff == 0) return (0); if (diff > 0 ) @@ -298,7 +298,7 @@ systrace_readpolicy(char *filename) goto out; } *p = '\0'; - + p = line; strsep(&p, "#"); @@ -322,7 +322,7 @@ systrace_readpolicy(char *filename) goto error; continue; } - + if (policy == NULL) goto error; @@ -354,7 +354,7 @@ systrace_readpolicy(char *filename) filter = calloc(1, sizeof(struct filter)); if (filter == NULL) err(1, "%s:%d: calloc", __func__, __LINE__); - + filter->rule = strdup(rule); strlcpy(filter->name, name, sizeof(filter->name)); strlcpy(filter->emulation,emulation,sizeof(filter->emulation)); diff --git a/bin/systrace/systrace.c b/bin/systrace/systrace.c index 81ca62d4ab8..01a3aaadcba 100644 --- a/bin/systrace/systrace.c +++ b/bin/systrace/systrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: systrace.c,v 1.2 2002/06/04 19:07:04 provos Exp $ */ +/* $OpenBSD: systrace.c,v 1.3 2002/06/04 19:15:54 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -64,7 +64,7 @@ trans_cb(int fd, pid_t pid, int policynr, int size; action = ICPOLICY_PERMIT; - + if (policynr == -1) goto out; @@ -221,7 +221,7 @@ void child_handler(int sig) { int s = errno, status; - + if (signal(SIGCHLD, child_handler) == SIG_ERR) { close(fd); } @@ -247,13 +247,13 @@ systrace_initcb(void) X(intercept_register_sccb("native", "connect", trans_cb, NULL)); X(intercept_register_translation("native", "connect", 1, - &ic_translate_connect)); + &ic_translate_connect)); X(intercept_register_sccb("native", "sendto", trans_cb, NULL)); X(intercept_register_translation("native", "sendto", 4, - &ic_translate_connect)); + &ic_translate_connect)); X(intercept_register_sccb("native", "bind", trans_cb, NULL)); X(intercept_register_translation("native", "bind", 1, - &ic_translate_connect)); + &ic_translate_connect)); X(intercept_register_sccb("native", "execve", trans_cb, NULL)); X(intercept_register_transfn("native", "execve", 0)); X(intercept_register_sccb("native", "stat", trans_cb, NULL)); diff --git a/bin/systrace/systrace.h b/bin/systrace/systrace.h index b584925afde..b60065a73c6 100644 --- a/bin/systrace/systrace.h +++ b/bin/systrace/systrace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systrace.h,v 1.1 2002/06/04 17:20:04 provos Exp $ */ +/* $OpenBSD: systrace.h,v 1.2 2002/06/04 19:15:54 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -78,7 +78,7 @@ struct policy { char emulation[16]; SPLAY_HEAD(syscalltree, policy_syscall) pflqs; - + int policynr; int flags; @@ -87,7 +87,7 @@ struct policy { struct filterq prefilters; }; -#define POLICY_PATH "/etc/systrace" +#define POLICY_PATH "/etc/systrace" #define POLICY_UNSUPERVISED 0x01 /* Auto-Pilot */ #define POLICY_DETACHED 0x02 /* Ignore this program */ diff --git a/bin/systrace/util.c b/bin/systrace/util.c index a81e882b667..e4393b5dc4d 100644 --- a/bin/systrace/util.c +++ b/bin/systrace/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.1 2002/06/04 17:20:04 provos Exp $ */ +/* $OpenBSD: util.c,v 1.2 2002/06/04 19:15:54 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -51,7 +51,6 @@ strrpl(char *str, size_t size, char *match, char *value) if (p >= e) return (NULL); - } if (p == NULL) @@ -84,9 +83,9 @@ strrpl(char *str, size_t size, char *match, char *value) * cyg //foo yes yes no */ #ifdef OS2 -# define PATHSEP ';' -# define DIRSEP '/' /* even though \ is native */ -# define DIRSEPSTR "\\" +# define PATHSEP ';' +# define DIRSEP '/' /* even though \ is native */ +# define DIRSEPSTR "\\" # define ISDIRSEP(c) ((c) == '\\' || (c) == '/') # define ISABSPATH(s) (((s)[0] && (s)[1] == ':' && ISDIRSEP((s)[2]))) # define ISROOTEDPATH(s) (ISDIRSEP((s)[0]) || ISABSPATH(s)) @@ -96,16 +95,16 @@ strrpl(char *str, size_t size, char *match, char *value) # define FILENCMP(s1, s2, n) strnicmp(s1, s2, n) extern char *ksh_strchr_dirsep(const char *path); extern char *ksh_strrchr_dirsep(const char *path); -# define chdir _chdir2 -# define getcwd _getcwd2 +# define chdir _chdir2 +# define getcwd _getcwd2 #else -# define PATHSEP ':' -# define DIRSEP '/' -# define DIRSEPSTR "/" +# define PATHSEP ':' +# define DIRSEP '/' +# define DIRSEPSTR "/" # define ISDIRSEP(c) ((c) == '/') #ifdef __CYGWIN__ # define ISABSPATH(s) \ - (((s)[0] && (s)[1] == ':' && ISDIRSEP((s)[2])) || ISDIRSEP((s)[0])) + (((s)[0] && (s)[1] == ':' && ISDIRSEP((s)[2])) || ISDIRSEP((s)[0])) # define ISRELPATH(s) (!(s)[0] || ((s)[1] != ':' && !ISDIRSEP((s)[0]))) #else /* __CYGWIN__ */ # define ISABSPATH(s) ISDIRSEP((s)[0]) @@ -161,9 +160,9 @@ simplify_path(path) */ #ifdef __CYGWIN__ - /* preserve leading double-slash on pathnames (for UNC paths) */ - if (path[0] && ISDIRSEP(path[0]) && path[1] && ISDIRSEP(path[1])) - very_start++; + /* preserve leading double-slash on pathnames (for UNC paths) */ + if (path[0] && ISDIRSEP(path[0]) && path[1] && ISDIRSEP(path[1])) + very_start++; #endif /* __CYGWIN__ */ for (cur = t = start = very_start; ; ) { |