~ubuntu-branches/debian/sid/ecryptfs-utils/sid

« back to all changes in this revision

Viewing changes to src/utils/mount.ecryptfs.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-04-25 09:49:00 UTC
  • mto: (1.4.1 upstream) (13.1.3 sid)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090425094900-29zmexzvikuoapgc
Tags: upstream-74
ImportĀ upstreamĀ versionĀ 74

Show diffs side-by-side

added added

removed removed

Lines of Context:
301
301
        char yesno[4];
302
302
        int i;
303
303
        int rc;
 
304
        int tries;
304
305
 
305
306
        home = pw->pw_dir;
306
307
        rc = asprintf(&dot_ecryptfs_dir, "%s/.ecryptfs", home);
328
329
                       "it looks like you have never mounted with this key \n"
329
330
                       "before. This could mean that you have typed your \n"
330
331
                       "passphrase wrong.\n\n", sig_cache_filename);
331
 
                printf("Would you like to proceed with the mount (yes/no)? ");
332
 
                i = 0;
 
332
                tries = 0;
333
333
                do {
334
 
                        yesno[i++] = mygetchar();
335
 
                } while (yesno[i-1] != '\n' && i < 3);
336
 
                yesno[i] = '\0';
337
 
                if (yesno[i-1] != '\n')
338
 
                        while (mygetchar() != '\n');
339
 
                if (memcmp(yesno, "yes", 3) == 0) {
340
 
                        printf("Would you like to append sig [%s] to\n"
341
 
                               "[%s] \n"
342
 
                               "in order to avoid this warning in the future "
343
 
                               "(yes/no)? ", auth_tok_sig, sig_cache_filename);
 
334
                        rc = 0;
 
335
                        printf("Would you like to proceed "
 
336
                               "with the mount (yes/no)? ");
344
337
                        i = 0;
345
338
                        do {
346
339
                                yesno[i++] = mygetchar();
347
 
                        } while (yesno[i-1] != '\n' && i < 3);
348
 
                        yesno[i] = '\0';
349
 
                        if (yesno[i-1] != '\n')
 
340
                        } while (yesno[i-1] != '\n' && i < 4);
 
341
                        if (yesno[i-1] != '\n') {
350
342
                                while (mygetchar() != '\n');
351
 
                        if (memcmp(yesno, "yes", 3) == 0) {
 
343
                                yesno[0] = '\0';
 
344
                        }
 
345
                        yesno[i-1] = '\0';
 
346
                } while ((rc = strcmp(yesno, "yes")) && strcmp(yesno, "no")
 
347
                         && (++tries < 5));
 
348
                if (rc == 0) {
 
349
                        tries = 0;
 
350
                        do {
 
351
                                printf("Would you like to append sig [%s] to\n"
 
352
                                       "[%s] \nin order to avoid this warning "
 
353
                                       "in the future (yes/no)? ", auth_tok_sig,
 
354
                                       sig_cache_filename);
 
355
                                i = 0;
 
356
                                do {
 
357
                                        yesno[i++] = mygetchar();
 
358
                                } while (yesno[i-1] != '\n' && i < 4);
 
359
                                if (yesno[i-1] != '\n') {
 
360
                                        while (mygetchar() != '\n');
 
361
                                        yesno[0] = '\0';
 
362
                                }
 
363
                                yesno[i-1] = '\0';
 
364
                        } while ((rc = strcmp(yesno, "yes")) 
 
365
                                 && strcmp(yesno, "no") && (++tries < 5));
 
366
 
 
367
                        if (rc == 0) {
352
368
                                if ((rc = ecryptfs_append_sig(
353
 
                                             auth_tok_sig,
354
 
                                             sig_cache_filename))) {
 
369
                                            auth_tok_sig,
 
370
                                            sig_cache_filename))) {
355
371
                                        printf("Error appending to [%s]; rc = "
356
 
                                               "[%d]. Aborting mount.\n",
357
 
                                               sig_cache_filename, rc);
 
372
                                        "[%d]. Aborting mount.\n",
 
373
                                        sig_cache_filename, rc);
358
374
                                        goto out;
359
375
                                }
360
376
                                printf("Successfully appended new sig to user "
361
 
                                       "sig cache file\n");
362
 
                        } else
363
 
                                printf("Not adding sig to user sig cache "
364
 
                                       "file; continuing with mount.\n");
 
377
                                        "sig cache file\n");
 
378
                        } else {
 
379
                                if (strcmp(yesno,"no"))
 
380
                                        rc = -EINVAL;
 
381
                                else {
 
382
                                        printf("Not adding sig to user sig "
 
383
                                               "cache file; continuing with "
 
384
                                               "mount.\n");
 
385
                                        rc = 0;
 
386
                                }
 
387
                        }
365
388
                } else {
 
389
                        if (strcmp(yesno,"no"))
 
390
                                rc = -EINVAL;
366
391
                        printf("Aborting mount.\n");
367
392
                        rc = ECANCELED;
368
393
                        goto out;
600
625
                        &ctx, &mnt_params, version, opts_str,
601
626
                        ECRYPTFS_ASK_FOR_ALL_MOUNT_OPTIONS);
602
627
                if (rc) {
 
628
                        if (rc > 0) 
 
629
                                rc = -EINVAL;
603
630
                        printf("Error attempting to evaluate mount options: "
604
631
                               "[%d] %s\nCheck your system logs for details "
605
632
                               "on why this happened.\nTry updating your "