LCOV - code coverage report
Current view: top level - source3/rpc_server/spoolss - iremotewinspool_util.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 0 7 0.0 %
Date: 2024-04-21 15:09:00 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             : 
       4             :    Copyright (C) Guenther Deschner 2016
       5             : 
       6             :    This program is free software; you can redistribute it and/or modify
       7             :    it under the terms of the GNU General Public License as published by
       8             :    the Free Software Foundation; either version 3 of the License, or
       9             :    (at your option) any later version.
      10             : 
      11             :    This program is distributed in the hope that it will be useful,
      12             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             :    GNU General Public License for more details.
      15             : 
      16             :    You should have received a copy of the GNU General Public License
      17             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      18             : */
      19             : 
      20             : #include "includes.h"
      21             : #include "librpc/gen_ndr/ndr_winspool.h"
      22             : #include "librpc/gen_ndr/ndr_spoolss.h"
      23             : #include "rpc_server/spoolss/iremotewinspool_util.h"
      24             : 
      25             : #define _PAR_MAPPING(NAME)      { .iremotewinspool_opcode = NDR_WINSPOOL_ASYNC ##NAME, .spoolss_opcode = NDR_SPOOLSS_ ##NAME }
      26             : #define _PAR_MAPPING_EX(NAME)   { .iremotewinspool_opcode = NDR_WINSPOOL_ASYNC ##NAME, .spoolss_opcode = NDR_SPOOLSS_ ##NAME## EX }
      27             : #define _PAR_MAPPING_2(NAME)    { .iremotewinspool_opcode = NDR_WINSPOOL_ASYNC ##NAME, .spoolss_opcode = NDR_SPOOLSS_ ##NAME## 2 }
      28             : 
      29             : struct {
      30             :         int iremotewinspool_opcode;
      31             :         int spoolss_opcode;
      32             : } proxy_table[] = {
      33             : 
      34             :         /* 3.1.4.1. Printer Management Methods */
      35             : 
      36             :         _PAR_MAPPING_EX(OPENPRINTER),
      37             :         _PAR_MAPPING_EX(ADDPRINTER),
      38             :         _PAR_MAPPING(DELETEPRINTER),
      39             :         _PAR_MAPPING(SETPRINTER),
      40             :         _PAR_MAPPING(GETPRINTER),
      41             :         _PAR_MAPPING(GETPRINTERDATA),
      42             :         _PAR_MAPPING(GETPRINTERDATAEX),
      43             :         _PAR_MAPPING(SETPRINTERDATA),
      44             :         _PAR_MAPPING(SETPRINTERDATAEX),
      45             :         _PAR_MAPPING(CLOSEPRINTER),
      46             :         _PAR_MAPPING(ENUMPRINTERDATA),
      47             :         _PAR_MAPPING(ENUMPRINTERDATAEX),
      48             :         _PAR_MAPPING(ENUMPRINTERKEY),
      49             :         _PAR_MAPPING(DELETEPRINTERDATA),
      50             :         _PAR_MAPPING(DELETEPRINTERDATAEX),
      51             :         _PAR_MAPPING(DELETEPRINTERKEY),
      52             :         _PAR_MAPPING(SENDRECVBIDIDATA),
      53             :         _PAR_MAPPING(CREATEPRINTERIC),
      54             :         _PAR_MAPPING(PLAYGDISCRIPTONPRINTERIC),
      55             :         _PAR_MAPPING(DELETEPRINTERIC),
      56             :         _PAR_MAPPING(ENUMPRINTERS),
      57             :         _PAR_MAPPING(ADDPERMACHINECONNECTION),
      58             :         _PAR_MAPPING(DELETEPERMACHINECONNECTION),
      59             :         _PAR_MAPPING(ENUMPERMACHINECONNECTIONS),
      60             :         _PAR_MAPPING(RESETPRINTER),
      61             : 
      62             :         /* 3.1.4.2. Printer Driver Management Methods */
      63             : 
      64             :         _PAR_MAPPING_2(GETPRINTERDRIVER),
      65             :         _PAR_MAPPING_EX(ADDPRINTERDRIVER),
      66             :         _PAR_MAPPING(ENUMPRINTERDRIVERS),
      67             :         _PAR_MAPPING(GETPRINTERDRIVERDIRECTORY),
      68             :         _PAR_MAPPING(DELETEPRINTERDRIVER),
      69             :         _PAR_MAPPING(DELETEPRINTERDRIVEREX),
      70             :         /* No mapping for: RpcAsyncInstallPrinterDriverFromPackage */
      71             :         /* No mapping for: RpcAsyncUploadPrinterDriverPackage */
      72             :         _PAR_MAPPING(GETCOREPRINTERDRIVERS),
      73             :         /* No mapping for: RpcAsyncCorePrinterDriverInstalled */
      74             :         _PAR_MAPPING(GETPRINTERDRIVERPACKAGEPATH),
      75             :         /* No mapping for: RpcAsyncDeletePrinterDriverPackage */
      76             : 
      77             :         /* 3.1.4.3. Printer Port Management Methods */
      78             : 
      79             :         _PAR_MAPPING(XCVDATA),
      80             :         _PAR_MAPPING(ENUMPORTS),
      81             :         _PAR_MAPPING_EX(ADDPORT),
      82             :         _PAR_MAPPING(SETPORT),
      83             : 
      84             :         /* 3.1.4.4. Printer Processor Management Methods */
      85             : 
      86             :         _PAR_MAPPING(ADDPRINTPROCESSOR),
      87             :         _PAR_MAPPING(ENUMPRINTPROCESSORS),
      88             :         _PAR_MAPPING(GETPRINTPROCESSORDIRECTORY),
      89             :         _PAR_MAPPING(DELETEPRINTPROCESSOR),
      90             :         _PAR_MAPPING(ENUMPRINTPROCESSORDATATYPES),
      91             : 
      92             :         /* 3.1.4.5. Port Monitor Management Methods */
      93             : 
      94             :         _PAR_MAPPING(ENUMMONITORS),
      95             :         _PAR_MAPPING(ADDMONITOR),
      96             :         _PAR_MAPPING(DELETEMONITOR),
      97             : 
      98             :         /* 3.1.4.6. Form Management Methods */
      99             : 
     100             :         _PAR_MAPPING(ADDFORM),
     101             :         _PAR_MAPPING(DELETEFORM),
     102             :         _PAR_MAPPING(GETFORM),
     103             :         _PAR_MAPPING(SETFORM),
     104             :         _PAR_MAPPING(ENUMFORMS),
     105             : 
     106             :         /* 3.1.4.7. Job Management Methods */
     107             : 
     108             :         _PAR_MAPPING(SETJOB),
     109             :         _PAR_MAPPING(GETJOB),
     110             :         _PAR_MAPPING(ENUMJOBS),
     111             :         _PAR_MAPPING(ADDJOB),
     112             :         _PAR_MAPPING(SCHEDULEJOB),
     113             : 
     114             :         /* 3.1.4.8. Job Printing Methods */
     115             : 
     116             :         _PAR_MAPPING(STARTDOCPRINTER),
     117             :         _PAR_MAPPING(STARTPAGEPRINTER),
     118             :         _PAR_MAPPING(WRITEPRINTER),
     119             :         _PAR_MAPPING(ENDPAGEPRINTER),
     120             :         _PAR_MAPPING(ENDDOCPRINTER),
     121             :         _PAR_MAPPING(ABORTPRINTER),
     122             :         _PAR_MAPPING(READPRINTER),
     123             : 
     124             :         /* 3.1.4.9. Printing Related Notification Methods */
     125             : 
     126             :         /* No mapping for: RpcSyncRegisterForRemoteNotifications */
     127             :         /* No mapping for: RpcSyncUnRegisterForRemoteNotifications */
     128             :         /* No mapping for: RpcSyncRefreshRemoteNotifications */
     129             :         /* No mapping for: RpcAsyncGetRemoteNotifications */
     130             : 
     131             :         /* 3.1.4.10. Job Named Property Management Methods */
     132             : 
     133             :         _PAR_MAPPING(GETJOBNAMEDPROPERTYVALUE),
     134             :         _PAR_MAPPING(SETJOBNAMEDPROPERTY),
     135             :         _PAR_MAPPING(DELETEJOBNAMEDPROPERTY),
     136             :         _PAR_MAPPING(ENUMJOBNAMEDPROPERTIES),
     137             : 
     138             :         /* 3.1.4.11. Branch Office Remote Logging Methods */
     139             : 
     140             :         _PAR_MAPPING(LOGJOBINFOFORBRANCHOFFICE),
     141             : };
     142             : 
     143           0 : bool iremotewinspool_map_opcode(uint16_t opcode,
     144             :                                 uint16_t *proxy_opcode)
     145             : {
     146           0 :         int i;
     147             : 
     148           0 :         for (i = 0; i <ARRAY_SIZE(proxy_table); i++) {
     149           0 :                 if (proxy_table[i].iremotewinspool_opcode == opcode) {
     150           0 :                         *proxy_opcode = proxy_table[i].spoolss_opcode;
     151           0 :                         return true;
     152             :                 }
     153             :         }
     154             : 
     155           0 :         return false;
     156             : }

Generated by: LCOV version 1.14