summaryrefslogtreecommitdiffstats
path: root/main.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'main.cxx')
-rw-r--r--main.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/main.cxx b/main.cxx
index 1ac5dd5a..6c28c4a5 100644
--- a/main.cxx
+++ b/main.cxx
@@ -130,6 +130,8 @@ usage (systemtap_session& s, int exitcode)
#ifdef HAVE_LIBSQLITE3
<< " -q generate information on tapset coverage" << endl
#endif /* HAVE_LIBSQLITE3 */
+ << " --unprivileged" << endl
+ << " restrict usage to features available to unprivileged users" << endl
#if 0 /* PR6864: disable temporarily; should merge with -d somehow */
<< " --kelf make do with symbol table from vmlinux" << endl
<< " --kmap[=FILE]" << endl
@@ -402,6 +404,15 @@ main (int argc, char * const argv [])
s.ignore_dwarf = false;
s.load_only = false;
s.skip_badvars = false;
+ s.unprivileged = false;
+
+ // Location of our signing certificate.
+ // If we're root, use the database in SYSCONFDIR, otherwise
+ // use the one in our $HOME directory. */
+ if (getuid() == 0)
+ s.cert_db_path = SYSCONFDIR "/systemtap/ssl/server";
+ else
+ s.cert_db_path = getenv("HOME") + string ("/.systemtap/ssl/server");
// Location of our signing certificate.
// If we're root, use the database in SYSCONFDIR, otherwise
@@ -475,6 +486,7 @@ main (int argc, char * const argv [])
#define LONG_OPT_IGNORE_DWARF 4
#define LONG_OPT_VERBOSE_PASS 5
#define LONG_OPT_SKIP_BADVARS 6
+#define LONG_OPT_UNPRIVILEGED 7
// NB: also see find_hash(), usage(), switch stmt below, stap.1 man page
static struct option long_options[] = {
{ "kelf", 0, &long_opt, LONG_OPT_KELF },
@@ -483,6 +495,7 @@ main (int argc, char * const argv [])
{ "ignore-dwarf", 0, &long_opt, LONG_OPT_IGNORE_DWARF },
{ "skip-badvars", 0, &long_opt, LONG_OPT_SKIP_BADVARS },
{ "vp", 1, &long_opt, LONG_OPT_VERBOSE_PASS },
+ { "unprivileged", 0, &long_opt, LONG_OPT_UNPRIVILEGED },
{ NULL, 0, NULL, 0 }
};
int grc = getopt_long (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uqwl:d:L:FS:",
@@ -610,6 +623,7 @@ main (int argc, char * const argv [])
case 'g':
s.guru_mode = true;
+ s.unprivileged = false;
break;
case 'P':
@@ -726,6 +740,10 @@ main (int argc, char * const argv [])
case LONG_OPT_SKIP_BADVARS:
s.skip_badvars = true;
break;
+ case LONG_OPT_UNPRIVILEGED:
+ s.unprivileged = true;
+ s.guru_mode = false;
+ break;
default:
cerr << "Internal error parsing command arguments." << endl;
usage(s, 1);