#include "authhash.h"
#include "client-common.h"
#include "rights.h"
-#include "trackdb.h"
#include "kvp.h"
/** @brief Client handle contents */
int verbose;
/** @brief Last error string */
const char *last;
+ /** @brief Address family */
+ int family;
};
/** @brief Create a new client
disorder_client *c = xmalloc(sizeof (struct disorder_client));
c->verbose = verbose;
+ c->family = -1;
return c;
}
+/** @brief Return the address family used by this client */
+int disorder_client_af(disorder_client *c) {
+ return c->family;
+}
+
/** @brief Read a response line
* @param c Client
* @param rp Where to store response, or NULL (UTF-8)
disorder_error(errno, "error calling socket");
return -1;
}
+ c->family = sa->sa_family;
if(connect(fd, sa, salen) < 0) {
byte_xasprintf((char **)&c->last, "connect: %s", strerror(errno));
disorder_error(errno, "error calling connect");
return -1;
}
password = config->password;
- /* Maybe we can read the database */
- if(!password && trackdb_readable()) {
- trackdb_init(TRACKDB_NO_RECOVER|TRACKDB_NO_UPGRADE);
- trackdb_open(TRACKDB_READ_ONLY);
- password = trackdb_get_password(username);
- trackdb_close();
- }
+ /* If we're connecting as 'root' guess that we're the system root
+ * user (or the jukebox user), both of which can use the privileged
+ * socket. They can also furtle with the db directly: that is why
+ * privileged socket does not represent a privilege escalation. */
+ if(!password
+ && !strcmp(username, "root"))
+ password = "anything will do for root";
if(!password) {
/* Oh well */
c->last = "no password";