summaryrefslogtreecommitdiff
path: root/examples/scripts
diff options
context:
space:
mode:
authorGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:34:30 -0500
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:34:30 -0500
commite5a951325a6cac8567af3a66de6d2df577508ae4 (patch)
tree34da9fe59f3c2d7f8edb072144443a9704197831 /examples/scripts
parent57482469b32645250e92a7ffd003aeeb4a42235e (diff)
downloadsamba-e5a951325a6cac8567af3a66de6d2df577508ae4.tar.gz
[GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
(This used to be commit 5c6c8e1fe93f340005110a7833946191659d88ab)
Diffstat (limited to 'examples/scripts')
-rwxr-xr-xexamples/scripts/users_and_groups/adduserstogroups.pl166
-rwxr-xr-xexamples/scripts/users_and_groups/createdomobj.pl157
2 files changed, 0 insertions, 323 deletions
diff --git a/examples/scripts/users_and_groups/adduserstogroups.pl b/examples/scripts/users_and_groups/adduserstogroups.pl
deleted file mode 100755
index 17ca5bd8420..00000000000
--- a/examples/scripts/users_and_groups/adduserstogroups.pl
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/usr/bin/perl
-
-#
-# adduserstogroups.pl
-#
-# add single or continuously numbered domain users
-# to a given single group or list of groups
-#
-# Copyright (C) Michael Adam <obnox@samba.org> 2007
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, see <http://www.gnu.org/licenses/>.
-#
-
-#
-# WARNING: This script is still rather crude.
-#
-
-use strict;
-use Getopt::Std;
-
-my $net_cmd = "net";
-
-# defaults:
-
-my $server;
-my $num_members = 1;
-my $startmem; # if empty, don't add numbers to member prefix
-my $member_prefix; # name prefix for member
-my $num_groups = 1;
-my $startgroup; # if empty, don't add numbers to group prefix
-my $group_prefix; # name prefix for group
-my $path; # path to rpcclient command
-my $net_path = $net_cmd;
-my $creds;
-
-sub usage {
- print "USAGE: $0 [-h] -S server -U user\%pass \\\n"
- . "\t-m member [-s startmem] [-n nummem] \\\n"
- . "\t-g group [-G stargroup] [-N numgroups] \\\n"
- . "\t[-P path]\n";
-}
-
-# parse commandline:
-
-my %options = ();
-getopts("U:S:m:s:n:g:G:N:P:h", \%options);
-
-if (exists($options{h})) {
- usage();
- exit 0;
-}
-
-if (exists($options{g})) {
- $group_prefix = $options{g};
-}
-else {
- print "ERROR: mandatory argument '-g' missing\n";
- usage();
- exit 1;
-}
-
-if (exists($options{U})) {
- $creds = "-U $options{U}";
- if ($creds !~ '%') {
- print "ERROR: you need to specify credentials in the form -U user\%pass\n";
- usage();
- exit 1;
- }
-}
-else {
- print "ERROR: mandatory argument '-U' missing\n";
- usage();
- exit 1;
-}
-
-if (exists($options{S})) {
- $server = $options{S};
-}
-else {
- print "ERROR: madatory argument '-S' missing\n";
- usage();
- exit 1;
-}
-
-if (exists($options{s})) {
- $startmem = $options{s};
-}
-
-if (exists($options{n})) {
- $num_members = $options{n};
-}
-
-if (exists($options{m})) {
- $member_prefix = $options{m};
-}
-else {
- print "ERROR: mandatory argument '-m' missing\n";
- usage();
- exit 1;
-}
-
-if (exists($options{G})) {
- $startgroup = $options{G};
-}
-
-if (exists($options{N})) {
- $num_groups = $options{N};
-}
-
-if (exists($options{P})) {
- $path = $options{p};
- $net_path = "$path/$net_cmd";
-}
-
-if (@ARGV) {
- print "ERROR: junk on the command line ('" . join(" ", @ARGV) . "')...\n";
- usage();
- exit 1;
-}
-
-# utility functions:
-
-sub do_add {
- my $member_name = shift;
- my $group_name = shift;
- print "adding member $member_name to group $group_name\n";
- system("$net_path rpc -I $server ".$creds." group addmem $group_name $member_name");
-}
-
-sub add_group_loop {
- my $member_name = shift;
-
- if ("x$startgroup" eq "x") {
- do_add($member_name, $group_prefix);
- }
- else {
- for (my $groupnum = 1; $groupnum <= $num_groups; ++$groupnum) {
- do_add($member_name,
- sprintf("%s%.05d", $group_prefix, $startgroup + $groupnum - 1));
- }
- }
-}
-
-
-# main:
-
-if ("x$startmem" eq "x") {
- add_group_loop($member_prefix);
-}
-else {
- for (my $memnum = 1; $memnum <= $num_members; ++$memnum) {
- add_group_loop(sprintf("%s%.05d", $member_prefix, $startmem + $memnum - 1));
- }
-}
-
diff --git a/examples/scripts/users_and_groups/createdomobj.pl b/examples/scripts/users_and_groups/createdomobj.pl
deleted file mode 100755
index 60f34b84f23..00000000000
--- a/examples/scripts/users_and_groups/createdomobj.pl
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/usr/bin/perl
-
-#
-# createdomobj.pl
-#
-# create single or continuously numbered domain
-# users/groups/aliases via rpc
-#
-# Copyright (C) Michael Adam <obnox@samba.org> 2007
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, see <http://www.gnu.org/licenses/>.
-#
-
-#
-# WARNING: This script is still rather crude.
-#
-
-use strict;
-use Getopt::Std;
-
-
-my $target_type = "group"; # what type of object to create
-my $rpc_cmd = "createdom".$target_type;
-my $rpccli_cmd = "rpcclient";
-
-# defaults:
-
-my $server;
-my $num_targets = 1;
-my $startnum; # if empty, don't add numbers to prefix
-my $prefix = $target_type; # name-prefix
-my $path; # path to rpcclient command
-my $rpccli_path = $rpccli_cmd;
-my $creds;
-
-sub usage {
- print "USAGE: $0 [-h] -S server -U user\%pass [-p prefix] \\\n"
- . "\t[-t {alias|group|user}] [-s startnum] [-n numobjs] [-P path] \n";
-}
-
-# parse commandline:
-
-my %options = ();
-getopts("U:t:S:s:n:p:P:h", \%options);
-
-if (exists($options{h})) {
- usage();
- exit 0;
-}
-
-if (exists($options{t})) {
- $target_type = $options{t};
- if ($target_type !~ /^(alias|user|group)$/) {
- print "ERROR: invalid target type given\n";
- usage();
- exit 1;
- }
- $rpc_cmd = "createdom".$target_type;
-}
-
-if (exists($options{U})) {
- $creds = "-U $options{U}";
- if ($creds !~ '%') {
- print "ERROR: you need to specify credentials in the form -U user\%pass\n";
- usage();
- exit 1;
- }
-}
-else {
- print "ERROR: mandatory argument '-U' missing\n";
- usage();
- exit 1;
-}
-
-if (exists($options{S})) {
- $server = $options{S};
-}
-else {
- print "ERROR: madatory argument '-S' missing\n";
- usage();
- exit 1;
-}
-
-if (exists($options{s})) {
- $startnum = $options{s};
-}
-
-if (exists($options{n})) {
- $num_targets = $options{n};
-}
-
-if (exists($options{p})) {
- $prefix = $options{p};
-}
-
-if (exists($options{P})) {
- $path = $options{p};
- $rpccli_path = "$path/$rpccli_cmd";
-}
-
-if (@ARGV) {
- print "ERROR: junk on the command line ('" . join(" ", @ARGV) . "')...\n";
- usage();
- exit 1;
-}
-
-# utility functions:
-
-sub open_rpc_pipe {
- print "opening rpc pipe\n";
- open(IPC, "| $rpccli_cmd $server $creds -d0") or
- die "error opening rpc pipe.";
-}
-
-sub close_rpc_pipe {
- print "closing rpc pipe\n";
- close(IPC);
-}
-
-sub do_create {
- my $target_name = shift;
- print "creating $target_type $target_name\n";
- print IPC "$rpc_cmd $target_name\n";
-}
-
-# main:
-
-open_rpc_pipe();
-
-if ("x$startnum" eq "x") {
- do_create($prefix);
-}
-else {
- for (my $num = 1; $num <= $num_targets; ++$num) {
- do_create(sprintf "%s%.05d", $prefix, $startnum + $num - 1);
- if (($num) % 500 == 0) {
- printf("500 ".$target_type."s created\n");
- close_rpc_pipe();
- sleep 2;
- open_rpc_pipe();
- }
- }
-}
-
-close_rpc_pipe();
-