The branch, master has been updated
       via  867daf6... s3-selftest: finally enable RPC-SPOOLSS-PRINTER against 
Samba 3.
       via  34ad5da... s3-selftest: include addprinter/deleteprinter command.
      from  43e3d8f... s3-spoolss: fix return code of spoolss_DeletePrinter.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 867daf6e0a48b26286efdbc220a5572d6e0c92e2
Author: Günther Deschner <g...@samba.org>
Date:   Thu Feb 18 02:17:01 2010 +0100

    s3-selftest: finally enable RPC-SPOOLSS-PRINTER against Samba 3.
    
    Guenther

commit 34ad5da5cd5b891c2aa18d06cbb1023e8b5c5ddc
Author: Günther Deschner <g...@samba.org>
Date:   Thu Feb 18 00:48:58 2010 +0100

    s3-selftest: include addprinter/deleteprinter command.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 selftest/target/Samba3.pm                   |    5 +
 source3/script/tests/printing/modprinter.pl |  128 +++++++++++++++++++++++++++
 source3/script/tests/selftest.sh            |    3 +
 source3/script/tests/test_posix_s3.sh       |    3 +-
 4 files changed, 138 insertions(+), 1 deletions(-)
 create mode 100755 source3/script/tests/printing/modprinter.pl


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 0e16022..c3f696a 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -436,6 +436,8 @@ sub provision($$$$$$)
        my $nss_wrapper_passwd = "$privatedir/passwd";
        my $nss_wrapper_group = "$privatedir/group";
 
+       my $mod_printer_pl = "$ENV{PERL} 
$RealBin/../source3/script/tests/printing/modprinter.pl";
+
        open(CONF, ">$conffile") or die("Unable to open $conffile");
        print CONF "
 [global]
@@ -469,6 +471,9 @@ sub provision($$$$$$)
        delete group script =           $nss_wrapper_pl --group_path  
$nss_wrapper_group  --type group  --action delete --name %g
        delete user from group script = $nss_wrapper_pl --passwd_path 
$nss_wrapper_passwd --type member --action delete --member %u --name %g 
--group_path $nss_wrapper_group
 
+       addprinter command =            $mod_printer_pl -a -s $conffile --
+       deleteprinter command =         $mod_printer_pl -d -s $conffile --
+
        kernel oplocks = no
        kernel change notify = no
 
diff --git a/source3/script/tests/printing/modprinter.pl 
b/source3/script/tests/printing/modprinter.pl
new file mode 100755
index 0000000..4064841
--- /dev/null
+++ b/source3/script/tests/printing/modprinter.pl
@@ -0,0 +1,128 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Getopt::Long;
+use Cwd qw(abs_path);
+
+my $opt_help = 0;
+my $opt_smb_conf = undef;
+my $opt_add = 0;
+my $opt_delete = 0;
+
+my $result = GetOptions(
+       'help|h|?'      => \$opt_help,
+       'smb_conf|s=s'  => \$opt_smb_conf,
+       'add|a'         => \$opt_add,
+       'delete|d'      => \$opt_delete
+);
+
+sub usage($;$)
+{
+       my ($ret, $msg) = @_;
+
+       print $msg."\n\n" if defined($msg);
+
+       print "usage:
+
+       --help|-h|-?            Show this help.
+
+       --smb_conf|-s <path>    Path of the 'smb.conf' file.
+
+       --add|-a                'add' a printer.
+       --delete|-d             'delete' a printer.
+
+       printer_name share_name port_name driver_name location XX remote_machine
+";
+       exit($ret);
+}
+
+usage(1) if (not $result);
+
+usage(0) if ($opt_help);
+
+if (!$opt_add && !$opt_delete) {
+       usage(1, "invalid: neither --add|-a nor --delete|-d set");
+}
+
+if (!$opt_smb_conf) {
+       usage(1, "invalid: no smb.conf file set");
+}
+
+my @argv = @ARGV;
+
+my $printer_name = shift(@argv);
+my $share_name = shift(@argv);
+my $port_name = shift(@argv);
+my $driver_name = shift(@argv);
+my $location = shift(@argv);
+my $win9x_driver_location = shift(@argv);
+my $remote_machine = shift(@argv);
+
+if (!defined($share_name) || length($share_name) == 0) {
+       $share_name = $printer_name;
+}
+
+if (!defined($share_name)) {
+       die "share name not defined";
+}
+
+my $tmp = $opt_smb_conf.$$;
+
+my $section = undef;
+my $within_section = 0;
+my $found_section = 0;
+
+open(CONFIGFILE_NEW, "+>$tmp") || die "Unable top open conf file $tmp";
+
+open (CONFIGFILE, "+<$opt_smb_conf") || die "Unable to open config file 
$opt_smb_conf";
+while (<CONFIGFILE>) {
+       my $line = $_;
+       chomp($_);
+       $_ =~ s/^\s*//;
+       $_ =~ s/\s*$//;
+       if (($_ =~ /^#/) || ($_ =~ /^;/)) {
+               print CONFIGFILE_NEW $line;
+               next;
+       }
+       if ($_ =~ /^\[.*\]$/) {
+               $_ = substr($_, 1, length($_)-2);
+               if (length($_)) {
+                       $section = $_;
+               } else {
+                       die "invalid section found";
+               }
+               if ($section eq $share_name) {
+                       $found_section = 1;
+                       if ($opt_add) {
+                               die("share $share_name already exists\n");
+                       }
+                       if ($opt_delete) {
+                               $within_section = 1;
+                               next;
+                       }
+               } else {
+                       print CONFIGFILE_NEW $line;
+                       $within_section = 0;
+               }
+               next;
+       } else {
+               if ($within_section == 1) {
+                       next;
+               }
+               print CONFIGFILE_NEW $line;
+       }
+}
+if ($opt_add) {
+       print CONFIGFILE_NEW "[$share_name]\n\tprintable = yes\n\tpath = 
/tmp\n";
+}
+close (CONFIGFILE);
+close (CONFIGFILE_NEW);
+
+if ($opt_delete && ($found_section == 0)) {
+       die "share $share_name not found";
+}
+system("cp", "$tmp", "$opt_smb_conf");
+unlink $tmp;
+
+exit 0;
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index b9c11b8..e6e3c29 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -236,6 +236,9 @@ cat >$SERVERCONFFILE<<EOF
        delete group script =           $PERL 
$SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --group_path  $NSS_WRAPPER_GROUP  
--type group  --action delete --name %g
        delete user from group script = $PERL 
$SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --group_path  $NSS_WRAPPER_GROUP  
--type member --action delete --name %g --member %u --passwd_path 
$NSS_WRAPPER_PASSWD
 
+       addprinter command =            $PERL 
$SRCDIR/../source3/script/tests/printing/modprinter.pl -a -s $SERVERCONFFILE --
+       deleteprinter command =         $PERL 
$SRCDIR/../source3/script/tests/printing/modprinter.pl -d -s $SERVERCONFFILE --
+
        kernel oplocks = no
        kernel change notify = no
 
diff --git a/source3/script/tests/test_posix_s3.sh 
b/source3/script/tests/test_posix_s3.sh
index 0725548..8099617 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -41,7 +41,8 @@ rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-SAMBA3-SRVSVC 
RPC-SAMBA3-SHARESEC"
 rpc="$rpc RPC-SAMBA3-SPOOLSS RPC-SAMBA3-WKSSVC RPC-SAMBA3-WINREG"
 rpc="$rpc RPC-SAMBA3-GETALIASMEMBERSHIP-0"
 rpc="$rpc RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME"
-rpc="$rpc RPC-SVCCTL RPC-SPOOLSS RPC-SPOOLSS-WIN RPC-SPOOLSS-NOTIFY RPC-NTSVCS"
+rpc="$rpc RPC-SVCCTL RPC-NTSVCS"
+rpc="$rpc RPC-SPOOLSS RPC-SPOOLSS-WIN RPC-SPOOLSS-NOTIFY RPC-SPOOLSS-PRINTER"
 rpc="$rpc RPC-LSA-GETUSER RPC-LSA-LOOKUPSIDS RPC-LSA-LOOKUPNAMES"
 rpc="$rpc RPC-LSA-PRIVILEGES "
 rpc="$rpc RPC-SAMR RPC-SAMR-USERS RPC-SAMR-USERS-PRIVILEGES RPC-SAMR-PASSWORDS"


-- 
Samba Shared Repository

Reply via email to