Skip to content
This repository was archived by the owner on Jun 14, 2022. It is now read-only.

Commit 53dca5b

Browse files
committed
Fix auth command
1 parent 99106c2 commit 53dca5b

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

src/psync/pdiff.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,13 @@ static binresult *get_userinfo_user_digest(
109109
P_LSTR("username", username, userlen),
110110
P_LSTR("digest", digest, diglen),
111111
P_LSTR("passworddigest", pwddig, PSYNC_SHA1_DIGEST_HEXLEN),
112-
P_STR("osversion", osversion),
113-
P_STR("appversion", appversion),
114-
P_STR("deviceid", deviceid),
112+
/* TODO: Sending the following params leads to PSTATUS_AUTH_BADLOGIN
113+
* (possible the bug in the code or specific to API):
114+
*
115+
* P_STR("osversion", osversion),
116+
* P_STR("appversion", appversion),
117+
* P_STR("deviceid", deviceid),
118+
*/
115119
P_STR("device", device),
116120
P_BOOL("getauth", 1),
117121
P_BOOL("getapiserver", 1),
@@ -2348,22 +2352,27 @@ static void psync_run_analyze_if_needed() {
23482352
}
23492353

23502354
static int psync_diff_check_quota(psync_socket *sock) {
2351-
binparam diffparams[] = {P_STR("timeformat", "timestamp"), P_BOOL("getapiserver", 1)};
2355+
binparam diffparams[] = {
2356+
P_STR("timeformat", "timestamp"),
2357+
P_BOOL("getapiserver", 1)
2358+
};
23522359
binresult *res;
23532360
const binresult *uq;
23542361
uint64_t oused_quota, result;
23552362
oused_quota=used_quota;
2356-
res=send_command(sock, "userinfo", diffparams);
2363+
res = send_command(sock, "userinfo", diffparams);
23572364
if (!res)
23582365
return -1;
2359-
result=psync_find_result(res, "result", PARAM_NUM)->num;
2360-
if (unlikely(result))
2361-
log_warn(
2362-
"userinfo returned error %u: %s",
2363-
(unsigned)result, psync_find_result(res, "error", PARAM_STR)->str
2366+
2367+
result = psync_find_result(res, "result", PARAM_NUM)->num;
2368+
if (unlikely(result)) {
2369+
log_error(
2370+
"api returned error %lu during the \"userinfo\" command: %s",
2371+
(unsigned)result,
2372+
psync_find_result(res, "error", PARAM_STR)->str
23642373
);
2365-
else{
2366-
uq=psync_check_result(res, "usedquota", PARAM_NUM);
2374+
} else {
2375+
uq = psync_check_result(res, "usedquota", PARAM_NUM);
23672376
if (likely_log(uq))
23682377
used_quota=uq->num;
23692378
}

0 commit comments

Comments
 (0)