It should be PRIX64 to ensure we use the right format for both 32 and
64 bit platforms.
storebuf.buffer = malloc(8192);
logthing(LOGTHING_TRACE,
storebuf.buffer = malloc(8192);
logthing(LOGTHING_TRACE,
- "Iterating over 0x%016llX.",
+ "Iterating over 0x%016" PRIX64 ".",
get_keyid(key));
flatten_publickey(key,
get_keyid(key));
flatten_publickey(key,
storebuf.offset = 0;
if (ret == 0) {
logthing(LOGTHING_INFO,
storebuf.offset = 0;
if (ret == 0) {
logthing(LOGTHING_INFO,
- "Fetching 0x%llX, result: %d",
+ "Fetching 0x%" PRIX64
+ ", result: %d",
keyid,
config.dbbackend->
fetch_key(keyid, &key, false));
keyid,
config.dbbackend->
fetch_key(keyid, &key, false));
}
if (ret == 0) {
logthing(LOGTHING_INFO,
}
if (ret == 0) {
logthing(LOGTHING_INFO,
- "Deleting 0x%llX, result: %d",
+ "Deleting 0x%" PRIX64
+ ", result: %d",
keyid,
config.dbbackend->delete_key(
keyid, false));
keyid,
config.dbbackend->delete_key(
keyid, false));
for (curkey = *keys; curkey != NULL; curkey = curkey->next) {
intrans = config.dbbackend->starttrans();
logthing(LOGTHING_INFO,
for (curkey = *keys; curkey != NULL; curkey = curkey->next) {
intrans = config.dbbackend->starttrans();
logthing(LOGTHING_INFO,
- "Fetching key 0x%llX, result: %d",
+ "Fetching key 0x%" PRIX64 ", result: %d",
get_keyid(curkey),
config.dbbackend->fetch_key(get_keyid(curkey), &oldkey,
intrans));
get_keyid(curkey),
config.dbbackend->fetch_key(get_keyid(curkey), &oldkey,
intrans));
for (curkey = *keys; curkey != NULL; curkey = curkey->next) {
intrans = dynamic_starttrans();
logthing(LOGTHING_INFO,
for (curkey = *keys; curkey != NULL; curkey = curkey->next) {
intrans = dynamic_starttrans();
logthing(LOGTHING_INFO,
- "Fetching key 0x%llX, result: %d",
+ "Fetching key 0x%" PRIX64 ", result: %d",
get_keyid(curkey),
dynamic_fetch_key(get_keyid(curkey), &oldkey, intrans));
get_keyid(curkey),
dynamic_fetch_key(get_keyid(curkey), &oldkey, intrans));
char keyfile[1024];
int fd = -1;
char keyfile[1024];
int fd = -1;
- snprintf(keyfile, 1023, "%s/0x%llX", config.db_dir,
+ snprintf(keyfile, 1023, "%s/0x%" PRIX64, config.db_dir,
keyid & 0xFFFFFFFF);
fd = open(keyfile, O_RDONLY); // | O_SHLOCK);
keyid & 0xFFFFFFFF);
fd = open(keyfile, O_RDONLY); // | O_SHLOCK);
char keyfile[1024];
int fd = -1;
char keyfile[1024];
int fd = -1;
- snprintf(keyfile, 1023, "%s/0x%llX", config.db_dir,
+ snprintf(keyfile, 1023, "%s/0x%" PRIX64, config.db_dir,
get_keyid(publickey) & 0xFFFFFFFF);
fd = open(keyfile, O_WRONLY | O_CREAT, 0664); // | O_EXLOCK);
get_keyid(publickey) & 0xFFFFFFFF);
fd = open(keyfile, O_WRONLY | O_CREAT, 0664); // | O_EXLOCK);
- snprintf(keyfile, 1023, "%s/0x%llX", config.db_dir,
+ snprintf(keyfile, 1023, "%s/0x%" PRIX64, config.db_dir,
keyid & 0xFFFFFFFF);
return unlink(keyfile);
keyid & 0xFFFFFFFF);
return unlink(keyfile);
static void keypath(char *buffer, uint64_t _keyid)
{
uint64_t keyid = _keyid << 32;
static void keypath(char *buffer, uint64_t _keyid)
{
uint64_t keyid = _keyid << 32;
- snprintf(buffer, PATH_MAX, "%s/key/%02X/%02X/%08X/%016llX",
+ snprintf(buffer, PATH_MAX, "%s/key/%02X/%02X/%08X/%016" PRIX64,
config.db_dir, (uint8_t) ((keyid >> 56) & 0xFF),
(uint8_t) ((keyid >> 48) & 0xFF),
(uint32_t) (keyid >> 32), _keyid);
config.db_dir, (uint8_t) ((keyid >> 56) & 0xFF),
(uint8_t) ((keyid >> 48) & 0xFF),
(uint32_t) (keyid >> 32), _keyid);
static void wordpath(char *buffer, char *word, uint32_t hash, uint64_t keyid)
{
static void wordpath(char *buffer, char *word, uint32_t hash, uint64_t keyid)
{
- snprintf(buffer, PATH_MAX, "%s/words/%02X/%02X/%08X/%s/%016llX",
+ snprintf(buffer, PATH_MAX, "%s/words/%02X/%02X/%08X/%s/%016" PRIX64,
config.db_dir, (uint8_t) ((hash >> 24) & 0xFF),
(uint8_t) ((hash >> 16) & 0xFF), hash, word, keyid);
}
config.db_dir, (uint8_t) ((hash >> 24) & 0xFF),
(uint8_t) ((hash >> 16) & 0xFF), hash, word, keyid);
}
static void subkeypath(char *buffer, uint64_t subkey, uint64_t keyid)
{
static void subkeypath(char *buffer, uint64_t subkey, uint64_t keyid)
{
- snprintf(buffer, PATH_MAX, "%s/subkeys/%02X/%02X/%08X/%016llX",
+ snprintf(buffer, PATH_MAX, "%s/subkeys/%02X/%02X/%08X/%016" PRIX64,
config.db_dir,
(uint8_t) ((subkey >> 24) & 0xFF),
(uint8_t) ((subkey >> 16) & 0xFF),
config.db_dir,
(uint8_t) ((subkey >> 24) & 0xFF),
(uint8_t) ((subkey >> 16) & 0xFF),
ret = fetch_key(keyid, &pk, true);
if (ret) {
ret = fetch_key(keyid, &pk, true);
if (ret) {
- logthing(LOGTHING_DEBUG, "Wordlist for key %016llX",
+ logthing(LOGTHING_DEBUG, "Wordlist for key %016" PRIX64,
keyid);
wl = wordlist = makewordlistfromkey(wordlist, pk);
logthing(LOGTHING_DEBUG,
keyid);
wl = wordlist = makewordlistfromkey(wordlist, pk);
logthing(LOGTHING_DEBUG,
- "Wordlist for key %016llX done", keyid);
+ "Wordlist for key %016" PRIX64 " done", keyid);
while (wl) {
uint32_t hash = calchash((uint8_t *) (wl->object));
prove_path_to(hash, "words");
while (wl) {
uint32_t hash = calchash((uint8_t *) (wl->object));
prove_path_to(hash, "words");
if (keyid > 0xFFFFFFFF) {
snprintf(statement, 1023,
if (keyid > 0xFFFFFFFF) {
snprintf(statement, 1023,
- "SELECT keydata FROM onak_keys WHERE keyid = '%llX'",
+ "SELECT keydata FROM onak_keys WHERE keyid = '%"
+ PRIX64 "'",
keyid);
} else {
snprintf(statement, 1023,
"SELECT keydata FROM onak_keys WHERE keyid "
keyid);
} else {
snprintf(statement, 1023,
"SELECT keydata FROM onak_keys WHERE keyid "
+ "LIKE '%%%" PRIX64 "'",
keyid);
}
result = PQexec(dbconn, statement);
keyid);
}
result = PQexec(dbconn, statement);
}
snprintf(statement, 1023,
}
snprintf(statement, 1023,
- "SELECT keydata FROM onak_keys WHERE keyid = '%llX'",
+ "SELECT keydata FROM onak_keys WHERE keyid = '%"
+ PRIX64 "'",
keyid);
result = PQexec(dbconn, statement);
keyid);
result = PQexec(dbconn, statement);
PQclear(result);
snprintf(statement, 1023,
PQclear(result);
snprintf(statement, 1023,
- "DELETE FROM onak_keys WHERE keyid = '%llX'",
+ "DELETE FROM onak_keys WHERE keyid = '%" PRIX64 "'",
keyid);
result = PQexec(dbconn, statement);
PQclear(result);
snprintf(statement, 1023,
keyid);
result = PQexec(dbconn, statement);
PQclear(result);
snprintf(statement, 1023,
- "DELETE FROM onak_sigs WHERE signee = '%llX'",
+ "DELETE FROM onak_sigs WHERE signee = '%" PRIX64 "'",
keyid);
result = PQexec(dbconn, statement);
PQclear(result);
snprintf(statement, 1023,
keyid);
result = PQexec(dbconn, statement);
PQclear(result);
snprintf(statement, 1023,
- "DELETE FROM onak_uids WHERE keyid = '%llX'",
+ "DELETE FROM onak_uids WHERE keyid = '%" PRIX64 "'",
keyid);
result = PQexec(dbconn, statement);
} else if (PQresultStatus(result) != PGRES_TUPLES_OK) {
logthing(LOGTHING_ERROR,
keyid);
result = PQexec(dbconn, statement);
} else if (PQresultStatus(result) != PGRES_TUPLES_OK) {
logthing(LOGTHING_ERROR,
- "Problem retrieving key (%llX) from DB.",
+ "Problem retrieving key (%" PRIX64
+ ") from DB.",
snprintf(statement, 1023,
"INSERT INTO onak_keys (keyid, keydata) VALUES "
snprintf(statement, 1023,
"INSERT INTO onak_keys (keyid, keydata) VALUES "
+ "('%" PRIX64 "', '%d')",
get_keyid(publickey),
key_oid);
result = PQexec(dbconn, statement);
get_keyid(publickey),
key_oid);
result = PQexec(dbconn, statement);
snprintf(statement, 1023,
"INSERT INTO onak_uids "
"(keyid, uid, pri) "
snprintf(statement, 1023,
"INSERT INTO onak_uids "
"(keyid, uid, pri) "
- "VALUES ('%llX', '%s', '%c')",
+ "VALUES ('%" PRIX64 "', '%s', '%c')",
get_keyid(publickey),
safeuid,
(uids[i] == primary) ? 't' : 'f');
get_keyid(publickey),
safeuid,
(uids[i] == primary) ? 't' : 'f');
packets = packets->next) {
snprintf(statement, 1023,
"INSERT INTO onak_sigs (signer, signee) "
packets = packets->next) {
snprintf(statement, 1023,
"INSERT INTO onak_sigs (signer, signee) "
- "VALUES ('%llX', '%llX')",
+ "VALUES ('%" PRIX64 "', '%" PRIX64 "')",
sig_keyid(packets->packet),
get_keyid(publickey));
result = PQexec(dbconn, statement);
sig_keyid(packets->packet),
get_keyid(publickey));
result = PQexec(dbconn, statement);
char *uid = NULL;
snprintf(statement, 1023,
char *uid = NULL;
snprintf(statement, 1023,
- "SELECT uid FROM onak_uids WHERE keyid = '%llX' AND pri = 't'",
+ "SELECT uid FROM onak_uids WHERE keyid = '%" PRIX64
+ "' AND pri = 't'",
keyid);
result = PQexec(dbconn, statement);
keyid);
result = PQexec(dbconn, statement);
uid = strdup(PQgetvalue(result, 0, 0));
} else if (PQresultStatus(result) != PGRES_TUPLES_OK) {
logthing(LOGTHING_ERROR,
uid = strdup(PQgetvalue(result, 0, 0));
} else if (PQresultStatus(result) != PGRES_TUPLES_OK) {
logthing(LOGTHING_ERROR,
- "Problem retrieving key (%llX) from DB.",
+ "Problem retrieving key (%" PRIX64
+ ") from DB.",
}
snprintf(statement, 1023,
}
snprintf(statement, 1023,
- "SELECT DISTINCT signer FROM onak_sigs WHERE signee = '%llX'",
+ "SELECT DISTINCT signer FROM onak_sigs WHERE signee = '%"
+ PRIX64 "'",
keyid);
result = PQexec(dbconn, statement);
keyid);
result = PQexec(dbconn, statement);
case OP_GET:
if (ishex) {
logthing(LOGTHING_NOTICE,
case OP_GET:
if (ishex) {
logthing(LOGTHING_NOTICE,
- "Getting keyid 0x%llX",
+ "Getting keyid 0x%" PRIX64,
keyid);
result = config.dbbackend->fetch_key(keyid,
&publickey, false);
keyid);
result = config.dbbackend->fetch_key(keyid,
&publickey, false);