|
|
@ -44,7 +44,7 @@
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
|
|
|
|
KdeSudo::KdeSudo(TQWidget *parent, const char *name,const TQString& icon, const TQString& generic, bool withIgnoreButton)
|
|
|
|
TdeSudo::TdeSudo(TQWidget *parent, const char *name,const TQString& icon, const TQString& generic, bool withIgnoreButton)
|
|
|
|
: KPasswordDialog(KPasswordDialog::Password, false, false, icon, parent, name)
|
|
|
|
: KPasswordDialog(KPasswordDialog::Password, false, false, icon, parent, name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
|
|
|
|
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
|
|
|
@ -72,7 +72,7 @@ KdeSudo::KdeSudo(TQWidget *parent, const char *name,const TQString& icon, const
|
|
|
|
!(!args->isSet("c") && args->count()) &&
|
|
|
|
!(!args->isSet("c") && args->count()) &&
|
|
|
|
!args->isSet("s"))
|
|
|
|
!args->isSet("s"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KMessageBox::information(NULL, i18n("No command arguments supplied!\nUsage: tdesudo [-u <runas>] <command>\nKdeSudo will now exit..."));
|
|
|
|
KMessageBox::information(NULL, i18n("No command arguments supplied!\nUsage: tdesudo [-u <runas>] <command>\nTdeSudo will now exit..."));
|
|
|
|
noExec = true;
|
|
|
|
noExec = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -323,11 +323,11 @@ KdeSudo::KdeSudo(TQWidget *parent, const char *name,const TQString& icon, const
|
|
|
|
p->start( TDEProcess::NotifyOnExit, TDEProcess::All );
|
|
|
|
p->start( TDEProcess::NotifyOnExit, TDEProcess::All );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KdeSudo::~KdeSudo()
|
|
|
|
TdeSudo::~TdeSudo()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KdeSudo::receivedOut(TDEProcess*, char*buffer, int buflen)
|
|
|
|
void TdeSudo::receivedOut(TDEProcess*, char*buffer, int buflen)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char *pcTmp= new char[buflen+1];
|
|
|
|
char *pcTmp= new char[buflen+1];
|
|
|
|
strncpy(pcTmp,buffer,buflen);
|
|
|
|
strncpy(pcTmp,buffer,buflen);
|
|
|
@ -385,7 +385,7 @@ void KdeSudo::receivedOut(TDEProcess*, char*buffer, int buflen)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KdeSudo::procExited(TDEProcess*)
|
|
|
|
void TdeSudo::procExited(TDEProcess*)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!keepPwd && unCleaned)
|
|
|
|
if (!keepPwd && unCleaned)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -406,7 +406,7 @@ void KdeSudo::procExited(TDEProcess*)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KdeSudo::slotOk()
|
|
|
|
void TdeSudo::slotOk()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString strTmp(password());
|
|
|
|
TQString strTmp(password());
|
|
|
|
strTmp+="\n";
|
|
|
|
strTmp+="\n";
|
|
|
@ -414,19 +414,19 @@ void KdeSudo::slotOk()
|
|
|
|
this->hide();
|
|
|
|
this->hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KdeSudo::slotUser1()
|
|
|
|
void TdeSudo::slotUser1()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
done(AsUser);
|
|
|
|
done(AsUser);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KdeSudo::blockSigChild()
|
|
|
|
void TdeSudo::blockSigChild()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sigset_t sset;
|
|
|
|
sigset_t sset;
|
|
|
|
sigemptyset(&sset);
|
|
|
|
sigemptyset(&sset);
|
|
|
|
sigaddset(&sset, SIGCHLD);
|
|
|
|
sigaddset(&sset, SIGCHLD);
|
|
|
|
sigprocmask(SIG_BLOCK, &sset, 0L);
|
|
|
|
sigprocmask(SIG_BLOCK, &sset, 0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void KdeSudo::unblockSigChild()
|
|
|
|
void TdeSudo::unblockSigChild()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sigset_t sset;
|
|
|
|
sigset_t sset;
|
|
|
|
sigemptyset(&sset);
|
|
|
|
sigemptyset(&sset);
|
|
|
@ -434,7 +434,7 @@ void KdeSudo::unblockSigChild()
|
|
|
|
sigprocmask(SIG_UNBLOCK, &sset, 0L);
|
|
|
|
sigprocmask(SIG_UNBLOCK, &sset, 0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString KdeSudo::validArg(TQString arg)
|
|
|
|
TQString TdeSudo::validArg(TQString arg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQChar firstChar = arg.at(0);
|
|
|
|
TQChar firstChar = arg.at(0);
|
|
|
|
TQChar lastChar = arg.at(arg.length() - 1);
|
|
|
|
TQChar lastChar = arg.at(arg.length() - 1);
|
|
|
|