[ADD] Proper stanza limits

This commit is contained in:
LDA 2024-10-25 18:03:05 +02:00
commit 7c60ab28cb
18 changed files with 74 additions and 39 deletions

View file

@ -23,11 +23,12 @@ Main(Array *args, HashMap *env)
int flag, code = EXIT_FAILURE;
int port = 5347;
size_t lmdb_size = 0;
size_t max_stanza = 10000;
listen = "localhost";
ArgParseStateInit(&state);
while ((flag = ArgParse(&state, args, "H:J:s:d:p:m:l:S:")) != -1)
while ((flag = ArgParse(&state, args, "H:J:s:d:p:m:l:S:M:")) != -1)
{
switch (flag)
{
@ -56,6 +57,12 @@ Main(Array *args, HashMap *env)
case 'S':
lmdb_size = strtol(state.optArg, NULL, 10) * 1024 * 1024;
break;
case 'M':
max_stanza = strtol(state.optArg, NULL, 10);
if (max_stanza < 10000)
{
max_stanza = 10000;
}
}
}
@ -71,6 +78,7 @@ Main(Array *args, HashMap *env)
"-l [Host/IP to listen as] "
"-p [XMPP component port=5347] "
"-J [parsee.xmppserver.ex]",
"-M [max stanza size>=10000]",
"-S [LMDB size]",
ArrayGet(args, 0)
);
@ -109,6 +117,7 @@ Main(Array *args, HashMap *env)
JsonSet(json, JsonValueString(jabber), 1, "component_host");
JsonSet(json, JsonValueInteger(port), 1, "component_port");
JsonSet(json, JsonValueInteger(max_stanza), 1, "max_stanza_size");
JsonSet(json, JsonValueString(jcp), 1, "shared_secret");