~mrooney/ecryptfs/nautilus-integration

« back to all changes in this revision

Viewing changes to src/key_mod/ecryptfs_key_mod_pkcs11_helper.c

  • Committer: Dustin Kirkland
  • Date: 2009-04-23 03:07:43 UTC
  • mfrom: (376.1.12 ecryptfs)
  • Revision ID: kirkland@canonical.com-20090423030743-607khpd47cr7zi6q
Tags: 74
 388. By Michal Hlavinka  17 hours ago

    key_management.c: if key is already in keyring don't report it as error

    ecryptfs_add_passphrase_key_to_keyring gets return code 1 if key,
    it is trying to add to keyring, already exists in keyring.
    Return code remains 1, just don't report it as error.

    Signed-off-by: Michal Hlavinka <mhlavink@redhat.com>
387. By Michal Hlavinka 18 hours ago

    check and fix asprintf's error codes

    Change all MOUNT_ERROR return codes for asprintf failure to -ENOMEM.
    Make sure all return codes are reset to zero or overwritten,
    because asprintf doesn't return zero for success.

    Signed-off-by: Michal Hlavinka <mhlavink@redhat.com>


Acked-by: Dustin Kirkland <kirkland@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
872
872
                goto out;
873
873
        }
874
874
        if ((rc = asprintf(&sig_mnt_opt, "ecryptfs_sig=%s", sig)) == -1) {
875
 
                rc = MOUNT_ERROR;
 
875
                rc = -ENOMEM;
876
876
                goto out;
877
877
        }
878
878
        rc = 0;
975
975
        subgraph_provider_ctx = (struct pkcs11h_subgraph_provider_ctx *)(*foo);
976
976
        if ((rc = asprintf(&subgraph_provider_ctx->name, "%s", node->val))
977
977
            == -1) {
978
 
                rc = MOUNT_ERROR;
 
978
                rc = -ENOMEM;
979
979
                goto out;
980
980
        }
981
981
        rc = DEFAULT_TOK;
993
993
        subgraph_provider_ctx = (struct pkcs11h_subgraph_provider_ctx *)(*foo);
994
994
        if ((rc = asprintf(&subgraph_provider_ctx->library, "%s", node->val))
995
995
            == -1) {
996
 
                rc = MOUNT_ERROR;
 
996
                rc = -ENOMEM;
997
997
                goto out;
998
998
        }
999
999
        rc = DEFAULT_TOK;
1085
1085
        subgraph_key_ctx = (struct pkcs11h_subgraph_key_ctx *)(*foo);
1086
1086
        if ((rc = asprintf(&subgraph_key_ctx->pkcs11h_data.serialized_id, "%s", node->val))
1087
1087
            == -1) {
1088
 
                rc = MOUNT_ERROR;
 
1088
                rc = -ENOMEM;
1089
1089
                goto out;
1090
1090
        }
1091
1091
        rc = DEFAULT_TOK;
1103
1103
        subgraph_key_ctx = (struct pkcs11h_subgraph_key_ctx *)(*foo);
1104
1104
        if ((rc = asprintf(&subgraph_key_ctx->pkcs11h_data.passphrase, "%s",
1105
1105
                           node->val)) == -1) {
1106
 
                rc = MOUNT_ERROR;
 
1106
                rc = -ENOMEM;
1107
1107
                goto out;
1108
1108
        }
1109
1109
        node->val = NULL;