diff options
| -rwxr-xr-x | source4/setup/dcpromo.pl | 225 | ||||
| -rwxr-xr-x | source4/setup/rootdse.pl | 152 | 
2 files changed, 0 insertions, 377 deletions
| diff --git a/source4/setup/dcpromo.pl b/source4/setup/dcpromo.pl deleted file mode 100755 index 56461ae825..0000000000 --- a/source4/setup/dcpromo.pl +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/perl -w - -################################################### -# package to generate samba ads configuration -# Copyright metze@samba.org 2004 - -# released under the GNU GPL - -use strict; -use Data::Dumper; - -sub print_options($$) { -	my $ads = shift; -	my $ctx = shift; -	my @arr; -	my $i; -	my $len; - -	print "options:\n"; - -	@arr = @{$ctx}; -	$len = $#arr; -	for($i = 0; $i <= $len; $i++) { -		my $val = $ctx->[$i]; -		print "\t".$i.": ".$val->{TEXT}."\n"; -	} - -	print "choise []:"; -} - -sub read_option($$) { -	my $ads = shift; -	my $ctx = shift; -	my $val; - -	$val = <STDIN>; - -	return $val; -} - -sub call_option($$$) { -	my $ads = shift; -	my $ctx = shift; -	my $switch = shift; -	my $val; -	my $funcref; - -	$val = $ctx->[$switch]; - -	$funcref = $val->{ACTION}; - -	&$funcref($ads); -} - -sub ask_option($$) { -	my $ads = shift; -	my $ctx = shift; -	my $ret; - -	print_options($ads, $ctx); - -	$ret = read_option($ads, $ctx); - -	call_option($ads, $ctx, $ret); -} - -sub create_ads_tree($) { -	my $ads = shift; - -	print "Create ADS Domain:\n"; -	print Dumper($ads); -} - -sub do_new_domain_in_entire_structure($) { -	my $ads; -	my $domain_dns; -	my $domain_netbios; - -	$ads->{NEW_DOMAIN} = 1; -	$ads->{NEW_FOREST} = 1; - -	print "full dns name of the new domain []:";	 -	$domain_dns = <STDIN>; -	chomp $domain_dns; -	$ads->{FULL_DNS_NAME} = $domain_dns; - -	print "netbios name of the new domain []:";	 -	$domain_netbios = <STDIN>; -	chomp $domain_netbios; -	$ads->{NETBIOS} = $domain_netbios; - -	create_ads_tree($ads); -} - -sub do_sub_domain_in_existing_structure($) { -	my $ads = shift; -	my $user_name; -	my $user_domain; -	my $user_password; -	my $top_dns; -	my $domain_dns; -	my $domain_netbios; -	my $db_folder; -	my $db_logs; -	my $sysvol_folder; -	my $admin_password1; -	my $admin_password2; - -	$ads->{NEW_DOMAIN} = 1; -	$ads->{NEW_FOREST} = 0; - -	print "User Name []:"; -	$user_name = <STDIN>; -	chomp $user_name; -	$ads->{USER}{NAME} = $user_name; - -	print "User Domain []:"; -	$user_domain = <STDIN>; -	chomp $user_domain; -	$ads->{USER}{DOMAIN} = $user_domain; - -	print "User Password []:"; -	$user_password = <STDIN>; -	chomp $user_password; -	$ads->{USER}{PASSWORD} = $user_password; - -	print "full dns name of the top domain []:";	 -	$top_dns = <STDIN>; -	chomp $top_dns; -	$ads->{TOP_DNS_NAME} = $top_dns; - -	print "suffix of the new domain []:"; -	$domain_dns = <STDIN>; -	chomp $domain_dns; -	$ads->{FULL_DNS_NAME} = $domain_dns.".".$top_dns; - -	print "netbios name of the new domain []:"; -	$domain_netbios = <STDIN>; -	chomp $domain_netbios; -	$ads->{NETBIOS} = $domain_netbios; - -	print "folder for database files []:"; -	$db_folder = <STDIN>; -	chomp $db_folder; -	$ads->{DB_FOLDER} = $db_folder; - -	print "folder for database logs []:"; -	$db_logs = <STDIN>; -	chomp $db_logs; -	$ads->{DB_LOGS} = $db_logs; - -	print "folder for SYSVOL []:"; -	$sysvol_folder = <STDIN>; -	chomp $sysvol_folder; -	$ads->{SYSVOL_FOLDER} = $sysvol_folder; - -	# -	# test DNS here -	# - -	# -	# test mixed/native here -	# - -	print "Administrator password []:"; -	$admin_password1 = <STDIN>; -	chomp $admin_password1; -	print "retype Administrator password []:"; -	$admin_password2 = <STDIN>; -	chomp $admin_password2; -	if ($admin_password1 eq $admin_password2) { -		$ads->{ADMIN_PASSWORD} = $admin_password1; -	} else { -		$ads->{ADMIN_PASSWORD} = ""; -	} - -	create_ads_tree($ads); -} - -sub do_sub_structure_in_global_structure($) { -	print "go on with do_sub_structure_in_global_structure\n"; -} - -sub do_new_domain($) { -	my $ads = shift; -	my $ctx; -	 -	$ctx->[0]{TEXT}		= "new domain in entire structure"; -	$ctx->[0]{ACTION}	= \&do_new_domain_in_entire_structure; - -	$ctx->[1]{TEXT}		= "sub domain in existing structure"; -	$ctx->[1]{ACTION}	= \&do_sub_domain_in_existing_structure; - -	$ctx->[2]{TEXT}		= "sub structure in global structure"; -	$ctx->[2]{ACTION}	= \&do_sub_structure_in_global_structure; - -	ask_option($ads ,$ctx); -} - -sub do_existing_domain($) { -	print "go on with do existing domain\n"; -} - -sub ask_new_or_exist_domain($) { -	my $ads = shift; -	my $ctx; -	 -	$ctx->[0]{TEXT}		= "new domain"; -	$ctx->[0]{ACTION}	= \&do_new_domain; - -	$ctx->[1]{TEXT}		= "existing domain"; -	$ctx->[1]{ACTION}	= \&do_existing_domain; - -	ask_option($ads, $ctx); -} - -sub main { -	my $ads; - -	$ads->{ADS_TREE} = 1; - -	ask_new_or_exist_domain($ads); -} - -main(); diff --git a/source4/setup/rootdse.pl b/source4/setup/rootdse.pl deleted file mode 100755 index 799019fad8..0000000000 --- a/source4/setup/rootdse.pl +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use Getopt::Long; - -my $opt_hostname = `hostname`; -chomp $opt_hostname; -my $netbiosname; -my $opt_realm; -my $opt_domain; -my $dnsdomain; -my $dnsname; -my $basedn; - -sub ldaptime() -{ -	my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) =  gmtime(time); -	return sprintf "%04u%02u%02u%02u%02u%02u.0Z", -	$year+1900, $mon+1, $mday, $hour, $min, $sec; -} - -####################### -# substitute a single variable -sub substitute($) -{ -	my $var = shift; - -	if ($var eq "BASEDN") { -		return $basedn; -	} - -	if ($var eq "NETBIOSNAME") { -		return $netbiosname; -	} - -	if ($var eq "DNSNAME") { -		return $dnsname; -	} - -	if ($var eq "DNSDOMAIN") { -		return $dnsdomain; -	} - -	die "ERROR: Uknown substitution variable $var\n"; -} - -##################################################################### -# write a string into a file -sub FileSave($$) -{ -    my($filename) = shift; -    my($v) = shift; -    local(*FILE); -    open(FILE, ">$filename") || die "can't open $filename";     -    print FILE $v; -    close(FILE); -} - -##################################################################### -# read a file into a string -sub FileLoad($) -{ -    my($filename) = shift; -    local(*INPUTFILE); -    open(INPUTFILE, $filename) || return undef; -    my($saved_delim) = $/; -    undef $/; -    my($data) = <INPUTFILE>; -    close(INPUTFILE); -    $/ = $saved_delim; -    return $data; -} - -############################################ -# show some help -sub ShowHelp() -{ -	print " -Samba4 provisioning - -rootdse.pl [options] -  --realm       REALM        set realm -  --domain      DOMAIN       set domain -  --hostname    HOSTNAME     set hostname - -You must provide at least a realm and domain - -"; -	exit(1); -} - -my $opt_help; - -GetOptions( -	    'help|h|?' => \$opt_help,  -	    'realm=s' => \$opt_realm, -	    'domain=s' => \$opt_domain, -	    'hostname=s' => \$opt_hostname, -	    ); - -if ($opt_help ||  -    !$opt_realm || -    !$opt_domain || -    !$opt_hostname) { -	ShowHelp(); -} - -$opt_realm=uc($opt_realm); -$opt_domain=uc($opt_domain); -$opt_hostname=lc($opt_hostname); -$netbiosname=uc($opt_hostname); - -print "Provisioning host '$opt_hostname' with netbios name '$netbiosname' for domain '$opt_domain' in realm '$opt_realm'\n"; - -print "generating ldif ...\n"; - -$dnsdomain = lc($opt_realm); -$dnsname = $opt_hostname.".".$dnsdomain; -$basedn = "DC=" . join(",DC=", split(/\./, $opt_realm)); - -my $data = FileLoad("rootdse.ldif") || die "Unable to load rootdse.ldif\n"; - -my $res = ""; - -print "applying substitutions ...\n"; - -while ($data =~ /(.*?)\$\{(\w*)\}(.*)/s) { -	my $sub = substitute($2); -	$res .= "$1$sub"; -	$data = $3; -} -$res .= $data; - -print "saving ldif to newrootdse.ldif ...\n"; - -FileSave("newrootdse.ldif", $res); - -unlink("newrootdse.ldb"); - -print "creating newrootdse.ldb ...\n"; - -# allow provisioning to be run from the source directory -$ENV{"PATH"} .= ":bin:../bin"; - -system("ldbadd -H newrootdse.ldb newrootdse.ldif"); - -print "done - -Please move newrootdse.ldb to rootdse.ldb in the private/ directory of your -Samba4 installation -"; - | 
