@@ -7405,91 +7405,116 @@ static rem_port* analyze(ClntAuthBlock& cBlock, PathName& attach_name, unsigned
7405
7405
7406
7406
cBlock.loadClnt (pb, &parSet);
7407
7407
pb.deleteWithTag (parSet.auth_block );
7408
- authenticateStep0 (cBlock);
7409
7408
7410
7409
bool needFile = !(flags & ANALYZE_EMP_NAME);
7410
+ const PathName save_attach_name (attach_name);
7411
+ bool legacySSP = false ;
7412
+ Auth::setLegacySSP (legacySSP);
7411
7413
7414
+ while (true )
7415
+ {
7416
+ authenticateStep0 (cBlock);
7417
+
7418
+ try
7419
+ {
7412
7420
#ifdef WIN_NT
7413
- if (ISC_analyze_protocol (PROTOCOL_XNET, attach_name, node_name, NULL , needFile))
7414
- port = XNET_analyze (&cBlock, attach_name, flags & ANALYZE_USER_VFY, cBlock.getConfig (), ref_db_name);
7415
- else
7421
+ if (ISC_analyze_protocol (PROTOCOL_XNET, attach_name, node_name, NULL , needFile))
7422
+ port = XNET_analyze (&cBlock, attach_name, flags & ANALYZE_USER_VFY, cBlock.getConfig (), ref_db_name);
7423
+ else
7416
7424
#endif
7417
7425
7418
- if (ISC_analyze_protocol (PROTOCOL_INET4, attach_name, node_name, INET_SEPARATOR, needFile))
7419
- inet_af = AF_INET;
7420
- else if (ISC_analyze_protocol (PROTOCOL_INET6, attach_name, node_name, INET_SEPARATOR, needFile))
7421
- inet_af = AF_INET6;
7426
+ if (ISC_analyze_protocol (PROTOCOL_INET4, attach_name, node_name, INET_SEPARATOR, needFile))
7427
+ inet_af = AF_INET;
7428
+ else if (ISC_analyze_protocol (PROTOCOL_INET6, attach_name, node_name, INET_SEPARATOR, needFile))
7429
+ inet_af = AF_INET6;
7422
7430
7423
- if (inet_af != AF_UNSPEC ||
7424
- ISC_analyze_protocol (PROTOCOL_INET, attach_name, node_name, INET_SEPARATOR, needFile) ||
7425
- ISC_analyze_tcp (attach_name, node_name, needFile))
7426
- {
7427
- if (node_name.isEmpty ())
7428
- node_name = INET_LOCALHOST;
7429
- else
7430
- {
7431
- ISC_unescape (node_name);
7432
- ISC_utf8ToSystem (node_name);
7433
- }
7431
+ if (inet_af != AF_UNSPEC ||
7432
+ ISC_analyze_protocol (PROTOCOL_INET, attach_name, node_name, INET_SEPARATOR, needFile) ||
7433
+ ISC_analyze_tcp (attach_name, node_name, needFile))
7434
+ {
7435
+ if (node_name.isEmpty ())
7436
+ node_name = INET_LOCALHOST;
7437
+ else
7438
+ {
7439
+ ISC_unescape (node_name);
7440
+ ISC_utf8ToSystem (node_name);
7441
+ }
7434
7442
7435
- port = INET_analyze (&cBlock, attach_name, node_name.c_str (), flags & ANALYZE_USER_VFY, pb,
7436
- cBlock.getConfig (), ref_db_name, cryptCb, inet_af);
7437
- }
7443
+ port = INET_analyze (&cBlock, attach_name, node_name.c_str (), flags & ANALYZE_USER_VFY, pb,
7444
+ cBlock.getConfig (), ref_db_name, cryptCb, inet_af);
7445
+ }
7438
7446
7439
- // We have a local connection string. If it's a file on a network share,
7440
- // try to connect to the corresponding host remotely.
7441
- if (flags & ANALYZE_MOUNTS)
7442
- {
7443
- #ifdef WIN_NT
7444
- if (!port)
7445
- {
7446
- PathName expanded_name = attach_name;
7447
- if (ISC_analyze_pclan (expanded_name, node_name))
7447
+ // We have a local connection string. If it's a file on a network share,
7448
+ // try to connect to the corresponding host remotely.
7449
+ if (flags & ANALYZE_MOUNTS)
7448
7450
{
7449
- ISC_unescape (node_name);
7450
- ISC_utf8ToSystem (node_name);
7451
+ #ifdef WIN_NT
7452
+ if (!port)
7453
+ {
7454
+ PathName expanded_name = attach_name;
7455
+ if (ISC_analyze_pclan (expanded_name, node_name))
7456
+ {
7457
+ ISC_unescape (node_name);
7458
+ ISC_utf8ToSystem (node_name);
7451
7459
7452
- port = INET_analyze (&cBlock, expanded_name, node_name.c_str (), flags & ANALYZE_USER_VFY, pb,
7453
- cBlock.getConfig (), ref_db_name, cryptCb);
7454
- }
7455
- }
7460
+ port = INET_analyze (&cBlock, expanded_name, node_name.c_str (), flags & ANALYZE_USER_VFY, pb,
7461
+ cBlock.getConfig (), ref_db_name, cryptCb);
7462
+ }
7463
+ }
7456
7464
#endif
7457
7465
7458
7466
#ifndef NO_NFS
7459
- if (!port)
7460
- {
7461
- PathName expanded_name = attach_name;
7462
- if (ISC_analyze_nfs (expanded_name, node_name))
7463
- {
7464
- ISC_unescape (node_name);
7465
- ISC_utf8ToSystem (node_name);
7467
+ if (!port)
7468
+ {
7469
+ PathName expanded_name = attach_name;
7470
+ if (ISC_analyze_nfs (expanded_name, node_name))
7471
+ {
7472
+ ISC_unescape (node_name);
7473
+ ISC_utf8ToSystem (node_name);
7466
7474
7467
- port = INET_analyze (&cBlock, expanded_name, node_name.c_str (), flags & ANALYZE_USER_VFY, pb,
7468
- cBlock.getConfig (), ref_db_name, cryptCb);
7469
- }
7470
- }
7475
+ port = INET_analyze (&cBlock, expanded_name, node_name.c_str (), flags & ANALYZE_USER_VFY, pb,
7476
+ cBlock.getConfig (), ref_db_name, cryptCb);
7477
+ }
7478
+ }
7471
7479
#endif
7472
- }
7480
+ }
7473
7481
7474
- if ((flags & ANALYZE_LOOPBACK) && !port)
7475
- {
7476
- // We have a local connection string.
7477
- // If we are in loopback mode attempt connect to a localhost.
7482
+ if ((flags & ANALYZE_LOOPBACK) && !port)
7483
+ {
7484
+ // We have a local connection string.
7485
+ // If we are in loopback mode attempt connect to a localhost.
7478
7486
7479
- if (node_name.isEmpty ())
7480
- {
7487
+ if (node_name.isEmpty ())
7488
+ {
7481
7489
#ifdef WIN_NT
7482
- if (!port)
7483
- {
7484
- port = XNET_analyze (&cBlock, attach_name, flags & ANALYZE_USER_VFY,
7485
- cBlock.getConfig (), ref_db_name);
7486
- }
7490
+ if (!port)
7491
+ {
7492
+ port = XNET_analyze (&cBlock, attach_name, flags & ANALYZE_USER_VFY,
7493
+ cBlock.getConfig (), ref_db_name);
7494
+ }
7487
7495
#endif
7488
- if (!port)
7489
- {
7490
- port = INET_analyze (&cBlock, attach_name, INET_LOCALHOST, flags & ANALYZE_USER_VFY, pb,
7491
- cBlock.getConfig (), ref_db_name, cryptCb);
7496
+ if (!port)
7497
+ {
7498
+ port = INET_analyze (&cBlock, attach_name, INET_LOCALHOST, flags & ANALYZE_USER_VFY, pb,
7499
+ cBlock.getConfig (), ref_db_name, cryptCb);
7500
+ }
7501
+ }
7492
7502
}
7503
+
7504
+ break ;
7505
+ }
7506
+ catch (const Exception&)
7507
+ {
7508
+ const char * const pluginName = cBlock.plugins .name ();
7509
+ if (legacySSP || fb_utils::stricmp (pluginName, " WIN_SSPI" ) != 0 )
7510
+ throw ;
7511
+
7512
+ // Retry connect with failed plugin only and using legacy security package
7513
+ legacySSP = true ;
7514
+ Auth::setLegacySSP (legacySSP);
7515
+ attach_name = save_attach_name;
7516
+
7517
+ cBlock.plugins .set (pluginName);
7493
7518
}
7494
7519
}
7495
7520
0 commit comments