- info("added %s as %s after %s", track, q->id, afterme);
+ disorder_info("added %s as %s after %s", track, q->id, afterme);
* prepare the same track twice so there's no point. */
if(qhead.next != &qhead) {
prepare(c->ev, qhead.next);
* prepare the same track twice so there's no point. */
if(qhead.next != &qhead) {
prepare(c->ev, qhead.next);
sink_writes(ev_writer_sink(c->w),
"510 Not authorized to remove that track\n");
return 1;
sink_writes(ev_writer_sink(c->w),
"510 Not authorized to remove that track\n");
return 1;
* playing track then you will get 550 if you weren't authorized to scratch
* the currently playing track. */
if(!right_scratchable(c->rights, c->who, playing)) {
* playing track then you will get 550 if you weren't authorized to scratch
* the currently playing track. */
if(!right_scratchable(c->rights, c->who, playing)) {
sink_writes(ev_writer_sink(c->w),
"510 Not authorized to scratch that track\n");
return 1;
sink_writes(ev_writer_sink(c->w),
"510 Not authorized to scratch that track\n");
return 1;
static int c_shutdown(struct conn *c,
char attribute((unused)) **vec,
int attribute((unused)) nvec) {
static int c_shutdown(struct conn *c,
char attribute((unused)) **vec,
int attribute((unused)) nvec) {
static int c_reconfigure(struct conn *c,
char attribute((unused)) **vec,
int attribute((unused)) nvec) {
static int c_reconfigure(struct conn *c,
char attribute((unused)) **vec,
int attribute((unused)) nvec) {
if(reconfigure(c->ev, 1))
sink_writes(ev_writer_sink(c->w), "550 error reading new config\n");
else
if(reconfigure(c->ev, 1))
sink_writes(ev_writer_sink(c->w), "550 error reading new config\n");
else
- info("S%x rescan by %s (%s %s)", c->tag, c->who,
- flag_wait ? "wait" : "",
- flag_fresh ? "fresh" : "");
+ disorder_info("S%x rescan by %s (%s %s)", c->tag, c->who,
+ flag_wait ? "wait" : "",
+ flag_fresh ? "fresh" : "");
if(trackdb_rescan_underway()) {
if(flag_fresh) {
/* We want a fresh rescan but there is already one underway. Arrange a
if(trackdb_rescan_underway()) {
if(flag_fresh) {
/* We want a fresh rescan but there is already one underway. Arrange a
/* get connection data */
l = sizeof u;
if(getpeername(c->fd, &u.sa, &l) < 0) {
/* get connection data */
l = sizeof u;
if(getpeername(c->fd, &u.sa, &l) < 0) {
return 0;
}
if(c->l->pf != PF_UNIX) {
if((n = getnameinfo(&u.sa, l,
host, sizeof host, 0, 0, NI_NUMERICHOST))) {
return 0;
}
if(c->l->pf != PF_UNIX) {
if((n = getnameinfo(&u.sa, l,
host, sizeof host, 0, 0, NI_NUMERICHOST))) {
- error(0, "S%x error calling getnameinfo: %s", c->tag, gai_strerror(n));
+ disorder_error(0, "S%x error calling getnameinfo: %s",
+ c->tag, gai_strerror(n));
- error(0, "S%x unknown user '%s' from %s", c->tag, vec[0], host);
+ disorder_error(0, "S%x unknown user '%s' from %s", c->tag, vec[0], host);
sink_writes(ev_writer_sink(c->w), "530 authentication failed\n");
return 1;
}
/* reject unconfirmed users */
if(kvp_get(k, "confirmation")) {
sink_writes(ev_writer_sink(c->w), "530 authentication failed\n");
return 1;
}
/* reject unconfirmed users */
if(kvp_get(k, "confirmation")) {
- error(0, "S%x unconfirmed user '%s' from %s", c->tag, vec[0], host);
+ disorder_error(0, "S%x unconfirmed user '%s' from %s",
+ c->tag, vec[0], host);
sink_writes(ev_writer_sink(c->w), "530 authentication failed\n");
return 1;
}
password = kvp_get(k, "password");
if(!password) password = "";
if(parse_rights(kvp_get(k, "rights"), &rights, 1)) {
sink_writes(ev_writer_sink(c->w), "530 authentication failed\n");
return 1;
}
password = kvp_get(k, "password");
if(!password) password = "";
if(parse_rights(kvp_get(k, "rights"), &rights, 1)) {
c->rights = rights;
/* currently we only bother logging remote connections */
if(strcmp(host, "local"))
c->rights = rights;
/* currently we only bother logging remote connections */
if(strcmp(host, "local"))
- info("S%x %s connected from %s", c->tag, vec[0], host);
+ disorder_info("S%x %s connected from %s", c->tag, vec[0], host);
else
c->rights |= RIGHT__LOCAL;
sink_writes(ev_writer_sink(c->w), "230 OK\n");
return 1;
}
/* oops, response was wrong */
else
c->rights |= RIGHT__LOCAL;
sink_writes(ev_writer_sink(c->w), "230 OK\n");
return 1;
}
/* oops, response was wrong */
sink_writes(ev_writer_sink(c->w),
"510 Not authorized to move that track\n");
return 1;
sink_writes(ev_writer_sink(c->w),
"510 Not authorized to move that track\n");
return 1;
sink_writes(ev_writer_sink(c->w),
"510 Not authorized to move those tracks\n");
return 1;
sink_writes(ev_writer_sink(c->w),
"510 Not authorized to move those tracks\n");
return 1;
max = config->new_max;
tracks = trackdb_new(0, max);
sink_printf(ev_writer_sink(c->w), "253 New track list follows\n");
max = config->new_max;
tracks = trackdb_new(0, max);
sink_printf(ev_writer_sink(c->w), "253 New track list follows\n");
while(*tracks) {
sink_printf(ev_writer_sink(c->w), "%s%s\n",
**tracks == '.' ? "." : "", *tracks);
while(*tracks) {
sink_printf(ev_writer_sink(c->w), "%s%s\n",
**tracks == '.' ? "." : "", *tracks);
- info("S%x %s connected with cookie from %s", c->tag, user, host);
+ disorder_info("S%x %s connected with cookie from %s", c->tag, user, host);
if(!config->remote_userman
&& !(c->rights & RIGHT__LOCAL)
&& strcmp(vec[1], "rights")) {
if(!config->remote_userman
&& !(c->rights & RIGHT__LOCAL)
&& strcmp(vec[1], "rights")) {
- error(0, "S%x: remote userinfo %s %s", c->tag, vec[0], vec[1]);
+ disorder_error(0, "S%x: remote userinfo %s %s", c->tag, vec[0], vec[1]);
* letters and digits, minimizing the chance of the URL being mispasted. */
gcry_randomize(nonce, sizeof nonce, GCRY_STRONG_RANDOM);
if(basen(nonce, CONFIRM_SIZE, nonce_str, sizeof nonce_str, 62)) {
* letters and digits, minimizing the chance of the URL being mispasted. */
gcry_randomize(nonce, sizeof nonce, GCRY_STRONG_RANDOM);
if(basen(nonce, CONFIRM_SIZE, nonce_str, sizeof nonce_str, 62)) {
sink_writes(ev_writer_sink(c->w), "550 Cannot create user\n");
}
byte_xasprintf(&cs, "%s/%s", vec[0], nonce_str);
sink_writes(ev_writer_sink(c->w), "550 Cannot create user\n");
}
byte_xasprintf(&cs, "%s/%s", vec[0], nonce_str);
- info("S%x %s confirmed from %s", c->tag, user, host);
+ disorder_info("S%x %s confirmed from %s", c->tag, user, host);
sink_writes(ev_writer_sink(c->w), "550 Cannot send a reminder email\n");
}
/* Re-enable this connection */
sink_writes(ev_writer_sink(c->w), "550 Cannot send a reminder email\n");
}
/* Re-enable this connection */
sink_writes(ev_writer_sink(c->w), "550 Cannot send a reminder email\n");
return 1;
}
if(!(k = trackdb_getuserinfo(vec[0]))) {
sink_writes(ev_writer_sink(c->w), "550 Cannot send a reminder email\n");
return 1;
}
if(!(k = trackdb_getuserinfo(vec[0]))) {
sink_writes(ev_writer_sink(c->w), "550 Cannot send a reminder email\n");
return 1;
}
if(!(email = kvp_get(k, "email"))
|| !email_valid(email)) {
sink_writes(ev_writer_sink(c->w), "550 Cannot send a reminder email\n");
return 1;
}
if(!(email = kvp_get(k, "email"))
|| !email_valid(email)) {
sink_writes(ev_writer_sink(c->w), "550 Cannot send a reminder email\n");
return 1;
}
if(!(password = kvp_get(k, "password"))
|| !*password) {
sink_writes(ev_writer_sink(c->w), "550 Cannot send a reminder email\n");
return 1;
}
if(!(password = kvp_get(k, "password"))
|| !*password) {
last = hash_find(last_reminder, vec[0]);
xtime(&now);
if(last && now < *last + config->reminder_interval) {
last = hash_find(last_reminder, vec[0]);
xtime(&now);
if(last && now < *last + config->reminder_interval) {
byte_xasprintf((char **)&content_type, "text/plain;charset=%s",
quote822(charset, 0));
pid = sendmail_subprocess("", config->mail_sender, email,
byte_xasprintf((char **)&content_type, "text/plain;charset=%s",
quote822(charset, 0));
pid = sendmail_subprocess("", config->mail_sender, email,
return 1;
}
hash_add(last_reminder, vec[0], &now, HASH_INSERT_OR_REPLACE);
return 1;
}
hash_add(last_reminder, vec[0], &now, HASH_INSERT_OR_REPLACE);
/* We can only continue when the subprocess finishes */
ev_child(c->ev, pid, 0, sent_reminder, c);
return 0;
/* We can only continue when the subprocess finishes */
ev_child(c->ev, pid, 0, sent_reminder, c);
return 0;
- error(0, "%s attempted %s but lacks required rights", c->who ? c->who : "NULL",
+ disorder_error(0, "%s attempted %s but lacks required rights",
+ c->who ? c->who : "NULL",
c->w = ev_writer_new(ev, fd, writer_error, c,
"client writer");
if(!c->w) {
c->w = ev_writer_new(ev, fd, writer_error, c,
"client writer");
if(!c->w) {
fd = xsocket(pf, SOCK_STREAM, 0);
xsetsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
if(bind(fd, sa, socklen) < 0) {
fd = xsocket(pf, SOCK_STREAM, 0);
xsetsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
if(bind(fd, sa, socklen) < 0) {
l->pf = pf;
if(ev_listen(ev, fd, listen_callback, l, "server listener"))
exit(EXIT_FAILURE);
l->pf = pf;
if(ev_listen(ev, fd, listen_callback, l, "server listener"))
exit(EXIT_FAILURE);