Skip to content

Commit

Permalink
* Disabling "BAD_CHL"
Browse files Browse the repository at this point in the history
* Fix : CHANNEL raw was sent twice when trying to force a user to join a channel during a "adduser" event or a "CONNECT" hook
  • Loading branch information
paraboul committed Jun 17, 2011
1 parent d7906d2 commit 260da96
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.sh
Expand Up @@ -30,7 +30,7 @@ fi
cd ./deps/udns-0.0.9/
make clean && ./configure && make
cd ../js/src/
./configure && make
./configure && make -j8
cd ../../../
make
cd ./modules/ && make
14 changes: 11 additions & 3 deletions src/cmd.c
Expand Up @@ -216,16 +216,19 @@ int process_cmd(json_item *ijson, struct _cmd_process *pc, subuser **iuser, acet

}

if (pc->guser != NULL && sub != NULL && (jchl = json_lookup(ijson->jchild.child, "chl")) != NULL && jchl->jval.vu.integer_value > sub->current_chl) {
if (pc->guser != NULL && sub != NULL && (jchl = json_lookup(ijson->jchild.child, "chl")) != NULL /*&& jchl->jval.vu.integer_value > sub->current_chl*/) {
sub->current_chl = jchl->jval.vu.integer_value;
} else if (pc->guser != NULL && sub != NULL) {
}
#if 0
else if (pc->guser != NULL && sub != NULL) {
/* if a bad challenge is detected, we are stoping walking on cmds */
send_error(pc->guser, "BAD_CHL", "250", g_ape);

sub->state = ALIVE;

return (CONNECT_KEEPALIVE);
}
#endif

cp.param = json_lookup(ijson->jchild.child, "params");
cp.client = (cp.client != NULL ? cp.client : pc->client);
Expand Down Expand Up @@ -388,8 +391,13 @@ unsigned int cmd_connect(callbackp *callbacki)

callbacki->call_user = nuser;

subuser_restor(getsubuser(callbacki->call_user, callbacki->host), callbacki->g_ape);
jstr = json_new_object();
json_set_property_objN(jstr, "user", 4, get_json_object_user(callbacki->call_user));

newraw = forge_raw("IDENT", jstr);
newraw->priority = RAW_PRI_HI;
post_raw_sub(newraw, callbacki->call_subuser, callbacki->g_ape);

jstr = json_new_object();
json_set_property_strN(jstr, "sessid", 6, nuser->sessid, 32);

Expand Down
6 changes: 3 additions & 3 deletions src/raw.c
Expand Up @@ -47,7 +47,7 @@ RAW *forge_raw(const char *raw, json_item *jlist)
string = json_to_string(jstruct, NULL, 1);

new_raw = xmalloc(sizeof(*new_raw));
new_raw->len = string->len;
new_raw->len = string->len;
new_raw->next = NULL;
new_raw->priority = RAW_PRI_LO;
new_raw->refcount = 0;
Expand Down Expand Up @@ -79,9 +79,9 @@ RAW *copy_raw(RAW *input)
new_raw->next = input->next;
new_raw->priority = input->priority;
new_raw->refcount = 0;
new_raw->data = xmalloc(sizeof(char) * (new_raw->len + 1));
new_raw->data = xmalloc(sizeof(char) * (new_raw->len + 1));

memcpy(new_raw->data, input->data, new_raw->len + 1);
memcpy(new_raw->data, input->data, new_raw->len + 1);

return new_raw;
}
Expand Down

0 comments on commit 260da96

Please sign in to comment.