mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 21:27:57 +00:00
clean up more compiler warnings etc.
This commit is contained in:
parent
c3a7bfdb89
commit
c9995dbf52
@ -45,8 +45,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "overlay_address.h"
|
||||
#include "overlay_buffer.h"
|
||||
|
||||
#include "serialization_meshms.c"
|
||||
|
||||
//unsigned char did_chars[16]="0123456789+#*abX";
|
||||
|
||||
extern struct cli_schema command_line_options[];
|
||||
@ -1651,9 +1649,7 @@ int app_meshms_add_message(const struct cli_parsed *parsed, void *context)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Does this even do anything? It retrieves the service, but then completely
|
||||
// ignores it. Should it be checking that service_manifest == service?
|
||||
const char *service_manifest = rhizome_manifest_get(mout, "service", NULL, 0);
|
||||
service = rhizome_manifest_get(mout, "service", NULL, 0);
|
||||
if (service) {
|
||||
cli_puts("service");
|
||||
cli_delim(":");
|
||||
|
18
rhizome.h
18
rhizome.h
@ -325,11 +325,6 @@ int rhizome_is_bar_interesting(unsigned char *bar);
|
||||
int rhizome_list_manifests(const char *service, const char *name,
|
||||
const char *sender_sid, const char *recipient_sid,
|
||||
int limit, int offset, char count_rows);
|
||||
int rhizome_list_manifests_forMeshMS(const char *service, const char *name,
|
||||
const char *sender_sid,
|
||||
const char *recipient_sid,
|
||||
int limit, int offset, char count_rows,
|
||||
char *manifest_id);
|
||||
int rhizome_retrieve_manifest(const char *manifestid, rhizome_manifest *m);
|
||||
int rhizome_advertise_manifest(rhizome_manifest *m);
|
||||
int rhizome_delete_bundle(const char *manifestid);
|
||||
@ -378,7 +373,6 @@ int rhizome_ignore_manifest_check(unsigned char *bid_prefix, int prefix_len);
|
||||
int meshms_read_message(const char *manifestid,rhizome_manifest *m, unsigned char *buffer);
|
||||
int rhizome_fill_manifest(rhizome_manifest *m, const char *filepath, const sid_t *authorSid, rhizome_bk_t *bsk);
|
||||
int rhizome_add_message(rhizome_manifest *m, unsigned char *message, unsigned char *buffer_file, int message_size, int manifest_exist, const char *manifestid);
|
||||
int rhizome_fill_manifest_forMeshMS(rhizome_manifest *m, const sid_t *authorSid, rhizome_bk_t *bsk, const char *sender_sid, const char *recipient_sid);
|
||||
|
||||
/* one manifest is required per candidate, plus a few spare.
|
||||
so MAX_RHIZOME_MANIFESTS must be > MAX_CANDIDATES.
|
||||
@ -697,4 +691,16 @@ int rhizome_dump_file(const char *id, const char *filepath, int64_t *length);
|
||||
|
||||
int rhizome_database_filehash_from_id(const char *id, uint64_t version, char hash[SHA512_DIGEST_STRING_LENGTH]);
|
||||
|
||||
int serialize_meshms(unsigned char *buffer,int *offset,unsigned int length,const char *sender_did,const char *recipient_did, unsigned long long time, const char *payload, int payload_length);
|
||||
int deserialize_meshms(unsigned char *buffer,int *offset, int buffer_size);
|
||||
int rhizome_list_manifests_forMeshMS(const char *service, const char *name,
|
||||
const char *sender_sid,
|
||||
const char *recipient_sid,
|
||||
int limit, int offset, char count_rows,
|
||||
char *manifest_id);
|
||||
int rhizome_fill_manifest_forMeshMS(rhizome_manifest *m, const sid_t *authorSid, rhizome_bk_t *bsk, const char *sender_sid, const char *recipient_sid);
|
||||
int rhizome_open_write_forMeshms_manifest_exist(struct rhizome_write *write, char *expectedFileHash, int64_t file_length, int priority, const char *manifestid);
|
||||
int rhizome_open_write_forMeshms(struct rhizome_write *write, char *expectedFileHash, int64_t file_length, int priority);
|
||||
int rhizome_open_write_forMeshms_manifest_exist(struct rhizome_write *write, char *expectedFileHash, int64_t file_length, int priority, const char *manifestid);
|
||||
int rhizome_finish_write_forMeshms_manifest_exist(struct rhizome_write *write);
|
||||
#endif //__SERVALDNA__RHIZOME_H
|
||||
|
@ -882,7 +882,6 @@ int rhizome_fill_manifest_forMeshMS(rhizome_manifest *m, const sid_t *authorSid,
|
||||
int crypt = rhizome_manifest_get_ll(m,"crypt");
|
||||
if (crypt==-1 && m->fileLength){
|
||||
// no explicit crypt flag, should we encrypt this bundle?
|
||||
char *sender = rhizome_manifest_get(m, "sender", NULL, 0);
|
||||
char *recipient = rhizome_manifest_get(m, "recipient", NULL, 0);
|
||||
|
||||
if (strcmp(recipient, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") == 0)
|
||||
|
@ -1265,26 +1265,8 @@ int rhizome_list_manifests_forMeshMS(const char *service, const char *name,
|
||||
ret=0;
|
||||
size_t rows = 0;
|
||||
|
||||
const char *names[]={
|
||||
"_id",
|
||||
"service",
|
||||
"id",
|
||||
"version",
|
||||
"date",
|
||||
".inserttime",
|
||||
".author",
|
||||
".fromhere",
|
||||
"filesize",
|
||||
"filehash",
|
||||
"sender",
|
||||
"recipient",
|
||||
"name"
|
||||
};
|
||||
//cli_columns(13,names);
|
||||
//cli_printf("%d",rows);
|
||||
while (sqlite_step_retry(&retry, statement) == SQLITE_ROW) {
|
||||
++rows;
|
||||
// cli_printf("%d",rows);
|
||||
if (limit>0 && rows>limit)
|
||||
break;
|
||||
if (rows>2)
|
||||
@ -1310,9 +1292,7 @@ int rhizome_list_manifests_forMeshMS(const char *service, const char *name,
|
||||
const char *manifestblob = (char *) sqlite3_column_blob(statement, 1);
|
||||
size_t manifestblobsize = sqlite3_column_bytes(statement, 1); // must call after sqlite3_column_blob()
|
||||
long long q_version = sqlite3_column_int64(statement, 2);
|
||||
long long q_inserttime = sqlite3_column_int64(statement, 3);
|
||||
const char *q_author = (const char *) sqlite3_column_text(statement, 4);
|
||||
long long rowid = sqlite3_column_int64(statement, 5);
|
||||
|
||||
if (rhizome_read_manifest_file(m, manifestblob, manifestblobsize) == -1) {
|
||||
WARNF("MANIFESTS row id=%s has invalid manifest blob -- skipped", q_manifestid);
|
||||
@ -1338,7 +1318,6 @@ int rhizome_list_manifests_forMeshMS(const char *service, const char *name,
|
||||
|
||||
if (match) {
|
||||
const char *blob_name = rhizome_manifest_get(m, "name", NULL, 0);
|
||||
long long blob_date = rhizome_manifest_get_ll(m, "date");
|
||||
const char *blob_filehash = rhizome_manifest_get(m, "filehash", NULL, 0);
|
||||
int from_here = 0;
|
||||
unsigned char senderSid[SID_SIZE];
|
||||
@ -1366,8 +1345,6 @@ int rhizome_list_manifests_forMeshMS(const char *service, const char *name,
|
||||
//cli_put_hexvalue(m->cryptoSignPublic, RHIZOME_MANIFEST_ID_BYTES, ":");
|
||||
|
||||
int i=0;
|
||||
int manifest_id_length=strlen(q_manifestid);
|
||||
//cli_printf("%d",manifest_id_length);
|
||||
for (i;i<strlen(q_manifestid);i++)
|
||||
{
|
||||
manifest_id[i] = q_manifestid[i];
|
||||
|
@ -697,18 +697,18 @@ int rhizome_add_message(rhizome_manifest *m, unsigned char *message, unsigned ch
|
||||
}
|
||||
} else {
|
||||
if (rhizome_open_write_forMeshms(&write, NULL, m->fileLength, RHIZOME_PRIORITY_DEFAULT))
|
||||
{
|
||||
cli_printf("error in rhizome_open_write");
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
cli_printf("error in rhizome_open_write");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
write.crypt=m->payloadEncryption;
|
||||
if (write.crypt){
|
||||
// if the manifest specifies encryption, make sure we can generate the payload key and encrypt the contents as we go
|
||||
if (rhizome_derive_key(m, NULL))
|
||||
{cli_puts("error in rhizome derive key");
|
||||
return -1; }
|
||||
{cli_puts("error in rhizome derive key");
|
||||
return -1; }
|
||||
|
||||
if (config.debug.rhizome)
|
||||
DEBUGF("Encrypting file contents");
|
||||
@ -719,20 +719,20 @@ int rhizome_add_message(rhizome_manifest *m, unsigned char *message, unsigned ch
|
||||
|
||||
int i = 0;
|
||||
if (file_size != 0)
|
||||
{
|
||||
for (i; i< file_size; i++)
|
||||
{
|
||||
write.buffer[i]=buffer_file[i];
|
||||
}
|
||||
}
|
||||
{
|
||||
for (i; i< file_size; i++)
|
||||
{
|
||||
write.buffer[i]=buffer_file[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (file_size == 0)
|
||||
{ i = 0; }
|
||||
{ i = 0; }
|
||||
|
||||
for (i; i<m->fileLength; i++)
|
||||
{
|
||||
write.buffer[i]=message[i-file_size];
|
||||
}
|
||||
{
|
||||
write.buffer[i]=message[i-file_size];
|
||||
}
|
||||
|
||||
//hex_dump(write.buffer, m->fileLength);
|
||||
|
||||
@ -740,22 +740,22 @@ int rhizome_add_message(rhizome_manifest *m, unsigned char *message, unsigned ch
|
||||
ret = rhizome_flush(&write);
|
||||
|
||||
if (ret == -1)
|
||||
{ cli_puts("erreur dans flush");}
|
||||
{ cli_puts("erreur dans flush");}
|
||||
|
||||
if ( manifest_exist == 0) {
|
||||
|
||||
if (rhizome_finish_write_forMeshms_manifest_exist(&write)){
|
||||
rhizome_fail_write(&write);
|
||||
cli_printf("rhizome_finish_write_failed");
|
||||
return -1;
|
||||
}
|
||||
if (rhizome_finish_write_forMeshms_manifest_exist(&write)){
|
||||
rhizome_fail_write(&write);
|
||||
cli_printf("rhizome_finish_write_failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
rhizome_finish_write(&write);
|
||||
if (rhizome_finish_write(&write)){
|
||||
rhizome_fail_write(&write);
|
||||
cli_printf("rhizome_finish_write_failed");
|
||||
return -1;
|
||||
rhizome_fail_write(&write);
|
||||
cli_printf("rhizome_finish_write_failed");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1100,7 +1100,6 @@ int meshms_read_message(const char *manifestid,rhizome_manifest *m, unsigned cha
|
||||
if (bskhex && fromhexstr(bsk.binary, bskhex, RHIZOME_BUNDLE_KEY_BYTES) == -1)
|
||||
return WHYF("invalid bsk: \"%s\"", bskhex);
|
||||
|
||||
int retfile=0;
|
||||
// ret=0 if retrieve manifest is ok
|
||||
if (ret==0 && m->fileLength != 0 ){
|
||||
// Rhizome_extract_file
|
||||
|
@ -53,6 +53,7 @@ SERVAL_SOURCES = $(SERVAL_BASE)audiodevices.c \
|
||||
$(SERVAL_BASE)rhizome_http.c \
|
||||
$(SERVAL_BASE)rhizome_packetformats.c \
|
||||
$(SERVAL_BASE)rhizome_store.c \
|
||||
$(SERVAL_BASE)serialization_meshms.c \
|
||||
$(SERVAL_BASE)serval_packetvisualise.c \
|
||||
$(SERVAL_BASE)server.c \
|
||||
$(SERVAL_BASE)sha2.c \
|
||||
|
Loading…
Reference in New Issue
Block a user