1 /* 2 Unix SMB/CIFS implementation. 3 RAP client 4 Copyright (C) Volker Lendecke 2004 5 Copyright (C) Tim Potter 2005 6 Copyright (C) Jelmer Vernooij 2007 7 Copyright (C) Guenther Deschner 2010 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 3 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 #define RAP_GOTO(call) do { \ 24 NTSTATUS _status; \ 25 _status = call; \ 26 if (!NT_STATUS_IS_OK(_status)) { \ 27 result = _status; \ 28 goto done; \ new_rap_cli_call(TALLOC_CTX * mem_ctx,uint16_t callno)29 } \ 30 } while (0) 31 32 #define RAP_RETURN(call) do { \ 33 NTSTATUS _status; \ 34 _status = call; \ 35 if (!NT_STATUS_IS_OK(_status)) { \ 36 return _status; \ 37 } \ 38 } while (0) 39 40 #define NDR_GOTO(call) do { \ 41 enum ndr_err_code _ndr_err; \ 42 _ndr_err = call; \ 43 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \ 44 result = ndr_map_error2ntstatus(_ndr_err); \ 45 goto done; \ 46 } \ 47 } while (0) 48 49 #define NDR_RETURN(call) do { \ 50 enum ndr_err_code _ndr_err; \ 51 _ndr_err = call; \ 52 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \ 53 return ndr_map_error2ntstatus(_ndr_err); \ 54 } \ 55 } while (0) 56 57 struct rap_call { 58 uint16_t callno; 59 char *paramdesc; rap_cli_push_paramdesc(struct rap_call * call,char desc)60 const char *datadesc; 61 const char *auxdatadesc; 62 63 uint16_t rcv_paramlen, rcv_datalen; 64 65 struct ndr_push *ndr_push_param; 66 struct ndr_push *ndr_push_data; 67 68 TALLOC_CTX *pull_mem_ctx; 69 struct ndr_pull *ndr_pull_param; 70 struct ndr_pull *ndr_pull_data; 71 }; 72 73 #define RAPNDR_FLAGS (LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); 74 75 #include "../librpc/gen_ndr/rap.h" rap_cli_push_word(struct rap_call * call,uint16_t val)76#include "libcli/rap/proto.h" 77