~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/libecryptfs/module_mgr.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:
97
97
                .trans_func = sig_param_node_callback}}
98
98
};
99
99
 
 
100
/* returns: 1 for str=="yes" or "y", 0 for "no" or "n", -1 elsewhere */
 
101
static int is_yes(const char *str)
 
102
{
 
103
        if (str) {
 
104
                if (!strcmp(str,"y") || !strcmp(str,"yes"))
 
105
                        return 1;
 
106
                if (!strcmp(str,"no") || !strcmp(str,"n"))
 
107
                        return 0;
 
108
        }
 
109
 
 
110
        return -1;
 
111
}
 
112
 
 
113
 
 
114
/* returns: 0 for success
 
115
 *          WRONG_VALUE if node->val is none of  'yes','y','no','n'
 
116
 *          <0 for error
 
117
 */
 
118
static int stack_push_if_yes(struct param_node *node, struct val_node **head,
 
119
                             char *opt_name)
 
120
{
 
121
        int rc;
 
122
 
 
123
        if (((rc=is_yes(node->val)) == 1) || (node->flags & PARAMETER_SET)) {
 
124
                rc = stack_push(head, opt_name);
 
125
        } else if (rc == -1)
 
126
                rc = WRONG_VALUE;
 
127
        free(node->val);
 
128
        node->val = NULL;
 
129
        return rc;
 
130
}
 
131
 
100
132
static int get_hmac(struct ecryptfs_ctx *ctx, struct param_node *node,
101
133
                    struct val_node **head, void **foo)
102
134
{
103
 
        if (node->val && (*(node->val) == 'y')) {
104
 
                stack_push(head, "ecryptfs_hmac");
105
 
        } else if (node->flags & PARAMETER_SET) {
106
 
                stack_push(head, "ecryptfs_hmac");
107
 
                return 0;
108
 
        }
109
 
        free(node->val);
110
 
        return 0;
 
135
        return stack_push_if_yes(node, head, "ecryptfs_hmac");
111
136
}
112
137
 
113
138
static int get_passthrough(struct ecryptfs_ctx *ctx, struct param_node *node,
114
139
                           struct val_node **head, void **foo)
115
140
{
116
 
        if (node->val && (*(node->val) == 'y')) {
117
 
                stack_push(head, "ecryptfs_passthrough");
118
 
        } else if (node->flags & PARAMETER_SET) {
119
 
                stack_push(head, "ecryptfs_passthrough");
120
 
                return 0;
121
 
        }
122
 
        free(node->val);
123
 
        return 0;
 
141
        return stack_push_if_yes(node, head, "ecryptfs_passthrough");
124
142
}
125
143
 
126
144
static int get_xattr(struct ecryptfs_ctx *ctx, struct param_node *node,
127
145
                           struct val_node **head, void **foo)
128
146
{
129
 
        if (node->val && (*(node->val) == 'y')) {
130
 
                stack_push(head, "ecryptfs_xattr_metadata");
131
 
        } else if (node->flags & PARAMETER_SET) {
132
 
                stack_push(head, "ecryptfs_xattr_metadata");
133
 
                return 0;
134
 
        }
135
 
        free(node->val);
136
 
        return 0;
 
147
        return stack_push_if_yes(node, head, "ecryptfs_xattr_metadata");
137
148
}
138
149
 
139
150
static int get_encrypted_passthrough(struct ecryptfs_ctx *ctx,
140
151
                                     struct param_node *node,
141
152
                                     struct val_node **head, void **foo)
142
153
{
143
 
        if (node->val && (*(node->val) == 'y')) {
144
 
                stack_push(head, "ecryptfs_encrypted_view");
145
 
        } else if (node->flags & PARAMETER_SET) {
146
 
                stack_push(head, "ecryptfs_encrypted_view");
147
 
                return 0;
148
 
        }
149
 
        free(node->val);
150
 
        return 0;
 
154
        return stack_push_if_yes(node, head, "ecryptfs_encrypted_view");
151
155
}
152
156
 
153
157
static struct param_node end_param_node = {
221
225
                                        struct param_node *node,
222
226
                                        struct val_node **head, void **foo)
223
227
{
224
 
        int rc = 0;
 
228
        int yn, rc = 0;
225
229
 
226
 
        if ((node->val && (*(node->val) == 'y'))
 
230
        if (((yn=is_yes(node->val)) > 0)
227
231
            || (node->flags & PARAMETER_SET)) {
228
232
                int i;
229
233
                struct val_node *val_node;
254
258
                        }
255
259
                        val_node = val_node->next;
256
260
                }
257
 
        }
 
261
        } else if (node->val) {
 
262
                if (yn < 0)
 
263
                        rc = WRONG_VALUE;
 
264
        } else
 
265
                /* default: no */;
258
266
out_free:
259
 
        if (node->val)
 
267
        if (node->val) {
260
268
                free(node->val);
 
269
                node->val = NULL;
 
270
        }
261
271
        return rc;
262
272
}
263
273