Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add checkbox for the net ads join --no-dns-updates switch #48

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package/yast2-samba-client.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Aug 19 14:00:29 UTC 2016 - aaptel@suse.com

- Add checkbox for net ads join --no-dns-updates; (bsc#991564).

-------------------------------------------------------------------
Tue Jun 7 11:06:52 UTC 2016 - igonzalezsosa@suse.com

Expand Down
11 changes: 10 additions & 1 deletion src/include/samba-client/dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,13 @@ def MembershipDialog
Ops.get_string(pw_data, "machine", "") != nil ?
Ops.get_string(pw_data, "machine", "") :
""
)
),
CheckBox(
Id(:update_dns),
Opt(:hstretch),
_('Update DNS'),
!!pw_data['update_dns'],
),
)
),
VSpacing(),
Expand Down Expand Up @@ -760,6 +766,9 @@ def MembershipDialog
val = Convert.to_string(UI.QueryWidget(Id(key), :Value))
Ops.set(Samba.password_data, key, val) if val != nil && val != ""
end
# update_dns is a boolean, using to_string is incorrect
Samba.password_data["update_dns"] = UI.QueryWidget(Id(:update_dns), :Value)

if Convert.to_string(UI.QueryWidget(Id(:ads), :Value)) != ""
SambaAD.SetADS(
Convert.to_string(UI.QueryWidget(Id(:ads), :Value))
Expand Down
8 changes: 6 additions & 2 deletions src/include/samba-client/routines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def passwordUserPopup(message, defaultuser, domain, what)
default_id = "default_entry"
# default value of Machine Account
default_entry = Item(Id(default_id), _("(default)"))
update_dns = Empty()
if SambaAD.ADS != "" && what != :leave
machines = [default_entry]
machine_term = HBox(
Expand All @@ -77,6 +78,7 @@ def passwordUserPopup(message, defaultuser, domain, what)
),
VBox(Label(""), PushButton(Id(:acquire), _("O&btain list")))
)
update_dns = CheckBox(Id(:update_dns), Opt(:hstretch), _('Update DNS'), true)
end
UI.OpenDialog(
Opt(:decorated),
Expand All @@ -90,6 +92,7 @@ def passwordUserPopup(message, defaultuser, domain, what)
InputField(Id(:user), Opt(:hstretch), _("&Username"), defaultuser),
Password(Id(:passwd), Opt(:hstretch), Label.Password),
machine_term,
update_dns,
VSpacing(0.2),
ButtonBox(
PushButton(Id(:ok), Opt(:default), Label.OKButton),
Expand Down Expand Up @@ -146,7 +149,7 @@ def passwordUserPopup(message, defaultuser, domain, what)
end
end

result = ret == :ok ? { "user" => user, "password" => pass } : nil
result = ret == :ok ? { "user" => user, "password" => pass, "update_dns" => UI.QueryWidget(Id(:update_dns), :Value) } : nil
if SambaAD.ADS != "" && ret == :ok && what != :leave
machine = Convert.to_string(UI.QueryWidget(Id(:machines), :Value))
Ops.set(result, "machine", machine) if machine != default_id
Expand Down Expand Up @@ -267,7 +270,8 @@ def JoinDomain(workgroup)
Ops.get(passwd, "password", ""),
Ops.get(passwd, "machine"),
relname,
relver
relver,
passwd["update_dns"]
)

if error != nil
Expand Down
5 changes: 3 additions & 2 deletions src/modules/Samba.rb
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,8 @@ def Write(write_only)
),
Ops.get(@password_data, "machine"),
relname,
relver
relver,
!!@password_data['update_dns']
)
end
end
Expand Down Expand Up @@ -959,7 +960,7 @@ def Import(settings)
Ops.get_string(settings, ["active_directory", "kdc"], "")
)
elsif key == "join"
@password_data = Ops.get_map(settings, "join", {})
@password_data = Ops.get_map(settings, "join", {'update_dns' => true})
elsif key == "mkhomedir"
SetMkHomeDir(Ops.get_boolean(settings, "mkhomedir", @mkhomedir))
elsif key == "disable_dhcp_hostname"
Expand Down
6 changes: 5 additions & 1 deletion src/modules/SambaNetJoin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ BEGIN{$TYPEINFO{Join}=[
"function","string","string","string","string","string","string", "string", "string"]}
sub Join {
my ($self, $domain, $join_level, $user, $passwd, $machine, $release_name,
$release_version) = @_;
$release_version, $update_dns) = @_;

my $netbios_name = SambaConfig->GlobalGetStr("netbios name", undef);
my $server = SambaAD->ADS ();
Expand Down Expand Up @@ -341,6 +341,10 @@ sub Join {
. " osVer='" . String->Quote ($release_version) . "'"
. " osName='" . String->Quote ($release_name) . "'";

if ($server ne "" && !$update_dns) {
$cmd .= " --no-dns-updates"
}

if ($machine) {
$machine =~ s/dc=([^,]*)//gi; # remove DC=* parts
$machine =~ s/([^,]*)=//gi; # leave only values from the rest
Expand Down