]> sourceware.org Git - systemtap.git/commitdiff
Add 'no-prompt' to the --trust-servers option to bypass prompting the user for confir...
authorDave Brolley <brolley@redhat.com>
Tue, 5 Oct 2010 18:24:13 +0000 (14:24 -0400)
committerDave Brolley <brolley@redhat.com>
Wed, 6 Oct 2010 15:16:09 +0000 (11:16 -0400)
csclient.cxx
stap.1

index ff5813740a6a01f4fa3fbf4eac444f9a4c88dc6e..04ff3e0345d598e22a8043ce3b3ebf186c73fdf7 100644 (file)
@@ -1125,6 +1125,7 @@ manage_server_trust (systemtap_session &s)
   //   signer    - trust the specified servers as module signers
   //   revoke    - revoke the requested trust
   //   all-users - apply/revoke the requested trust for all users
+  //   no-prompt - don't prompt the user for confirmation
   vector<string>components;
   tokenize (s.server_trust_spec, components, ",");
   bool ssl = false;
@@ -1132,6 +1133,7 @@ manage_server_trust (systemtap_session &s)
   bool revoke = false;
   bool all_users = false;
   bool error = false;
+  bool no_prompt = false;
   for (vector<string>::const_iterator i = components.begin ();
        i != components.end ();
        ++i)
@@ -1160,6 +1162,8 @@ manage_server_trust (systemtap_session &s)
          else
            all_users = true;
        }
+      else if (*i == "no-prompt")
+       no_prompt = true;
       else
        cerr << "Warning: Unrecognized server trust specification: " << *i
             << endl;
@@ -1216,22 +1220,38 @@ manage_server_trust (systemtap_session &s)
     }
 
   // Prompt the user to confirm what's about to happen.
-  if (revoke)
-    clog << "Revoke trust ";
+  if (no_prompt)
+    {
+      if (revoke)
+       clog << "Revoking trust ";
+      else
+       clog << "Adding trust ";
+    }
   else
-    clog << "Add trust ";
-  clog << "in the following servers " << trustString.str () << '?' << endl;
+    {
+      if (revoke)
+       clog << "Revoke trust ";
+      else
+       clog << "Add trust ";
+    }
+  clog << "in the following servers " << trustString.str ();
+  if (! no_prompt)
+    clog << '?';
+  clog << endl;
   for (unsigned i = 0; i < limit; ++i)
     clog << "  " << server_list[i] << endl;
-  clog << "[y/N] " << flush;
-
-  // Only carry out the operation if the response is "yes"
-  string response;
-  cin >> response;
-  if (response[0] != 'y' && response [0] != 'Y')
+  if (! no_prompt)
     {
-      clog << "Server trust unchanged" << endl;
-      return;
+      clog << "[y/N] " << flush;
+
+      // Only carry out the operation if the response is "yes"
+      string response;
+      cin >> response;
+      if (response[0] != 'y' && response [0] != 'Y')
+       {
+         clog << "Server trust unchanged" << endl;
+         return;
+       }
     }
 
   // Now add/revoke the requested trust.
diff --git a/stap.1 b/stap.1
index aabe9a2d3418627a4fa4a2f03b9bf256ad596efe..d8dc41a1f5efe6b780e9444ee95fa84c92d83d00 100644 (file)
--- a/stap.1
+++ b/stap.1
@@ -191,7 +191,7 @@ ldd to be necessary for user-space binaries being probe or listed with
 the \-d option.  Caution: this can make the probe modules considerably
 larger.
 .TP
-.BI \-\-all-modules
+.BI \-\-all\-modules
 Equivalent to specifying "-dkernel" and a "-d" for each kernel module that is
 currently loaded.  Caution: this can make the probe modules considerably
 larger.
@@ -369,6 +369,10 @@ signer is always granted for all users. Only root can specify
 .TP
 .BI revoke
 revoke the specified trust. The default is to grant it.
+.TP
+.BI no\-prompt
+do not prompt the user for confirmation before carrying out the requested
+action. The default is to prompt the user for confirmation.
 .RE
 
 If no argument is provided, then the default is
@@ -377,7 +381,8 @@ If no servers were specified using
 .IR \-\-use\-server ,
 then no trust will be granted or revoked.
 
-The user will be prompted to confirm the trust to be granted or revoked before
+Unless \fBno\-prompt\fR has been specified,
+the user will be prompted to confirm the trust to be granted or revoked before
 the operation is performed.
 
 .SH ARGUMENTS
This page took 0.031707 seconds and 5 git commands to generate.