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)) { | ||
529 | error(KIO::ERR_ACCESS_DENIED, path); | 530 | if (!execWithRoot(QStringLiteral("del"), QStringLiteral("delete_file"), _path, WARN_PRIVILEDGE_DEL)) { | ||
531 | error(KIO::ERR_ACCESS_DENIED, path); | ||||
532 | return; | ||||
533 | } | ||||
530 | } else if (errno == EISDIR) { | 534 | } else if (errno == EISDIR) { | ||
531 | error(KIO::ERR_IS_DIRECTORY, path); | 535 | error(KIO::ERR_IS_DIRECTORY, path); | ||
536 | return; | ||||
532 | } else { | 537 | } else { | ||
533 | error(KIO::ERR_CANNOT_DELETE, path); | 538 | error(KIO::ERR_CANNOT_DELETE, path); | ||
539 | return; | ||||
534 | } | 540 | } | ||
535 | return; | | |||
536 | } | 541 | } | ||
537 | } else { | 542 | } else { | ||
538 | 543 | | |||
Context not available. | |||||
548 | } | 553 | } | ||
549 | if (QT_RMDIR(_path.data()) == -1) { | 554 | if (QT_RMDIR(_path.data()) == -1) { | ||
550 | if ((errno == EACCES) || (errno == EPERM)) { | 555 | if ((errno == EACCES) || (errno == EPERM)) { | ||
551 | error(KIO::ERR_ACCESS_DENIED, path); | 556 | if (!execWithRoot(QStringLiteral("del"), QStringLiteral("delete_dir"), path, WARN_PRIVILEDGE_RMDIR)) { | ||
552 | return; | 557 | error(KIO::ERR_ACCESS_DENIED, path); | ||
558 | return; | ||||
559 | } | ||||
553 | } else { | 560 | } else { | ||
554 | // qDebug() << "could not rmdir " << perror; | 561 | // qDebug() << "could not rmdir " << perror; | ||
555 | error(KIO::ERR_CANNOT_RMDIR, path); | 562 | error(KIO::ERR_CANNOT_RMDIR, path); | ||
Context not available. | |||||
558 | } | 565 | } | ||
559 | } | 566 | } | ||
560 | 567 | | |||
568 | endPriviledgeOp(); | ||||
561 | finished(); | 569 | finished(); | ||
562 | } | 570 | } | ||
563 | 571 | | |||
Context not available. |