mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r14643: Merge dcerpc_errstr from Samba 4.
Might need to rework prs_dcerpc_status(). Guenther
This commit is contained in:
parent
db1162241f
commit
38b18f428b
@ -250,8 +250,9 @@ SECRETS_OBJ = passdb/secrets.o passdb/machine_sid.o
|
||||
LIBNMB_OBJ = libsmb/unexpected.o libsmb/namecache.o libsmb/nmblib.o \
|
||||
libsmb/namequery.o libsmb/conncache.o
|
||||
|
||||
LIBSAMBA_OBJ = libsmb/nterr.o libsmb/smbdes.o libsmb/smbencrypt.o libsmb/ntlm_check.o \
|
||||
libsmb/ntlmssp.o libsmb/ntlmssp_parse.o libsmb/ntlmssp_sign.o
|
||||
LIBSAMBA_OBJ = libsmb/nterr.o libsmb/dcerpc_err.o libsmb/smbdes.o \
|
||||
libsmb/smbencrypt.o libsmb/ntlm_check.o \
|
||||
libsmb/ntlmssp.o libsmb/ntlmssp_parse.o libsmb/ntlmssp_sign.o
|
||||
|
||||
LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
|
||||
libsmb/clikrb5.o libsmb/clispnego.o libsmb/asn1.o \
|
||||
|
110
source/libsmb/dcerpc_err.c
Normal file
110
source/libsmb/dcerpc_err.c
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* Copyright (C) Stefan Metzmacher 2004
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
struct dcerpc_fault_table {
|
||||
const char *errstr;
|
||||
uint32_t faultcode;
|
||||
};
|
||||
|
||||
static const struct dcerpc_fault_table dcerpc_faults[] =
|
||||
{
|
||||
{ "DCERPC_FAULT_OP_RNG_ERROR", DCERPC_FAULT_OP_RNG_ERROR },
|
||||
{ "DCERPC_FAULT_UNK_IF", DCERPC_FAULT_UNK_IF },
|
||||
{ "DCERPC_FAULT_NDR", DCERPC_FAULT_NDR },
|
||||
{ "DCERPC_FAULT_INVALID_TAG", DCERPC_FAULT_INVALID_TAG },
|
||||
{ "DCERPC_FAULT_CONTEXT_MISMATCH", DCERPC_FAULT_CONTEXT_MISMATCH },
|
||||
{ "DCERPC_FAULT_OTHER", DCERPC_FAULT_OTHER },
|
||||
{ "DCERPC_FAULT_ACCESS_DENIED", DCERPC_FAULT_ACCESS_DENIED },
|
||||
|
||||
{ NULL, 0}
|
||||
};
|
||||
|
||||
const char *dcerpc_errstr(uint32 fault_code)
|
||||
{
|
||||
static pstring msg;
|
||||
int idx = 0;
|
||||
|
||||
slprintf(msg, sizeof(msg), "DCERPC fault 0x%08x", fault_code);
|
||||
|
||||
while (dcerpc_faults[idx].errstr != NULL) {
|
||||
if (dcerpc_faults[idx].faultcode == fault_code) {
|
||||
return dcerpc_faults[idx].errstr;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* Copyright (C) Stefan Metzmacher 2004
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
struct dcerpc_fault_table {
|
||||
const char *errstr;
|
||||
uint32_t faultcode;
|
||||
};
|
||||
|
||||
static const struct dcerpc_fault_table dcerpc_faults[] =
|
||||
{
|
||||
{ "DCERPC_FAULT_OP_RNG_ERROR", DCERPC_FAULT_OP_RNG_ERROR },
|
||||
{ "DCERPC_FAULT_UNK_IF", DCERPC_FAULT_UNK_IF },
|
||||
{ "DCERPC_FAULT_NDR", DCERPC_FAULT_NDR },
|
||||
{ "DCERPC_FAULT_INVALID_TAG", DCERPC_FAULT_INVALID_TAG },
|
||||
{ "DCERPC_FAULT_CONTEXT_MISMATCH", DCERPC_FAULT_CONTEXT_MISMATCH },
|
||||
{ "DCERPC_FAULT_OTHER", DCERPC_FAULT_OTHER },
|
||||
{ "DCERPC_FAULT_ACCESS_DENIED", DCERPC_FAULT_ACCESS_DENIED },
|
||||
|
||||
{ NULL, 0}
|
||||
};
|
||||
|
||||
const char *dcerpc_errstr(uint32 fault_code)
|
||||
{
|
||||
static pstring msg;
|
||||
int idx = 0;
|
||||
|
||||
slprintf(msg, sizeof(msg), "DCERPC fault 0x%08x", fault_code);
|
||||
|
||||
while (dcerpc_faults[idx].errstr != NULL) {
|
||||
if (dcerpc_faults[idx].faultcode == fault_code) {
|
||||
return dcerpc_faults[idx].errstr;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
@ -619,7 +619,7 @@ static NTSTATUS cli_pipe_validate_current_pdu(struct rpc_pipe_client *cli, RPC_H
|
||||
|
||||
DEBUG(1, ("cli_pipe_validate_current_pdu: RPC fault code %s received from remote machine %s "
|
||||
"pipe %s fnum 0x%x!\n",
|
||||
nt_errstr(fault_resp.status),
|
||||
dcerpc_errstr(NT_STATUS_V(fault_resp.status)),
|
||||
cli->cli->desthost,
|
||||
cli->pipe_name,
|
||||
(unsigned int)cli->fnum));
|
||||
|
@ -767,6 +767,37 @@ BOOL prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status)
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Stream a DCE error code
|
||||
********************************************************************/
|
||||
|
||||
BOOL prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status)
|
||||
{
|
||||
char *q = prs_mem_get(ps, sizeof(uint32));
|
||||
if (q == NULL)
|
||||
return False;
|
||||
|
||||
if (UNMARSHALLING(ps)) {
|
||||
if (ps->bigendian_data)
|
||||
*status = NT_STATUS(RIVAL(q,0));
|
||||
else
|
||||
*status = NT_STATUS(IVAL(q,0));
|
||||
} else {
|
||||
if (ps->bigendian_data)
|
||||
RSIVAL(q,0,NT_STATUS_V(*status));
|
||||
else
|
||||
SIVAL(q,0,NT_STATUS_V(*status));
|
||||
}
|
||||
|
||||
DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name,
|
||||
dcerpc_errstr(NT_STATUS_V(*status))));
|
||||
|
||||
ps->data_offset += sizeof(uint32);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Stream a WERROR
|
||||
********************************************************************/
|
||||
|
@ -661,7 +661,7 @@ BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps,
|
||||
prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault");
|
||||
depth++;
|
||||
|
||||
if(!prs_ntstatus("status ", ps, depth, &rpc->status))
|
||||
if(!prs_dcerpc_status("status ", ps, depth, &rpc->status))
|
||||
return False;
|
||||
if(!prs_uint32("reserved", ps, depth, &rpc->reserved))
|
||||
return False;
|
||||
|
Loading…
Reference in New Issue
Block a user