Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164713146
D53672.id166143.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D53672.id166143.diff
View Options
diff --git a/usr.sbin/setaudit/setaudit.8 b/usr.sbin/setaudit/setaudit.8
--- a/usr.sbin/setaudit/setaudit.8
+++ b/usr.sbin/setaudit/setaudit.8
@@ -28,7 +28,7 @@
.Nd "specify audit configurations on a process"
.Sh SYNOPSIS
.Nm
-.Op Fl 46
+.Op Fl 46U
.Op Fl a Ar auid
.Op Fl m Ar mask
.Op Fl s Ar source
@@ -44,6 +44,16 @@
Use IPv4.
.It Fl 6
Use IPv6.
+.It Fl U
+Update audit session state rather than overwriting it.
+By default,
+.Nm
+will overwrite the entire audit session state using the specified
+parameters.
+If
+.Fl U
+is specified, only the parameters given on the command line will be
+updated, leaving the rest unchanged.
.It Fl a Ar auid
Audit user ID or user name.
.It Fl m Ar mask
diff --git a/usr.sbin/setaudit/setaudit.c b/usr.sbin/setaudit/setaudit.c
--- a/usr.sbin/setaudit/setaudit.c
+++ b/usr.sbin/setaudit/setaudit.c
@@ -35,6 +35,7 @@
#include <err.h>
#include <netdb.h>
#include <pwd.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,7 +45,7 @@
usage(char *prog)
{
(void)fprintf(stderr,
- "usage: %s [-46] [-a auid] [-m mask] [-s source] [-p port] command ...\n",
+ "usage: %s [-46U] [-a auid] [-m mask] [-p port] [-s source] command ...\n",
prog);
exit(1);
}
@@ -56,19 +57,21 @@
struct sockaddr_in *sin;
struct addrinfo hints;
auditinfo_addr_t aia;
- struct addrinfo *res;
- struct passwd *pwd;
char *aflag, *mflag, *sflag, *prog;
+ dev_t term_port;
+ uint32_t term_type;
int ch, error;
+ bool Uflag;
aflag = mflag = sflag = NULL;
+ Uflag = false;
prog = argv[0];
bzero(&aia, sizeof(aia));
bzero(&hints, sizeof(hints));
- aia.ai_termid.at_type = AU_IPv4;
+ term_type = AU_IPv4;
hints.ai_family = PF_UNSPEC;
- while ((ch = getopt(argc, argv, "46a:m:p:s:")) != -1)
+ while ((ch = getopt(argc, argv, "46a:m:p:s:U")) != -1)
switch (ch) {
case '4':
hints.ai_family = PF_INET;
@@ -83,11 +86,14 @@
mflag = optarg;
break;
case 'p':
- aia.ai_termid.at_port = htons(atoi(optarg));
+ term_port = htons(atoi(optarg));
break;
case 's':
sflag = optarg;
break;
+ case 'U':
+ Uflag = true;
+ break;
default:
usage(prog);
/* NOT REACHED */
@@ -96,7 +102,14 @@
argv += optind;
if (argc == 0)
usage(prog);
+
+ if (Uflag) {
+ if (getaudit_addr(&aia, sizeof(aia)) < 0)
+ err(1, "getaudit_addr");
+ }
if (aflag) {
+ struct passwd *pwd;
+
pwd = getpwnam(aflag);
if (pwd == NULL) {
char *r;
@@ -112,6 +125,8 @@
err(1, "getauditflagsbin");
}
if (sflag) {
+ struct addrinfo *res;
+
error = getaddrinfo(sflag, NULL, &hints, &res);
if (error)
errx(1, "%s", gai_strerror(error));
@@ -121,20 +136,23 @@
bcopy(&sin6->sin6_addr.s6_addr,
&aia.ai_termid.at_addr[0],
sizeof(struct in6_addr));
- aia.ai_termid.at_type = AU_IPv6;
+ term_type = AU_IPv6;
break;
case PF_INET:
sin = (struct sockaddr_in *)(void *)res->ai_addr;
bcopy(&sin->sin_addr.s_addr,
&aia.ai_termid.at_addr[0],
sizeof(struct in_addr));
- aia.ai_termid.at_type = AU_IPv4;
+ term_type = AU_IPv4;
break;
}
}
- if (setaudit_addr(&aia, sizeof(aia)) < 0) {
- err(1, "setaudit_addr");
+ if (!Uflag || sflag) {
+ aia.ai_termid.at_port = term_port;
+ aia.ai_termid.at_type = term_type;
}
+ if (setaudit_addr(&aia, sizeof(aia)) < 0)
+ err(1, "setaudit_addr");
(void)execvp(*argv, argv);
err(1, "%s", *argv);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 4, 7:43 AM (10 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35896441
Default Alt Text
D53672.id166143.diff (3 KB)
Attached To
Mode
D53672: setaudit: Add an update mode
Attached
Detach File
Event Timeline
Log In to Comment