1
0
mirror of https://github.com/altlinux/admc.git synced 2025-03-31 02:50:17 +03:00

use specific dc for smb path

not specifying a dc leads to a random dc being selected which is bad
\ due to slow replication
This commit is contained in:
Dmitry Degtyarev 2021-08-17 16:01:23 +04:00
parent fdb9fa1b3d
commit b78ee2e491
2 changed files with 13 additions and 5 deletions

View File

@ -113,7 +113,7 @@ AdInterface::AdInterface(AdConfig *adconfig) {
//
const QString connect_error_context = tr("Failed to connect");
const QString dc = [&]() {
d->dc = [&]() {
const QList<QString> dc_list = get_domain_hosts(d->domain, QString());
if (dc_list.isEmpty()) {
d->error_message_plain(tr("Failed to find domain controllers. Make sure your computer is in the domain and that domain controllers are operational."));
@ -135,14 +135,14 @@ AdInterface::AdInterface(AdConfig *adconfig) {
}();
if (AdInterfacePrivate::s_dc.isEmpty()) {
AdInterfacePrivate::s_dc = dc;
AdInterfacePrivate::s_dc = d->dc;
}
const QString uri = [&]() {
QString out;
if (!dc.isEmpty()) {
out = "ldap://" + dc;
if (!d->dc.isEmpty()) {
out = "ldap://" + d->dc;
if (!AdInterfacePrivate::s_port.isEmpty()) {
out = out + ":" + AdInterfacePrivate::s_port;
@ -1436,7 +1436,14 @@ QString AdInterface::sysvol_path_to_smb(const QString &sysvol_path) const {
out.replace("\\", "/");
out.prepend("smb:");
const int sysvol_i = out.indexOf("/sysvol/");
out.remove(0, sysvol_i);
// TODO: currently using dc that was used for ldap
// connection, but maybe there's some specific dc that's
// supposed to be used for smb connection?
out = QString("smb://%1%2").arg(d->dc, out);
return out;
}

View File

@ -47,6 +47,7 @@ public:
bool is_connected;
QString domain;
QString domain_head;
QString dc;
QList<AdMessage> messages;
void success_message(const QString &msg, const DoStatusMsg do_msg = DoStatusMsg_Yes);