0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

provider: compile fixes

This commit is contained in:
Elizabeth Myers 2016-03-19 15:58:48 -05:00
parent 893a92e7b3
commit 46d17a88b4

View file

@ -42,6 +42,7 @@
* --Elizafox, 9 March 2016 * --Elizafox, 9 March 2016
*/ */
#include "rb_dictionary.h"
#include "authd.h" #include "authd.h"
#include "provider.h" #include "provider.h"
@ -110,6 +111,10 @@ void cancel_providers(struct auth_client *auth)
/* Cancel if required */ /* Cancel if required */
provider->cancel(auth); provider->cancel(auth);
} }
/* All data should be already destroyed */
rb_dictionary_destroy(auth->data, NULL, NULL);
auth->data = NULL;
} }
/* Provider is done */ /* Provider is done */
@ -160,16 +165,13 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason)
break; break;
} }
/* TODO send back ident */
rb_helper_write(authd_helper, "R %x %c :%s", auth->cid, reject, reason); rb_helper_write(authd_helper, "R %x %c :%s", auth->cid, reject, reason);
unset_provider(auth, id); unset_provider(auth, id);
if(auth->providers)
{
cancel_providers(auth); cancel_providers(auth);
memset(&auth_clients[cid], 0, sizeof(struct auth_client)); memset(&auth_clients[cid], 0, sizeof(struct auth_client));
} }
}
/* Accept a client, cancel outstanding providers if any */ /* Accept a client, cancel outstanding providers if any */
void accept_client(struct auth_client *auth, provider_t id) void accept_client(struct auth_client *auth, provider_t id)
@ -179,10 +181,7 @@ void accept_client(struct auth_client *auth, provider_t id)
rb_helper_write(authd_helper, "A %x %s %s", auth->cid, auth->username, auth->hostname); rb_helper_write(authd_helper, "A %x %s %s", auth->cid, auth->username, auth->hostname);
unset_provider(auth, id); unset_provider(auth, id);
if(auth->providers)
cancel_providers(auth); cancel_providers(auth);
memset(&auth_clients[cid], 0, sizeof(struct auth_client)); memset(&auth_clients[cid], 0, sizeof(struct auth_client));
} }
@ -217,7 +216,7 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co
rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip)); rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip));
auth->c_port = (uint16_t)atoi(c_port); auth->c_port = (uint16_t)atoi(c_port);
snprintf("%d provider data", sizeof(name), auth->cid); snprintf(name, sizeof(name), "%d provider data", auth->cid);
auth->data = rb_dictionary_create(name, rb_uint32cmp); auth->data = rb_dictionary_create(name, rb_uint32cmp);
RB_DLINK_FOREACH(ptr, auth_providers.head) RB_DLINK_FOREACH(ptr, auth_providers.head)