Blame ecryptfs-utils-83-splitnss.patch

Michal Hlavinka 14f1a4
diff -up ecryptfs-utils-83/src/libecryptfs/key_management.c.splitnss ecryptfs-utils-83/src/libecryptfs/key_management.c
Michal Hlavinka 14f1a4
--- ecryptfs-utils-83/src/libecryptfs/key_management.c.splitnss	2010-02-16 17:59:21.000000000 +0100
Michal Hlavinka 14f1a4
+++ ecryptfs-utils-83/src/libecryptfs/key_management.c	2010-05-04 11:08:19.875872481 +0200
Michal Hlavinka 14f1a4
@@ -133,28 +133,8 @@ out:
Michal Hlavinka 14f1a4
 }
Michal Hlavinka 14f1a4
 
Michal Hlavinka 14f1a4
 
Michal Hlavinka 14f1a4
-int ecryptfs_remove_auth_tok_from_keyring(char *auth_tok_sig)
Michal Hlavinka 14f1a4
-{
Michal Hlavinka 14f1a4
-	int rc;
Michal Hlavinka 14f1a4
+#include "key_management.inc.c"
Michal Hlavinka 14f1a4
 
Michal Hlavinka 14f1a4
-	rc = (int)keyctl_search(KEY_SPEC_USER_KEYRING, "user", auth_tok_sig, 0);
Michal Hlavinka 14f1a4
-	if (rc < 0) {
Michal Hlavinka 14f1a4
-		rc = errno;
Michal Hlavinka 14f1a4
-		syslog(LOG_ERR, "Failed to find key with sig [%s]: %m\n",
Michal Hlavinka 14f1a4
-		       auth_tok_sig);
Michal Hlavinka 14f1a4
-		goto out;
Michal Hlavinka 14f1a4
-	}
Michal Hlavinka 14f1a4
-	rc = keyctl_unlink(rc, KEY_SPEC_USER_KEYRING);
Michal Hlavinka 14f1a4
-	if (rc < 0) {
Michal Hlavinka 14f1a4
-		rc = errno;
Michal Hlavinka 14f1a4
-		syslog(LOG_ERR, "Failed to unlink key with sig [%s]: %s\n",
Michal Hlavinka 14f1a4
-		       auth_tok_sig, strerror(rc));
Michal Hlavinka 14f1a4
-		goto out;
Michal Hlavinka 14f1a4
-	}
Michal Hlavinka 14f1a4
-	rc = 0;
Michal Hlavinka 14f1a4
-out:
Michal Hlavinka 14f1a4
-	return rc;
Michal Hlavinka 14f1a4
-}
Michal Hlavinka 14f1a4
 int ecryptfs_add_auth_tok_to_keyring(struct ecryptfs_auth_tok *auth_tok,
Michal Hlavinka 14f1a4
 				     char *auth_tok_sig)
Michal Hlavinka 14f1a4
 {
Michal Hlavinka 14f1a4
diff -up ecryptfs-utils-83/src/libecryptfs/key_management.inc.c.splitnss ecryptfs-utils-83/src/libecryptfs/key_management.inc.c
Michal Hlavinka 14f1a4
--- ecryptfs-utils-83/src/libecryptfs/key_management.inc.c.splitnss	2010-05-04 11:08:19.875872481 +0200
Michal Hlavinka 14f1a4
+++ ecryptfs-utils-83/src/libecryptfs/key_management.inc.c	2010-05-04 11:08:19.875872481 +0200
Michal Hlavinka 14f1a4
@@ -0,0 +1,22 @@
Michal Hlavinka 14f1a4
+int ecryptfs_remove_auth_tok_from_keyring(char *auth_tok_sig)
Michal Hlavinka 14f1a4
+{
Michal Hlavinka 14f1a4
+	int rc;
Michal Hlavinka 14f1a4
+
Michal Hlavinka 14f1a4
+	rc = (int)keyctl_search(KEY_SPEC_USER_KEYRING, "user", auth_tok_sig, 0);
Michal Hlavinka 14f1a4
+	if (rc < 0) {
Michal Hlavinka 14f1a4
+		rc = errno;
Michal Hlavinka 14f1a4
+		syslog(LOG_ERR, "Failed to find key with sig [%s]: %m\n",
Michal Hlavinka 14f1a4
+		       auth_tok_sig);
Michal Hlavinka 14f1a4
+		goto out;
Michal Hlavinka 14f1a4
+	}
Michal Hlavinka 14f1a4
+	rc = keyctl_unlink(rc, KEY_SPEC_USER_KEYRING);
Michal Hlavinka 14f1a4
+	if (rc < 0) {
Michal Hlavinka 14f1a4
+		rc = errno;
Michal Hlavinka 14f1a4
+		syslog(LOG_ERR, "Failed to unlink key with sig [%s]: %s\n",
Michal Hlavinka 14f1a4
+		       auth_tok_sig, strerror(rc));
Michal Hlavinka 14f1a4
+		goto out;
Michal Hlavinka 14f1a4
+	}
Michal Hlavinka 14f1a4
+	rc = 0;
Michal Hlavinka 14f1a4
+out:
Michal Hlavinka 14f1a4
+	return rc;
Michal Hlavinka 14f1a4
+}
Michal Hlavinka 14f1a4
diff -up ecryptfs-utils-83/src/utils/Makefile.am.splitnss ecryptfs-utils-83/src/utils/Makefile.am
Michal Hlavinka 14f1a4
--- ecryptfs-utils-83/src/utils/Makefile.am.splitnss	2010-05-04 11:09:05.176554494 +0200
Michal Hlavinka 14f1a4
+++ ecryptfs-utils-83/src/utils/Makefile.am	2010-05-04 11:09:05.200991500 +0200
Michal Hlavinka 14f1a4
@@ -36,7 +36,7 @@ mount_ecryptfs_CFLAGS = $(AM_CFLAGS) $(K
Michal Hlavinka 14f1a4
 mount_ecryptfs_LDADD = $(top_builddir)/src/libecryptfs/libecryptfs.la $(KEYUTILS_LIBS) $(LIBGCRYPT_LIBS)
Michal Hlavinka 14f1a4
 umount_ecryptfs_SOURCES = umount.ecryptfs.c
Michal Hlavinka 14f1a4
 umount_ecryptfs_CFLAGS = $(AM_CFLAGS) $(KEYUTILS_CFLAGS)
Michal Hlavinka 14f1a4
-umount_ecryptfs_LDADD = $(top_builddir)/src/libecryptfs/libecryptfs.la
Michal Hlavinka 14f1a4
+umount_ecryptfs_LDADD = -lkeyutils
Michal Hlavinka 14f1a4
 ecryptfs_manager_SOURCES = manager.c io.c io.h gen_key.c
Michal Hlavinka 14f1a4
 ecryptfs_manager_CFLAGS = $(AM_CFLAGS) $(KEYUTILS_CFLAGS) $(LIBGCRYPT_CFLAGS)
Michal Hlavinka 14f1a4
 ecryptfs_manager_LDADD = $(top_builddir)/src/libecryptfs/libecryptfs.la $(KEYUTILS_LIBS) $(LIBGCRYPT_LIBS)
Michal Hlavinka 14f1a4
diff -up ecryptfs-utils-83/src/utils/umount.ecryptfs.c.splitnss ecryptfs-utils-83/src/utils/umount.ecryptfs.c
Michal Hlavinka 14f1a4
--- ecryptfs-utils-83/src/utils/umount.ecryptfs.c.splitnss	2009-10-20 20:49:55.000000000 +0200
Michal Hlavinka 14f1a4
+++ ecryptfs-utils-83/src/utils/umount.ecryptfs.c	2010-05-04 11:08:19.893867192 +0200
Michal Hlavinka 14f1a4
@@ -24,7 +24,10 @@
Michal Hlavinka 14f1a4
 #include <stdlib.h>
Michal Hlavinka 14f1a4
 #include <string.h>
Michal Hlavinka 14f1a4
 #include <unistd.h>
Michal Hlavinka 14f1a4
-#include "ecryptfs.h"
Michal Hlavinka 14f1a4
+#include <keyutils.h>
Michal Hlavinka 14f1a4
+#include <syslog.h>
Michal Hlavinka 14f1a4
+
Michal Hlavinka 14f1a4
+#include "../libecryptfs/key_management.inc.c"
Michal Hlavinka 14f1a4
 
Michal Hlavinka 14f1a4
 static void usage()
Michal Hlavinka 14f1a4
 {