sharedsecret
This commit is contained in:
parent
b16be4f98f
commit
6f9ae7bcb2
@ -2,7 +2,7 @@ CREATE SEQUENCE device_s START WITH 1 INCREMENT BY 1;
|
|||||||
|
|
||||||
CREATE TABLE device_t (
|
CREATE TABLE device_t (
|
||||||
id integer PRIMARY KEY DEFAULT NEXTVAL('device_s'),
|
id integer PRIMARY KEY DEFAULT NEXTVAL('device_s'),
|
||||||
deviceid varchar(16) NOT NULL,
|
deviceid varchar(16) UNIQUE NOT NULL,
|
||||||
sharedsecret varchar(31) NOT NULL,
|
sharedsecret varchar(31) NOT NULL,
|
||||||
active boolean NOT NULL DEFAULT false
|
active boolean NOT NULL DEFAULT false
|
||||||
);
|
);
|
@ -152,12 +152,12 @@ t_device *findDevice(t_commonHandle *handle, char *deviceId) {
|
|||||||
logmsg(LOG_INFO, "findDevice query fails, database returns %s", PQresStatus(execStatus));
|
logmsg(LOG_INFO, "findDevice query fails, database returns %s", PQresStatus(execStatus));
|
||||||
} else {
|
} else {
|
||||||
int ntuples = PQntuples(res2);
|
int ntuples = PQntuples(res2);
|
||||||
if (ntuples == 0) {
|
if (ntuples == 1) {
|
||||||
logmsg(LOG_ERR, "no device found");
|
|
||||||
} else if (ntuples == 1) {
|
|
||||||
logmsg(LOG_DEBUG, "device found");
|
logmsg(LOG_DEBUG, "device found");
|
||||||
|
char *sharedsecret = PQgetvalue(res2, 0, 0);
|
||||||
|
logmsg(LOG_DEBUG, "found sharedsecret is %s", sharedsecret);
|
||||||
} else {
|
} else {
|
||||||
logmsg(LOG_ERR, "strange number of devices found: %d", ntuples);
|
logmsg(LOG_ERR, "no device found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PQclear(res2);
|
PQclear(res2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user