chiark
/
gitweb
/
~ianmdlvl
/
secnet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
site: Write an argument for the soundness of key file update
[secnet.git]
/
util.c
diff --git
a/util.c
b/util.c
index bcc24bdc637d828245bb6f8173863e91d6d9b490..cc2f9fa6b17f2ce43fe0cf5760ed550ed0d1f040 100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-413,6
+413,7
@@
void priomsg_reset(struct priomsg *pm)
}
bool_t priomsg_update_p(struct priomsg *pm, int prio)
{
}
bool_t priomsg_update_p(struct priomsg *pm, int prio)
{
+ if (!pm) return False;
if (prio <= pm->prio) return False;
buffer_init(&pm->m, 0);
pm->prio = prio;
if (prio <= pm->prio) return False;
buffer_init(&pm->m, 0);
pm->prio = prio;
@@
-426,6
+427,11
@@
const char *priomsg_getmessage(const struct priomsg *pm, const char *defmsg)
return defmsg;
}
return defmsg;
}
+bool_t priomsg_update_fixed(struct priomsg *pm, int prio, const char *m) {
+ if (!priomsg_update_p(pm, prio)) return False;
+ truncmsg_add_string(&pm->m, m);
+ return True;
+}
void buffer_new(struct buffer_if *buf, int32_t len)
{
void buffer_new(struct buffer_if *buf, int32_t len)
{
@@
-525,10
+531,11
@@
void send_nak(const struct comm_addr *dest, uint32_t our_index,
buf_append_uint32(buf,our_index);
buf_append_uint32(buf,LABEL_NAK);
if (logwhy)
buf_append_uint32(buf,our_index);
buf_append_uint32(buf,LABEL_NAK);
if (logwhy)
- Message(M_INFO,"%s: %08"PRIx32"<-%08"PRIx32": %08"PRIx32":"
- " %s; sending NAK\n",
+ Message(M_INFO,"%s: sending NAK for"
+ " %08"PRIx32" %08"PRIx32"<-%08"PRIx32":"
+ " %s\n",
comm_addr_to_string(dest),
comm_addr_to_string(dest),
-
our_index, their_index, msgtype
, logwhy);
+
msgtype, our_index, their_index
, logwhy);
dest->comm->sendmsg(dest->comm->st, buf, dest, 0);
}
dest->comm->sendmsg(dest->comm->st, buf, dest, 0);
}
@@
-716,6
+723,15
@@
const char *pollbadbit(int revents)
return 0;
}
return 0;
}
+void pathprefix_template_init(struct pathprefix_template *out,
+ const char *prefix, int maxsuffix)
+{
+ size_t l=strlen(prefix);
+ NEW_ARY(out->buffer,l+maxsuffix+1);
+ strcpy(out->buffer,prefix);
+ out->write_here=out->buffer+l;
+}
+
enum async_linebuf_result
async_linebuf_read(struct pollfd *pfd, struct buffer_if *buf,
const char **emsg_out)
enum async_linebuf_result
async_linebuf_read(struct pollfd *pfd, struct buffer_if *buf,
const char **emsg_out)