This repository was archived by the owner on Sep 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ class OscapScannerRemoteSsh : public OscapScannerBase
43
43
virtual QStringList getCommandLineArgs () const ;
44
44
virtual void evaluate ();
45
45
46
+ protected:
47
+
48
+ virtual void selectError (MessageType& kind, const QString& message);
49
+ virtual void processError (QString& message);
50
+
46
51
private:
47
52
void ensureConnected ();
48
53
Original file line number Diff line number Diff line change @@ -344,6 +344,29 @@ void OscapScannerRemoteSsh::evaluate()
344
344
signalCompletion (mCancelRequested );
345
345
}
346
346
347
+ void OscapScannerRemoteSsh::selectError (MessageType& kind, const QString& message)
348
+ {
349
+ OscapScannerBase::selectError (kind, message);
350
+ if (mUserIsSudoer )
351
+ {
352
+ if (message.contains (QRegExp (" ^sudo:" )))
353
+ {
354
+ kind = MSG_ERROR;
355
+ }
356
+ }
357
+
358
+ }
359
+
360
+ void OscapScannerRemoteSsh::processError (QString& message)
361
+ {
362
+ OscapScannerBase::processError (message);
363
+ if (mUserIsSudoer && message.contains (QRegExp (" ^sudo:" )))
364
+ {
365
+ message.replace (QRegExp (" ^sudo:" ), " Error invoking sudo on the host:" );
366
+ message += " .\n Only passwordless sudo setup on the remote host is supported by scap-workbench." ;
367
+ }
368
+ }
369
+
347
370
void OscapScannerRemoteSsh::ensureConnected ()
348
371
{
349
372
if (mSshConnection .isConnected ())
You can’t perform that action at this time.
0 commit comments