[packagekit] packagekit: Branch 'master' - 6 commits

Richard Hughes hughsient at kemper.freedesktop.org
Thu Nov 1 14:51:34 PDT 2007


 NEWS                             |   43 ++++++++++++++++++++++++++++++++
 configure.ac                     |    4 +--
 html/pk-faq.html                 |    8 +-----
 libpackagekit/pk-client.c        |    2 -
 libpackagekit/pk-common.c        |   52 ++++++++++++++++++++-------------------
 libpackagekit/pk-enum-list.c     |   11 ++++----
 libpackagekit/pk-enum.c          |    6 +++-
 libpackagekit/pk-package-id.c    |   16 ++++++------
 libpackagekit/pk-package-list.c  |    3 +-
 libpackagekit/pk-polkit-client.c |    3 +-
 src/pk-backend.c                 |   34 ++++++++++++-------------
 src/pk-engine.c                  |    7 ++++-
 src/pk-transaction-db.c          |   13 +++++----
 13 files changed, 127 insertions(+), 75 deletions(-)

New commits:
commit ab6c3fe1d385a446c6abc2c7561a37487ddaaa6a
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 1 21:50:44 2007 +0000

    post release version bump

diff --git a/configure.ac b/configure.ac
index 556ece9..769c708 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ(2.52)
 
-AC_INIT(PackageKit, 0.1.2)
+AC_INIT(PackageKit, 0.1.3)
 AC_CONFIG_SRCDIR(src)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AM_CONFIG_HEADER(config.h)
commit 3173024fbc452e83d87524337137aaf5fc938b17
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 1 21:36:23 2007 +0000

    Version 0.1.2

diff --git a/NEWS b/NEWS
index 46fb3c7..e3b74ca 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,47 @@
 ~~~~~~~~~~~~~
+Version 0.1.2
+~~~~~~~~~~~~~
+
+* Backends:
+ - Add a new python based APT backend (Ali Sabil)
+ - Significant smart backend updates (James Bowes)
+ - Significant PiSi backend updates (S.Çağlar Onur)
+ - More yum functionality (James Bowes, Tim Lauridsen)
+ - More box functionality (Grzegorz Dabrowski)
+
+* New features:
+ - Allow PkClient to be set promiscuous, i.e. to report all activity and use to
+   get the errors and completions (Richard Hughes)
+ - Add pk-backend-python.[c|h], for common spawning functions for python
+   backends and switch the backends to use them (James Bowes)
+ - Use pk_strzero, pk_strlen and pk_strcmp to increase performance and
+   potentally improve security (Richard Hughes)
+ - Add resolve support to pkcon get depends/requires/description/updatedetail
+   (S.Çağlar Onur)
+ - Try to guess the remaining time of the transaction using a super nifty
+   algorithm (Richard Hughes)
+ - Add Cleanup and Obsoleting as info states so we don't scare the user with
+   DELETING when they are doing an upgrade (Richard Hughes, Tim Lauridsen)
+
+* API changes:
+ - Switch the discrete GetPercentage and GetSubPercentage to a GetProgress
+   method that allows us to report remaining and elapsed time into the
+   client UI (Richard Hughes)
+
+* Bugfixes:
+ - Sanitise more text from the backends in case the backend sends invalid or
+   malicious text (Richard Hughes)
+ - Defer destroying the backend for 5 seconds so we can query it in the
+   finished handler in clients (Richard Hughes)
+ - Add GetFiles method so we don't slow down the GUI box getting the file list
+   every time we click a package (James Bowes)
+ - Calculate progress bar length based on terminal columns (James Bowes)
+ - Convert RefreshCache to a privileged operation but with default to allow
+   when on active console. The distro can then patch this default to whatever
+   depending on the security policy - and the admin can of course change the
+   default. (S.Çağlar Onur)
+
+~~~~~~~~~~~~~
 Version 0.1.1
 ~~~~~~~~~~~~~
 
diff --git a/configure.ac b/configure.ac
index 2448e31..556ece9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,7 @@ AM_CONFIG_HEADER(config.h)
 # REVISION	If the API and ABI remains the same, but bugs are fixed.
 # AGE		If libpackagekit can be linked into executables which can be
 # 		built with previous versions of this library. Don't use.
-LT_CURRENT=2
+LT_CURRENT=3
 LT_REVISION=0
 LT_AGE=0
 AC_SUBST(LT_CURRENT)
commit 0b1817a717d6270cfbcd0205e478172d92026eef
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 1 19:58:57 2007 +0000

    use more of pk_strequal and pk_strcmp for security and speed

diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index e5447a5..4015eb5 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -145,7 +145,7 @@ pk_transaction_id_equal (const gchar *tid1, const gchar *tid2)
 		pk_warning ("tid compare invalid '%s' and '%s'", tid1, tid2);
 		return FALSE;
 	}
-	return (strcmp (tid1, tid2) == 0);
+	return pk_strequal (tid1, tid2);
 }
 
 /**
diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 25fb20b..dc076cd 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -44,10 +44,10 @@ pk_filter_check_part (const gchar *filter)
 	if (filter == NULL) {
 		return FALSE;
 	}
-	/* ITS4: ignore, not used for allocation */
-	if (strlen (filter) == 0) {
+	if (pk_strzero (filter) == TRUE) {
 		return FALSE;
 	}
+	/* keep strcmp for speed */
 	if (strcmp (filter, "none") == 0) {
 		return TRUE;
 	}
@@ -243,7 +243,7 @@ pk_strsplit (const gchar *id, guint parts)
 	}
 
 	/* ITS4: ignore, not used for allocation */
-	if (strlen (sections[0]) == 0) {
+	if (pk_strzero (sections[0]) == TRUE) {
 		/* name has to be valid */
 		pk_warning ("ident first section is empty");
 		goto out;
@@ -270,7 +270,7 @@ gboolean
 pk_strequal (const gchar *id1, const gchar *id2)
 {
 	if (id1 == NULL || id2 == NULL) {
-		pk_warning ("string id compare invalid '%s' and '%s'", id1, id2);
+		pk_debug ("string compare invalid '%s' and '%s'", id1, id2);
 		return FALSE;
 	}
 	return (strcmp (id1, id2) == 0);
@@ -317,7 +317,7 @@ pk_strcmp_sections (const gchar *id1, const gchar *id2, guint parts, guint compa
 
 	/* only compare preceeding sections */
 	for (i=0; i<compare; i++) {
-		if (strcmp (sections1[i], sections2[i]) != 0) {
+		if (pk_strequal (sections1[i], sections2[i]) == FALSE) {
 			goto out;
 		}
 	}
@@ -383,6 +383,8 @@ pk_strpad_extra (const gchar *data, guint length, guint *extra)
 
 	/* do the padding */
 	text = pk_strpad (data, size);
+
+	/* ITS4: ignore, we know pk_strpad is null terminated */
 	*extra = strlen (text) - size;
 
 	return text;
@@ -490,7 +492,7 @@ libst_common (LibSelfTest *test)
 	libst_title (test, "test pass 1");
 	array = pk_strsplit ("foo", 1);
 	if (array != NULL &&
-	    strcmp(array[0], "foo") == 0) {
+	    pk_strequal (array[0], "foo") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "got %s", array[0]);
@@ -501,8 +503,8 @@ libst_common (LibSelfTest *test)
 	libst_title (test, "test pass 2");
 	array = pk_strsplit ("foo;moo", 2);
 	if (array != NULL &&
-	    strcmp(array[0], "foo") == 0 &&
-	    strcmp(array[1], "moo") == 0) {
+	    pk_strequal (array[0], "foo") == TRUE &&
+	    pk_strequal (array[1], "moo") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "got %s, %s", array[0], array[1]);
@@ -513,9 +515,9 @@ libst_common (LibSelfTest *test)
 	libst_title (test, "test pass 3");
 	array = pk_strsplit ("foo;moo;bar", 3);
 	if (array != NULL &&
-	    strcmp(array[0], "foo") == 0 &&
-	    strcmp(array[1], "moo") == 0 &&
-	    strcmp(array[2], "bar") == 0) {
+	    pk_strequal (array[0], "foo") == TRUE &&
+	    pk_strequal (array[1], "moo") == TRUE &&
+	    pk_strequal (array[2], "bar") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "got %s, %s, %s, %s", array[0], array[1], array[2], array[3]);
@@ -526,10 +528,10 @@ libst_common (LibSelfTest *test)
 	libst_title (test, "test on real packageid");
 	array = pk_strsplit ("kde-i18n-csb;4:3.5.8~pre20071001-0ubuntu1;all;", 4);
 	if (array != NULL &&
-	    strcmp(array[0], "kde-i18n-csb") == 0 &&
-	    strcmp(array[1], "4:3.5.8~pre20071001-0ubuntu1") == 0 &&
-	    strcmp(array[2], "all") == 0 &&
-	    strcmp(array[3], "") == 0) {
+	    pk_strequal (array[0], "kde-i18n-csb") == TRUE &&
+	    pk_strequal (array[1], "4:3.5.8~pre20071001-0ubuntu1") == TRUE &&
+	    pk_strequal (array[2], "all") == TRUE &&
+	    pk_strequal (array[3], "") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "got %s, %s, %s, %s", array[0], array[1], array[2], array[3]);
@@ -540,10 +542,10 @@ libst_common (LibSelfTest *test)
 	libst_title (test, "test on short packageid");
 	array = pk_strsplit ("kde-i18n-csb;4:3.5.8~pre20071001-0ubuntu1;;", 4);
 	if (array != NULL &&
-	    strcmp(array[0], "kde-i18n-csb") == 0 &&
-	    strcmp(array[1], "4:3.5.8~pre20071001-0ubuntu1") == 0 &&
-	    strcmp(array[2], "") == 0 &&
-	    strcmp(array[3], "") == 0) {
+	    pk_strequal (array[0], "kde-i18n-csb") == TRUE &&
+	    pk_strequal (array[1], "4:3.5.8~pre20071001-0ubuntu1") == TRUE &&
+	    pk_strequal (array[2], "") == TRUE &&
+	    pk_strequal (array[3], "") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "got %s, %s, %s, %s", array[0], array[1], array[2], array[3]);
@@ -759,7 +761,7 @@ libst_common (LibSelfTest *test)
 	libst_title (test, "strlen bigger");
 	text_safe = g_strdup ("123456789");
 	length = pk_strlen (text_safe, 20);
-	if (length == 9 && strcmp (text_safe, "123456789") == 0) {
+	if (length == 9 && pk_strequal (text_safe, "123456789") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "failed the strlen %i,'%s'", length, text_safe);
@@ -770,7 +772,7 @@ libst_common (LibSelfTest *test)
 	libst_title (test, "strlen smaller");
 	text_safe = g_strdup ("123456789");
 	length = pk_strlen (text_safe, 5);
-	if (length == 5 && strcmp (text_safe, "12345") == 0) {
+	if (length == 5 && pk_strequal (text_safe, "12345") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "failed the strlen %i,'%s'", length, text_safe);
@@ -879,7 +881,7 @@ libst_common (LibSelfTest *test)
 	 ************************************************************/
 	libst_title (test, "test replace unsafe (okay)");
 	text_safe = pk_strsafe ("Richard Hughes");
-	if (text_safe != NULL && strcmp (text_safe, "Richard Hughes") == 0) {
+	if (pk_strequal (text_safe, "Richard Hughes") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "failed the replace unsafe '%s'", text_safe);
@@ -889,7 +891,7 @@ libst_common (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "test replace unsafe (one invalid)");
 	text_safe = pk_strsafe ("Richard\tHughes");
-	if (text_safe != NULL && strcmp (text_safe, "Richard Hughes") == 0) {
+	if (pk_strequal (text_safe, "Richard Hughes") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "failed the replace unsafe '%s'", text_safe);
@@ -899,7 +901,7 @@ libst_common (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "test replace unsafe (one invalid 2)");
 	text_safe = pk_strsafe ("Richard\"Hughes\"");
-	if (text_safe != NULL && strcmp (text_safe, "Richard Hughes ") == 0) {
+	if (pk_strequal (text_safe, "Richard Hughes ") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "failed the replace unsafe '%s'", text_safe);
@@ -909,7 +911,7 @@ libst_common (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "test replace unsafe (multiple invalid)");
 	text_safe = pk_strsafe ("'Richard\"Hughes\"");
-	if (text_safe != NULL && strcmp (text_safe, " Richard Hughes ") == 0) {
+	if (pk_strequal (text_safe, " Richard Hughes ") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "failed the replace unsafe '%s'", text_safe);
diff --git a/libpackagekit/pk-enum-list.c b/libpackagekit/pk-enum-list.c
index e8738e1..d091600 100644
--- a/libpackagekit/pk-enum-list.c
+++ b/libpackagekit/pk-enum-list.c
@@ -32,6 +32,7 @@
 
 #include <glib/gi18n.h>
 
+#include "pk-common.h"
 #include "pk-debug.h"
 #include "pk-enum.h"
 #include "pk-enum-list.h"
@@ -110,7 +111,7 @@ pk_enum_list_from_string (PkEnumList *elist, const gchar *enums)
 	}
 
 	/* check if we have nothing */
-	if (strcmp (enums, "none") == 0) {
+	if (pk_strequal (enums, "none") == TRUE) {
 		pk_debug ("no values");
 		return TRUE;
 	}
@@ -397,7 +398,7 @@ libst_enum_list (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "get empty list");
 	text = pk_enum_list_to_string (elist);
-	if (strcmp (text, "none") == 0) {
+	if (pk_strequal (text, "none") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "invalid '%s', should be 'none'", text);
@@ -452,7 +453,7 @@ libst_enum_list (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "get single list");
 	text = pk_enum_list_to_string (elist);
-	if (strcmp (text, "search-name") == 0) {
+	if (pk_strequal (text, "search-name") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "invalid '%s', should be 'search-name'", text);
@@ -480,7 +481,7 @@ libst_enum_list (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "get multiple list");
 	text = pk_enum_list_to_string (elist);
-	if (strcmp (text, "search-name;search-details;search-group") == 0) {
+	if (pk_strequal (text, "search-name;search-details;search-group") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "invalid '%s', should be 'search-name;search-details;search-group'", text);
@@ -530,7 +531,7 @@ libst_enum_list (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "get none enum list");
 	text = pk_enum_list_to_string (elist);
-	if (strcmp (text, "none") == 0) {
+	if (pk_strequal (text, "none") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "invalid '%s', should be 'none'", text);
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index ea76e4c..14956c1 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -28,6 +28,7 @@
 #include <glib/gi18n.h>
 
 #include "pk-debug.h"
+#include "pk-common.h"
 #include "pk-enum.h"
 
 static PkEnumMatch enum_exit[] = {
@@ -207,6 +208,7 @@ pk_enum_find_value (PkEnumMatch *table, const gchar *string)
 		if (string_tmp == NULL) {
 			break;
 		}
+		/* keep strcmp for speed */
 		if (strcmp (string, string_tmp) == 0) {
 			return table[i].value;
 		}
@@ -464,7 +466,7 @@ libst_enum (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "find string");
 	string = pk_enum_find_string (enum_role, PK_ROLE_ENUM_SEARCH_FILE);
-	if (strcmp (string, "search-file") == 0) {
+	if (pk_strequal (string, "search-file") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, NULL);
@@ -482,7 +484,7 @@ libst_enum (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "find string");
 	string = pk_role_enum_to_text (PK_ROLE_ENUM_SEARCH_FILE);
-	if (strcmp (string, "search-file") == 0) {
+	if (pk_strequal (string, "search-file") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, NULL);
diff --git a/libpackagekit/pk-package-id.c b/libpackagekit/pk-package-id.c
index b06bcc2..746fd94 100644
--- a/libpackagekit/pk-package-id.c
+++ b/libpackagekit/pk-package-id.c
@@ -154,7 +154,7 @@ pk_package_id_free (PkPackageId *ident)
 }
 
 /**
- * pk_strcmp_sections:
+ * pk_package_id_equal:
  **/
 gboolean
 pk_package_id_equal (const gchar *pid1, const gchar *pid2)
@@ -253,10 +253,10 @@ libst_package_id (LibSelfTest *test)
 	libst_title (test, "parse package_id from string");
 	ident = pk_package_id_new_from_string ("moo;0.0.1;i386;fedora");
 	if (ident != NULL &&
-	    strcmp (ident->name, "moo") == 0 &&
-	    strcmp (ident->arch, "i386") == 0 &&
-	    strcmp (ident->data, "fedora") == 0 &&
-	    strcmp (ident->version, "0.0.1") == 0) {
+	    pk_strequal (ident->name, "moo") == TRUE &&
+	    pk_strequal (ident->arch, "i386") == TRUE &&
+	    pk_strequal (ident->data, "fedora") == TRUE &&
+	    pk_strequal (ident->version, "0.0.1") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, NULL);
@@ -265,7 +265,7 @@ libst_package_id (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "test ident building with valid data");
 	text = pk_package_id_to_string (ident);
-	if (strcmp (text, "moo;0.0.1;i386;fedora") == 0) {
+	if (pk_strequal (text, "moo;0.0.1;i386;fedora") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "package_id is '%s'", text);
@@ -277,8 +277,8 @@ libst_package_id (LibSelfTest *test)
 	libst_title (test, "parse short package_id from string");
 	ident = pk_package_id_new_from_string ("moo;0.0.1;;");
 	if (ident != NULL &&
-	    strcmp (ident->name, "moo") == 0 &&
-	    strcmp (ident->version, "0.0.1") == 0 &&
+	    pk_strequal (ident->name, "moo") == TRUE &&
+	    pk_strequal (ident->version, "0.0.1") == TRUE &&
 	    ident->data == NULL &&
 	    ident->arch == NULL) {
 		libst_success (test, NULL);
diff --git a/libpackagekit/pk-package-list.c b/libpackagekit/pk-package-list.c
index f528e12..81df06a 100644
--- a/libpackagekit/pk-package-list.c
+++ b/libpackagekit/pk-package-list.c
@@ -36,6 +36,7 @@
 #include <glib/gi18n.h>
 
 #include "pk-debug.h"
+#include "pk-common.h"
 #include "pk-package-id.h"
 #include "pk-package-list.h"
 
@@ -299,7 +300,7 @@ libst_package_list (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "add entry");
 	text = pk_package_list_get_string (plist);
-	if (text != NULL && strcmp (text, "installed\tgnome;1.23;i386;data\tGNOME!") == 0) {
+	if (pk_strequal (text, "installed\tgnome;1.23;i386;data\tGNOME!") == TRUE) {
 		libst_success (test, NULL);
 	} else {
 		libst_failed (test, "get string incorrect '%s'", text);
diff --git a/libpackagekit/pk-polkit-client.c b/libpackagekit/pk-polkit-client.c
index 0af4b6e..3e30df4 100644
--- a/libpackagekit/pk-polkit-client.c
+++ b/libpackagekit/pk-polkit-client.c
@@ -33,6 +33,7 @@
 #include <glib/gi18n.h>
 #include <dbus/dbus-glib.h>
 
+#include "pk-common.h"
 #include "pk-debug.h"
 #include "pk-polkit-client.h"
 
@@ -135,7 +136,7 @@ pk_polkit_client_error_denied_by_policy (GError *error)
 	/* check for specific error */
 	error_name = dbus_g_error_get_name (error);
 	pk_debug ("ERROR: %s: %s", error_name, error->message);
-	if (strcmp (error_name, "org.freedesktop.PackageKit.RefusedByPolicy") == 0) {
+	if (pk_strequal (error_name, "org.freedesktop.PackageKit.RefusedByPolicy") == TRUE) {
 		return TRUE;
 	}
 	return FALSE;
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 5f0cbf1..87a3654 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -266,7 +266,7 @@ pk_backend_parse_common_output (PkBackend *backend, const gchar *line)
 	/* get size */
 	size = g_strv_length (sections);
 
-	if (strcmp (command, "package") == 0) {
+	if (pk_strequal (command, "package") == TRUE) {
 		if (size != 4) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
@@ -288,7 +288,7 @@ pk_backend_parse_common_output (PkBackend *backend, const gchar *line)
 		} else {
 			pk_warning ("invalid package_id");
 		}
-	} else if (strcmp (command, "description") == 0) {
+	} else if (pk_strequal (command, "description") == TRUE) {
 		if (size != 8) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
@@ -305,7 +305,7 @@ pk_backend_parse_common_output (PkBackend *backend, const gchar *line)
 						group, sections[4], sections[5],
 						package_size, sections[7]);
 		}
-	} else if (strcmp (command, "files") == 0) {
+	} else if (pk_strequal (command, "files") == TRUE) {
 		if (size != 3) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
@@ -313,15 +313,15 @@ pk_backend_parse_common_output (PkBackend *backend, const gchar *line)
 		}
 
 		pk_backend_files (backend, sections[1], sections[2]);
-	} else if (strcmp (command, "repo-detail") == 0) {
+	} else if (pk_strequal (command, "repo-detail") == TRUE) {
 		if (size != 4) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
 			goto out;
 		}
-		if (strcmp (sections[3], "true") == 0) {
+		if (pk_strequal (sections[3], "true") == TRUE) {
 			pk_backend_repo_detail (backend, sections[1], sections[2], TRUE);
-		} else if (strcmp (sections[3], "false") == 0) {
+		} else if (pk_strequal (sections[3], "false") == TRUE) {
 			pk_backend_repo_detail (backend, sections[1], sections[2], FALSE);
 		} else {
 			g_warning ("invalid qualifier '%s'", sections[3]);
@@ -365,7 +365,7 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
 	/* get size */
 	for (size=0; sections[size]; size++);
 
-	if (strcmp (command, "percentage") == 0) {
+	if (pk_strequal (command, "percentage") == TRUE) {
 		if (size != 2) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
@@ -378,7 +378,7 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
 		} else {
 			pk_backend_change_percentage (backend, percentage);
 		}
-	} else if (strcmp (command, "subpercentage") == 0) {
+	} else if (pk_strequal (command, "subpercentage") == TRUE) {
 		if (size != 2) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
@@ -391,7 +391,7 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
 		} else {
 			pk_backend_change_sub_percentage (backend, percentage);
 		}
-	} else if (strcmp (command, "error") == 0) {
+	} else if (pk_strequal (command, "error") == TRUE) {
 		if (size != 3) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
@@ -399,7 +399,7 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
 		}
 		error_enum = pk_error_enum_from_text (sections[1]);
 		pk_backend_error_code (backend, error_enum, sections[2]);
-	} else if (strcmp (command, "requirerestart") == 0) {
+	} else if (pk_strequal (command, "requirerestart") == TRUE) {
 		if (size != 3) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
@@ -407,14 +407,14 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
 		}
 		restart_enum = pk_restart_enum_from_text (sections[1]);
 		pk_backend_require_restart (backend, restart_enum, sections[2]);
-	} else if (strcmp (command, "change-transaction-data") == 0) {
+	} else if (pk_strequal (command, "change-transaction-data") == TRUE) {
 		if (size != 2) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
 			goto out;
 		}
 		pk_backend_change_transaction_data (backend, sections[1]);
-	} else if (strcmp (command, "status") == 0) {
+	} else if (pk_strequal (command, "status") == TRUE) {
 		if (size != 2) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
@@ -422,29 +422,29 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
 		}
 		status_enum = pk_status_enum_from_text (sections[1]);
 		pk_backend_change_status (backend, status_enum);
-	} else if (strcmp (command, "allow-interrupt") == 0) {
+	} else if (pk_strequal (command, "allow-interrupt") == TRUE) {
 		if (size != 2) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
 			goto out;
 		}
-		if (strcmp (sections[1], "true") == 0) {
+		if (pk_strequal (sections[1], "true") == TRUE) {
 			pk_backend_allow_interrupt (backend, TRUE);
-		} else if (strcmp (sections[1], "false") == 0) {
+		} else if (pk_strequal (sections[1], "false") == TRUE) {
 			pk_backend_allow_interrupt (backend, FALSE);
 		} else {
 			pk_warning ("invalid section '%s'", sections[1]);
 			ret = FALSE;
 			goto out;
 		}
-	} else if (strcmp (command, "no-percentage-updates") == 0) {
+	} else if (pk_strequal (command, "no-percentage-updates") == TRUE) {
 		if (size != 1) {
 			g_warning ("invalid command '%s'", command);
 			ret = FALSE;
 			goto out;
 		}
 		pk_backend_no_percentage_updates (backend);
-	} else if (strcmp (command, "repo-signature-required") == 0) {
+	} else if (pk_strequal (command, "repo-signature-required") == TRUE) {
 		ret = FALSE;
 		goto out;
 	} else {
diff --git a/src/pk-engine.c b/src/pk-engine.c
index a76f155..5ad0c2f 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -926,7 +926,7 @@ pk_engine_search_check (const gchar *search, GError **error)
 	guint size;
 	gboolean ret;
 
-	/* ITS4: ignore, not used for allocation */
+	/* ITS4: ignore, not used for allocation, and checked */
 	size = strlen (search);
 
 	if (search == NULL) {
@@ -944,6 +944,11 @@ pk_engine_search_check (const gchar *search, GError **error)
 			     "The search string length is too small");
 		return FALSE;
 	}
+	if (size > 1024) {
+		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_SEARCH_INVALID,
+			     "The search string length is too large");
+		return FALSE;
+	}
 	if (strstr (search, "*") != NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_SEARCH_INVALID,
 			     "Invalid search containing '*'");
diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index 1a2420e..51e6a46 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -35,6 +35,7 @@
 
 #include <glib/gi18n.h>
 #include <sqlite3.h>
+#include <pk-common.h>
 
 #include "pk-debug.h"
 #include "pk-transaction-db.h"
@@ -117,30 +118,30 @@ pk_transaction_sqlite_callback (void *data, gint argc, gchar **argv, gchar **col
 	for (i=0; i<argc; i++) {
 		col = col_name[i];
 		value = argv[i];
-		if (strcmp (col, "succeeded") == 0) {
+		if (pk_strequal (col, "succeeded") == TRUE) {
 			/* ITS4: ignore, checked for sanity */
 			item.succeeded = atoi (value);
 			if (item.succeeded > 1) {
 				pk_warning ("item.succeeded %i! Resetting to 1", item.succeeded);
 				item.succeeded = 1;
 			}
-		} else if (strcmp (col, "role") == 0) {
+		} else if (pk_strequal (col, "role") == TRUE) {
 			if (value != NULL) {
 				item.role = pk_role_enum_from_text (value);
 			}
-		} else if (strcmp (col, "transaction_id") == 0) {
+		} else if (pk_strequal (col, "transaction_id") == TRUE) {
 			if (value != NULL) {
 				item.tid = g_strdup (value);
 			}
-		} else if (strcmp (col, "timespec") == 0) {
+		} else if (pk_strequal (col, "timespec") == TRUE) {
 			if (value != NULL) {
 				item.timespec = g_strdup (value);
 			}
-		} else if (strcmp (col, "data") == 0) {
+		} else if (pk_strequal (col, "data") == TRUE) {
 			if (value != NULL) {
 				item.data = g_strdup (value);
 			}
-		} else if (strcmp (col, "duration") == 0) {
+		} else if (pk_strequal (col, "duration") == TRUE) {
 			if (value != NULL) {
 				/* ITS4: ignore, checked for sanity */
 				item.duration = atoi (value);
commit 76a8f38464f12ba8185e479c276eb5ab2e074d76
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 1 18:56:54 2007 +0000

    FOO is scary

diff --git a/html/pk-faq.html b/html/pk-faq.html
index ddc9796..9c77f2f 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -17,7 +17,7 @@
 
 <h1>Frequently asked questions</h1>
 
-<h3>How complete is backend ${FOO}?</h3>
+<h3>How complete are the backends?</h3>
 <pre>
                   | conary | yum | apt | box | alpm | smart | pisi |
 --------------------------------------------------------------------
commit 72aa289fbecb4cfa8059ff6805870899158c0c28
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 1 18:56:06 2007 +0000

    yum can Cancel

diff --git a/html/pk-faq.html b/html/pk-faq.html
index 67edfcf..ddc9796 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -41,7 +41,7 @@ get-update-detail |        |     |     |     |      |       |      |
 get-repo-list     |        |  X  |     |  X  |  X   |   X   |   X  |
 repo-enable       |        |  X  |     |  X  |      |   X   |      |
 repo-set-data     |        |     |     |  X  |      |       |   X  |
-cancel-transaction|        |     |     |     |      |       |   X  |
+cancel-transaction|        |  X  |     |     |      |       |   X  |
 </pre>
 
 <h3>What if the backend package manager doesn't support percentage updates?</h3>
commit 8dfc3387e9af0aa28087e1d6ccd1bbace629e6c1
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 1 18:52:43 2007 +0000

    we've removed BACKENDS

diff --git a/html/pk-faq.html b/html/pk-faq.html
index 82a7849..67edfcf 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -18,10 +18,6 @@
 <h1>Frequently asked questions</h1>
 
 <h3>How complete is backend ${FOO}?</h3>
-<p>
-Backends are updated all the time, so it's best to see the BACKENDS file in git -
-this is the latest version of that file:
-</p>
 <pre>
                   | conary | yum | apt | box | alpm | smart | pisi |
 --------------------------------------------------------------------



More information about the PackageKit mailing list