1
0
forked from bip/bip

Allow weirdly ordered user blocks in config.

This commit is contained in:
Arnaud Cornet 2008-01-01 15:02:45 +01:00
parent 781b1ba8d0
commit eb82981996

View File

@ -645,8 +645,10 @@ static int add_user(bip_t *bip, list_t *data, struct historical_directives *hds)
int r; int r;
struct tuple *t; struct tuple *t;
struct user *u; struct user *u;
char *name = get_tuple_pvalue(data, LEX_NAME); char *name = get_tuple_pvalue(data, LEX_NAME);
list_t connection_list, *cl;
list_init(&connection_list, NULL);
if (name == NULL) { if (name == NULL) {
conf_die(bip, "User with no name"); conf_die(bip, "User with no name");
@ -727,11 +729,8 @@ static int add_user(bip_t *bip, list_t *data, struct historical_directives *hds)
u->bip_use_notice = t->ndata; u->bip_use_notice = t->ndata;
break; break;
case LEX_CONNECTION: case LEX_CONNECTION:
r = add_connection(bip, u, t->pdata); list_add_last(&connection_list, t->pdata);
free(t->pdata);
t->pdata = NULL; t->pdata = NULL;
if (!r)
return 0;
break; break;
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
case LEX_SSL_CHECK_MODE: case LEX_SSL_CHECK_MODE:
@ -759,6 +758,13 @@ static int add_user(bip_t *bip, list_t *data, struct historical_directives *hds)
return 0; return 0;
} }
while ((cl = list_remove_first(&connection_list))) {
r = add_connection(bip, u, cl);
free(cl);
if (!r)
return 0;
}
u->in_use = 1; u->in_use = 1;
return 1; return 1;
} }