rpms/gnome-keyring-sharp/F-13 gnome-keyring-sharp-1.0.1-new-api.diff, NONE, 1.1 gnome-keyring-sharp.spec, 1.7, 1.8

chkr chkr at fedoraproject.org
Sun Jun 13 19:03:26 UTC 2010


Author: chkr

Update of /cvs/pkgs/rpms/gnome-keyring-sharp/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv24144

Modified Files:
	gnome-keyring-sharp.spec 
Added Files:
	gnome-keyring-sharp-1.0.1-new-api.diff 
Log Message:
* Sun Jun 13 2010 Christian Krause <chkr at fedoraproject.org> - 1.0.1-0.6.133722svn
- Add patch to directly p/invoke libgnome-keyring instead of using
  deprecated socket interface (BZ 595457)


gnome-keyring-sharp-1.0.1-new-api.diff:
 Makefile.am                                             |    3 
 Tests/TestRing.cs                                       |  415 ++++++++
 autogen.sh                                              |    4 
 configure.ac                                            |   31 
 gnome-keyring-sharp-glue/Makefile.am                    |    6 
 gnome-keyring-sharp-glue/glue.c                         |   36 
 gnome-keyring-sharp-glue/gnome-keyring-sharp-glue.cproj |    1 
 gnome-keyring-sharp.csproj                              |   79 +
 gnome-keyring-sharp.sln                                 |   29 
 src/Gnome.Keyring.dll.config                            |    3 
 src/Gnome.Keyring/Makefile.am                           |    3 
 src/Gnome.Keyring/Operation.cs                          |   54 -
 src/Gnome.Keyring/RequestMessage.cs                     |  173 ---
 src/Gnome.Keyring/ResponseMessage.cs                    |  108 --
 src/Gnome.Keyring/Ring.cs                               |  775 +++++++++-------
 src/Makefile.am                                         |   10 
 16 files changed, 1057 insertions(+), 673 deletions(-)

--- NEW FILE gnome-keyring-sharp-1.0.1-new-api.diff ---
=== modified file 'Makefile.am'
--- Makefile.am	2007-10-04 23:12:37 +0000
+++ Makefile.am	2010-03-30 04:39:13 +0000
@@ -1,3 +1,2 @@
-SUBDIRS=src docs sample
+SUBDIRS=src gnome-keyring-sharp-glue docs sample
 EXTRA_DIST=Gnome.Keyring.snk
-

=== added directory 'Tests'
=== added file 'Tests/TestRing.cs'
--- Tests/TestRing.cs	1970-01-01 00:00:00 +0000
+++ Tests/TestRing.cs	2010-03-30 03:00:47 +0000
@@ -0,0 +1,415 @@
+// 
+// TestRing.cs
+//  
+// Author:
+//       Christopher James Halse Rogers <<christopher.halse.rogers at canonical.com>>
+// 
+// Copyright (c) 2010 Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Gnome.Keyring
+{
+	public static class TestHelpers
+	{
+		public static void NotContains<T> (T toFind, ICollection<T> collection)
+		{
+			Assert.That (collection, new NotConstraint (new ContainsConstraint (toFind)));
+		}
+	}
+	
+	[TestFixture()]
+	public class TestRing
+	{
+		[SetUp()]
+		public void SetUp ()
+		{
+			try {
+				Ring.CreateKeyring ("keyring1", "password");
+			} catch (KeyringException e) {
+				if (e.ResultCode != ResultCode.AlreadyExists) {
+					throw;
+				}
+			}
+			Ring.SetDefaultKeyring ("keyring1");
+		}
+		
+		[TearDown()]
+		public void TearDown ()
+		{
+			try {
+				Ring.DeleteKeyring ("keyring1");
+				Ring.SetDefaultKeyring ("login");
+			} catch {
+				// I don't care.
+			}
+			GC.Collect ();
+		}
+		
+		[Test()]
+		public void GetDefaultKeyringNameReturnsLogin ()
+		{
+			Assert.AreEqual ("keyring1", Ring.GetDefaultKeyring ());
+		}
+		
+		[Test()]
+		public void GetKeyringsListsAllKeyrings ()
+		{
+			Assert.Contains ("keyring1", Ring.GetKeyrings ());
+		}
+		
+		[Test()]
+		public void KeyringIsAvailable ()
+		{
+			Assert.IsTrue (Ring.Available);
+		}
+		
+		[Test()]
+		public void SetDefaultKeyringUpdatesGetDefaultKeyring ()
+		{
+			string prevDefault = Ring.GetDefaultKeyring ();
+			Ring.CreateKeyring ("test1", "password");
+			try {
+				Ring.SetDefaultKeyring ("test1");
+				Assert.AreEqual ("test1", Ring.GetDefaultKeyring ());
+			} finally {
+				Ring.DeleteKeyring ("test1");
+				Ring.SetDefaultKeyring (prevDefault);
+			}
+		}
+		
+		[Test()]
+		[ExpectedException (ExpectedMessage = "No such keyring", ExceptionType = typeof (KeyringException))]
+		public void SetDefaultKeyringWithInvalidKeyringRaisesException ()
+		{
+			Ring.SetDefaultKeyring ("Keyring That Doesn't Exist");
+		}
+		
+		[Test()]
+		public void CreatedKeyringAppearsInKeyringList ()
+		{
+			Ring.ApplicationName = "Tests";
+			string keyringName = "atestkeyring";
+			Ring.CreateKeyring (keyringName, "password");
+			Assert.Contains (keyringName, Ring.GetKeyrings ());
+			Ring.DeleteKeyring (keyringName);
+		}
+		
+		[Test()]
+		[ExpectedException (ExpectedMessage = "Item already exists", ExceptionType = typeof (KeyringException))]
+		public void CreatingTheSameKeyringTwiceRaisesException ()
+		{
+			string keyringName = "anothertestkeyring";
+			Ring.CreateKeyring (keyringName, "password");
+			try {
+				Ring.CreateKeyring (keyringName, "password");
+			} finally {
+				Ring.DeleteKeyring (keyringName);
+			}
+		}
+		
+		[Test()]
+		public void RemovingKeyringRemovesItFromKeyringList ()
+		{
+			string keyringName = "akeyring";
+			Ring.CreateKeyring (keyringName, "password");
+			Assert.Contains (keyringName, Ring.GetKeyrings ());
+			Ring.DeleteKeyring (keyringName);
+			TestHelpers.NotContains (keyringName, Ring.GetKeyrings ());
+		}
+		
+		[Test()]
+		public void GetKeyringInfoGetsCorrectName ()
+		{
+			string keyringName = "login";
+			KeyringInfo info = Ring.GetKeyringInfo (keyringName);
+			Assert.AreEqual (keyringName, info.Name);
+		}
+		
+		[Test()]
+		[Ignore ("Setting keyring properties is broken in libgnome-keyring.  Apparently no one uses this.")]
+		public void SetKeyringInfoUpdatesLockTimeout ()
+		{
+			string keyringName = "testkeyring";
+			Ring.CreateKeyring (keyringName, "password");
+			
+			try {
+				KeyringInfo info = Ring.GetKeyringInfo (keyringName);
+				info.LockTimeoutSeconds++;
+				Assert.AreNotEqual (info.LockTimeoutSeconds, Ring.GetKeyringInfo (keyringName).LockTimeoutSeconds);
+				
+				Ring.Unlock (keyringName, null);
+				Ring.SetKeyringInfo (keyringName, info);
+				Assert.AreEqual (info.LockTimeoutSeconds, Ring.GetKeyringInfo (keyringName).LockTimeoutSeconds);
+			} finally {
+				Ring.DeleteKeyring (keyringName);
+			}
+		}
+		
+		[Test()]
+		[Ignore ("Setting keyring properties is broken in libgnome-keyring.  Apparently no one uses this.")]
+		public void SetKeyringLockOnIdleUpdatesInfo ()
+		{
+			string keyringName = "theamazingtestkeyring";
+			Ring.CreateKeyring (keyringName, "password");
+			
+			try {
+				KeyringInfo info = Ring.GetKeyringInfo (keyringName);
+				info.LockOnIdle = !info.LockOnIdle;
+				Assert.AreNotEqual (info.LockOnIdle, Ring.GetKeyringInfo (keyringName).LockOnIdle);
+				
+				Ring.SetKeyringInfo (keyringName, info);
[...1644 lines suppressed...]
+			ResultCode result = gnome_keyring_item_set_attributes_sync (keyring, (uint)id, attrList);
+			
+			gnome_keyring_attribute_list_free (attrList);
+			
+			if (result != ResultCode.Ok) {
+				throw new KeyringException (result);
+			}
 		}
 
+		[DllImport ("libgnome-keyring.dll")]
+		static extern ResultCode gnome_keyring_get_info_sync (string keyringName, out IntPtr keyringInfo);
+		[DllImport ("libgnome-keyring.dll")]
+		static extern void gnome_keyring_info_free (IntPtr keyringInfo);
+		[DllImport ("libgnome-keyring.dll")]
+		static extern IntPtr gnome_keyring_info_get_ctime (IntPtr keyringInfo);
+		[DllImport ("libgnome-keyring.dll")]
+		static extern IntPtr gnome_keyring_info_get_mtime (IntPtr keyringInfo);
+		[DllImport ("libgnome-keyring.dll")]
+		static extern int gnome_keyring_info_get_lock_timeout (IntPtr keyringInfo);
+		[DllImport("libgnome-keyring.dll")]
+		static extern bool gnome_keyring_info_get_is_locked (IntPtr keyringInfo);
+		[DllImport("libgnome-keyring.dll")]
+		static extern bool gnome_keyring_info_get_lock_on_idle (IntPtr keyringInfo);
+		
 		public static KeyringInfo GetKeyringInfo (string keyring)
 		{
 			if (keyring == null)
 				throw new ArgumentNullException ("keyring");
 
-			RequestMessage req = new RequestMessage ();
-			req.CreateSimpleOperation (Operation.GetKeyringInfo, keyring);
-			ResponseMessage resp = SendRequest (req.Stream);
-			return new KeyringInfo (keyring, (resp.GetInt32 () != 0),
-							resp.GetInt32 (),
-							resp.GetDateTime (),
-							resp.GetDateTime (),
-							(resp.GetInt32 () != 0));
+			IntPtr keyring_info = IntPtr.Zero;
+			ResultCode result = gnome_keyring_get_info_sync (keyring, out keyring_info);
+			
+			if (result != ResultCode.Ok) {
+				throw new KeyringException (result);
+			}
+			
+			DateTime ctime = GLib.Marshaller.time_tToDateTime (gnome_keyring_info_get_ctime (keyring_info));
+			DateTime mtime = GLib.Marshaller.time_tToDateTime (gnome_keyring_info_get_mtime (keyring_info));
+			KeyringInfo retval = new KeyringInfo (keyring,
+				gnome_keyring_info_get_lock_on_idle (keyring_info),
+				gnome_keyring_info_get_lock_timeout (keyring_info),
+				mtime,
+				ctime,
+				gnome_keyring_info_get_is_locked (keyring_info)
+				);
+			
+			
+			gnome_keyring_info_free (keyring_info);
+			return retval;
 		}
+		
+		[DllImport ("libgnome-keyring.dll")]
+		static extern ResultCode gnome_keyring_set_info_sync (string keyring, IntPtr keyringInfo);
+		[DllImport ("libgnome-keyring.dll")]
+		static extern void gnome_keyring_info_set_lock_timeout (IntPtr keyringInfo, UInt32 timeout);
+		[DllImport ("libgnome-keyring.dll")]
+		static extern void gnome_keyring_info_set_lock_on_idle (IntPtr keyringInfo, bool lockOnIdle);
 
 		public static void SetKeyringInfo (string keyring, KeyringInfo info)
 		{
@@ -469,41 +652,47 @@
 			if (info == null)
 				throw new ArgumentNullException ("info");
 
-			RequestMessage req = new RequestMessage ();
-			req.StartOperation (Operation.SetKeyringInfo);
-			req.Write (keyring);
-			req.Write (info.LockOnIdle ? 1 : 0);
-			req.Write (info.LockTimeoutSeconds);
-			req.EndOperation ();
-			SendRequest (req.Stream);
+		
+			IntPtr keyring_info;
+			ResultCode result = gnome_keyring_get_info_sync (keyring, out keyring_info);
+			
+			if (result != ResultCode.Ok) {
+				throw new KeyringException (result);
+			}
+			
+			gnome_keyring_info_set_lock_timeout (keyring_info, (uint)info.LockTimeoutSeconds);
+			gnome_keyring_info_set_lock_on_idle (keyring_info, info.LockOnIdle);
+			
+			result = gnome_keyring_set_info_sync (keyring, keyring_info);
+
+			gnome_keyring_info_free (keyring_info);
+			
+			if (result != ResultCode.Ok) {
+				throw new KeyringException (result);
+			}
 		}
 
+		[Obsolete ("Item ACLs are deprecated.  GetItemACL never returns any ACLs")]
 		public static ArrayList GetItemACL (string keyring, int id)
 		{
 			if (keyring == null)
 				throw new ArgumentNullException ("keyring");
 
-			RequestMessage req = new RequestMessage ();
-			req.CreateSimpleOperation (Operation.GetItemACL, keyring, id);
-			ResponseMessage resp = SendRequest (req.Stream);
-			int count = resp.GetInt32 ();
-			ArrayList list = new ArrayList (count);
-			for (int i = 0; i < count; i++) {
-				list.Add (new ItemACL (resp.GetString (), resp.GetString (), (AccessRights) resp.GetInt32 ()));
-			}
-			return list;
+			return new ArrayList ();
 		}
 
+		[Obsolete("Item ACLs are deprecated.  SetItemACL has no effect.")]
 		public static void SetItemACL (string keyring, int id, ICollection acls)
 		{
 			if (acls == null)
 				throw new ArgumentNullException ("acls");
 
-			ItemACL [] arr = new ItemACL [acls.Count];
+			ItemACL[] arr = new ItemACL[acls.Count];
 			acls.CopyTo (arr, 0);
 			SetItemACL (keyring, id, arr);
 		}
-
+		
+		[Obsolete("Item ACLs are deprecated.  SetItemACL has no effect.")]
 		public static void SetItemACL (string keyring, int id, ItemACL [] acls)
 		{
 			if (keyring == null)
@@ -514,28 +703,6 @@
 
 			if (acls.Length == 0)
 				throw new ArgumentException ("Empty ACL set.", "acls");
-
-			RequestMessage req = new RequestMessage ();
-			req.StartOperation (Operation.SetItemACL);
-			req.Write (keyring);
-			req.Write (id);
-			req.Write (acls.Length);
-			foreach (ItemACL acl in acls) {
-				req.Write (acl.DisplayName);
-				req.Write (acl.FullPath);
-				req.Write ((int) acl.Access);
-			}
-			req.EndOperation ();
-			SendRequest (req.Stream);
 		}
 	}
-
-#if WITH_DBUS
-	[Interface ("org.gnome.keyring.Daemon")]
-	interface IDaemon
-	{
-		string GetSocketPath ();
-	}
-#endif
 }
-

=== modified file 'src/Makefile.am'
--- src/Makefile.am	2007-10-16 22:46:31 +0000
+++ src/Makefile.am	2010-03-30 05:11:26 +0000
@@ -5,13 +5,13 @@
 SNK=$(ASSEMBLY_NAME).snk
 
 pkgconfigdir=$(libdir)/pkgconfig
-CSFLAGS+= -debug+ -debug:full -nologo -r:Mono.Posix.dll
+CSFLAGS += -debug+ -debug:full -nologo -r:Mono.Posix.dll
 
 pkgconfig_DATA = gnome-keyring-sharp-1.0.pc
 
-CLEANFILES = $(ASSEMBLY_NAME).*
+CLEANFILES = $(ASSEMBLY_NAME).dll $(ASSEMBLY_NAME).dll.mdb $(ASSEMBLY_NAME).snk
 
-gnomekeyring_references = $(DBUS_LIBS)
+gnomekeyring_references = $(GLIB_SHARP_LIBS)
 
 gnomekeyring_sources  = \
 			Gnome.Keyring/AccessRights.cs \
@@ -24,9 +24,6 @@
 			Gnome.Keyring/KeyringInfo.cs \
 			Gnome.Keyring/NetItemData.cs \
 			Gnome.Keyring/NoteItemData.cs \
-			Gnome.Keyring/Operation.cs \
-			Gnome.Keyring/RequestMessage.cs \
-			Gnome.Keyring/ResponseMessage.cs \
 			Gnome.Keyring/ResultCode.cs \
 			Gnome.Keyring/Ring.cs
 
@@ -50,3 +47,4 @@
 	echo "$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \
 	$(GACUTIL) /u $(ASSEMBLY_NAME) /package $(PACKAGE)-$(API_VERSION) $(GACUTIL_FLAGS) || exit 1;
 
+EXTRA_DIST=Gnome.Keyring.dll.config



Index: gnome-keyring-sharp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-keyring-sharp/F-13/gnome-keyring-sharp.spec,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- gnome-keyring-sharp.spec	20 Aug 2009 23:10:09 -0000	1.7
+++ gnome-keyring-sharp.spec	13 Jun 2010 19:03:26 -0000	1.8
@@ -3,7 +3,7 @@
 
 Name:           gnome-keyring-sharp
 Version:        1.0.1
-Release:        0.5.%{svn_rev}svn%{?dist}
+Release:        0.6.%{svn_rev}svn%{?dist}
 Summary:        Mono implementation of GNOME Keyring
 
 Group:          System Environment/Libraries
@@ -17,15 +17,19 @@ URL:            http://www.mono-project.
 #   gnome-keyring-sharp-%{version}
 Source0:        gnome-keyring-sharp-%{version}-r%{svn_rev}.tar.bz2
 Patch0:         gnome-keyring-sharp-libdir.patch
+# Patch to directly p/invoke libgnome-keyring instead of using
+# deprecated socket interface taken from upstream bug report:
+# https://bugzilla.novell.com/show_bug.cgi?id=589166
+Patch1:         gnome-keyring-sharp-1.0.1-new-api.diff
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 # sparc64 is even worse. Secondary arch, but package owner gets emailed
 # on build failures
 ExcludeArch:    sparc64
 
-BuildRequires:  autoconf automake
+BuildRequires:  autoconf automake libtool
 BuildRequires:  mono-devel ndesk-dbus-devel monodoc
-#Requires:       
+BuildRequires:  gtk-sharp2-devel libgnome-keyring-devel
 
 %description
 gnome-keyring-sharp is a fully managed implementation of libgnome-keyring.
@@ -42,8 +46,8 @@ Requires:       %{name} = %{version}-%{r
 Requires:       pkgconfig
 
 %description    devel
-The %{name}-devel package contains libraries and header files for
-developing applications that use %{name}.
+The %{name}-devel package contains libraries and header files
+for developing applications that use %{name}.
 
 %package        doc
 Summary:        Documentation for %{name}
@@ -52,18 +56,18 @@ Requires:       %{name} = %{version}-%{r
 Requires:       monodoc
 
 %description    doc
-The %{name}-doc package contains documentation for %{name}.
+The %{name}-doc package contains documentation
+for %{name}.
 
 
 %prep
 %setup -q
 %patch0 -p1 -b .libdir
+%patch1 -p0 -F 2 -b .new-api
 
 
 %build
-aclocal
-automake -a
-autoreconf
+autoreconf -f -i
 %configure --disable-static
 make
 # sharing violation when doing parallel build
@@ -73,6 +77,7 @@ make
 %install
 rm -rf $RPM_BUILD_ROOT
 make install DESTDIR=$RPM_BUILD_ROOT
+strip $RPM_BUILD_ROOT%{_libdir}/libgnome-keyring-sharp-glue.so
 find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
 
 
@@ -85,6 +90,7 @@ rm -rf $RPM_BUILD_ROOT
 %doc AUTHORS ChangeLog COPYING README
 %{_libdir}/mono/gnome-keyring-sharp-1.0
 %{_libdir}/mono/gac/Gnome.Keyring
+%{_libdir}/libgnome-keyring-sharp-glue.so
 
 %files devel
 %defattr(-,root,root,-)
@@ -97,6 +103,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Sun Jun 13 2010 Christian Krause <chkr at fedoraproject.org> - 1.0.1-0.6.133722svn
+- Add patch to directly p/invoke libgnome-keyring instead of using
+  deprecated socket interface (BZ 595457)
+
 * Thu Aug 20 2009 Toshio Kuratomi <toshio at fedoraproject.org> - 1.0.1-0.5.133722svn%{?dist}
 - Rebuild for ppc64 since previous build was obsoleted.
 



More information about the scm-commits mailing list