Make rhizome_add_manifest() stricter for MeshMS

If author not given, use 'sender' as author
Ensure that author and 'sender' field are identical
This commit is contained in:
Andrew Bettison 2012-05-21 10:37:24 +09:30
parent ddd17db1c4
commit c2de68449b

View File

@ -163,6 +163,12 @@ int rhizome_add_manifest(rhizome_manifest *m_in,
return WHY("Manifest missing 'sender' field"); return WHY("Manifest missing 'sender' field");
if (!validateSid(sender)) if (!validateSid(sender))
return WHY("Manifest contains invalid 'sender' field"); return WHY("Manifest contains invalid 'sender' field");
/* If the author was not specified, use the 'sender' as the author, otherwise ensure that they
match. */
if (!author || !author[0])
author = sender;
else if (strcasecmp(author, sender))
return WHYF("Author inconsistent with sender: author=%s, sender=%s", author, sender);
if (recipient == NULL || !recipient[0]) if (recipient == NULL || !recipient[0])
return WHY("Manifest missing 'recipient' field"); return WHY("Manifest missing 'recipient' field");
if (!validateSid(recipient)) if (!validateSid(recipient))