Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/file/file_unix.cpp
Context not available. | |||||
32 | #include <qplatformdefs.h> | 32 | #include <qplatformdefs.h> | ||
---|---|---|---|---|---|
33 | 33 | | |||
34 | #include <QDebug> | 34 | #include <QDebug> | ||
35 | #include <KAuth> | ||||
35 | #include <kconfiggroup.h> | 36 | #include <kconfiggroup.h> | ||
36 | #include <klocalizedstring.h> | 37 | #include <klocalizedstring.h> | ||
37 | #include <kmountpoint.h> | 38 | #include <kmountpoint.h> | ||
Context not available. | |||||
526 | 527 | | |||
527 | if (unlink(_path.data()) == -1) { | 528 | if (unlink(_path.data()) == -1) { | ||
528 | if ((errno == EACCES) || (errno == EPERM)) { | 529 | if ((errno == EACCES) || (errno == EPERM)) { | ||
530 | if (execWithRoot(QStringLiteral("del"), QStringLiteral("delete_file"), _path, WARN_PRIVILEDGE_DEL)) { | ||||
531 | finished(); | ||||
532 | return; | ||||
533 | } | ||||
529 | error(KIO::ERR_ACCESS_DENIED, path); | 534 | error(KIO::ERR_ACCESS_DENIED, path); | ||
535 | | ||||
530 | } else if (errno == EISDIR) { | 536 | } else if (errno == EISDIR) { | ||
531 | error(KIO::ERR_IS_DIRECTORY, path); | 537 | error(KIO::ERR_IS_DIRECTORY, path); | ||
532 | } else { | 538 | } else { | ||
Context not available. | |||||
548 | } | 554 | } | ||
549 | if (QT_RMDIR(_path.data()) == -1) { | 555 | if (QT_RMDIR(_path.data()) == -1) { | ||
550 | if ((errno == EACCES) || (errno == EPERM)) { | 556 | if ((errno == EACCES) || (errno == EPERM)) { | ||
551 | error(KIO::ERR_ACCESS_DENIED, path); | 557 | if (!execWithRoot(QStringLiteral("del"), QStringLiteral("delete_dir"), path, WARN_PRIVILEDGE_RMDIR)) { | ||
552 | return; | 558 | error(KIO::ERR_ACCESS_DENIED, path); | ||
559 | return; | ||||
560 | } | ||||
553 | } else { | 561 | } else { | ||
554 | // qDebug() << "could not rmdir " << perror; | 562 | // qDebug() << "could not rmdir " << perror; | ||
555 | error(KIO::ERR_CANNOT_RMDIR, path); | 563 | error(KIO::ERR_CANNOT_RMDIR, path); | ||
Context not available. | |||||
558 | } | 566 | } | ||
559 | } | 567 | } | ||
560 | 568 | | |||
569 | endPriviledgeOp(); | ||||
561 | finished(); | 570 | finished(); | ||
562 | } | 571 | } | ||
563 | 572 | | |||
Context not available. |