diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-02-20 14:59:42 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-02-20 07:09:19 +0100 |
commit | 2f4b21bb57c4f96c5f5b57a69d022c142d8088d5 (patch) | |
tree | ccc1865699e47eaf9702953ae9a59f746fe4afa2 /examples/misc | |
parent | 3c9c3029f2bcf10ef614dd9f923d02232db3ac8d (diff) | |
download | samba-2f4b21bb57c4f96c5f5b57a69d022c142d8088d5.tar.gz samba-2f4b21bb57c4f96c5f5b57a69d022c142d8088d5.tar.bz2 samba-2f4b21bb57c4f96c5f5b57a69d022c142d8088d5.zip |
ntdb: switch between secrets.tdb and secrets.ntdb depending on 'use ntdb'
Since we open with dbwrap, it auto-converts old tdbs (which it will
rename to secrets.tdb.bak once it's done).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Wed Feb 20 07:09:19 CET 2013 on sn-devel-104
Diffstat (limited to 'examples/misc')
-rwxr-xr-x | examples/misc/adssearch.pl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/examples/misc/adssearch.pl b/examples/misc/adssearch.pl index 13a85bede9..02c4464abb 100755 --- a/examples/misc/adssearch.pl +++ b/examples/misc/adssearch.pl @@ -42,11 +42,13 @@ my $rebind_url; my $tdbdump = "/usr/bin/tdbdump"; +my $ntdbdump = "/usr/bin/ntdbdump"; my $testparm = "/usr/bin/testparm"; my $net = "/usr/bin/net"; my $dig = "/usr/bin/dig"; my $nmblookup = "/usr/bin/nmblookup"; my $secrets_tdb = "/etc/samba/secrets.tdb"; +my $secrets_ntdb = "/etc/samba/secrets.ntdb"; my $klist = "/usr/bin/klist"; my $kinit = "/usr/bin/kinit"; my $workgroup = ""; @@ -723,13 +725,21 @@ sub get_machine_password { my $workgroup = shift || ""; $workgroup = uc($workgroup); - my ($found, $tmp); - -x $tdbdump || die "tdbdump is not installed. cannot proceed autodetection\n"; - -r $secrets_tdb || die "cannot read $secrets_tdb. cannot proceed autodetection\n"; + my ($found, $tmp, $dbdump, $db); + if (-r $secrets_ntdb) { + -x $ntdbdump || die "ntdbdump is not installed. cannot proceed autodetection\n"; + $dbdump = $ntdbdump; + $db = $secrets_ntdb; + } else { + -x $tdbdump || die "tdbdump is not installed. cannot proceed autodetection\n"; + -r $secrets_tdb || die "cannot read $secrets_tdb. cannot proceed autodetection\n"; + $dbdump = $tdbdump; + $db = $secrets_tdb; + } # get machine-password my $key = sprintf("SECRETS/MACHINE_PASSWORD/%s", $workgroup); - open(SECRETS,"$tdbdump $secrets_tdb |"); + open(SECRETS,"$dbdump $db |"); while(my $line = <SECRETS>) { chomp($line); if ($found) { |