mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Fix rhizome_fill_manifest() 'name' semantics
Only set 'name' field if the given pathname is valid Do not set 'name' field if no pathname supplied
This commit is contained in:
parent
3b5c0d2092
commit
b5f7a088b2
1
meshms.c
1
meshms.c
@ -108,6 +108,7 @@ static int get_my_conversation_bundle(const sid_t *my_sidp, rhizome_manifest *m)
|
||||
assert(m->haveSecret);
|
||||
if (m->haveSecret == NEW_BUNDLE_ID) {
|
||||
rhizome_manifest_set_service(m, RHIZOME_SERVICE_FILE);
|
||||
rhizome_manifest_set_name(m, "");
|
||||
if (rhizome_fill_manifest(m, NULL, my_sidp) == -1)
|
||||
return WHY("Invalid manifest");
|
||||
if (config.debug.meshms) {
|
||||
|
@ -1144,18 +1144,20 @@ int rhizome_fill_manifest(rhizome_manifest *m, const char *filepath, const sid_t
|
||||
}
|
||||
|
||||
if (strcasecmp(RHIZOME_SERVICE_FILE, m->service) == 0) {
|
||||
if (m->name == NULL) {
|
||||
if (filepath && *filepath) {
|
||||
const char *name = strrchr(filepath, '/');
|
||||
rhizome_manifest_set_name(m, name ? name + 1 : filepath);
|
||||
} else
|
||||
rhizome_manifest_set_name(m, "");
|
||||
if (m->name) {
|
||||
if (config.debug.rhizome)
|
||||
DEBUGF("missing 'name', set default name=%s", alloca_str_toprint(m->name));
|
||||
} else {
|
||||
if (config.debug.rhizome)
|
||||
DEBUGF("manifest contains name=%s", alloca_str_toprint(m->name));
|
||||
DEBUGF("manifest already contains name=%s", alloca_str_toprint(m->name));
|
||||
} else if (filepath) {
|
||||
const char *name = strrchr(filepath, '/');
|
||||
if (!name)
|
||||
name = filepath;
|
||||
if (rhizome_str_is_manifest_name(name))
|
||||
rhizome_manifest_set_name(m, name);
|
||||
else if (config.debug.rhizome)
|
||||
DEBUGF("invalid rhizome name %s -- not used", alloca_str_toprint(name));
|
||||
}
|
||||
else if (config.debug.rhizome)
|
||||
DEBUGF("manifest missing 'name'");
|
||||
}
|
||||
|
||||
// Anything sent from one person to another should be considered private and encrypted by default.
|
||||
|
Loading…
x
Reference in New Issue
Block a user