~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/key_mod/ecryptfs_key_mod_openssl.c

  • Committer: Dustin Kirkland
  • Date: 2009-04-21 23:20:27 UTC
  • mfrom: (376.1.10 ecryptfs)
  • Revision ID: kirkland@canonical.com-20090421232027-xhtpj31xtf4c1n79
Merge from Michal Hlavinka.


386. By Michal Hlavinka 2 hours ago

    change error codes to be more descriptive

    Error codes were changed to be more descriptive. MOUNT_ERROR after
    asprintf changed to ENOMEM, some error codes are no longer filtered
    to MOUNT_ERROR. And some other changes mostly from general MOUNT_ERROR
    to ESOMETHING.

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

    decision_graph.h, *: change definition of node return codes to positive values

    Using negative node return codes and negative error codes brings
    too big complications everywhere. Use positive values for node return codes.
    Change error codes that were changed to positive values back to negative
    values.

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

    mount.ecryptfs.c: insist for yes/no answer for unkown sigs

    Mounting with new uknown sig is important question. Insist on yes/no
    answer. Don't assume everything else than yes is no.

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

    don't print error for removing key from keyring if it succeeded

    Prevent printing of "Failed to remove ... with sig [...] from keyring: Success"

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

    module_mgr.c: insist on yes/no answer

    Insist on yes/no/y/n answer. Don't assume everything starting 'y'
    is yes and everything else is no. If wrong anser, return
    WRONG_VALUE for asking again.

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

    use ECRYPTFS_NONEMPTY_VALUE_REQUIRED where reasonable

    Some empty values makes no sense. Require nonempty values
    in that case (for interactive mount).

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

    pam_ecryptfs.c: don't try to unwrap key for users not using pam mounting

    Don't delay passphrase verification for users not using pam automounting.

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

    add verbosity to man page

    Added notes about verbosity to ecryptfs man page.

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

    decision_graph.* : add ECRYPTFS_NONEMPTY_VALUE_REQUIRED flag for nodes

    Nodes can prevent future problems asking for non-empty value.

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

    decision_graph.* : add WRONG_VALUE return code to nodes for asking question again

    Failing mount because of typo is not nice. If node transaction function returns
    WRONG_VALUE and we can ask questions (verbosity=0 is not specified),
    ask question again.

    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:
294
294
                syslog(LOG_ERR,
295
295
                       "%s: Unable to read private key from file [%s]\n",
296
296
                       __FUNCTION__, openssl_data->path);
297
 
                rc = -EIO;
 
297
                rc = -ENOKEY;
298
298
                goto out;
299
299
        }
300
300
        rc = 0;
487
487
        subgraph_ctx = (struct ecryptfs_subgraph_ctx *)(*foo);
488
488
        if ((rc = asprintf(&subgraph_ctx->openssl_data.path, "%s", node->val))
489
489
            == -1) {
490
 
                rc = MOUNT_ERROR;
 
490
                rc = -ENOMEM;
491
491
                goto out;
492
492
        }
493
493
        rc = DEFAULT_TOK;
 
494
        free(node->val);
494
495
        node->val = NULL;
495
496
out:
496
497
        return rc;
518
519
        }
519
520
        if ((subgraph_ctx->key_mod->blob = malloc(blob_size)) == NULL) {
520
521
                syslog(LOG_ERR, "Out of memory\n");
521
 
                rc = MOUNT_ERROR;
 
522
                rc = -ENOMEM;
522
523
                goto out;
523
524
        }
524
525
        if ((rc = ecryptfs_openssl_serialize((unsigned char *) 
538
539
                syslog(LOG_ERR, "Error attempting to add key to keyring for "
539
540
                       "key module [%s]; rc = [%d]\n",
540
541
                       subgraph_ctx->key_mod->alias, rc);
541
 
                rc = MOUNT_ERROR;
542
542
                goto out;
543
543
        }
544
544
        if ((rc = asprintf(&sig_mnt_opt, "ecryptfs_sig=%s", sig)) == -1) {
545
 
                rc = MOUNT_ERROR;
 
545
                rc = -ENOMEM;
546
546
                goto out;
547
547
        }
548
 
        rc = 0;
549
 
        stack_push(mnt_params, sig_mnt_opt);
 
548
        rc = stack_push(mnt_params, sig_mnt_opt);
550
549
out:
551
550
        return rc;
552
551
}
609
608
                rc = MOUNT_ERROR;
610
609
                goto out;
611
610
        }
612
 
        if ((rc = parse_options_file(fd, &file_head))) {
 
611
        rc = parse_options_file(fd, &file_head);
 
612
        close(fd);
 
613
        if (rc) {
613
614
                syslog(LOG_ERR, "%s: Error attempting to parse options out "
614
615
                       "of file\n", __FUNCTION__);
615
 
                rc = MOUNT_ERROR;
616
616
                goto out;
617
617
        }
618
 
        close(fd);
619
618
        walker = file_head.next;
620
619
        while (walker) {
621
620
                if (strcmp(walker->name, "openssl_passwd") == 0) {
622
621
                        if ((rc = 
623
622
                             asprintf(&subgraph_ctx->openssl_data.passphrase,
624
623
                                      "%s", walker->value)) == -1) {
625
 
                                rc = MOUNT_ERROR;
 
624
                                rc = -ENOMEM;
626
625
                                goto out;
627
626
                        }
628
627
                        break;
635
634
                rc = MOUNT_ERROR;
636
635
                goto out;
637
636
        }
638
 
// #warning MEMORY LEAK: something is wrong with freeing file_head
639
637
        walker = NULL;
640
638
        if ((rc = ecryptfs_openssl_process_key(subgraph_ctx, mnt_params))) {
641
639
                syslog(LOG_ERR, "Error processing OpenSSL key; rc = [%d]", rc);
658
656
static int tf_ssl_passwd_fd(struct ecryptfs_ctx *ctx, struct param_node *node,
659
657
                            struct val_node **mnt_params, void **foo)
660
658
{
661
 
        return 0;
 
659
        return ENOSYS;
662
660
}
663
661
 
664
662
static int tf_ecryptfs_openssl_gen_key_param_node_keyfile(
826
824
         .val = NULL,
827
825
         .display_opts = NULL,
828
826
         .default_val = NULL,
829
 
         .flags = STDIN_REQUIRED | ECRYPTFS_PARAM_FLAG_ECHO_INPUT,
 
827
         .flags = STDIN_REQUIRED | ECRYPTFS_PARAM_FLAG_ECHO_INPUT
 
828
                  | ECRYPTFS_NONEMPTY_VALUE_REQUIRED,
830
829
         .num_transitions = 1,
831
830
         .tl = {{.val = NULL,
832
831
                 .pretty_val = NULL,
840
839
         .val = NULL,
841
840
         .display_opts = NULL,
842
841
         .default_val = NULL,
843
 
         .flags = STDIN_REQUIRED | ECRYPTFS_PARAM_FLAG_ECHO_INPUT,
 
842
         .flags = STDIN_REQUIRED | ECRYPTFS_PARAM_FLAG_ECHO_INPUT
 
843
                  | ECRYPTFS_NONEMPTY_VALUE_REQUIRED,
844
844
         .num_transitions = 1,
845
845
         .tl = {{.val = NULL,
846
846
                 .pretty_val = NULL,