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