]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- work on dbus interface
authorArvin Schnell <aschnell@suse.de>
Wed, 6 Jun 2012 08:02:53 +0000 (10:02 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 6 Jun 2012 08:02:53 +0000 (10:02 +0200)
client/snapper.cc
server/snapperd.cc

index 4191c6db238ae3399fe126771c6adee3f4415d30..e3a95be242ea74693bca07126e6cd4884d9b00cf 100644 (file)
@@ -1220,7 +1220,9 @@ main(int argc, char** argv)
     }
     catch (const DBus::ErrorException& e)
     {
-       if (strcmp(e.name(), "error.no_permissions") == 0)
+       if (strcmp(e.name(), "error.unknown_config") == 0)
+           cerr << _("Unknown config.") << endl;
+       else if (strcmp(e.name(), "error.no_permissions") == 0)
            cerr << _("No permissions.") << endl;
        else if (strcmp(e.name(), "error.invalid_userdata") == 0)
            cerr << _("Invalid userdata.") << endl;
index 52f6665c2b4c27f0f60ba4e72c1894bf181b3e1b..0a0cb1308f241ffb26f04cdeffba30038b82c871 100644 (file)
@@ -205,6 +205,13 @@ reply_to_introspect(DBus::Connection& conn, DBus::Message& msg)
 }
 
 
+struct UnknownConfig : public std::exception
+{
+    explicit UnknownConfig() throw() {}
+    virtual const char* what() const throw() { return "unknown config"; }
+};
+
+
 struct Permissions : public std::exception
 {
     explicit Permissions() throw() {}
@@ -241,11 +248,11 @@ check_permission(DBus::Connection& conn, DBus::Message& msg, const string& confi
            if (find(it->users.begin(), it->users.end(), username) != it->users.end())
                return;
 
-           break;
+           throw Permissions();
        }
     }
 
-    throw Permissions();
+    throw UnknownConfig();
 }
 
 
@@ -1048,6 +1055,11 @@ dispatch(DBus::Connection& conn, DBus::Message& msg)
        DBus::MessageError reply(msg, "error.marshalling", DBUS_ERROR_FAILED);
        conn.send(reply);
     }
+    catch (const UnknownConfig& e)
+    {
+       DBus::MessageError reply(msg, "error.unknown_config", DBUS_ERROR_FAILED);
+       conn.send(reply);
+    }
     catch (const Permissions& e)
     {
        DBus::MessageError reply(msg, "error.no_permissions", DBUS_ERROR_FAILED);