oldnonce = strtok(NULL, ":\r\n");
hauthobj = strtok(NULL, ":\r\n");
} else {
- eprint("error reading from %s: %s\n",
+ eprint("error reading from %s: %s",
fn, strerror(errno));
}
fclose(fp);
hlen = strlen(hauthobj);
if (hlen % 32 != 0) {
- eprint("error: auth string has wrong length\n");
+ eprint("error: auth string has wrong length");
} else if (hlen !=
strspn(hauthobj, "0123456789abcdefABCDEF")) {
- eprint("error: auth string not hexadecimal\n");
+ eprint("error: auth string not hexadecimal");
} else {
oldauthsize = hlen/2;
oldauthobj = alloca(oldauthsize);
rc = make_challenge(id, password, nonce, chal, &csize);
if (rc) {
- eprint("cannot make challenge\n");
+ eprint("cannot make challenge");
return -1;
}
rc = pcsc_cr(chal, csize, key, &keysize);
if (rc) {
- eprint("error querying token: %s\n", pcsc_errstr(rc));
+ eprint("error querying token: %s", pcsc_errstr(rc));
return -1;
}
rc = parse_authobj(key, keysize, oldauthobj, oldauthsize,
mysecret, &mysecsize, myload, &myloadsize);
if (rc) {
- eprint("cannot parse old authobj: %d\n", rc);
+ eprint("cannot parse old authobj: %d", rc);
return -1;
}
}
rc = make_authobj(id, password, nonce, mysecret, mysecsize,
payload, paysize, authobj, &authsize);
if (rc) {
- eprint("make_authobj error %d\n", rc);
+ eprint("make_authobj error %d", rc);
return -1;
}
fp = fopen(fn, "w");
if (!fp) {
- eprint("cannot open \"%s\": %s\n",
+ eprint("cannot open \"%s\": %s",
fn, strerror(errno));
return -1;
}
if (fprintf(fp, "%s:%s:%s:", tokenid, id, nonce) < 0) {
- eprint("cannot write to \"%s\": %s\n",
+ eprint("cannot write to \"%s\": %s",
fn, strerror(errno));
return -1;
}
for (i = 0; i < authsize; i++)
if (fprintf(fp, "%02x", authobj[i]) < 0) {
- eprint("cannot write to \"%s\": %s\n",
+ eprint("cannot write to \"%s\": %s",
fn, strerror(errno));
return -1;
}
fprintf(fp, "\n");
if (fclose(fp) < 0) {
- eprint("cannot close \"%s\": %s\n",
+ eprint("cannot close \"%s\": %s",
fn, strerror(errno));
return -1;
}