Changeset 841 in openpam


Ignore:
Timestamp:
Nov 12, 2014, 4:21:15 PM (6 years ago)
Author:
Dag-Erling Smørgrav
Message:

Turn writeback mode on by default in oathkey(1).

Location:
trunk/bin/oathkey
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/oathkey/oathkey.1

    r827 r841  
    2929.\" $Id$
    3030.\"
    31 .Dd October 22, 2014
     31.Dd November 11, 2014
    3232.Dt OATHKEY 1
    3333.Os
     
    3737.Sh SYNOPSIS
    3838.Nm
    39 .Op Fl hvw
     39.Op Fl hrvw
    4040.Op Fl u Ar user
    4141.Op Fl k Ar keyfile
     
    5656The default is
    5757.Pa /var/oath/ Ns Ar user Ns Pa .otpauth .
     58.It Fl r
     59Disable writeback mode.
    5860.It Fl u Ar user
    5961Specify the user on which to operate.
     
    6466.It Fl w
    6567Enable writeback mode (see below).
     68This is the default.
    6669.El
    6770.Pp
  • trunk/bin/oathkey/oathkey.c

    r827 r841  
    5656static char *keyfile;
    5757static int verbose;
    58 static int writeback;
     58static int readonly;
    5959
    6060static int isroot;              /* running as root */
     
    161161        if ((key = oath_key_create(user, om_totp, oh_undef, NULL, 0)) == NULL)
    162162                return (RET_ERROR);
    163         ret = writeback ? oathkey_save(key) : oathkey_print_uri(key);
     163        ret = readonly ? oathkey_print_uri(key) : oathkey_save(key);
    164164        oath_key_free(key);
    165165        return (ret);
     
    262262                warnx("response: %lu %s", response,
    263263                    match ? "matched" : "did not match");
    264         ret = match ? RET_SUCCESS : RET_FAILURE;
    265         if (match && writeback)
    266                 ret = oathkey_save(key);
     264        ret = match ? readonly ? RET_SUCCESS : oathkey_save(key) : RET_FAILURE;
    267265        oath_key_free(key);
    268266        return (ret);
     
    295293        } else {
    296294                printf("%.*d\n", (int)key->digits, current);
    297                 ret = RET_SUCCESS;
    298                 if (writeback)
    299                         ret = oathkey_save(key);
     295                ret = readonly ? RET_SUCCESS : oathkey_save(key);
    300296        }
    301297        oath_key_free(key);
     
    338334                        keyfile = optarg;
    339335                        break;
     336                case 'r':
     337                        readonly = 1;
     338                        break;
    340339                case 'u':
    341340                        user = optarg;
     
    345344                        break;
    346345                case 'w':
    347                         ++writeback;
     346                        readonly = 0;
    348347                        break;
    349348                case 'h':
Note: See TracChangeset for help on using the changeset viewer.