[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Oct 13 03:20:02 UTC 2023


The branch, master has been updated
       via  afb335664c9 s4-torture: add another test to demonstrate identical functions
       via  e05c83408f7 s3-iremotewinspool: check for correct object_uuid in dispatch fn.
       via  e6b07d42538 s4-torture: add testcase to iremotewinspool suite to explore object_uuid handling
       via  e7a4c86878a s3-iremotewinspool: properly map incoming PAR to RPRN requests.
       via  7f3f6530d45 s3-iremotewinspool: add PAR->RPRN mapping table
       via  240b082dc4b s4:rpc_server: Check return values of gnutls functions (CID 1452111)
       via  ca2a97b729d s4:rpc_server: Check mkdir() return value (CID 1034649)
       via  c2daa3564a1 s4:ntvfs: Correctly acknowledge PVFS_FLAG_STRICT_SYNC flag (CID 241154)
       via  bea908cf604 s4:ntvfs: Remove dead code path
       via  4bb18ece5bf s4:ntvfs: Remove unneeded NULL check (CID 240771)
       via  c65411eab58 s4:messaging: Remove redundant code
       via  61534dd22d9 s4:libcli: Check return value of convert_string_talloc() (CID 1272839)
       via  077a7e41341 s4:libcli: Remove unnecessary casts
       via  244440d1578 s4:dsdb: Don’t overwrite existing error code (CID 1445263)
       via  b60604b1379 s4:dsdb: Log correct ldb error
       via  ea561fea6fb s4:dsdb: Replace early ‘continue’ with ‘if’ statement (CID 1414738)
       via  d4042e880f6 s4:dsdb: Check return value of ldb_msg_add_empty() (CID 1272827)
       via  b098eb82bf4 s4:dsdb: Fix unreachable code (CID 1435967)
       via  4cf9f43e431 s4:dsdb: Remove unreachable code (CID 1034686)
       via  7e8c38604ab s4:dsdb: Check return code (CID 1444824/1444844)
       via  61037a85bf8 s4:dsdb: Permit forward link to be missing in linked_attributes_fix_forward_link()
       via  d0db0ff268b s4:dsdb: Check whether ‘p’ is NULL before dereferencing it (CID 240875)
       via  1ad4dd92882 s4:dns_server: Check return value of ldb_transaction_commit() (CID 1034631)
       via  d3b1aa6359d s4:dns_server: Merge similar code paths
       via  fa68f26167e s4:auth: Remove event context on failure
       via  79a9a07c799 s4:auth: Fix resource leak (CID 1107222)
       via  ac00851fc9f s3:utils: Check return value of cli_RNetServiceEnum() (CID 1273313)
       via  59e16873210 s3:utils: Avoid integer overflow (CID 1035488)
       via  7eaad46f8c3 smb2_server: Check status codes (CID 1474441)
       via  7774ca87e7d smb2_server: Remove unreachable code (CID 1444981)
       via  68fb12cb797 Revert "smbd: Fix CID 1504457 Resource leak"
       via  dbf96126cb2 s3:smbd: Avoid integer overflow (CID 1035487)
       via  1e4d4e6abd3 s3:rpcclient: Do not pass uninitialized pointer to printf() (CID 1476170)
       via  67b2dc725da s3:nmbd: Remove redundant code (CID 1414756)
       via  c30aa741ee9 s3:modules: Initialize mask_permset (CID 1435850)
       via  86b0755a4b7 s3:modules: Remove unreachable code (CID 1508998)
       via  d53483a5405 s3:libsmb: Fix array traversal (CID 1034683)
       via  0c2d2f833eb s3:libnet: Remove always‐false comparison (CID 241309)
       via  728177088cc Revert "s3:libads: Don’t do first loop iteration if ‘attr’ is NULL"
       via  7eb47179b57 s3:lib: Rearrange preprocessor directives to avoid structurally dead code (CID 242032)
       via  3179fc2a703 s3:client: Correctly call setgroups() (CID 1449449)
       via  b28a268b459 smbXcli: Remove unreachable code (CID 1444978)
       via  86f8cde6b34 lib:util: Remove always‐false comparison (CID 242193)
       via  700754b0961 util: Remove redundant assertion (CID 1497841)
       via  757cd49b844 tdb: Do not pass non–null‐terminated strings to strcmp() (CID 1449485)
       via  8f4aa3508c0 lib:replace: Properly check result of write() and read() (CID 1034925)
       via  fe86989fcc1 lib:printer_driver: Check return value of gp_inifile_enum_section() (CID 1444835)
       via  03ca8c25d09 lib:compression: Correctly fix sign extension of long matches (CID 1517275)
      from  a2d96f5e291 s4:kdc: Always regard device info when checking a server authentication policy

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


- Log -----------------------------------------------------------------
commit afb335664c9f01f3a3b6f98712b31e4289d58aaf
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 28 22:01:36 2023 +0200

    s4-torture: add another test to demonstrate identical functions
    
    Create a spoolss_EnumPrinters request and send it to both endpoints and
    verify they deliver identical replies.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Fri Oct 13 03:19:59 UTC 2023 on atb-devel-224

commit e05c83408f7e39c5359865394b629579abbeb4b4
Author: Günther Deschner <gd at samba.org>
Date:   Mon Sep 25 20:31:24 2023 +0200

    s3-iremotewinspool: check for correct object_uuid in dispatch fn.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e6b07d42538b0d03f1c97dbdcdc3e8eb8e65b1c7
Author: Günther Deschner <gd at samba.org>
Date:   Mon Sep 25 20:28:52 2023 +0200

    s4-torture: add testcase to iremotewinspool suite to explore object_uuid handling
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit e7a4c86878ac5968dba73d9156366754b1a7e791
Author: Günther Deschner <gd at samba.org>
Date:   Sat Sep 23 00:29:51 2023 +0200

    s3-iremotewinspool: properly map incoming PAR to RPRN requests.
    
    Map the incoming iremotewinspool opnum to match the appropriate call in
    the spoolss server in the pull path.
    
    There is no 1:1 mapping in the opnums between the procols, only in the
    corresponding functions.
    
    Without doing the mapping we currently forward
    e.g. winspool_AsyncOpenPrinter() to spoolss_EnumPrinters() leading to
    all sorts of errors.
    
    A correct mapping was in place earlier with an handsorted server call
    table but it got removed with the rpc server rewrite.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7f3f6530d456ab73df91fbb44191f93f3d88dbbf
Author: Günther Deschner <gd at samba.org>
Date:   Thu Aug 25 11:37:36 2016 +0200

    s3-iremotewinspool: add PAR->RPRN mapping table
    
    There is no 1:1 mapping between the opcodes but between the functions
    (including _Ex and _2 naming extensions):
    
    e.g.
    winspool_AsyncOpenPrinter  (0x00) -> spoolss_OpenPrinterEx (0x45)
    winspool_AsyncClosePrinter (0x14) -> spoolss_ClosePrinter  (0x1d)
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 240b082dc4bd2d62ad5eaeea8811ec9cb51e0b69
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 14:24:51 2023 +1300

    s4:rpc_server: Check return values of gnutls functions (CID 1452111)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ca2a97b729d005d9be4e1c04da6b3f65bd7b0693
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 11:10:25 2023 +1300

    s4:rpc_server: Check mkdir() return value (CID 1034649)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c2daa3564a16aa97fae13ed48a0e1c00f035cdb6
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 16:00:46 2023 +1300

    s4:ntvfs: Correctly acknowledge PVFS_FLAG_STRICT_SYNC flag (CID 241154)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit bea908cf604b60a3501527a7fdb9ed221f451556
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 10:10:16 2023 +1300

    s4:ntvfs: Remove dead code path
    
    ‘pending’ will never be NULL.
    
    View with ‘git show -b’.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4bb18ece5bfdc8bf88bf8358c5e94a9d866e18cc
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 10:07:14 2023 +1300

    s4:ntvfs: Remove unneeded NULL check (CID 240771)
    
    We’ve already dereferenced ‘pending’ in the init‐clause of the loop, and
    won’t reassign it during the loop.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c65411eab5802971e5ac28ac30167eb419066881
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 12:03:40 2023 +1300

    s4:messaging: Remove redundant code
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 61534dd22d91dd9d47453c82371016bf45ecb4e1
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 14:10:09 2023 +1300

    s4:libcli: Check return value of convert_string_talloc() (CID 1272839)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 077a7e4134142ce9e4d3c3a2e6d9e5d81b4f758d
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Aug 9 16:55:15 2023 +1200

    s4:libcli: Remove unnecessary casts
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 244440d1578ca0f0486f970b319aa5e7ddf1b06b
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:43:41 2023 +1300

    s4:dsdb: Don’t overwrite existing error code (CID 1445263)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b60604b1379af4c60bd516cbc371651a40f88c91
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:43:13 2023 +1300

    s4:dsdb: Log correct ldb error
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ea561fea6fbaa0876cd1f43f2197afc809e76c20
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 14:33:16 2023 +1300

    s4:dsdb: Replace early ‘continue’ with ‘if’ statement (CID 1414738)
    
    A ‘continue’ statement creates the misleading impression that this loop
    executes more than once.
    
    This also avoids ‘mem_ctx’ being leaked.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d4042e880f62bc7e3f40576a0763073f8464bc2b
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 14:07:41 2023 +1300

    s4:dsdb: Check return value of ldb_msg_add_empty() (CID 1272827)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b098eb82bf4c91aa8a7599cad4b0b6f65e843692
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 12:45:55 2023 +1300

    s4:dsdb: Fix unreachable code (CID 1435967)
    
    Commit ede668e8e24c86f0836dfa5740e76d8aca1e0824 removed this condition
    for some unexplained reason, causing the following code to become
    unreachable.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4cf9f43e4313f178fdfb6c38b067e70127e6fcfa
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 11:05:49 2023 +1300

    s4:dsdb: Remove unreachable code (CID 1034686)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7e8c38604abb7c5e9285d691727373feddd7c48a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 10:37:32 2023 +1300

    s4:dsdb: Check return code (CID 1444824/1444844)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 61037a85bf8bf953fc83d258e61e11d561b498db
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Oct 9 11:55:10 2023 +1300

    s4:dsdb: Permit forward link to be missing in linked_attributes_fix_forward_link()
    
    We don’t care if a forward link is missing from an object being renamed
    during the deletion process.
    
    Nothing yet checks the value returned from this function, so there
    should be no change in behaviour.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d0db0ff268bf7f7abcdc705088e1b5c04796d671
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 10:27:45 2023 +1300

    s4:dsdb: Check whether ‘p’ is NULL before dereferencing it (CID 240875)
    
    Commit 6baf7608dfc3517cb3798fc53db849f49c6d157a added a NULL check in
    one place, but not everywhere ‘p’ was dereferenced.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1ad4dd92882b5e299b02d981386c6ec9d60ee5cb
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 11:16:37 2023 +1300

    s4:dns_server: Check return value of ldb_transaction_commit() (CID 1034631)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d3b1aa6359deaa6e2f97f7e435024c1fe548fe58
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 11:15:38 2023 +1300

    s4:dns_server: Merge similar code paths
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fa68f26167edc0227c9ede59308a266b1e621268
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 11:04:06 2023 +1300

    s4:auth: Remove event context on failure
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 79a9a07c799beb31034e302f09b9463768995e46
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 11:03:52 2023 +1300

    s4:auth: Fix resource leak (CID 1107222)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ac00851fc9fd3f5375f15002fbe0793623d1b06e
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:31:47 2023 +1300

    s3:utils: Check return value of cli_RNetServiceEnum() (CID 1273313)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 59e16873210a5ac504b7cd9cde7de10903e96ec2
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:23:05 2023 +1300

    s3:utils: Avoid integer overflow (CID 1035488)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7eaad46f8c34498eb2d59c985f202a9cf92b1a73
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:46:34 2023 +1300

    smb2_server: Check status codes (CID 1474441)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7774ca87e7d0e6a11419ddbba70a77e8e03276c9
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 12:49:32 2023 +1300

    smb2_server: Remove unreachable code (CID 1444981)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 68fb12cb79751c4fce59ea981e7e36daa2023662
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 11:55:46 2023 +1300

    Revert "smbd: Fix CID 1504457 Resource leak"
    
    We cannot free ‘enc’ — it may be a copy of ‘buffer’, in which parameter
    both construct_reply_chain() and smb_request_done() pass arrays of
    automatic storage duration!
    
    Fixes CID 1505354.
    
    This reverts commit a395f752f0748751d4ade533c41066903f26c2dd.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit dbf96126cb232d265a555eda38425d74f9b5e677
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:20:35 2023 +1300

    s3:smbd: Avoid integer overflow (CID 1035487)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1e4d4e6abd3ce42d62b9a760d2b2ddc297e8d574
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:07:24 2023 +1300

    s3:rpcclient: Do not pass uninitialized pointer to printf() (CID 1476170)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 67b2dc725da4757446ffc704a991943daa80a50d
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:38:29 2023 +1300

    s3:nmbd: Remove redundant code (CID 1414756)
    
    ‘buf’ is reassigned a few lines down.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c30aa741ee9fd1ba26bacf4fad98c004897ac3e5
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 14:58:34 2023 +1300

    s3:modules: Initialize mask_permset (CID 1435850)
    
    If this code had ever run, sys_acl_clear_perms() would have attempted to
    write to some random address in memory. ‘mask_permset’ must be a valid
    non‐NULL pointer.
    
    Commit 9b79d5f2a2f8af75ef13bdc41d2dc296e19ba098 seems to have been a
    previous attempt to fix this issue.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 86b0755a4b791e368010ce4a72add5dfa2a5f13d
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 12:54:48 2023 +1300

    s3:modules: Remove unreachable code (CID 1508998)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d53483a54058b13ebc3c3cb86ec5dd226453cb82
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 12:20:37 2023 +1300

    s3:libsmb: Fix array traversal (CID 1034683)
    
    Commit 033185e2a1b2892fe8dc74a18a38e5e13e08cb22 changed the sentinel
    value to an empty character array, but failed to update the traversal
    code to match.
    
    Commit 48a453996ac161d7c7a7cb15a047e57cbdbb1e87 then tried to fix the
    situation, but did not do so correctly.
    
    Fix this code by forgetting about sentinel values altogether.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0c2d2f833eb4c32b55db8f3b66bfd2ab2a38dd59
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:25:13 2023 +1300

    s3:libnet: Remove always‐false comparison (CID 241309)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 728177088cc9117fe4de99ad4c592fae44b43a88
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 11:18:10 2023 +1300

    Revert "s3:libads: Don’t do first loop iteration if ‘attr’ is NULL"
    
    Fixes CID 1547073: Control flow issues (DEADCODE).
    
    This reverts commit 184a48d65772f359bd81f83256daada8c9e500b3.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 7eb47179b5784a7783090ab39e7ca908e2cfa2ff
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 13:59:59 2023 +1300

    s3:lib: Rearrange preprocessor directives to avoid structurally dead code (CID 242032)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3179fc2a7032b8869109ebc6c6f771688aa8fbbc
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 13:25:16 2023 +1300

    s3:client: Correctly call setgroups() (CID 1449449)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b28a268b459eb101f8e815e04f550461ec17b4f5
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 12:48:40 2023 +1300

    smbXcli: Remove unreachable code (CID 1444978)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 86f8cde6b34e4f56286ed3c4984ed4ebe74d5914
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:27:18 2023 +1300

    lib:util: Remove always‐false comparison (CID 242193)
    
    ‘id’ is an unsigned variable, and so it can never be less than zero.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 700754b0961a8bc11d31df17e5d1d8ee62bd9b9b
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 13:12:05 2023 +1300

    util: Remove redundant assertion (CID 1497841)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 757cd49b8445f22c2c19380e948e7aba5a76399a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 13:54:02 2023 +1300

    tdb: Do not pass non–null‐terminated strings to strcmp() (CID 1449485)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8f4aa3508c0423a98dd2e75edb2f0afa1921fb28
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 13:49:43 2023 +1300

    lib:replace: Properly check result of write() and read() (CID 1034925)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fe86989fcc184ffa55d9fe227cd9410928816100
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:40:23 2023 +1300

    lib:printer_driver: Check return value of gp_inifile_enum_section() (CID 1444835)
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 03ca8c25d09c1d6bae914c2f64d0c1e96b2b272c
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Fri Oct 6 15:18:41 2023 +1300

    lib:compression: Correctly fix sign extension of long matches (CID 1517275)
    
    Commit 6b4d94c9877ec59081b9da946c00fa2647cad928 was a previous attempt
    to fix this issue.
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 lib/compression/lzxpress_huffman.c                 |   2 +-
 lib/printer_driver/printer_driver.c                |   3 +
 lib/replace/tests/testsuite.c                      |   4 +-
 lib/tdb/common/open.c                              |   8 +-
 lib/util/idtree.c                                  |   2 +-
 lib/util/util.c                                    |   2 +-
 libcli/smb/smbXcli_base.c                          |   7 -
 source3/client/smbspool_krb5_wrapper.c             |   2 +-
 source3/lib/smbldap.c                              |   3 +-
 source3/libads/ldap.c                              |   4 -
 source3/libnet/libnet_dssync_keytab.c              |   2 +-
 source3/libsmb/libsmb_xattr.c                      |  10 +-
 source3/modules/vfs_fake_acls.c                    |   3 +-
 source3/modules/vfs_preopen.c                      |   6 -
 source3/nmbd/nmbd_incomingrequests.c               |   2 -
 source3/rpc_server/spoolss/iremotewinspool_util.c  | 156 ++++++++++++++
 .../rpc_server/spoolss/iremotewinspool_util.h      |   5 +-
 source3/rpc_server/spoolss/srv_iremotewinspool.c   |  26 +++
 source3/rpc_server/wscript_build                   |   1 +
 source3/rpcclient/cmd_spoolss.c                    |   4 +-
 source3/smbd/scavenger.c                           |   2 +-
 source3/smbd/smb1_process.c                        |   5 +-
 source3/smbd/smb2_server.c                         |   8 +-
 source3/utils/net_rap.c                            |   4 +
 source3/utils/net_serverid.c                       |   2 +-
 source4/auth/kerberos/kerberos_util.c              |   5 +
 source4/dns_server/dns_update.c                    |  21 +-
 source4/dsdb/samdb/ldb_modules/dirsync.c           |   2 -
 source4/dsdb/samdb/ldb_modules/extended_dn_out.c   |   4 +-
 source4/dsdb/samdb/ldb_modules/linked_attributes.c |  18 +-
 source4/dsdb/samdb/ldb_modules/partition.c         |   6 +-
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c    |   5 +-
 source4/dsdb/schema/schema_convert_to_ol.c         |  10 +-
 source4/lib/messaging/messaging.c                  |   3 -
 source4/libcli/ldap/ldap_controls.c                |  37 ++--
 source4/ntvfs/posix/pvfs_lock.c                    |  33 ++-
 source4/ntvfs/posix/pvfs_open.c                    |   9 +-
 source4/rpc_server/backupkey/dcesrv_backupkey.c    |  29 ++-
 source4/rpc_server/service_rpc.c                   |   7 +-
 source4/torture/rpc/iremotewinspool.c              | 237 ++++++++++++++++++++-
 source4/torture/rpc/iremotewinspool_common.c       |  36 +++-
 source4/torture/rpc/iremotewinspool_common.h       |  11 +-
 42 files changed, 597 insertions(+), 149 deletions(-)
 create mode 100644 source3/rpc_server/spoolss/iremotewinspool_util.c
 copy librpc/ndr/ndr_cab.h => source3/rpc_server/spoolss/iremotewinspool_util.h (86%)


Changeset truncated at 500 lines:

diff --git a/lib/compression/lzxpress_huffman.c b/lib/compression/lzxpress_huffman.c
index c5da4af0d85..e14419cd96b 100644
--- a/lib/compression/lzxpress_huffman.c
+++ b/lib/compression/lzxpress_huffman.c
@@ -1049,7 +1049,7 @@ static ssize_t write_compressed_bytes(uint16_t symbol_values[512],
 			}
 
 			len = intermediate[i + 1];
-			len |= intermediate[i + 2] << 16U;
+			len |= (uint32_t)intermediate[i + 2] << 16;
 			distance = intermediate[i + 3];
 			i += 3;
 		} else if (c == 0xffff) {
diff --git a/lib/printer_driver/printer_driver.c b/lib/printer_driver/printer_driver.c
index e41f665aacd..2d07df37adc 100644
--- a/lib/printer_driver/printer_driver.c
+++ b/lib/printer_driver/printer_driver.c
@@ -387,6 +387,9 @@ static NTSTATUS enum_devices_in_toc(struct gp_inifile_context *ctx,
 			status = gp_inifile_enum_section(ctx, decorated_models_section_name,
 							 &num_devices, &devices,
 							 &device_values);
+			if (!NT_STATUS_IS_OK(status)) {
+				return status;
+			}
 			for (d = 0; d < num_devices; d++) {
 
 				DEBUG(11,("processing device: %s\n",
diff --git a/lib/replace/tests/testsuite.c b/lib/replace/tests/testsuite.c
index c0dcda55bd2..58624f11eb6 100644
--- a/lib/replace/tests/testsuite.c
+++ b/lib/replace/tests/testsuite.c
@@ -854,14 +854,14 @@ static int test_socketpair(void)
 		return false;
 	}
 
-	if (write(sock[1], "automatisch", 12) == -1) {
+	if (write(sock[1], "automatisch", 12) != 12) {
 		printf("failure: socketpair [\n"
 			   "write() failed: %s\n"
 			   "]\n", strerror(errno));
 		return false;
 	}
 
-	if (read(sock[0], buf, 12) == -1) {
+	if (read(sock[0], buf, 12) != 12) {
 		printf("failure: socketpair [\n"
 			   "read() failed: %s\n"
 			   "]\n", strerror(errno));
diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c
index 10233591dad..3fa7ce1389d 100644
--- a/lib/tdb/common/open.c
+++ b/lib/tdb/common/open.c
@@ -513,7 +513,13 @@ _PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int td
 
 	errno = 0;
 	if (read(tdb->fd, &header, sizeof(header)) != sizeof(header)
-	    || strcmp(header.magic_food, TDB_MAGIC_FOOD) != 0) {
+	    /*
+	     * Call strncmp() rather than strcmp() in case header.magic_food is
+	     * not zero‐terminated. We’re still checking the full string for
+	     * equality, as tdb_header::magic_food is larger than
+	     * TDB_MAGIC_FOOD.
+	     */
+	    || strncmp(header.magic_food, TDB_MAGIC_FOOD, sizeof(header.magic_food)) != 0) {
 		if (!(open_flags & O_CREAT) ||
 		    tdb_new_database(tdb, &header, hash_size) == -1) {
 			if (errno == 0) {
diff --git a/lib/util/idtree.c b/lib/util/idtree.c
index d72ddfbc538..7f08b42947d 100644
--- a/lib/util/idtree.c
+++ b/lib/util/idtree.c
@@ -150,7 +150,7 @@ restart:
 			sh = IDR_BITS*l;
 			id = ((id >> sh) ^ n ^ m) << sh;
 		}
-		if ((id >= MAX_ID_BIT) || (id < 0))
+		if (id >= MAX_ID_BIT)
 			return -1;
 		if (l == 0)
 			break;
diff --git a/lib/util/util.c b/lib/util/util.c
index 9d935d5f192..5f9310ec1c9 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -498,7 +498,7 @@ static void dump_data_block16(const char *prefix, size_t idx,
 	char tmp[16];
 	size_t i;
 
-	SMB_ASSERT(len >= 0 && len <= 16);
+	SMB_ASSERT(len <= 16);
 
 	snprintf(tmp, sizeof(tmp), "%s[%04zX]", prefix, idx);
 	cb(tmp, private_data);
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index d3a70cce85f..a3079fc41e9 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -5447,13 +5447,6 @@ static void smbXcli_negprot_smb2_done(struct tevent_req *subreq)
 		}
 	}
 
-	if (rc < 0) {
-		gnutls_hash_deinit(hash_hnd, NULL);
-		tevent_req_nterror(req,
-				   gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED));
-		return;
-	}
-
 	/* This resets the hash state */
 	gnutls_hash_output(hash_hnd, conn->smb2.preauth_sha512);
 	TALLOC_FREE(subreq);
diff --git a/source3/client/smbspool_krb5_wrapper.c b/source3/client/smbspool_krb5_wrapper.c
index 9abd1c6b868..34553d616e6 100644
--- a/source3/client/smbspool_krb5_wrapper.c
+++ b/source3/client/smbspool_krb5_wrapper.c
@@ -267,7 +267,7 @@ int main(int argc, char *argv[])
 
 	CUPS_SMB_DEBUG("Adding group 'lp' (%u)", g->gr_gid);
 	groups[0] = g->gr_gid;
-	rc = setgroups(sizeof(groups), groups);
+	rc = setgroups(ARRAY_SIZE(groups), groups);
 	if (rc != 0) {
 		CUPS_SMB_ERROR("Failed to set groups for 'lp' - %s",
 			       strerror(errno));
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index e1e01f76ea4..a95036e2f87 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -670,7 +670,6 @@ static int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri)
 				ldap_err2string(rc)));
 	}
 
-	return LDAP_SUCCESS;
 #else
 
 	/* Parse the string manually */
@@ -719,7 +718,6 @@ static int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri)
 #endif /* LDAP_OPT_X_TLS */
 		}
 	}
-#endif /* HAVE_LDAP_INITIALIZE */
 
 	/* now set connection timeout */
 #ifdef LDAP_X_OPT_CONNECT_TIMEOUT /* Netscape */
@@ -744,6 +742,7 @@ static int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri)
 	}
 #endif
 
+#endif /* HAVE_LDAP_INITIALIZE */
 	return LDAP_SUCCESS;
 }
 
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 740bc6bb434..509196834ae 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -3176,10 +3176,6 @@ int ads_count_replies(ADS_STRUCT *ads, void *res)
 	for (attr = ldap_first_attribute(ads->ldap.ld, (LDAPMessage *)msg, &ptr);
 	     attr;
 	     attr = ldap_next_attribute(ads->ldap.ld, (LDAPMessage *)msg, ptr)) {
-		if (attr == NULL) {
-			break;
-		}
-
 		/* we ignore the fact that this is utf8, as all attributes are ascii... */
 		if (strnequal(attr, expected_range_attrib, strlen(expected_range_attrib))) {
 			range_attr = attr;
diff --git a/source3/libnet/libnet_dssync_keytab.c b/source3/libnet/libnet_dssync_keytab.c
index 289ffcb56b9..41893b4f7fd 100644
--- a/source3/libnet/libnet_dssync_keytab.c
+++ b/source3/libnet/libnet_dssync_keytab.c
@@ -502,7 +502,7 @@ static NTSTATUS parse_object(TALLOC_CTX *mem_ctx,
 		}
 	}
 
-	if ((kvno < 0) && (kvno < pwd_history_len)) {
+	if (kvno < pwd_history_len) {
 		return status;
 	}
 
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 77a215c1f54..3ccb063160a 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -267,11 +267,11 @@ parse_ace(struct cli_state *ipc_cli,
         unsigned int amask;
 	struct dom_sid sid;
 	uint32_t mask;
-	const struct perm_value *v;
         struct perm_value {
                 const char perm[7];
                 uint32_t mask;
         };
+	size_t i;
 	TALLOC_CTX *frame = talloc_stackframe();
 
         /* These values discovered by inspection */
@@ -282,14 +282,12 @@ parse_ace(struct cli_state *ipc_cli,
                 { "D", 0x00010000 },
                 { "P", 0x00040000 },
                 { "O", 0x00080000 },
-                { "", 0 },
         };
 
         static const struct perm_value standard_values[] = {
                 { "READ",   0x001200a9 },
                 { "CHANGE", 0x001301bf },
                 { "FULL",   0x001f01ff },
-                { "", 0 },
         };
 
 	ZERO_STRUCTP(ace);
@@ -350,7 +348,8 @@ parse_ace(struct cli_state *ipc_cli,
 		goto done;
 	}
 
-	for (v = standard_values; v != NULL; v++) {
+	for (i = 0; i < ARRAY_SIZE(standard_values); i++) {
+		const struct perm_value *v = &standard_values[i];
 		if (strcmp(tok, v->perm) == 0) {
 			amask = v->mask;
 			goto done;
@@ -362,7 +361,8 @@ parse_ace(struct cli_state *ipc_cli,
 	while(*p) {
 		bool found = False;
 
-		for (v = special_values; v != NULL; v++) {
+		for (i = 0; i < ARRAY_SIZE(special_values); i++) {
+			const struct perm_value *v = &special_values[i];
 			if (v->perm[0] == *p) {
 				amask |= v->mask;
 				found = True;
diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c
index 402ac593aae..fefe6c5483e 100644
--- a/source3/modules/vfs_fake_acls.c
+++ b/source3/modules/vfs_fake_acls.c
@@ -575,7 +575,8 @@ static int fake_acl_process_chmod(SMB_ACL_T *pp_the_acl,
 
 	if (!got_mask) {
 		SMB_ACL_ENTRY_T mask_entry;
-		SMB_ACL_PERMSET_T mask_permset;
+		uint32_t mask_perm = 0;
+		SMB_ACL_PERMSET_T mask_permset = &mask_perm;
 		ret = sys_acl_create_entry(&the_acl, &mask_entry);
 		if (ret == -1) {
 			return -1;
diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c
index 0810dcbc5b9..d1327f64e58 100644
--- a/source3/modules/vfs_preopen.c
+++ b/source3/modules/vfs_preopen.c
@@ -431,12 +431,6 @@ static bool preopen_parse_fname(const char *fname, uint64_t *pnum,
 		 * parsing the string into a number
 		 */
 
-		if (*pnum_digits < 1) {
-			/*
-			 * We need at least one digit
-			 */
-			return false;
-		}
 		if (*pnum_digits > PREOPEN_MAX_DIGITS) {
 			/*
 			 * a string with as much digits as
diff --git a/source3/nmbd/nmbd_incomingrequests.c b/source3/nmbd/nmbd_incomingrequests.c
index 6cace78799b..06c486d9811 100644
--- a/source3/nmbd/nmbd_incomingrequests.c
+++ b/source3/nmbd/nmbd_incomingrequests.c
@@ -369,8 +369,6 @@ subnet %s - name not found.\n", nmb_namestr(&nmb->question.question_name),
 				set_nb_flags( &buf[16],namerec->data.nb_flags );
 				buf[16] |= NB_ACTIVE; /* all our names are active */
 
-				buf += 18;
-
 				names_added++;
 			}
 		}
diff --git a/source3/rpc_server/spoolss/iremotewinspool_util.c b/source3/rpc_server/spoolss/iremotewinspool_util.c
new file mode 100644
index 00000000000..6b9c7260442
--- /dev/null
+++ b/source3/rpc_server/spoolss/iremotewinspool_util.c
@@ -0,0 +1,156 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Copyright (C) Guenther Deschner 2016
+
+   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/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_winspool.h"
+#include "librpc/gen_ndr/ndr_spoolss.h"
+#include "rpc_server/spoolss/iremotewinspool_util.h"
+
+#define _PAR_MAPPING(NAME)	{ .iremotewinspool_opcode = NDR_WINSPOOL_ASYNC ##NAME, .spoolss_opcode = NDR_SPOOLSS_ ##NAME }
+#define _PAR_MAPPING_EX(NAME)	{ .iremotewinspool_opcode = NDR_WINSPOOL_ASYNC ##NAME, .spoolss_opcode = NDR_SPOOLSS_ ##NAME## EX }
+#define _PAR_MAPPING_2(NAME)	{ .iremotewinspool_opcode = NDR_WINSPOOL_ASYNC ##NAME, .spoolss_opcode = NDR_SPOOLSS_ ##NAME## 2 }
+
+struct {
+	int iremotewinspool_opcode;
+	int spoolss_opcode;
+} proxy_table[] = {
+
+	/* 3.1.4.1. Printer Management Methods */
+
+	_PAR_MAPPING_EX(OPENPRINTER),
+	_PAR_MAPPING_EX(ADDPRINTER),
+	_PAR_MAPPING(DELETEPRINTER),
+	_PAR_MAPPING(SETPRINTER),
+	_PAR_MAPPING(GETPRINTER),
+	_PAR_MAPPING(GETPRINTERDATA),
+	_PAR_MAPPING(GETPRINTERDATAEX),
+	_PAR_MAPPING(SETPRINTERDATA),
+	_PAR_MAPPING(SETPRINTERDATAEX),
+	_PAR_MAPPING(CLOSEPRINTER),
+	_PAR_MAPPING(ENUMPRINTERDATA),
+	_PAR_MAPPING(ENUMPRINTERDATAEX),
+	_PAR_MAPPING(ENUMPRINTERKEY),
+	_PAR_MAPPING(DELETEPRINTERDATA),
+	_PAR_MAPPING(DELETEPRINTERDATAEX),
+	_PAR_MAPPING(DELETEPRINTERKEY),
+	_PAR_MAPPING(SENDRECVBIDIDATA),
+	_PAR_MAPPING(CREATEPRINTERIC),
+	_PAR_MAPPING(PLAYGDISCRIPTONPRINTERIC),
+	_PAR_MAPPING(DELETEPRINTERIC),
+	_PAR_MAPPING(ENUMPRINTERS),
+	_PAR_MAPPING(ADDPERMACHINECONNECTION),
+	_PAR_MAPPING(DELETEPERMACHINECONNECTION),
+	_PAR_MAPPING(ENUMPERMACHINECONNECTIONS),
+	_PAR_MAPPING(RESETPRINTER),
+
+	/* 3.1.4.2. Printer Driver Management Methods */
+
+	_PAR_MAPPING_2(GETPRINTERDRIVER),
+	_PAR_MAPPING_EX(ADDPRINTERDRIVER),
+	_PAR_MAPPING(ENUMPRINTERDRIVERS),
+	_PAR_MAPPING(GETPRINTERDRIVERDIRECTORY),
+	_PAR_MAPPING(DELETEPRINTERDRIVER),
+	_PAR_MAPPING(DELETEPRINTERDRIVEREX),
+	/* No mapping for: RpcAsyncInstallPrinterDriverFromPackage */
+	/* No mapping for: RpcAsyncUploadPrinterDriverPackage */
+	_PAR_MAPPING(GETCOREPRINTERDRIVERS),
+	/* No mapping for: RpcAsyncCorePrinterDriverInstalled */
+	_PAR_MAPPING(GETPRINTERDRIVERPACKAGEPATH),
+	/* No mapping for: RpcAsyncDeletePrinterDriverPackage */
+
+	/* 3.1.4.3. Printer Port Management Methods */
+
+	_PAR_MAPPING(XCVDATA),
+	_PAR_MAPPING(ENUMPORTS),
+	_PAR_MAPPING_EX(ADDPORT),
+	_PAR_MAPPING(SETPORT),
+
+	/* 3.1.4.4. Printer Processor Management Methods */
+
+	_PAR_MAPPING(ADDPRINTPROCESSOR),
+	_PAR_MAPPING(ENUMPRINTPROCESSORS),
+	_PAR_MAPPING(GETPRINTPROCESSORDIRECTORY),
+	_PAR_MAPPING(DELETEPRINTPROCESSOR),
+	_PAR_MAPPING(ENUMPRINTPROCESSORDATATYPES),
+
+	/* 3.1.4.5. Port Monitor Management Methods */
+
+	_PAR_MAPPING(ENUMMONITORS),
+	_PAR_MAPPING(ADDMONITOR),
+	_PAR_MAPPING(DELETEMONITOR),
+
+	/* 3.1.4.6. Form Management Methods */
+
+	_PAR_MAPPING(ADDFORM),
+	_PAR_MAPPING(DELETEFORM),
+	_PAR_MAPPING(GETFORM),
+	_PAR_MAPPING(SETFORM),
+	_PAR_MAPPING(ENUMFORMS),
+
+	/* 3.1.4.7. Job Management Methods */
+
+	_PAR_MAPPING(SETJOB),
+	_PAR_MAPPING(GETJOB),
+	_PAR_MAPPING(ENUMJOBS),
+	_PAR_MAPPING(ADDJOB),
+	_PAR_MAPPING(SCHEDULEJOB),
+
+	/* 3.1.4.8. Job Printing Methods */
+
+	_PAR_MAPPING(STARTDOCPRINTER),
+	_PAR_MAPPING(STARTPAGEPRINTER),
+	_PAR_MAPPING(WRITEPRINTER),
+	_PAR_MAPPING(ENDPAGEPRINTER),
+	_PAR_MAPPING(ENDDOCPRINTER),
+	_PAR_MAPPING(ABORTPRINTER),
+	_PAR_MAPPING(READPRINTER),
+
+	/* 3.1.4.9. Printing Related Notification Methods */
+
+	/* No mapping for: RpcSyncRegisterForRemoteNotifications */
+	/* No mapping for: RpcSyncUnRegisterForRemoteNotifications */
+	/* No mapping for: RpcSyncRefreshRemoteNotifications */
+	/* No mapping for: RpcAsyncGetRemoteNotifications */
+
+	/* 3.1.4.10. Job Named Property Management Methods */
+
+	_PAR_MAPPING(GETJOBNAMEDPROPERTYVALUE),
+	_PAR_MAPPING(SETJOBNAMEDPROPERTY),
+	_PAR_MAPPING(DELETEJOBNAMEDPROPERTY),
+	_PAR_MAPPING(ENUMJOBNAMEDPROPERTIES),
+
+	/* 3.1.4.11. Branch Office Remote Logging Methods */
+
+	_PAR_MAPPING(LOGJOBINFOFORBRANCHOFFICE),
+};
+
+bool iremotewinspool_map_opcode(uint16_t opcode,
+				uint16_t *proxy_opcode)
+{
+	int i;
+
+	for (i = 0; i <ARRAY_SIZE(proxy_table); i++) {
+		if (proxy_table[i].iremotewinspool_opcode == opcode) {
+			*proxy_opcode = proxy_table[i].spoolss_opcode;
+			return true;
+		}
+	}
+
+	return false;
+}
diff --git a/librpc/ndr/ndr_cab.h b/source3/rpc_server/spoolss/iremotewinspool_util.h
similarity index 86%
copy from librpc/ndr/ndr_cab.h
copy to source3/rpc_server/spoolss/iremotewinspool_util.h
index 39b6bc9b483..e2de82ab1b0 100644
--- a/librpc/ndr/ndr_cab.h
+++ b/source3/rpc_server/spoolss/iremotewinspool_util.h
@@ -1,8 +1,6 @@
 /*
    Unix SMB/CIFS implementation.
 
-   routines for marshalling/unmarshalling cab structures
-
    Copyright (C) Guenther Deschner 2016
 
    This program is free software; you can redistribute it and/or modify
@@ -19,4 +17,5 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-uint32_t ndr_count_cfdata(const struct cab_file *r);
+bool iremotewinspool_map_opcode(uint16_t opcode,
+				uint16_t *proxy_opcode);
diff --git a/source3/rpc_server/spoolss/srv_iremotewinspool.c b/source3/rpc_server/spoolss/srv_iremotewinspool.c
index 2fc7e74d546..5bc4228f83f 100644
--- a/source3/rpc_server/spoolss/srv_iremotewinspool.c
+++ b/source3/rpc_server/spoolss/srv_iremotewinspool.c
@@ -12,6 +12,7 @@
 #include "librpc/gen_ndr/ndr_spoolss_scompat.h"
 #include "rpc_server/rpc_config.h"
 #include "rpc_server/rpc_server.h"
+#include "rpc_server/spoolss/iremotewinspool_util.h"
 
 static bool forward_opnum_to_spoolss(uint16_t opnum) {
 	switch (opnum) {
@@ -53,10 +54,16 @@ NTSTATUS iremotewinspool__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC
 {
 	enum ndr_err_code ndr_err;
 	uint16_t opnum = dce_call->pkt.u.request.opnum;
+	uint16_t mapped_opnum;
 
 	dce_call->fault_code = 0;
 
 	if (forward_opnum_to_spoolss(opnum)) {
+		bool ok;
+		ok = iremotewinspool_map_opcode(opnum, &mapped_opnum);
+		if (ok) {
+			dce_call->pkt.u.request.opnum = mapped_opnum;
+		}
 		return spoolss__op_ndr_pull(dce_call, mem_ctx, pull, r);
 	}
 
@@ -84,6 +91,25 @@ static NTSTATUS iremotewinspool__op_dispatch_internal(struct dcesrv_call_state *
 	struct pipes_struct *p = NULL;
 	NTSTATUS status = NT_STATUS_OK;
 	bool impersonated = false;
+	bool ok;
+	struct GUID object_uuid;
+
+	ok = dce_call->pkt.pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID;
+	if (!ok) {
+		dce_call->fault_code = DCERPC_NCA_S_UNSUPPORTED_TYPE;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list