| 612 | } |
| 613 | |
| 614 | const std::string Session::AuthorizationRejected(const Authz::Request::Ptr azreq) const noexcept |
| 615 | { |
| 616 | if (!be_prx || !be_target) |
| 617 | { |
| 618 | return "Access denied: Session no longer valid"; |
| 619 | } |
| 620 | |
| 621 | try |
| 622 | { |
| 623 | if (DBus::Object::Operation::PROPERTY_GET != azreq->operation) |
| 624 | { |
| 625 | // Don't log rejected property gets; they are not much useful |
| 626 | // and just adds lots of log noise |
| 627 | std::ostringstream errmsg; |
| 628 | errmsg << "Access denied to " |
| 629 | << (DBus::Object::Operation::METHOD_CALL == azreq->operation |
| 630 | ? "method" |
| 631 | : "property") |
| 632 | << " " << azreq->target << " on " << azreq->object_path |
| 633 | << " (caller: " << azreq->caller << ", user: " |
| 634 | << lookup_username(creds_qry->GetUID(azreq->caller)) |
| 635 | << ", caller pid: " |
| 636 | << creds_qry->GetPID(azreq->caller) << ")"; |
| 637 | sig_session->LogCritical(errmsg.str()); |
| 638 | } |
| 639 | } |
| 640 | catch (...) |
| 641 | { |
| 642 | std::cerr << "EXCEPTION: " |
| 643 | << "Access denied:" << azreq << std::endl; |
| 644 | } |
| 645 | return "Access denied"; |
| 646 | } |
| 647 | |
| 648 | |
| 649 | void Session::SetConfigName(const std::string &cfgname) |
nothing calls this directly
no test coverage detected