~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/libecryptfs/decision_graph.c

  • Committer: mike@halcrow.us
  • Date: 2007-12-16 00:54:37 UTC
  • Revision ID: git-v1:55dfb66bac7dba63b0da53d4a413901a7dd24e75
SupportĀ forĀ implicitĀ transitions

Show diffs side-by-side

added added

removed removed

Lines of Context:
316
316
                        temp = temp->next;
317
317
                }
318
318
        }
319
 
        if (node->default_val) {
 
319
        if (node->default_val && (strcmp(node->default_val, "NULL") != 0)) {
320
320
                if (asprintf(&node->val, "%s", node->default_val) == -1) {
321
321
                        rc = -ENOMEM;
322
322
                        goto out;
344
344
        char *verify;
345
345
        int val;
346
346
        int value_retrieved;
 
347
        int i;
347
348
        int rc;
348
349
 
 
350
        if (ecryptfs_verbosity)
 
351
                syslog(LOG_INFO, "%s: Called on node->mnt_opt_names[0] = [%s]",
 
352
                       __FUNCTION__, node->mnt_opt_names[0]);
 
353
        if (node->val) {
 
354
                if (ecryptfs_verbosity)
 
355
                        syslog(LOG_INFO, "%s: node->val already set to [%s]\n",
 
356
                               __FUNCTION__, node->val);
 
357
                goto out;
 
358
        }
349
359
        rc = retrieve_val(&value_retrieved, nvp_head, node);
350
360
        if (rc) {
351
361
                syslog(LOG_ERR, "%s: Error attempting to retrieve value; "
360
370
                               __FUNCTION__);
361
371
                goto out;
362
372
        }
 
373
        if (node->flags & ECRYPTFS_ALLOW_IMPLICIT_TRANSITION
 
374
            && !(node->flags & ECRYPTFS_NO_AUTO_TRANSITION)) {
 
375
                for (i = 0; i < node->num_transitions; i++) {
 
376
                        if (node->tl[i].next_token)
 
377
                                rc = retrieve_val(&value_retrieved, nvp_head,
 
378
                                                  node->tl[i].next_token);
 
379
                        if (rc) {
 
380
                                syslog(LOG_ERR, "%s: Error attempting to retrieve "
 
381
                                       "value; rc = [%d]\n", __FUNCTION__, rc);
 
382
                                goto out;
 
383
                        }
 
384
                        if (value_retrieved) {
 
385
                                if (ecryptfs_verbosity)
 
386
                                        syslog(LOG_INFO,
 
387
                                               "%s: Value retrieved from default_val "
 
388
                                               "or from parameter list for successive "
 
389
                                               "node at transition slot [%d]; "
 
390
                                               "returning\n", __FUNCTION__, i);
 
391
                                rc = asprintf(&node->val, "%s",
 
392
                                              node->tl[i].next_token->mnt_opt_names[0]);
 
393
                                if (rc == -1) {
 
394
                                        rc = -ENOMEM;
 
395
                                        goto out;
 
396
                                }
 
397
                                rc = 0;
 
398
                                goto out;
 
399
                        }
 
400
                }
 
401
        }
363
402
        if (node->flags & ECRYPTFS_PARAM_FLAG_NO_VALUE) {
364
403
                if (ecryptfs_verbosity)
365
404
                        syslog(LOG_INFO,
541
580
                                asprintf(&prompt, "%s", node->prompt);
542
581
                        if (ecryptfs_verbosity)
543
582
                                syslog(LOG_INFO,
544
 
                                       "node->mnt_opt_names[0] = [%s]\n; "
 
583
                                       "%s: node->mnt_opt_names[0] = [%s]\n; "
545
584
                                       "node->flags = [0x%.8x]\n",
 
585
                                       __FUNCTION__,
546
586
                                       node->mnt_opt_names[0], node->flags);
547
587
                        rc = (ctx->get_string)
548
588
                                (&(node->val), prompt,