Skip to content

Commit 2564188

Browse files
author
virco
committed
Merge branch 'master' of gitlab.pcloud.com:pcloud/synclib
2 parents 3ecb28d + 68c4aaf commit 2564188

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

pdiff.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ static psync_socket *get_connected_socket(){
169169
int saveauth, isbusiness, cryptosetup;
170170
auth=user=pass=NULL;
171171
psync_is_business = 0;
172-
while (1){
172+
int digest = 1;
173+
while (1){
173174
psync_free(auth);
174175
psync_free(user);
175176
psync_free(pass);
@@ -197,8 +198,22 @@ static psync_socket *get_connected_socket(){
197198
continue;
198199
}
199200
device=psync_deviceid();
200-
if (user && pass)
201-
res=get_userinfo_user_pass(sock, user, pass, device);
201+
202+
if (user && pass && pass[0])
203+
if (digest)
204+
res=get_userinfo_user_pass(sock, user, pass, device);
205+
else
206+
{
207+
binparam params[]={P_STR("timeformat", "timestamp"),
208+
P_STR("username", user),
209+
P_STR("password", pass),
210+
P_STR("device", device),
211+
P_BOOL("getauth", 1),
212+
P_BOOL("cryptokeyssign", 1),
213+
P_BOOL("getapiserver", 1),
214+
P_NUM("os", P_OS_ID)};
215+
res=send_command(sock, "userinfo", params);
216+
}
202217
else {
203218
binparam params[]={P_STR("timeformat", "timestamp"),
204219
P_STR("auth", auth),

psynclib.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,16 @@ void psync_set_user_pass(const char *username, const char *password, int save){
292292
clear_db(save);
293293
if (save){
294294
psync_set_string_value("user", username);
295-
psync_set_string_value("pass", password);
295+
if (password && password[0])
296+
psync_set_string_value("pass", password);
296297
}
297298
else{
298299
pthread_mutex_lock(&psync_my_auth_mutex);
299300
psync_free(psync_my_user);
300301
psync_my_user=psync_strdup(username);
301302
psync_free(psync_my_pass);
302-
psync_my_pass=psync_strdup(password);
303+
if (password && password[0])
304+
psync_my_pass=psync_strdup(password);
303305
pthread_mutex_unlock(&psync_my_auth_mutex);
304306
}
305307
psync_set_status(PSTATUS_TYPE_AUTH, PSTATUS_AUTH_PROVIDED);

0 commit comments

Comments
 (0)