~ubuntu-branches/ubuntu/vivid/ecryptfs-utils/vivid

« back to all changes in this revision

Viewing changes to src/key_mod/ecryptfs_key_mod_openssl.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-04-09 09:54:00 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080409095400-cexrc09wzgqsk9bs
Tags: 43-1
* New upstream release.
* Removing watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
581
581
        return rc;
582
582
}
583
583
 
584
 
/**
585
 
 * Read the passphrase from a file
586
 
 */
587
 
static int tf_ssl_passfile(struct ecryptfs_ctx *ctx, struct param_node *node,
588
 
                           struct val_node **mnt_params, void **foo)
 
584
static int tf_ssl_file(struct ecryptfs_ctx *ctx, struct param_node *node,
 
585
                       struct val_node **mnt_params, void **foo)
 
586
{
 
587
}
 
588
 
 
589
static int tf_ssl_passwd_file(struct ecryptfs_ctx *ctx, struct param_node *node,
 
590
                              struct val_node **mnt_params, void **foo)
589
591
{
590
592
        int rc = 0;
591
593
        char *tmp_val = NULL;
596
598
 
597
599
        syslog(LOG_INFO, "%s: Called\n", __FUNCTION__);
598
600
        subgraph_ctx = (struct ecryptfs_subgraph_ctx *)(*foo);
599
 
        if (strcmp(node->mnt_opt_names[0], "passfile") == 0)
 
601
        if (strcmp(node->mnt_opt_names[0], "passwd_file") == 0)
600
602
                fd = open(node->val, O_RDONLY);
601
 
        else if (strcmp(node->mnt_opt_names[0], "passfd") == 0)
 
603
        else if (strcmp(node->mnt_opt_names[0], "passwd_fd") == 0)
602
604
                fd = strtol(node->val, NULL, 0);
603
605
        else {
604
606
                rc = MOUNT_ERROR;
654
656
        return rc;
655
657
}
656
658
 
657
 
static int tf_ssl_file(struct ecryptfs_ctx *ctx, struct param_node *node,
658
 
                       struct val_node **mnt_params, void **foo)
659
 
{
660
 
}
661
 
 
662
 
static int tf_ssl_passwd_file(struct ecryptfs_ctx *ctx, struct param_node *node,
663
 
                              struct val_node **mnt_params, void **foo)
664
 
{
665
 
}
666
 
 
667
659
static int tf_ssl_passwd_fd(struct ecryptfs_ctx *ctx, struct param_node *node,
668
660
                            struct val_node **mnt_params, void **foo)
669
661
{
751
743
#define SSL_USER_PROVIDED_PASSWD_TOK 3
752
744
#define SSL_FILE_PASSWD_TOK 4
753
745
#define SSL_FD_PASSWD_TOK 5
754
 
static struct param_node ssl_param_nodes_new[] = {
 
746
static struct param_node ssl_param_nodes[] = {
755
747
        {.num_mnt_opt_names = 1,
756
748
         .mnt_opt_names = {"keysource"},
757
749
         .prompt = "Key source",
763
755
         .num_transitions = 1,
764
756
         .tl = {{.val = "default",
765
757
                 .pretty_val = "OpenSSL Key File",
766
 
                 .next_token = &ssl_param_nodes_new[SSL_KEY_FILE_TOK],
 
758
                 .next_token = &ssl_param_nodes[SSL_KEY_FILE_TOK],
767
759
                 .trans_func = NULL}}}, /* Add more options here later */
768
760
 
769
761
        {.num_mnt_opt_names = 1,
773
765
         .val = NULL,
774
766
         .display_opts = NULL,
775
767
         .default_val = NULL,
776
 
         .flags = 0,
 
768
         .flags = ECRYPTFS_PARAM_FLAG_ECHO_INPUT,
777
769
         .num_transitions = 1,
778
770
         .tl = {{.val = "default", /* The decision graph code will
779
771
                                    * just follow a "default"
780
772
                                    * transition node */
781
773
                 .pretty_val = "Passphrase Method",
782
 
                 .next_token = &ssl_param_nodes_new[SSL_PASSPHRASE_METHOD_TOK],
 
774
                 .next_token = &ssl_param_nodes[SSL_PASSPHRASE_METHOD_TOK],
783
775
                 .trans_func = tf_ssl_keyfile}}},
784
776
 
785
777
        {.num_mnt_opt_names = 1,
796
788
         .num_transitions = 3,
797
789
         .tl = {{.val = "passwd",
798
790
                 .pretty_val = "passwd: Enter on Console",
799
 
                 .next_token = &ssl_param_nodes_new[SSL_USER_PROVIDED_PASSWD_TOK],
 
791
                 .next_token = &ssl_param_nodes[SSL_USER_PROVIDED_PASSWD_TOK],
800
792
                 .trans_func = NULL},
801
793
                {.val = "passwd_file",
802
794
                 .pretty_val = "passwd_file: File Containing Passphrase",
803
 
                 .next_token = &ssl_param_nodes_new[SSL_FILE_PASSWD_TOK],
 
795
                 .next_token = &ssl_param_nodes[SSL_FILE_PASSWD_TOK],
804
796
                 .trans_func = NULL},
805
797
                {.val = "passwd_fd",
806
798
                 .pretty_val = ("passwd_fd: File Descriptor for File "
807
799
                                "Containing Passphrase"),
808
 
                 .next_token = &ssl_param_nodes_new[SSL_FD_PASSWD_TOK],
 
800
                 .next_token = &ssl_param_nodes[SSL_FD_PASSWD_TOK],
809
801
                 .trans_func = NULL}}},
810
802
 
811
803
        {.num_mnt_opt_names = 1,
917
909
struct transition_node openssl_transition = {
918
910
        .val = "openssl",
919
911
        .pretty_val = "OpenSSL module",
920
 
        .next_token = &(ssl_param_nodes_new[SSL_KEY_SOURCE_TOK]),
 
912
        .next_token = &(ssl_param_nodes[SSL_KEY_SOURCE_TOK]),
921
913
        .trans_func = tf_openssl_enter
922
914
};
923
915
 
972
964
                rc = -EIO;
973
965
                goto out;
974
966
        }
975
 
        if ((rc = asprintf(&ssl_param_nodes_new[SSL_KEY_FILE_TOK].suggested_val,
 
967
        if ((rc = asprintf(&ssl_param_nodes[SSL_KEY_FILE_TOK].suggested_val,
976
968
                           "%s/.ecryptfs/pki/openssl/key.pem",
977
969
                           pw->pw_dir)) == -1) {
978
970
                rc = -ENOMEM;