Changeset 841 in openpam
- Timestamp:
- Nov 12, 2014, 4:21:15 PM (6 years ago)
- Location:
- trunk/bin/oathkey
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/oathkey/oathkey.1
r827 r841 29 29 .\" $Id$ 30 30 .\" 31 .Dd October 22, 201431 .Dd November 11, 2014 32 32 .Dt OATHKEY 1 33 33 .Os … … 37 37 .Sh SYNOPSIS 38 38 .Nm 39 .Op Fl h vw39 .Op Fl hrvw 40 40 .Op Fl u Ar user 41 41 .Op Fl k Ar keyfile … … 56 56 The default is 57 57 .Pa /var/oath/ Ns Ar user Ns Pa .otpauth . 58 .It Fl r 59 Disable writeback mode. 58 60 .It Fl u Ar user 59 61 Specify the user on which to operate. … … 64 66 .It Fl w 65 67 Enable writeback mode (see below). 68 This is the default. 66 69 .El 67 70 .Pp -
trunk/bin/oathkey/oathkey.c
r827 r841 56 56 static char *keyfile; 57 57 static int verbose; 58 static int writeback;58 static int readonly; 59 59 60 60 static int isroot; /* running as root */ … … 161 161 if ((key = oath_key_create(user, om_totp, oh_undef, NULL, 0)) == NULL) 162 162 return (RET_ERROR); 163 ret = writeback ? oathkey_save(key) : oathkey_print_uri(key);163 ret = readonly ? oathkey_print_uri(key) : oathkey_save(key); 164 164 oath_key_free(key); 165 165 return (ret); … … 262 262 warnx("response: %lu %s", response, 263 263 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; 267 265 oath_key_free(key); 268 266 return (ret); … … 295 293 } else { 296 294 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); 300 296 } 301 297 oath_key_free(key); … … 338 334 keyfile = optarg; 339 335 break; 336 case 'r': 337 readonly = 1; 338 break; 340 339 case 'u': 341 340 user = optarg; … … 345 344 break; 346 345 case 'w': 347 ++writeback;346 readonly = 0; 348 347 break; 349 348 case 'h':
Note: See TracChangeset
for help on using the changeset viewer.