|
|
@ -471,12 +471,12 @@ static char *cmd_userset(PGconn *conn, char *cmd, char *id, |
|
|
|
__maybe_unused tv_t *notcd, K_TREE *trf_root, |
|
|
|
__maybe_unused tv_t *notcd, K_TREE *trf_root, |
|
|
|
__maybe_unused bool reload_data) |
|
|
|
__maybe_unused bool reload_data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
INTRANSIENT *in_username, *in_address; |
|
|
|
INTRANSIENT *in_username; |
|
|
|
K_ITEM *i_passwordhash, *i_2fa, *i_rows; |
|
|
|
K_ITEM *i_passwordhash, *i_2fa, *i_rows, *i_address; |
|
|
|
K_ITEM *i_ratio, *i_payname, *i_email, *u_item, *pa_item, *old_pa_item; |
|
|
|
K_ITEM *i_ratio, *i_payname, *i_email, *u_item, *pa_item, *old_pa_item; |
|
|
|
K_ITEM *ua_item = NULL; |
|
|
|
K_ITEM *ua_item = NULL; |
|
|
|
USERATTS *useratts = NULL; |
|
|
|
USERATTS *useratts = NULL; |
|
|
|
char *email, *payname; |
|
|
|
char *email, *address, *payname; |
|
|
|
char reply[1024] = ""; |
|
|
|
char reply[1024] = ""; |
|
|
|
size_t siz = sizeof(reply); |
|
|
|
size_t siz = sizeof(reply); |
|
|
|
int event = EVENT_OK; |
|
|
|
int event = EVENT_OK; |
|
|
@ -650,22 +650,24 @@ static char *cmd_userset(PGconn *conn, char *cmd, char *id, |
|
|
|
if (ratio == 0) |
|
|
|
if (ratio == 0) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This name won't be intransient
|
|
|
|
snprintf(tmp, sizeof(tmp), "address:%d", i); |
|
|
|
snprintf(tmp, sizeof(tmp), "address:%d", i); |
|
|
|
in_address = require_in(trf_root, tmp, |
|
|
|
i_address = require_name(trf_root, tmp, |
|
|
|
ADDR_MIN_LEN, |
|
|
|
ADDR_MIN_LEN, |
|
|
|
(char *)addrpatt, |
|
|
|
(char *)addrpatt, |
|
|
|
reply, siz); |
|
|
|
reply, siz); |
|
|
|
if (!in_address) { |
|
|
|
if (!i_address) { |
|
|
|
K_WUNLOCK(paymentaddresses_free); |
|
|
|
K_WUNLOCK(paymentaddresses_free); |
|
|
|
event = events_add(EVENTID_INCBTC, |
|
|
|
event = events_add(EVENTID_INCBTC, |
|
|
|
trf_root); |
|
|
|
trf_root); |
|
|
|
reason = "Invalid address"; |
|
|
|
reason = "Invalid address"; |
|
|
|
goto struckout; |
|
|
|
goto struckout; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
address = transfer_data(i_address); |
|
|
|
pa_item = STORE_HEAD_NOLOCK(pa_store); |
|
|
|
pa_item = STORE_HEAD_NOLOCK(pa_store); |
|
|
|
while (pa_item) { |
|
|
|
while (pa_item) { |
|
|
|
DATA_PAYMENTADDRESSES(row, pa_item); |
|
|
|
DATA_PAYMENTADDRESSES(row, pa_item); |
|
|
|
if (INTREQ(row->in_payaddress, in_address->str)) { |
|
|
|
if (strcmp(row->in_payaddress, address) == 0) { |
|
|
|
K_WUNLOCK(paymentaddresses_free); |
|
|
|
K_WUNLOCK(paymentaddresses_free); |
|
|
|
reason = "Duplicate address"; |
|
|
|
reason = "Duplicate address"; |
|
|
|
goto struckout; |
|
|
|
goto struckout; |
|
|
@ -683,7 +685,7 @@ static char *cmd_userset(PGconn *conn, char *cmd, char *id, |
|
|
|
pa_item = k_unlink_head(paymentaddresses_free); |
|
|
|
pa_item = k_unlink_head(paymentaddresses_free); |
|
|
|
DATA_PAYMENTADDRESSES(row, pa_item); |
|
|
|
DATA_PAYMENTADDRESSES(row, pa_item); |
|
|
|
bzero(row, sizeof(*row)); |
|
|
|
bzero(row, sizeof(*row)); |
|
|
|
row->in_payaddress = in_address->str; |
|
|
|
row->in_payaddress = intransient_str("payaddress", address); |
|
|
|
row->payratio = ratio; |
|
|
|
row->payratio = ratio; |
|
|
|
STRNCPY(row->payname, payname); |
|
|
|
STRNCPY(row->payname, payname); |
|
|
|
k_add_head(pa_store, pa_item); |
|
|
|
k_add_head(pa_store, pa_item); |
|
|
|