Blame ecryptfs-utils-75-werror.patch

88dca2
diff -up ecryptfs-utils-90/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c.werror ecryptfs-utils-90/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c
88dca2
--- ecryptfs-utils-90/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c.werror	2011-08-11 10:26:55.453235671 +0200
88dca2
+++ ecryptfs-utils-90/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c	2011-08-11 10:26:55.471235788 +0200
Michal Hlavinka 79c27c
@@ -86,7 +86,7 @@ static int ecryptfs_pkcs11h_deserialize(
Michal Hlavinka 79c27c
 		pkcs11h_data->serialized_id = NULL;
Michal Hlavinka 79c27c
 	}
Michal Hlavinka 79c27c
 	else {
Michal Hlavinka 79c27c
-		pkcs11h_data->serialized_id = blob + i;
Michal Hlavinka 79c27c
+		pkcs11h_data->serialized_id = (char *)blob + i;
Michal Hlavinka 79c27c
 		i += serialized_id_length;
Michal Hlavinka 79c27c
 	}
Michal Hlavinka 79c27c
 	pkcs11h_data->certificate_blob_size = blob[i++] % 256;
Michal Hlavinka 79c27c
@@ -104,12 +104,11 @@ static int ecryptfs_pkcs11h_deserialize(
Michal Hlavinka 79c27c
 		pkcs11h_data->passphrase = NULL;
Michal Hlavinka 79c27c
 	}
Michal Hlavinka 79c27c
 	else {
Michal Hlavinka 79c27c
-		pkcs11h_data->passphrase = blob + i;
Michal Hlavinka 79c27c
+		pkcs11h_data->passphrase = (char *)blob + i;
Michal Hlavinka 79c27c
 		i += passphrase_length;
Michal Hlavinka 79c27c
 	}
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
 	rc = 0;
Michal Hlavinka 79c27c
-out:
Michal Hlavinka 79c27c
 	return rc;
Michal Hlavinka 79c27c
 }
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
@@ -346,14 +345,14 @@ static int ecryptfs_pkcs11h_get_key_sig(
Michal Hlavinka 79c27c
 	data[i++] = '\02';
Michal Hlavinka 79c27c
 	data[i++] = (char)(nbits >> 8);
Michal Hlavinka 79c27c
 	data[i++] = (char)nbits;
Michal Hlavinka 79c27c
-	BN_bn2bin(rsa->n, &(data[i]));
Michal Hlavinka 79c27c
+	BN_bn2bin(rsa->n, (unsigned char *)&(data[i]));
Michal Hlavinka 79c27c
 	i += nbytes;
Michal Hlavinka 79c27c
 	data[i++] = (char)(ebits >> 8);
Michal Hlavinka 79c27c
 	data[i++] = (char)ebits;
Michal Hlavinka 79c27c
-	BN_bn2bin(rsa->e, &(data[i]));
Michal Hlavinka 79c27c
+	BN_bn2bin(rsa->e, (unsigned char *)&(data[i]));
Michal Hlavinka 79c27c
 	i += ebytes;
Michal Hlavinka 79c27c
-	SHA1(data, len + 3, hash);
Michal Hlavinka 79c27c
-	to_hex(sig, hash, ECRYPTFS_SIG_SIZE);
Michal Hlavinka 79c27c
+	SHA1((unsigned char *)data, len + 3, (unsigned char *)hash);
Michal Hlavinka 79c27c
+	to_hex((char *)sig, hash, ECRYPTFS_SIG_SIZE);
Michal Hlavinka 79c27c
 	sig[ECRYPTFS_SIG_SIZE_HEX] = '\0';
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
 	rc = 0;
Michal Hlavinka 79c27c
@@ -411,8 +410,8 @@ static int ecryptfs_pkcs11h_encrypt(char
Michal Hlavinka 79c27c
 		if (
Michal Hlavinka 79c27c
 			(rc = RSA_public_encrypt(
Michal Hlavinka 79c27c
 				from_size,
Michal Hlavinka 79c27c
-				from,
Michal Hlavinka 79c27c
-				to,
Michal Hlavinka 79c27c
+				(unsigned char *)from,
Michal Hlavinka 79c27c
+				(unsigned char *)to,
Michal Hlavinka 79c27c
 				rsa,
Michal Hlavinka 79c27c
 				RSA_PKCS1_PADDING
Michal Hlavinka 79c27c
 			)) == -1
Michal Hlavinka 79c27c
@@ -506,9 +505,9 @@ static int ecryptfs_pkcs11h_decrypt(char
Michal Hlavinka 79c27c
 		(rv = pkcs11h_certificate_decryptAny (
Michal Hlavinka 79c27c
 			certificate,
Michal Hlavinka 79c27c
 			CKM_RSA_PKCS,
Michal Hlavinka 79c27c
-			from,
Michal Hlavinka 79c27c
+			(unsigned char *)from,
Michal Hlavinka 79c27c
 			from_size,
Michal Hlavinka 79c27c
-			to,
Michal Hlavinka 79c27c
+			(unsigned char *)to,
Michal Hlavinka 79c27c
 			to_size
Michal Hlavinka 79c27c
 		)) != CKR_OK
Michal Hlavinka 79c27c
 	) {
Michal Hlavinka 79c27c
@@ -534,9 +533,9 @@ static int ecryptfs_pkcs11h_decrypt(char
Michal Hlavinka 79c27c
 		pkcs11h_certificate_decryptAny (
Michal Hlavinka 79c27c
 			certificate,
Michal Hlavinka 79c27c
 			CKM_RSA_PKCS,
Michal Hlavinka 79c27c
-			from,
Michal Hlavinka 79c27c
+			(unsigned char *)from,
Michal Hlavinka 79c27c
 			from_size,
Michal Hlavinka 79c27c
-			tmp,
Michal Hlavinka 79c27c
+			(unsigned char *)tmp,
Michal Hlavinka 79c27c
 			to_size
Michal Hlavinka 79c27c
 		);
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
@@ -851,7 +850,7 @@ static int ecryptfs_pkcs11h_process_key(
Michal Hlavinka 79c27c
 		rc = MOUNT_ERROR;
Michal Hlavinka 79c27c
 		goto out;
Michal Hlavinka 79c27c
 	}
Michal Hlavinka 79c27c
-	if ((rc = ecryptfs_pkcs11h_serialize(subgraph_key_ctx->key_mod->blob,
Michal Hlavinka 79c27c
+	if ((rc = ecryptfs_pkcs11h_serialize((unsigned char *)subgraph_key_ctx->key_mod->blob,
Michal Hlavinka 79c27c
 					     &subgraph_key_ctx->key_mod->blob_size, 
Michal Hlavinka 79c27c
 					     pkcs11h_data))) {
Michal Hlavinka 79c27c
 		syslog(LOG_ERR, "PKCS#11: Error serializing pkcs11; rc=[%d]\n", rc);
Michal Hlavinka 79c27c
@@ -930,7 +929,7 @@ static int tf_pkcs11h_global_loglevel(st
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
 	rc = DEFAULT_TOK;
Michal Hlavinka 79c27c
 	node->val = NULL;
Michal Hlavinka 79c27c
-out:
Michal Hlavinka 79c27c
+// out:
Michal Hlavinka 79c27c
 	return rc;
Michal Hlavinka 79c27c
 }
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
@@ -943,7 +942,7 @@ static int tf_pkcs11h_global_pincache(st
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
 	rc = DEFAULT_TOK;
Michal Hlavinka 79c27c
 	node->val = NULL;
Michal Hlavinka 79c27c
-out:
Michal Hlavinka 79c27c
+// out:
Michal Hlavinka 79c27c
 	return rc;
Michal Hlavinka 79c27c
 }
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
@@ -1013,7 +1012,7 @@ static int tf_pkcs11h_provider_prot_auth
Michal Hlavinka 79c27c
 	sscanf (node->val, "%x", &subgraph_provider_ctx->allow_protected_authentication);
Michal Hlavinka 79c27c
 	rc = DEFAULT_TOK;
Michal Hlavinka 79c27c
 	node->val = NULL;
Michal Hlavinka 79c27c
-out:
Michal Hlavinka 79c27c
+
Michal Hlavinka 79c27c
 	return rc;
Michal Hlavinka 79c27c
 }
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
@@ -1027,7 +1026,7 @@ static int tf_pkcs11h_provider_cert_priv
Michal Hlavinka 79c27c
 	sscanf (node->val, "%x", &subgraph_provider_ctx->certificate_is_private);
Michal Hlavinka 79c27c
 	rc = DEFAULT_TOK;
Michal Hlavinka 79c27c
 	node->val = NULL;
Michal Hlavinka 79c27c
-out:
Michal Hlavinka 79c27c
+
Michal Hlavinka 79c27c
 	return rc;
Michal Hlavinka 79c27c
 }
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
@@ -1042,7 +1041,7 @@ static int tf_pkcs11h_provider_private_m
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
 	rc = DEFAULT_TOK;
Michal Hlavinka 79c27c
 	node->val = NULL;
Michal Hlavinka 79c27c
-out:
Michal Hlavinka 79c27c
+
Michal Hlavinka 79c27c
 	return rc;
Michal Hlavinka 79c27c
 }
Michal Hlavinka 79c27c
 
Michal Hlavinka 79c27c
@@ -1073,7 +1072,7 @@ static int tf_pkcs11h_provider_end(struc
Michal Hlavinka 79c27c
 	free(subgraph_provider_ctx);
Michal Hlavinka 79c27c
 	*foo = NULL;
Michal Hlavinka 79c27c
 	rc = DEFAULT_TOK;
Michal Hlavinka 79c27c
-out:
Michal Hlavinka 79c27c
+
Michal Hlavinka 79c27c
 	return rc;
Michal Hlavinka 79c27c
 }
Michal Hlavinka 79c27c
 
9f5906
@@ -1120,7 +1119,7 @@ static int tf_pkcs11h_key_x509file(struc
9f5906
 	X509 *x509 = NULL;
9f5906
 	unsigned char *p = NULL;
9f5906
 	FILE *fp = NULL;
9f5906
-	int rc;
9f5906
+	int rc = 0;
9f5906
 
9f5906
 	subgraph_key_ctx = (struct pkcs11h_subgraph_key_ctx *)(*foo);
9f5906
 
88dca2
diff -up ecryptfs-utils-90/src/libecryptfs/ecryptfs-stat.c.werror ecryptfs-utils-90/src/libecryptfs/ecryptfs-stat.c
88dca2
--- ecryptfs-utils-90/src/libecryptfs/ecryptfs-stat.c.werror	2010-12-17 18:34:04.000000000 +0100
88dca2
+++ ecryptfs-utils-90/src/libecryptfs/ecryptfs-stat.c	2011-08-11 10:26:55.472235795 +0200
Michal Hlavinka 14f112
@@ -146,7 +146,7 @@ int ecryptfs_parse_stat(struct ecryptfs_
Michal Hlavinka 14f112
 	if (buf_size < (ECRYPTFS_FILE_SIZE_BYTES
Michal Hlavinka 14f112
 			+ MAGIC_ECRYPTFS_MARKER_SIZE_BYTES
Michal Hlavinka 14f112
 			+ 4)) {
Michal Hlavinka 14f112
-		printf("%s: Invalid metadata size; must have at least [%lu] "
Michal Hlavinka 14f112
+		printf("%s: Invalid metadata size; must have at least [%zu] "
Michal Hlavinka 14f112
 		       "bytes; there are only [%zu] bytes\n", __FUNCTION__,
Michal Hlavinka 14f112
 		       (ECRYPTFS_FILE_SIZE_BYTES
Michal Hlavinka 14f112
 			+ MAGIC_ECRYPTFS_MARKER_SIZE_BYTES
88dca2
diff -up ecryptfs-utils-90/src/pam_ecryptfs/pam_ecryptfs.c.werror ecryptfs-utils-90/src/pam_ecryptfs/pam_ecryptfs.c
88dca2
--- ecryptfs-utils-90/src/pam_ecryptfs/pam_ecryptfs.c.werror	2011-02-06 03:44:30.000000000 +0100
88dca2
+++ ecryptfs-utils-90/src/pam_ecryptfs/pam_ecryptfs.c	2011-08-11 10:26:55.472235795 +0200
8813d2
@@ -39,35 +39,11 @@
8813d2
 #include <sys/stat.h>
8813d2
 #include <fcntl.h>
8813d2
 #include <security/pam_modules.h>
8813d2
+#include <security/pam_ext.h>
8813d2
 #include "../include/ecryptfs.h"
Michal Hlavinka a225d8
 
Michal Hlavinka 538613
 #define PRIVATE_DIR "Private"
Michal Hlavinka a225d8
 
Michal Hlavinka 538613
-static void error(const char *msg)
Michal Hlavinka 538613
-{
Michal Hlavinka 538613
-	syslog(LOG_ERR, "errno = [%i]; strerror = [%m]\n", errno);
Michal Hlavinka 538613
-	switch (errno) {
Michal Hlavinka 538613
-	case ENOKEY:
Michal Hlavinka 538613
-		syslog(LOG_ERR, "%s: Requested key not available\n", msg);
Michal Hlavinka 538613
-		return;
Michal Hlavinka 538613
-
Michal Hlavinka 538613
-	case EKEYEXPIRED:
Michal Hlavinka 538613
-		syslog(LOG_ERR, "%s: Key has expired\n", msg);
Michal Hlavinka 538613
-		return;
Michal Hlavinka 538613
-
Michal Hlavinka 538613
-	case EKEYREVOKED:
Michal Hlavinka 538613
-		syslog(LOG_ERR, "%s: Key has been revoked\n", msg);
Michal Hlavinka 538613
-		return;
Michal Hlavinka 538613
-
Michal Hlavinka 538613
-	case EKEYREJECTED:
Michal Hlavinka 538613
-		syslog(LOG_ERR, "%s: Key was rejected by service\n", msg);
Michal Hlavinka 538613
-		return;
Michal Hlavinka 538613
-	default:
Michal Hlavinka 538613
-		syslog(LOG_ERR, "%s: Unknown key error\n", msg);
Michal Hlavinka 538613
-		return;
Michal Hlavinka 538613
-	}
Michal Hlavinka 538613
-}
Michal Hlavinka 538613
-
8813d2
 /* returns: 0 if file does not exist, 1 if it exists, <0 for error */
8813d2
 static int file_exists_dotecryptfs(const char *homedir, char *filename)
Michal Hlavinka 538613
 {
8813d2
@@ -87,7 +63,7 @@ out:
Michal Hlavinka c7231a
 	return rc;
Michal Hlavinka c7231a
 }
Michal Hlavinka c7231a
 
Michal Hlavinka c7231a
-static int wrap_passphrase_if_necessary(char *username, uid_t uid, char *wrapped_pw_filename, char *passphrase, char *salt)
Michal Hlavinka c7231a
+static int wrap_passphrase_if_necessary(const char *username, uid_t uid, char *wrapped_pw_filename, char *passphrase, char *salt)
Michal Hlavinka c7231a
 {
Michal Hlavinka c7231a
 	char *unwrapped_pw_filename = NULL;
Michal Hlavinka c7231a
 	struct stat s;
8813d2
@@ -201,8 +177,6 @@ PAM_EXTERN int pam_sm_authenticate(pam_h
Michal Hlavinka c7231a
 		if ((argc == 1)
Michal Hlavinka c7231a
 		    && (memcmp(argv[0], "unwrap\0", 7) == 0)) {
Michal Hlavinka c7231a
 			char *wrapped_pw_filename;
Michal Hlavinka c7231a
-			char *unwrapped_pw_filename;
Michal Hlavinka c7231a
-			struct stat s;
Michal Hlavinka c7231a
 
Michal Hlavinka c7231a
 			rc = asprintf(
Michal Hlavinka c7231a
 				&wrapped_pw_filename, "%s/.ecryptfs/%s",
8813d2
@@ -294,8 +268,6 @@ static int private_dir(pam_handle_t *pam
Michal Hlavinka 538613
 	char *autoumount = "auto-umount";
Michal Hlavinka 538613
 	struct stat s;
Michal Hlavinka 538613
 	pid_t pid;
Michal Hlavinka 538613
-	struct utmp *u;
Michal Hlavinka 538613
-	int count = 0;
Michal Hlavinka a225d8
 
Michal Hlavinka 538613
 	if ((pwd = fetch_pwd(pamh)) == NULL) {
Michal Hlavinka 538613
 		/* fetch_pwd() logged a message */
8813d2
@@ -342,7 +314,7 @@ static int private_dir(pam_handle_t *pam
Michal Hlavinka 538613
 			if (stat(recorded, &s) != 0 && stat("/usr/share/ecryptfs-utils/ecryptfs-record-passphrase", &s) == 0) {
Michal Hlavinka 538613
 				/* User has not recorded their passphrase */
Michal Hlavinka 538613
 				unlink("/var/lib/update-notifier/user.d/ecryptfs-record-passphrase");
Michal Hlavinka 538613
-				symlink("/usr/share/ecryptfs-utils/ecryptfs-record-passphrase", "/var/lib/update-notifier/user.d/ecryptfs-record-passphrase");
Michal Hlavinka 538613
+				rc=symlink("/usr/share/ecryptfs-utils/ecryptfs-record-passphrase", "/var/lib/update-notifier/user.d/ecryptfs-record-passphrase");
Michal Hlavinka 538613
 				fd = open("/var/lib/update-notifier/dpkg-run-stamp", O_WRONLY|O_CREAT|O_NONBLOCK, 0666);
Michal Hlavinka 538613
 				close(fd);
Michal Hlavinka 538613
 			}
8813d2
@@ -413,7 +385,7 @@ PAM_EXTERN int pam_sm_chauthtok(pam_hand
5d320b
 	char *old_passphrase = NULL;
5d320b
 	char *new_passphrase = NULL;
5d320b
 	char *wrapped_pw_filename;
5d320b
-	char *name = NULL;
5d320b
+// 	char *name = NULL;
5d320b
 	char salt[ECRYPTFS_SALT_SIZE];
5d320b
 	char salt_hex[ECRYPTFS_SALT_SIZE_HEX];
5d320b
 	pid_t child_pid, tmp_pid;
8813d2
@@ -427,11 +399,11 @@ PAM_EXTERN int pam_sm_chauthtok(pam_hand
5d320b
 		if (pwd) {
5d320b
 			uid = pwd->pw_uid;
5d320b
 			homedir = pwd->pw_dir;
5d320b
-			name = pwd->pw_name;
5d320b
+// 			name = pwd->pw_name;
Michal Hlavinka 538613
 		}
Michal Hlavinka 538613
 	} else {
Michal Hlavinka 538613
 		syslog(LOG_ERR, "Error getting passwd info for user [%s]; "
Michal Hlavinka 538613
-		       "rc = [%ld]\n", username, rc);
Michal Hlavinka 538613
+		       "rc = [%d]\n", username, rc);
Michal Hlavinka 538613
 		goto out;
Michal Hlavinka 538613
 	}
Michal Hlavinka 538613
 	saved_uid = geteuid();
88dca2
diff -up ecryptfs-utils-90/src/utils/mount.ecryptfs.c.werror ecryptfs-utils-90/src/utils/mount.ecryptfs.c
88dca2
--- ecryptfs-utils-90/src/utils/mount.ecryptfs.c.werror	2011-08-11 10:26:55.468235767 +0200
88dca2
+++ ecryptfs-utils-90/src/utils/mount.ecryptfs.c	2011-08-11 10:26:55.473235801 +0200
5d320b
@@ -461,7 +461,7 @@ static int ecryptfs_do_mount(int argc, c
5d320b
 {
5d320b
 	int rc;
5d320b
 	int flags = 0;
5d320b
-	int num_opts = 0;
5d320b
+// 	int num_opts = 0;
5d320b
 	char *src = NULL, *targ = NULL, *opts = NULL, *new_opts = NULL, *temp;
5d320b
 	char *val;
5d320b
 
5d320b
@@ -472,7 +472,7 @@ static int ecryptfs_do_mount(int argc, c
5d320b
 	rc = strip_userland_opts(opts);
5d320b
 	if (rc)
5d320b
 		goto out;
5d320b
-	num_opts = ecryptfs_generate_mount_flags(opts, &flags);
5d320b
+	ecryptfs_generate_mount_flags(opts, &flags);
5d320b
 	if (!(temp = strdup("ecryptfs_unlink_sigs"))) {
5d320b
 		rc = -ENOMEM;
5d320b
 		goto out;
88dca2
diff -up ecryptfs-utils-90/src/utils/mount.ecryptfs_private.c.werror ecryptfs-utils-90/src/utils/mount.ecryptfs_private.c
88dca2
--- ecryptfs-utils-90/src/utils/mount.ecryptfs_private.c.werror	2011-08-11 10:26:55.461235723 +0200
88dca2
+++ ecryptfs-utils-90/src/utils/mount.ecryptfs_private.c	2011-08-11 10:27:23.264417014 +0200
8813d2
@@ -95,7 +95,6 @@ int read_config(char *pw_dir, int uid, c
8813d2
 	*s = strdup(e->mnt_fsname);
8813d2
 	if (!*s)
8813d2
 		return -2;
8813d2
-out:
8813d2
 	return 0;
8813d2
 }
8813d2
 
88dca2
@@ -300,7 +299,7 @@ int update_mtab(char *dev, char *mnt, ch
88dca2
 		goto fail_early;
88dca2
 	}
88dca2
 
88dca2
-	while (old_ent = getmntent(old_mtab)) {
88dca2
+	while ((old_ent = getmntent(old_mtab))) {
88dca2
 		if (addmntent(new_mtab, old_ent) != 0) {
88dca2
 			perror("addmntent");
88dca2
 			goto fail;
88dca2
diff -up ecryptfs-utils-90/src/utils/test.c.werror ecryptfs-utils-90/src/utils/test.c
88dca2
--- ecryptfs-utils-90/src/utils/test.c.werror	2010-12-17 18:34:04.000000000 +0100
88dca2
+++ ecryptfs-utils-90/src/utils/test.c	2011-08-11 10:26:55.474235807 +0200
Michal Hlavinka beb646
@@ -281,7 +281,7 @@ int ecryptfs_encrypt_page(int page_cache
Michal Hlavinka beb646
 	struct inode *lower_inode;
Michal Hlavinka beb646
 	struct ecryptfs_crypt_stat *crypt_stat;
Michal Hlavinka beb646
 	int rc = 0;
Michal Hlavinka beb646
-	int lower_byte_offset;
Michal Hlavinka beb646
+	int lower_byte_offset = 0;
Michal Hlavinka beb646
 	int orig_byte_offset = 0;
Michal Hlavinka beb646
 	int num_extents_per_page;
Michal Hlavinka beb646
 #define ECRYPTFS_PAGE_STATE_UNREAD    0