31 int nusers, user, name, secret;
42 userfile = CONFIG_DIR
"/router-users.xml";
44 f = fopen(userfile,
"rb");
46 log_write(r->
log, LOG_ERR,
"couldn't open user table file %s: %s", userfile, strerror(errno));
50 fseek(f, 0, SEEK_END);
52 fseek(f, 0, SEEK_SET);
54 buf = (
char *) malloc(
sizeof(
char) * size);
56 if (fread(buf, 1, size, f) != size || ferror(f)) {
57 log_write(r->
log, LOG_ERR,
"couldn't read from user table file: %s", strerror(errno));
81 log_write(r->
log, LOG_ERR,
"malformed user entry in user table file, skipping");
87 xhash_put(r->
users,
pstrdupx(
xhash_pool(r->
users),
NAD_CDATA(nad, name),
NAD_CDATA_L(nad, name)),
pstrdupx(
xhash_pool(r->
users),
NAD_CDATA(nad, secret),
NAD_CDATA_L(nad, secret)));
96 log_write(r->
log, LOG_NOTICE,
"loaded user table (%d users)", nusers);