The branch, v3-6-test has been updated
       via  b9064cb s3-spoolss: allow a short printername w/o servername.
       via  8a82225 s3-selftest: rename printer "print4" to "lp".
       via  8a5647e s4-smbtorture: add spoolss_OpenPrinter with unc and 
printername in RPC-SPOOLSS-PRINTSERVER.
      from  1125b29 s4-smbtorture: fix winreg querymultiplevalues NDR test 
warning.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit b9064cbe861e8e726403d2ed976b34fa246ad8ad
Author: Günther Deschner <g...@samba.org>
Date:   Thu Sep 2 13:19:02 2010 +0200

    s3-spoolss: allow a short printername w/o servername.
    
    Verified with RPC-SPOOLSS-PRINTSERVER-enumprinters_old test.
    
    Guenther
    (cherry picked from commit 26ea51c7ab59f54f0b88f1367a0982404b9be18b)

commit 8a82225464b8b4c841709057036c069f9adc8f46
Author: Günther Deschner <g...@samba.org>
Date:   Thu Sep 2 13:39:12 2010 +0200

    s3-selftest: rename printer "print4" to "lp".
    
    This should trigger a false error condition in our code.
    
    Guenther
    (cherry picked from commit 9962462278e250f4ad2aa068bb6afb8015270e81)

commit 8a5647e9de1d25c9ff0866e9d836e68fe9338898
Author: Günther Deschner <g...@samba.org>
Date:   Fri Sep 10 00:16:30 2010 +0200

    s4-smbtorture: add spoolss_OpenPrinter with unc and printername in 
RPC-SPOOLSS-PRINTSERVER.
    
    Guenther
    (cherry picked from commit cf76cf02995f6050fc71066366810b355d26d4b9)

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

Summary of changes:
 selftest/target/Samba3.pm           |    2 +-
 source3/rpc_server/srv_spoolss_nt.c |    7 +------
 source3/script/tests/selftest.sh    |    2 +-
 source4/torture/rpc/spoolss.c       |   22 ++++++++++++++++++----
 4 files changed, 21 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 3c64e8d..39057ec 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -584,7 +584,7 @@ sub provision($$$$$$)
        copy = print1
 [print3]
        copy = print1
-[print4]
+[lp]
        copy = print1
 [print\$]
        copy = tmp
diff --git a/source3/rpc_server/srv_spoolss_nt.c 
b/source3/rpc_server/srv_spoolss_nt.c
index 03b8a60..59c2e78 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -421,13 +421,8 @@ static bool set_printer_hnd_printertype(Printer_entry 
*Printer, const char *hand
 {
        DEBUG(3,("Setting printer type=%s\n", handlename));
 
-       if ( strlen(handlename) < 3 ) {
-               DEBUGADD(4,("A print server must have at least 1 char ! %s\n", 
handlename));
-               return false;
-       }
-
        /* it's a print server */
-       if (*handlename=='\\' && *(handlename+1)=='\\' && 
!strchr_m(handlename+2, '\\')) {
+       if (handlename && *handlename=='\\' && *(handlename+1)=='\\' && 
!strchr_m(handlename+2, '\\')) {
                DEBUGADD(4,("Printer is a print server\n"));
                Printer->printer_type = SPLHND_SERVER;
        }
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index 6a74a89..5059cea 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -369,7 +369,7 @@ cat >$SERVERCONFFILE<<EOF
        copy = print1
 [print3]
        copy = print1
-[print4]
+[lp]
        copy = print1
 [print$]
        copy = tmp
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index a444c84..25c410a 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -5645,7 +5645,8 @@ static bool test_OpenPrinter_badname_list(struct 
torture_context *tctx,
 static bool test_OpenPrinter(struct torture_context *tctx,
                             struct dcerpc_pipe *p,
                             const char *name,
-                            const char *environment)
+                            const char *environment,
+                            bool open_only)
 {
        NTSTATUS status;
        struct spoolss_OpenPrinter r;
@@ -5653,7 +5654,7 @@ static bool test_OpenPrinter(struct torture_context *tctx,
        bool ret = true;
        struct dcerpc_binding_handle *b = p->binding_handle;
 
-       r.in.printername        = talloc_asprintf(tctx, "\\\\%s\\%s", 
dcerpc_server_name(p), name);
+       r.in.printername        = name;
        r.in.datatype           = NULL;
        r.in.devmode_ctr.devmode= NULL;
        r.in.access_mask        = SEC_FLAG_MAXIMUM_ALLOWED;
@@ -5667,6 +5668,10 @@ static bool test_OpenPrinter(struct torture_context 
*tctx,
 
        torture_assert_werr_ok(tctx, r.out.result, "OpenPrinter failed");
 
+       if (open_only) {
+               goto close_printer;
+       }
+
        if (!test_GetPrinter(tctx, b, &handle, environment)) {
                ret = false;
        }
@@ -5677,6 +5682,7 @@ static bool test_OpenPrinter(struct torture_context *tctx,
                }
        }
 
+ close_printer:
        if (!test_ClosePrinter(tctx, b, &handle)) {
                ret = false;
        }
@@ -5965,7 +5971,7 @@ static bool test_EnumPrinters_old(struct torture_context 
*tctx,
                for (j=0;j<count;j++) {
                        if (r.in.level == 1) {
                                char *unc = talloc_strdup(tctx, 
info[j].info1.name);
-                               char *slash, *name;
+                               char *slash, *name, *full_name;
                                name = unc;
                                if (unc[0] == '\\' && unc[1] == '\\') {
                                        unc +=2;
@@ -5975,7 +5981,15 @@ static bool test_EnumPrinters_old(struct torture_context 
*tctx,
                                        slash++;
                                        name = slash;
                                }
-                               if (!test_OpenPrinter(tctx, p, name, 
ctx->environment)) {
+                               full_name = talloc_asprintf(tctx, "\\\\%s\\%s",
+                                                           
dcerpc_server_name(p), name);
+                               if (!test_OpenPrinter(tctx, p, name, 
ctx->environment, true)) {
+                                       ret = false;
+                               }
+                               if (!test_OpenPrinter(tctx, p, full_name, 
ctx->environment, true)) {
+                                       ret = false;
+                               }
+                               if (!test_OpenPrinter(tctx, p, name, 
ctx->environment, false)) {
                                        ret = false;
                                }
                                if (!test_OpenPrinterEx(tctx, p, name, 
ctx->environment)) {


-- 
Samba Shared Repository

Reply via email to