@@ -261,6 +261,8 @@ static psync_socket *get_connected_socket(){
261
261
debug (D_NOTICE , "using deviceid %s" , deviceid );
262
262
appversion = psync_appname ();
263
263
devicestring = psync_device_string ();
264
+
265
+ debug (D_NOTICE , "BOBO: AppVersion: [%s]" , appversion );
264
266
265
267
while (1 ){
266
268
psync_free (auth );
@@ -319,27 +321,37 @@ static psync_socket *get_connected_socket(){
319
321
osversion = psync_deviceos ();
320
322
321
323
if (psync_my_2fa_token && psync_my_2fa_code_type && psync_my_2fa_code [0 ]){
324
+ debug (D_NOTICE , "BOBO: 2fa." );
325
+
322
326
const char * method = psync_my_2fa_code_type == 1 ?"tfa_login" :"tfa_loginwithrecoverycode" ;
323
327
binparam params []= {P_STR ("timeformat" , "timestamp" ),
324
- P_STR ("token" , psync_my_2fa_token ),
325
- P_STR ("code" , psync_my_2fa_code ),
326
- P_BOOL ("trustdevice" , psync_my_2fa_trust ),
327
- P_STR ("osversion" , osversion ),
328
- P_STR ("appversion" , appversion ),
329
- P_STR ("deviceid" , deviceid ),
330
- P_STR ("device" , devicestring ),
331
- P_BOOL ("getauth" , 1 ),
332
- P_BOOL ("cryptokeyssign" , 1 ),
333
- P_BOOL ("getapiserver" , 1 ),
334
- P_BOOL ("getlastsubscription" , 1 ),
335
- P_NUM ("os" , P_OS_ID )};
328
+ P_STR ("token" , psync_my_2fa_token ),
329
+ P_STR ("code" , psync_my_2fa_code ),
330
+ P_BOOL ("trustdevice" , psync_my_2fa_trust ),
331
+ P_STR ("osversion" , osversion ),
332
+ P_STR ("appversion" , appversion ),
333
+ P_STR ("deviceid" , deviceid ),
334
+ P_STR ("device" , devicestring ),
335
+ P_BOOL ("getauth" , 1 ),
336
+ P_BOOL ("cryptokeyssign" , 1 ),
337
+ P_BOOL ("getapiserver" , 1 ),
338
+ P_BOOL ("getlastsubscription" , 1 ),
339
+ P_NUM ("os" , P_OS_ID )};
336
340
res = send_command (sock , method , params );
337
341
}
338
342
else if (user && pass && pass [0 ]){
339
- if (digest )
343
+ debug (D_NOTICE , "BOBO: Got user [%s], pass [%s]!" , user , pass );
344
+ if (digest ){
345
+ debug (D_NOTICE , "BOBO: Digest. ApiServer: [%s]" , apiserver );
346
+ debug (D_NOTICE , "BOBO: Osversion: [%s], AppVersion: [%s], DeviceId: [%s], DeviceString: [%s]" , osversion , appversion , deviceid , devicestring );
340
347
res = get_userinfo_user_pass (sock , user , pass , osversion , appversion , deviceid , devicestring );
348
+ }
341
349
else {
342
- binparam params []= {P_STR ("timeformat" , "timestamp" ),
350
+ debug (D_NOTICE , "BOBO: Send login. user:[%s], pass:[%s]" , user , pass );
351
+ debug (D_NOTICE , "BOBO: Send login. OSversion:[%s], AppVersion:[%s]" , osversion , appversion );
352
+ debug (D_NOTICE , "BOBO: Send login. deviceid:[%s], devicestring:[%s]" , deviceid , devicestring );
353
+
354
+ binparam params []= {P_STR ("timeformat" , "timestamp" ),
343
355
P_STR ("username" , user ),
344
356
P_STR ("password" , pass ),
345
357
P_STR ("osversion" , osversion ),
@@ -355,6 +367,8 @@ static psync_socket *get_connected_socket(){
355
367
}
356
368
}
357
369
else {
370
+ debug (D_NOTICE , "BOBO: Userinfo." );
371
+
358
372
binparam params []= {P_STR ("timeformat" , "timestamp" ),
359
373
P_STR ("auth" , auth ),
360
374
P_STR ("osversion" , osversion ),
@@ -364,20 +378,25 @@ static psync_socket *get_connected_socket(){
364
378
P_BOOL ("getauth" , 1 ),
365
379
P_BOOL ("cryptokeyssign" , 1 ),
366
380
P_BOOL ("getapiserver" , 1 ),
367
- P_BOOL ("getlastsubscription" , 1 ),
381
+ P_BOOL ("getlastsubscription" , 1 ),
368
382
P_NUM ("os" , P_OS_ID )};
369
383
res = send_command (sock , "userinfo" , params );
370
384
}
371
385
psync_free (osversion );
386
+
372
387
if (unlikely_log (!res )){
373
388
psync_socket_close (sock );
374
389
psync_set_status (PSTATUS_TYPE_ONLINE , PSTATUS_ONLINE_OFFLINE );
375
390
psync_milisleep (PSYNC_SLEEP_BEFORE_RECONNECT );
376
391
psync_api_conn_fail_inc ();
377
392
continue ;
378
393
}
394
+
395
+ debug (D_NOTICE , "BOBO: Reset API connection." );
396
+
379
397
psync_api_conn_fail_reset ();
380
398
result = psync_find_result (res , "result" , PARAM_NUM )-> num ;
399
+
381
400
if (unlikely (result )){
382
401
debug (D_NOTICE , "userinfo returned error %lu %s" , (unsigned long )result , psync_find_result (res , "error" , PARAM_STR )-> str );
383
402
// here we only handle statuses that need to access the result
@@ -407,7 +426,10 @@ static psync_socket *get_connected_socket(){
407
426
cres = psync_check_result (res , "location" , PARAM_HASH );
408
427
if (cres ){
409
428
binapi = psync_strdup (psync_find_result (cres , "binapi" , PARAM_STR )-> str );
410
- locationid = psync_find_result (cres , "id" , PARAM_NUM )-> num ;
429
+
430
+ debug (D_NOTICE , "BOBO: Wring server. Suggested server: [%s]" , binapi );
431
+
432
+ locationid = psync_find_result (cres , "id" , PARAM_NUM )-> num ;
411
433
psync_set_apiserver (binapi ,locationid );
412
434
}
413
435
psync_socket_close (sock );
0 commit comments