LCOV - code coverage report
Current view: top level - librpc/ndr - ndr_orpc.c (source / functions) Hit Total Coverage
Test: coverage report for master 2b515b7d Lines: 0 88 0.0 %
Date: 2024-02-28 12:06:22 Functions: 0 6 0.0 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             : 
       4             :    routines for marshalling/unmarshalling DCOM string arrays
       5             : 
       6             :    Copyright (C) Jelmer Vernooij 2004
       7             :    
       8             :    This program is free software; you can redistribute it and/or modify
       9             :    it under the terms of the GNU General Public License as published by
      10             :    the Free Software Foundation; either version 3 of the License, or
      11             :    (at your option) any later version.
      12             :    
      13             :    This program is distributed in the hope that it will be useful,
      14             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             :    GNU General Public License for more details.
      17             :    
      18             :    You should have received a copy of the GNU General Public License
      19             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      20             : */
      21             : 
      22             : 
      23             : #include "includes.h"
      24             : #include "librpc/gen_ndr/ndr_orpc.h"
      25             : 
      26           0 : enum ndr_err_code ndr_pull_DUALSTRINGARRAY(struct ndr_pull *ndr, ndr_flags_type ndr_flags, struct DUALSTRINGARRAY *ar)
      27             : {
      28           0 :         uint16_t num_entries, security_offset;
      29           0 :         uint16_t towerid;
      30           0 :         uint32_t towernum = 0, conformant_size;
      31             : 
      32           0 :         if (!(ndr_flags & NDR_SCALARS)) {
      33           0 :                 return NDR_ERR_SUCCESS;
      34             :         }
      35             : 
      36           0 :         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &conformant_size));
      37           0 :         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &num_entries));
      38           0 :         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &security_offset));
      39             : 
      40           0 :         ar->stringbindings = talloc_array(ndr, struct STRINGBINDING *, 1);
      41           0 :         ar->stringbindings[0] = NULL;
      42             : 
      43           0 :         do {
      44             :                 /* 'Peek' */
      45           0 :                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
      46             : 
      47           0 :                 if (towerid > 0) {
      48           0 :                         ndr->offset -= 2; 
      49           0 :                         ar->stringbindings = talloc_realloc(ndr, ar->stringbindings, struct STRINGBINDING *, towernum+2);
      50           0 :                         ar->stringbindings[towernum] = talloc(ndr, struct STRINGBINDING);
      51           0 :                         NDR_CHECK(ndr_pull_STRINGBINDING(ndr, ndr_flags, ar->stringbindings[towernum]));
      52           0 :                         towernum++;
      53             :                 }
      54           0 :         } while (towerid != 0);
      55             : 
      56           0 :         ar->stringbindings[towernum] = NULL;
      57           0 :         towernum = 0;
      58             : 
      59           0 :         ar->securitybindings = talloc_array(ndr, struct SECURITYBINDING *, 1);
      60           0 :         ar->securitybindings[0] = NULL;
      61             : 
      62           0 :         do {
      63             :                 /* 'Peek' */
      64           0 :                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
      65             : 
      66           0 :                 if (towerid > 0) {
      67           0 :                         ndr->offset -= 2; 
      68           0 :                         ar->securitybindings = talloc_realloc(ndr, ar->securitybindings, struct SECURITYBINDING *, towernum+2);
      69           0 :                         ar->securitybindings[towernum] = talloc(ndr, struct SECURITYBINDING);
      70           0 :                         NDR_CHECK(ndr_pull_SECURITYBINDING(ndr, ndr_flags, ar->securitybindings[towernum]));
      71           0 :                         towernum++;
      72             :                 }
      73           0 :         } while (towerid != 0);
      74             :         
      75           0 :         ar->securitybindings[towernum] = NULL;
      76             :         
      77           0 :         return NDR_ERR_SUCCESS;
      78             : }
      79             : 
      80           0 : enum ndr_err_code ndr_push_DUALSTRINGARRAY(struct ndr_push *ndr, ndr_flags_type ndr_flags, const struct DUALSTRINGARRAY *ar)
      81             : {
      82           0 :         return ndr_push_error(ndr, NDR_ERR_STRING, "ndr_push_DUALSTRINGARRAY not implemented");
      83             : }
      84             : 
      85             : /*
      86             :   print a dom_sid
      87             : */
      88           0 : void ndr_print_DUALSTRINGARRAY(struct ndr_print *ndr, const char *name, const struct DUALSTRINGARRAY *ar)
      89             : {
      90           0 :         int i;
      91           0 :         ndr->print(ndr, "%-25s: DUALSTRINGARRAY", name);
      92           0 :         ndr->depth++;
      93           0 :         ndr->print(ndr, "STRING BINDINGS");
      94           0 :         ndr->depth++;
      95           0 :         for (i=0;ar->stringbindings[i];i++)  {
      96           0 :                 char idx[13];   /* 2^32 has 10 digits */
      97           0 :                 snprintf(idx, sizeof(idx), "[%d]", i);
      98           0 :                 ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
      99             :         }
     100           0 :         ndr->depth--;
     101           0 :         ndr->print(ndr, "SECURITY BINDINGS");
     102           0 :         ndr->depth++;
     103           0 :         for (i=0;ar->securitybindings[i];i++)        {
     104           0 :                 char idx[13];   /* 2^32 has 10 digits */
     105           0 :                 snprintf(idx, sizeof(idx), "[%d]", i);
     106           0 :                 ndr_print_SECURITYBINDING(ndr, idx, ar->securitybindings[i]);
     107             :         }
     108           0 :         ndr->depth--;
     109           0 : }
     110             : 
     111           0 : enum ndr_err_code ndr_pull_STRINGARRAY(struct ndr_pull *ndr, ndr_flags_type ndr_flags, struct STRINGARRAY *ar)
     112             : {
     113           0 :         uint16_t towerid;
     114           0 :         uint32_t towernum = 0;
     115           0 :         uint16_t num_entries;
     116             : 
     117           0 :         if (!(ndr_flags & NDR_SCALARS)) {
     118           0 :                 return NDR_ERR_SUCCESS;
     119             :         }
     120             : 
     121           0 :         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &num_entries));
     122             : 
     123           0 :         ar->stringbindings = talloc_array(ndr, struct STRINGBINDING *, 1);
     124           0 :         ar->stringbindings[0] = NULL;
     125             : 
     126           0 :         do {
     127             :                 /* 'Peek' */
     128           0 :                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &towerid));
     129             : 
     130           0 :                 if (towerid > 0) {
     131           0 :                         ndr->offset -= 2; 
     132           0 :                         ar->stringbindings = talloc_realloc(ndr, ar->stringbindings, struct STRINGBINDING *, towernum+2);
     133           0 :                         ar->stringbindings[towernum] = talloc(ndr, struct STRINGBINDING);
     134           0 :                         NDR_CHECK(ndr_pull_STRINGBINDING(ndr, ndr_flags, ar->stringbindings[towernum]));
     135           0 :                         towernum++;
     136             :                 }
     137           0 :         } while (towerid != 0);
     138             : 
     139           0 :         ar->stringbindings[towernum] = NULL;
     140             : 
     141           0 :         return NDR_ERR_SUCCESS;
     142             : }
     143             : 
     144           0 : enum ndr_err_code ndr_push_STRINGARRAY(struct ndr_push *ndr, ndr_flags_type ndr_flags, const struct STRINGARRAY *ar)
     145             : {
     146           0 :         return ndr_push_error(ndr, NDR_ERR_STRING, "ndr_push_STRINGARRAY not implemented");
     147             : }
     148             : 
     149             : /*
     150             :   print a dom_sid
     151             : */
     152           0 : void ndr_print_STRINGARRAY(struct ndr_print *ndr, const char *name, const struct STRINGARRAY *ar)
     153             : {
     154           0 :         int i;
     155           0 :         ndr->print(ndr, "%-25s: STRINGARRAY", name);
     156           0 :         ndr->depth++;
     157           0 :         for (i=0;ar->stringbindings[i];i++)  {
     158           0 :                 char idx[13];   /* 2^32 has 10 digits */
     159           0 :                 snprintf(idx, sizeof(idx), "[%d]", i);
     160           0 :                 ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
     161             :         }
     162           0 :         ndr->depth--;
     163           0 : }

Generated by: LCOV version 1.14