[srvx-commits] CVS: services/src nickserv.c,1.223,1.224
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2003-01-06 02:12:54
|
Update of /cvsroot/srvx/services/src
In directory sc8-pr-cvs1:/tmp/cvs-serv31704/src
Modified Files:
nickserv.c
Log Message:
allow cookie data to be missing when reading DB (allowauth, for example, does not use it)
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.223
retrieving revision 1.224
diff -C2 -r1.223 -r1.224
*** nickserv.c 6 Jan 2003 01:53:01 -0000 1.223
--- nickserv.c 6 Jan 2003 02:12:51 -0000 1.224
***************
*** 2396,2400 ****
char *type;
- saxdb_start_record(ctx, KEY_COOKIE, 0);
switch (cookie->type) {
case ACTIVATION: type = KEY_ACTIVATION; break;
--- 2396,2399 ----
***************
*** 2404,2412 ****
default: type = NULL; break;
}
! if (type) saxdb_write_string(ctx, KEY_COOKIE_TYPE, type);
! saxdb_write_int(ctx, KEY_COOKIE_EXPIRES, cookie->expires);
! if (cookie->data) saxdb_write_string(ctx, KEY_COOKIE_DATA, cookie->data);
! saxdb_write_string(ctx, KEY_COOKIE, cookie->cookie);
! saxdb_end_record(ctx);
}
if (hi->email_addr) saxdb_write_string(ctx, KEY_EMAIL_ADDR, hi->email_addr);
--- 2403,2414 ----
default: type = NULL; break;
}
! if (type) {
! saxdb_start_record(ctx, KEY_COOKIE, 0);
! saxdb_write_string(ctx, KEY_COOKIE_TYPE, type);
! saxdb_write_int(ctx, KEY_COOKIE_EXPIRES, cookie->expires);
! if (cookie->data) saxdb_write_string(ctx, KEY_COOKIE_DATA, cookie->data);
! saxdb_write_string(ctx, KEY_COOKIE, cookie->cookie);
! saxdb_end_record(ctx);
! }
}
if (hi->email_addr) saxdb_write_string(ctx, KEY_EMAIL_ADDR, hi->email_addr);
***************
*** 2933,2937 ****
expires = database_get_data(subdb, KEY_COOKIE_EXPIRES, RECDB_QSTRING);
cookie_str = database_get_data(subdb, KEY_COOKIE, RECDB_QSTRING);
! if (!type || !data || !expires || !cookie_str) {
log(NS_LOG, LOG_ERROR, "Missing field(s) from cookie for account %s; dropping cookie.\n", hi->handle);
goto cookie_out;
--- 2935,2939 ----
expires = database_get_data(subdb, KEY_COOKIE_EXPIRES, RECDB_QSTRING);
cookie_str = database_get_data(subdb, KEY_COOKIE, RECDB_QSTRING);
! if (!type || !expires || !cookie_str) {
log(NS_LOG, LOG_ERROR, "Missing field(s) from cookie for account %s; dropping cookie.\n", hi->handle);
goto cookie_out;
***************
*** 2947,2951 ****
cookie->expires = strtoul(expires, NULL, 0);
if (cookie->expires < now) goto cookie_out;
! cookie->data = strdup(data);
safestrncpy(cookie->cookie, cookie_str, sizeof(cookie->cookie));
cookie->hi = hi;
--- 2949,2953 ----
cookie->expires = strtoul(expires, NULL, 0);
if (cookie->expires < now) goto cookie_out;
! if (data) cookie->data = strdup(data);
safestrncpy(cookie->cookie, cookie_str, sizeof(cookie->cookie));
cookie->hi = hi;
|