diff options
-rw-r--r-- | lib/util/asn1_proto.h | 8 | ||||
-rw-r--r-- | libcli/util/doserr.c (renamed from source4/libcli/util/doserr.c) | 0 | ||||
-rw-r--r-- | libcli/util/doserr.h (renamed from source4/libcli/util/doserr.h) | 4 | ||||
-rw-r--r-- | libcli/util/error.h (renamed from source4/libcli/util/error.h) | 0 | ||||
-rw-r--r-- | libcli/util/errormap.c (renamed from source4/libcli/util/errormap.c) | 0 | ||||
-rw-r--r-- | libcli/util/nterr.c (renamed from source4/libcli/util/nterr.c) | 0 | ||||
-rw-r--r-- | libcli/util/ntstatus.h (renamed from source4/libcli/util/ntstatus.h) | 6 | ||||
-rw-r--r-- | libcli/util/werror.h (renamed from source4/libcli/util/werror.h) | 66 | ||||
-rwxr-xr-x | source3/librpc/tables.pl | 89 | ||||
-rw-r--r-- | source3/librpc/tools/ndrdump.c | 445 | ||||
-rw-r--r-- | source4/headermap.txt | 8 | ||||
-rw-r--r-- | source4/libcli/config.mk | 4 | ||||
-rw-r--r-- | source4/torture/rpc/epmapper.c | 2 |
13 files changed, 76 insertions, 556 deletions
diff --git a/lib/util/asn1_proto.h b/lib/util/asn1_proto.h index bcaf2c2121..9b7b4d26d5 100644 --- a/lib/util/asn1_proto.h +++ b/lib/util/asn1_proto.h @@ -1,5 +1,5 @@ -#ifndef ___LIB_UTIL_ASN1_PROTO_H__ -#define ___LIB_UTIL_ASN1_PROTO_H__ +#ifndef _____LIB_UTIL_ASN1_PROTO_H__ +#define _____LIB_UTIL_ASN1_PROTO_H__ #undef _PRINTF_ATTRIBUTE #define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2) @@ -10,7 +10,7 @@ * used outside this particular subsystem! */ -/* The following definitions come from lib/util/asn1.c */ +/* The following definitions come from ../lib/util/asn1.c */ struct asn1_data *asn1_init(TALLOC_CTX *mem_ctx); void asn1_free(struct asn1_data *data); @@ -55,5 +55,5 @@ NTSTATUS asn1_full_tag(DATA_BLOB blob, uint8_t tag, size_t *packet_size); #undef _PRINTF_ATTRIBUTE #define _PRINTF_ATTRIBUTE(a1, a2) -#endif /* ___LIB_UTIL_ASN1_PROTO_H__ */ +#endif /* _____LIB_UTIL_ASN1_PROTO_H__ */ diff --git a/source4/libcli/util/doserr.c b/libcli/util/doserr.c index be33ba47e2..be33ba47e2 100644 --- a/source4/libcli/util/doserr.c +++ b/libcli/util/doserr.c diff --git a/source4/libcli/util/doserr.h b/libcli/util/doserr.h index 6c757a3fc2..12cca12bd6 100644 --- a/source4/libcli/util/doserr.h +++ b/libcli/util/doserr.h @@ -5,6 +5,7 @@ Copyright (C) John H Terpstra 1996-2000 Copyright (C) Luke Kenneth Casson Leighton 1996-2000 Copyright (C) Paul Ashton 1998-2000 + Copyright (C) Gerald (Jerry) Carter 2005 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 @@ -42,6 +43,7 @@ #define ERRnomem 8 /* Out of memory */ #define ERRbadmem 9 /* Invalid memory block address */ #define ERRbadenv 10 /* Invalid environment */ +#define ERRbadformat 11 /* Bad Format */ #define ERRbadaccess 12 /* Invalid open mode */ #define ERRbaddata 13 /* Invalid data (only from ioctl call) */ #define ERRres 14 /* reserved */ @@ -58,6 +60,7 @@ #define ERRfilexists 80 /* File in operation already exists */ #define ERRinvalidparam 87 #define ERRcannotopen 110 /* Cannot open the file specified */ +#define ERRbufferoverflow 111 #define ERRinsufficientbuffer 122 #define ERRinvalidname 123 /* Invalid name */ #define ERRunknownlevel 124 @@ -138,6 +141,7 @@ #define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */ #define ERRuseSTD 251 /* temporarily unable to use raw mode, use standard mode */ #define ERRcontMPX 252 /* resume MPX mode */ +#define ERRbadPW /* reserved */ #define ERRnosupport 0xFFFF #define ERRunknownsmb 22 /* from NT 3.5 response */ diff --git a/source4/libcli/util/error.h b/libcli/util/error.h index 84255448a0..84255448a0 100644 --- a/source4/libcli/util/error.h +++ b/libcli/util/error.h diff --git a/source4/libcli/util/errormap.c b/libcli/util/errormap.c index 2257955c76..2257955c76 100644 --- a/source4/libcli/util/errormap.c +++ b/libcli/util/errormap.c diff --git a/source4/libcli/util/nterr.c b/libcli/util/nterr.c index 4e046c78ca..4e046c78ca 100644 --- a/source4/libcli/util/nterr.c +++ b/libcli/util/nterr.c diff --git a/source4/libcli/util/ntstatus.h b/libcli/util/ntstatus.h index 7d223ae789..b7195a41b4 100644 --- a/source4/libcli/util/ntstatus.h +++ b/libcli/util/ntstatus.h @@ -50,6 +50,8 @@ typedef uint32_t NTSTATUS; #define NT_STATUS_NO_MORE_ENTRIES NT_STATUS(0x8000001a) #define STATUS_PENDING NT_STATUS(0x0103) +/* Vista Status codes. */ +#define NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT NT_STATUS(0x8000002d) #define STATUS_MORE_ENTRIES NT_STATUS(0x0105) #define STATUS_SOME_UNMAPPED NT_STATUS(0x0107) #define STATUS_NOTIFY_CLEANUP NT_STATUS(0x010b) @@ -590,11 +592,13 @@ typedef uint32_t NTSTATUS; #define NT_STATUS_TOO_MANY_LINKS NT_STATUS(0xC0000000 | 0x0265) #define NT_STATUS_QUOTA_LIST_INCONSISTENT NT_STATUS(0xC0000000 | 0x0266) #define NT_STATUS_FILE_IS_OFFLINE NT_STATUS(0xC0000000 | 0x0267) +#define NT_STATUS_DS_NO_MORE_RIDS NT_STATUS(0xC0000000 | 0x02a8) #define NT_STATUS_NOT_A_REPARSE_POINT NT_STATUS(0xC0000000 | 0x0275) #define NT_STATUS_CURRENT_DOMAIN_NOT_ALLOWED NT_STATUS(0xC0000000 | 0x02E9) #define NT_STATUS_OBJECTID_NOT_FOUND NT_STATUS(0xC0000000 | 0x02F0) #define NT_STATUS_NO_SUCH_JOB NT_STATUS(0xC0000000 | 0xEDE) /* scheduler */ #define NT_STATUS_DOWNGRADE_DETECTED NT_STATUS(0xC0000000 | 0x0388) +#define NT_STATUS_NO_SUCH_JOB NT_STATUS(0xC0000000 | 0xEDE) /* scheduler */ #define NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED NT_STATUS(0xC0000000 | 0x20004) #define NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX NT_STATUS(0xC0000000 | 0x20026) #define NT_STATUS_RPC_NT_CALL_FAILED NT_STATUS(0xC0000000 | 0x2001B) @@ -673,6 +677,6 @@ NTSTATUS nt_status_string_to_code(const char *nt_status_str); #define NT_STATUS_IS_LDAP(status) ((NT_STATUS_V(status) & 0xFF000000) == 0xF2000000) #define NT_STATUS_LDAP_CODE(status) (NT_STATUS_V(status) & ~0xFF000000) - +#define NT_STATUS_RPC_CANNOT_SUPPORT NT_STATUS(0xC0000000 | 0x20041) #endif /* _NTSTATUS_H */ diff --git a/source4/libcli/util/werror.h b/libcli/util/werror.h index c5ec90d5dd..1ebd5cc349 100644 --- a/source4/libcli/util/werror.h +++ b/libcli/util/werror.h @@ -74,6 +74,7 @@ typedef uint32_t WERROR; #define WERR_BAD_NETPATH W_ERROR(53) #define WERR_BAD_NET_RESP W_ERROR(58) #define WERR_UNEXP_NET_ERR W_ERROR(59) +#define WERR_DEVICE_NOT_EXIST W_ERROR(55) #define WERR_PRINTQ_FULL W_ERROR(61) #define WERR_NO_SPOOL_SPACE W_ERROR(62) #define WERR_NO_SUCH_SHARE W_ERROR(67) @@ -81,6 +82,7 @@ typedef uint32_t WERROR; #define WERR_BAD_PASSWORD W_ERROR(86) #define WERR_INVALID_PARAM W_ERROR(87) #define WERR_CALL_NOT_IMPLEMENTED W_ERROR(120) +#define WERR_SEM_TIMEOUT W_ERROR(121) #define WERR_INSUFFICIENT_BUFFER W_ERROR(122) #define WERR_INVALID_NAME W_ERROR(123) #define WERR_UNKNOWN_LEVEL W_ERROR(124) @@ -88,44 +90,64 @@ typedef uint32_t WERROR; #define WERR_ALREADY_EXISTS W_ERROR(183) #define WERR_NO_MORE_ITEMS W_ERROR(259) #define WERR_MORE_DATA W_ERROR(234) +#define WERR_INVALID_OWNER W_ERROR(1307) +#define WERR_IO_PENDING W_ERROR(997) #define WERR_CAN_NOT_COMPLETE W_ERROR(1003) #define WERR_INVALID_FLAGS W_ERROR(1004) +#define WERR_REG_CORRUPT W_ERROR(1015) +#define WERR_REG_IO_FAILURE W_ERROR(1016) +#define WERR_REG_FILE_INVALID W_ERROR(1017) +#define WERR_NO_SUCH_SERVICE W_ERROR(1060) +#define WERR_INVALID_SERVICE_CONTROL W_ERROR(1052) +#define WERR_SERVICE_ALREADY_RUNNING W_ERROR(1056) +#define WERR_SERVICE_DISABLED W_ERROR(1058) +#define WERR_SERVICE_NEVER_STARTED W_ERROR(1077) #define WERR_NOT_FOUND W_ERROR(1168) #define WERR_INVALID_COMPUTERNAME W_ERROR(1210) #define WERR_INVALID_DOMAINNAME W_ERROR(1212) #define WERR_NOT_AUTHENTICATED W_ERROR(1244) #define WERR_UNKNOWN_REVISION W_ERROR(1305) +#define WERR_MACHINE_LOCKED W_ERROR(1271) #define WERR_REVISION_MISMATCH W_ERROR(1306) #define WERR_INVALID_OWNER W_ERROR(1307) #define WERR_NO_LOGON_SERVERS W_ERROR(1311) #define WERR_NO_SUCH_LOGON_SESSION W_ERROR(1312) #define WERR_NO_SUCH_PRIVILEGE W_ERROR(1313) #define WERR_PRIVILEGE_NOT_HELD W_ERROR(1314) +#define WERR_USER_ALREADY_EXISTS W_ERROR(1316) #define WERR_NO_SUCH_USER W_ERROR(1317) +#define WERR_GROUP_EXISTS W_ERROR(1318) +#define WERR_MEMBER_IN_GROUP W_ERROR(1320) +#define WERR_USER_NOT_IN_GROUP W_ERROR(1321) +#define WERR_WRONG_PASSWORD W_ERROR(1323) +#define WERR_PASSWORD_RESTRICTION W_ERROR(1325) #define WERR_LOGON_FAILURE W_ERROR(1326) +#define WERR_NO_SUCH_DOMAIN W_ERROR(1355) +#define WERR_NONE_MAPPED W_ERROR(1332) #define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338) +#define WERR_INVALID_DOMAIN_STATE W_ERROR(1353) #define WERR_INVALID_DOMAIN_ROLE W_ERROR(1354) #define WERR_NO_SUCH_DOMAIN W_ERROR(1355) #define WERR_NO_SYSTEM_RESOURCES W_ERROR(1450) +#define WERR_SPECIAL_ACCOUNT W_ERROR(1371) +#define WERR_NO_SUCH_ALIAS W_ERROR(1376) +#define WERR_MEMBER_IN_ALIAS W_ERROR(1378) +#define WERR_ALIAS_EXISTS W_ERROR(1379) +#define WERR_TIME_SKEW W_ERROR(1398) +#define WERR_EVENTLOG_FILE_CORRUPT W_ERROR(1500) #define WERR_SERVER_UNAVAILABLE W_ERROR(1722) #define WERR_INVALID_FORM_NAME W_ERROR(1902) #define WERR_INVALID_FORM_SIZE W_ERROR(1903) +#define WERR_PASSWORD_MUST_CHANGE W_ERROR(1907) +#define WERR_ACCOUNT_LOCKED_OUT W_ERROR(1909) #define WERR_ALREADY_SHARED W_ERROR(2118) -#define WERR_BUF_TOO_SMALL W_ERROR(2123) -#define WERR_JOB_NOT_FOUND W_ERROR(2151) -#define WERR_DEST_NOT_FOUND W_ERROR(2152) #define WERR_NOT_CONNECTED W_ERROR(2250) #define WERR_NAME_NOT_FOUND W_ERROR(2273) #define WERR_SESSION_NOT_FOUND W_ERROR(2312) #define WERR_FID_NOT_FOUND W_ERROR(2314) -#define WERR_NOT_LOCAL_DOMAIN W_ERROR(2320) #define WERR_DOMAIN_CONTROLLER_NOT_FOUND W_ERROR(2453) #define WERR_TIME_DIFF_AT_DC W_ERROR(2457) -#define WERR_SETUP_ALREADY_JOINED W_ERROR(2691) -#define WERR_SETUP_NOT_JOINED W_ERROR(2692) -#define WERR_SETUP_DOMAIN_CONTROLLER W_ERROR(2693) - #define WERR_DEVICE_NOT_AVAILABLE W_ERROR(4319) #define WERR_STATUS_MORE_ENTRIES W_ERROR(0x0105) @@ -155,16 +177,42 @@ typedef uint32_t WERROR; #define WERR_CLASS_NOT_REGISTERED W_ERROR(0x40154) #define WERR_NO_SHUTDOWN_IN_PROGRESS W_ERROR(0x45c) #define WERR_SHUTDOWN_ALREADY_IN_PROGRESS W_ERROR(0x45b) +/* Configuration Manager Errors */ +/* Basically Win32 errors meanings are specific to the \ntsvcs pipe */ + +#define WERR_CM_NO_MORE_HW_PROFILES W_ERROR(35) +#define WERR_CM_NO_SUCH_VALUE W_ERROR(37) -#define WERR_NET_NAME_NOT_FOUND W_ERROR(NERR_BASE+210) #define WERR_DEVICE_NOT_SHARED W_ERROR(NERR_BASE+211) /* DFS errors */ + +#ifndef NERR_BASE +#define NERR_BASE (2100) +#endif + +#ifndef MAX_NERR +#define MAX_NERR (NERR_BASE+899) +#endif + +#define WERR_BUF_TOO_SMALL W_ERROR(NERR_BASE+23) +#define WERR_JOB_NOT_FOUND W_ERROR(NERR_BASE+51) +#define WERR_DEST_NOT_FOUND W_ERROR(NERR_BASE+52) +#define WERR_GROUP_NOT_FOUND W_ERROR(NERR_BASE+120) +#define WERR_USER_NOT_FOUND W_ERROR(NERR_BASE+121) +#define WERR_USER_EXISTS W_ERROR(NERR_BASE+124) +#define WERR_NET_NAME_NOT_FOUND W_ERROR(NERR_BASE+210) +#define WERR_NOT_LOCAL_DOMAIN W_ERROR(NERR_BASE+220) +#define WERR_DC_NOT_FOUND W_ERROR(NERR_BASE+353) #define WERR_DFS_NO_SUCH_VOL W_ERROR(NERR_BASE+562) #define WERR_DFS_NO_SUCH_SHARE W_ERROR(NERR_BASE+565) #define WERR_DFS_NO_SUCH_SERVER W_ERROR(NERR_BASE+573) #define WERR_DFS_INTERNAL_ERROR W_ERROR(NERR_BASE+590) #define WERR_DFS_CANT_CREATE_JUNCT W_ERROR(NERR_BASE+569) +#define WERR_SETUP_ALREADY_JOINED W_ERROR(NERR_BASE+591) +#define WERR_SETUP_NOT_JOINED W_ERROR(NERR_BASE+592) +#define WERR_SETUP_DOMAIN_CONTROLLER W_ERROR(NERR_BASE+593) +#define WERR_DEFAULT_JOIN_REQUIRED W_ERROR(NERR_BASE+594) /* DS errors */ #define WERR_DS_SERVICE_BUSY W_ERROR(0x0000200e) diff --git a/source3/librpc/tables.pl b/source3/librpc/tables.pl deleted file mode 100755 index 946159c6f0..0000000000 --- a/source3/librpc/tables.pl +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/perl -w - -################################################### -# package to produce a table of all idl parsers -# Copyright tridge@samba.org 2003 -# Copyright jelmer@samba.org 2005 -# released under the GNU GPL - -use strict; - -use Getopt::Long; -use File::Basename; - -my $opt_output = 'librpc/gen_ndr/tables.c'; -my $opt_help = 0; - - -######################################### -# display help text -sub ShowHelp() -{ - print " - perl DCE/RPC interface table generator - Copyright (C) tridge\@samba.org - - Usage: tables.pl [options] <idlfile> - - \n"; - exit(0); -} - -# main program -GetOptions ( - 'help|h|?' => \$opt_help, - 'output=s' => \$opt_output, - ); - -if ($opt_help) { - ShowHelp(); - exit(0); -} - -my $init_fns = ""; - -################################### -# extract table entries from 1 file -sub process_file($) -{ - my $filename = shift; - open(FILE, $filename) || die "unable to open $filename\n"; - my $found = 0; - - while (my $line = <FILE>) { - if ($line =~ /extern const struct ndr_interface_table (\w+);/) { - $found = 1; - $init_fns.="\tstatus = librpc_register_interface(&$1);\n"; - $init_fns.="\tif (NT_STATUS_IS_ERR(status)) return status;\n\n"; - } - } - - if ($found) { - print "#include \"$filename\"\n"; - } - - close(FILE); -} - -print <<EOF; - -/* Automatically generated by tables.pl. DO NOT EDIT */ - -#include "includes.h" -#include "librpc/rpc/dcerpc.h" -#include "librpc/rpc/dcerpc_table.h" -EOF - -process_file($_) foreach (@ARGV); - -print <<EOF; - -NTSTATUS dcerpc_register_builtin_interfaces(void) -{ - NTSTATUS status; - -$init_fns - - return NT_STATUS_OK; -} -EOF diff --git a/source3/librpc/tools/ndrdump.c b/source3/librpc/tools/ndrdump.c deleted file mode 100644 index 5b96e152bb..0000000000 --- a/source3/librpc/tools/ndrdump.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB torture tester - Copyright (C) Andrew Tridgell 2003 - Copyright (C) Jelmer Vernooij 2006 - - 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" -#if (_SAMBA_BUILD_ >= 4) -#include "lib/cmdline/popt_common.h" -#include "system/filesys.h" -#include "system/locale.h" -#include "librpc/rpc/dcerpc.h" -#include "librpc/rpc/dcerpc_table.h" -#endif - -static const struct ndr_interface_call *find_function( - const struct ndr_interface_table *p, - const char *function) -{ - int i; - if (isdigit(function[0])) { - i = strtol(function, NULL, 0); - return &p->calls[i]; - } - for (i=0;i<p->num_calls;i++) { - if (strcmp(p->calls[i].name, function) == 0) { - break; - } - } - if (i == p->num_calls) { - printf("Function '%s' not found\n", function); - exit(1); - } - return &p->calls[i]; -} - -#if (_SAMBA_BUILD_ >= 4) - -static void show_pipes(void) -{ - const struct ndr_interface_list *l; - printf("\nYou must specify a pipe\n"); - printf("known pipes are:\n"); - for (l=librpc_dcerpc_pipes();l;l=l->next) { - if(l->table->helpstring) { - printf("\t%s - %s\n", l->table->name, l->table->helpstring); - } else { - printf("\t%s\n", l->table->name); - } - } - exit(1); -} - -#endif - -static void show_functions(const struct ndr_interface_table *p) -{ - int i; - printf("\nYou must specify a function\n"); - printf("known functions on '%s' are:\n", p->name); - for (i=0;i<p->num_calls;i++) { - printf("\t0x%02x (%2d) %s\n", i, i, p->calls[i].name); - } - exit(1); -} - -static char *stdin_load(TALLOC_CTX *mem_ctx, size_t *size) -{ - int num_read, total_len = 0; - char buf[255]; - char *result = NULL; - - while((num_read = read(STDIN_FILENO, buf, 255)) > 0) { - - if (result) { - result = (char *) talloc_realloc( - mem_ctx, result, char *, total_len + num_read); - } else { - result = (char *) talloc_size(mem_ctx, num_read); - } - - memcpy(result + total_len, buf, num_read); - - total_len += num_read; - } - - if (size) - *size = total_len; - - return result; -} - -static const struct ndr_interface_table *load_iface_from_plugin(const char *plugin, const char *pipe_name) -{ - const struct ndr_interface_table *p; - void *handle; - char *symbol; - - handle = dlopen(plugin, RTLD_NOW); - if (handle == NULL) { - printf("%s: Unable to open: %s\n", plugin, dlerror()); - return NULL; - } - - symbol = talloc_asprintf(NULL, "ndr_table_%s", pipe_name); - p = (const struct ndr_interface_table *)dlsym(handle, symbol); - - if (!p) { - printf("%s: Unable to find DCE/RPC interface table for '%s': %s\n", plugin, pipe_name, dlerror()); - talloc_free(symbol); - return NULL; - } - - talloc_free(symbol); - - return p; -} - - int main(int argc, const char *argv[]) -{ - const struct ndr_interface_table *p = NULL; - const struct ndr_interface_call *f; - const char *pipe_name, *function, *inout, *filename; - uint8_t *data; - size_t size; - DATA_BLOB blob; - struct ndr_pull *ndr_pull; - struct ndr_print *ndr_print; - TALLOC_CTX *mem_ctx; - int flags; - poptContext pc; - NTSTATUS status; - enum ndr_err_code ndr_err; - void *st; - void *v_st; - const char *ctx_filename = NULL; - const char *plugin = NULL; - bool validate = false; - bool dumpdata = false; - int opt; - enum {OPT_CONTEXT_FILE=1000, OPT_VALIDATE, OPT_DUMP_DATA, OPT_LOAD_DSO}; - struct poptOption long_options[] = { - POPT_AUTOHELP - {"context-file", 'c', POPT_ARG_STRING, NULL, OPT_CONTEXT_FILE, "In-filename to parse first", "CTX-FILE" }, - {"validate", 0, POPT_ARG_NONE, NULL, OPT_VALIDATE, "try to validate the data", NULL }, - {"dump-data", 0, POPT_ARG_NONE, NULL, OPT_DUMP_DATA, "dump the hex data", NULL }, - {"load-dso", 'l', POPT_ARG_STRING, NULL, OPT_LOAD_DSO, "load from shared object file", NULL }, - POPT_COMMON_SAMBA - POPT_COMMON_VERSION - { NULL } - }; - -#if (_SAMBA_BUILD_ >= 4) - ndr_table_init(); -#else - /* Initialise samba stuff */ - load_case_tables(); - - setlinebuf(stdout); - - dbf = x_stderr; - - setup_logging(argv[0],True); -#endif - - pc = poptGetContext("ndrdump", argc, argv, long_options, 0); - - poptSetOtherOptionHelp( - pc, "<pipe|uuid> <function> <inout> [<filename>]"); - - while ((opt = poptGetNextOpt(pc)) != -1) { - switch (opt) { - case OPT_CONTEXT_FILE: - ctx_filename = poptGetOptArg(pc); - break; - case OPT_VALIDATE: - validate = true; - break; - case OPT_DUMP_DATA: - dumpdata = true; - break; - case OPT_LOAD_DSO: - plugin = poptGetOptArg(pc); - break; - } - } - - pipe_name = poptGetArg(pc); - - if (!pipe_name) { - poptPrintUsage(pc, stderr, 0); -#if (_SAMBA_BUILD_ >= 4) - show_pipes(); -#endif - exit(1); - } - - if (plugin != NULL) { - p = load_iface_from_plugin(plugin, pipe_name); - } -#if (_SAMBA_BUILD_ <= 3) - else { - fprintf(stderr, "Only loading from DSO's supported in Samba 3\n"); - exit(1); - } -#else - if (!p) { - p = idl_iface_by_name(pipe_name); - } - - if (!p) { - struct GUID uuid; - - status = GUID_from_string(pipe_name, &uuid); - - if (NT_STATUS_IS_OK(status)) { - p = idl_iface_by_uuid(&uuid); - } - } -#endif - - if (!p) { - printf("Unknown pipe or UUID '%s'\n", pipe_name); - exit(1); - } - - function = poptGetArg(pc); - inout = poptGetArg(pc); - filename = poptGetArg(pc); - - if (!function || !inout) { - poptPrintUsage(pc, stderr, 0); - show_functions(p); - exit(1); - } - - if (strcmp(inout, "in") == 0 || - strcmp(inout, "request") == 0) { - flags = NDR_IN; - } else if (strcmp(inout, "out") == 0 || - strcmp(inout, "response") == 0) { - flags = NDR_OUT; - } else { - printf("Bad inout value '%s'\n", inout); - exit(1); - } - - f = find_function(p, function); - - mem_ctx = talloc_init("ndrdump"); - - st = talloc_zero_size(mem_ctx, f->struct_size); - if (!st) { - printf("Unable to allocate %d bytes\n", (int)f->struct_size); - exit(1); - } - - v_st = talloc_zero_size(mem_ctx, f->struct_size); - if (!v_st) { - printf("Unable to allocate %d bytes\n", (int)f->struct_size); - exit(1); - } - - if (ctx_filename) { - if (flags == NDR_IN) { - printf("Context file can only be used for \"out\" packages\n"); - exit(1); - } - - data = (uint8_t *)file_load(ctx_filename, &size, 0, mem_ctx); - if (!data) { - perror(ctx_filename); - exit(1); - } - - blob.data = data; - blob.length = size; - - ndr_pull = ndr_pull_init_blob(&blob, mem_ctx, NULL); - ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC; - - ndr_err = f->ndr_pull(ndr_pull, NDR_IN, st); - - if (ndr_pull->offset != ndr_pull->data_size) { - printf("WARNING! %d unread bytes while parsing context file\n", ndr_pull->data_size - ndr_pull->offset); - } - - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - status = ndr_map_error2ntstatus(ndr_err); - printf("pull for context file returned %s\n", nt_errstr(status)); - exit(1); - } - memcpy(v_st, st, f->struct_size); - } - - if (filename) - data = (uint8_t *)file_load(filename, &size, 0, mem_ctx); - else - data = (uint8_t *)stdin_load(mem_ctx, &size); - - if (!data) { - if (filename) - perror(filename); - else - perror("stdin"); - exit(1); - } - - blob.data = data; - blob.length = size; - - ndr_pull = ndr_pull_init_blob(&blob, mem_ctx, NULL); - ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC; - - ndr_err = f->ndr_pull(ndr_pull, flags, st); - status = ndr_map_error2ntstatus(ndr_err); - - printf("pull returned %s\n", nt_errstr(status)); - - if (ndr_pull->offset != ndr_pull->data_size) { - printf("WARNING! %d unread bytes\n", ndr_pull->data_size - ndr_pull->offset); - dump_data(0, ndr_pull->data+ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset); - } - - if (dumpdata) { - printf("%d bytes consumed\n", ndr_pull->offset); - dump_data(0, blob.data, blob.length); - } - - ndr_print = talloc_zero(mem_ctx, struct ndr_print); - ndr_print->print = ndr_print_debug_helper; - ndr_print->depth = 1; - f->ndr_print(ndr_print, function, flags, st); - - if (!NT_STATUS_IS_OK(status)) { - printf("dump FAILED\n"); - exit(1); - } - - if (validate) { - DATA_BLOB v_blob; - struct ndr_push *ndr_v_push; - struct ndr_pull *ndr_v_pull; - struct ndr_print *ndr_v_print; - uint32_t i; - uint8_t byte_a, byte_b; - bool differ; - - ndr_v_push = ndr_push_init_ctx(mem_ctx, NULL); - - ndr_err = f->ndr_push(ndr_v_push, flags, st); - status = ndr_map_error2ntstatus(ndr_err); - printf("push returned %s\n", nt_errstr(status)); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - printf("validate push FAILED\n"); - exit(1); - } - - v_blob = ndr_push_blob(ndr_v_push); - - if (dumpdata) { - printf("%ld bytes generated (validate)\n", (long)v_blob.length); - dump_data(0, v_blob.data, v_blob.length); - } - - ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx, NULL); - ndr_v_pull->flags |= LIBNDR_FLAG_REF_ALLOC; - - ndr_err = f->ndr_pull(ndr_v_pull, flags, v_st); - status = ndr_map_error2ntstatus(ndr_err); - printf("pull returned %s\n", nt_errstr(status)); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - printf("validate pull FAILED\n"); - exit(1); - } - - - if (ndr_v_pull->offset != ndr_v_pull->data_size) { - printf("WARNING! %d unread bytes in validation\n", ndr_v_pull->data_size - ndr_v_pull->offset); - dump_data(0, ndr_v_pull->data+ndr_v_pull->offset, ndr_v_pull->data_size - ndr_v_pull->offset); - } - - ndr_v_print = talloc_zero(mem_ctx, struct ndr_print); - ndr_v_print->print = ndr_print_debug_helper; - ndr_v_print->depth = 1; - f->ndr_print(ndr_v_print, function, flags, v_st); - - if (blob.length != v_blob.length) { - printf("WARNING! orig bytes:%u validated pushed " - "bytes:%u\n", (unsigned int)blob.length, - (unsigned int)v_blob.length); - } - - if (ndr_pull->offset != ndr_v_pull->offset) { - printf("WARNING! orig pulled bytes:%u validated pulled bytes:%u\n", ndr_pull->offset, ndr_v_pull->offset); - } - - differ = false; - byte_a = 0x00; - byte_b = 0x00; - for (i=0; i < blob.length; i++) { - byte_a = blob.data[i]; - - if (i == v_blob.length) { - byte_b = 0x00; - differ = true; - break; - } - - byte_b = v_blob.data[i]; - - if (byte_a != byte_b) { - differ = true; - break; - } - } - if (differ) { - printf("WARNING! orig and validated differ at byte 0x%02X (%u)\n", i, i); - printf("WARNING! orig byte[0x%02X] = 0x%02X validated byte[0x%02X] = 0x%02X\n", - i, byte_a, i, byte_b); - } - } - - printf("dump OK\n"); - - talloc_free(mem_ctx); - - poptFreeContext(pc); - - return 0; -} diff --git a/source4/headermap.txt b/source4/headermap.txt index 43119d2695..91b9d108ad 100644 --- a/source4/headermap.txt +++ b/source4/headermap.txt @@ -14,9 +14,9 @@ lib/ldb/include/ldb_errors.h: ldb_errors.h auth/gensec/gensec.h: gensec.h ../librpc/ndr/libndr.h: ndr.h lib/registry/registry.h: registry.h -libcli/util/werror.h: core/werror.h -libcli/util/doserr.h: core/doserr.h -libcli/util/ntstatus.h: core/ntstatus.h +../libcli/util/werror.h: core/werror.h +../libcli/util/doserr.h: core/doserr.h +../libcli/util/ntstatus.h: core/ntstatus.h libcli/cldap/cldap.h: cldap.h librpc/gen_ndr/dcerpc.h: gen_ndr/dcerpc.h librpc/gen_ndr/netlogon.h: gen_ndr/netlogon.h @@ -58,7 +58,7 @@ lib/cmdline/popt_common.h: samba/popt.h version.h: samba/version.h param/param.h: param.h ../lib/util/asn1.h: samba/asn1.h -libcli/util/error.h: core/error.h +../libcli/util/error.h: core/error.h lib/tdb_wrap.h: tdb_wrap.h lib/ldb_wrap.h: ldb_wrap.h torture/smbtorture.h: smbtorture.h diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk index 8d9a1f5fa8..74a4b88cbc 100644 --- a/source4/libcli/config.mk +++ b/source4/libcli/config.mk @@ -5,9 +5,9 @@ mkinclude wbclient/config.mk [SUBSYSTEM::LIBSAMBA-ERRORS] -LIBSAMBA-ERRORS_OBJ_FILES = $(addprefix $(libclisrcdir)/util/, doserr.o errormap.o nterr.o) +LIBSAMBA-ERRORS_OBJ_FILES = $(addprefix ../libcli/util/, doserr.o errormap.o nterr.o) -PUBLIC_HEADERS += $(addprefix $(libclisrcdir)/, util/error.h util/ntstatus.h util/doserr.h util/werror.h) +PUBLIC_HEADERS += $(addprefix ../libcli/util/, error.h ntstatus.h doserr.h werror.h) [SUBSYSTEM::LIBCLI_LSA] PUBLIC_DEPENDENCIES = RPC_NDR_LSA diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c index 708d46a5dc..e99b3b1354 100644 --- a/source4/torture/rpc/epmapper.c +++ b/source4/torture/rpc/epmapper.c @@ -268,9 +268,7 @@ struct torture_suite *torture_rpc_epmapper(TALLOC_CTX *mem_ctx) &ndr_table_epmapper); torture_rpc_tcase_add_test(tcase, "Lookup", test_Lookup); - torture_rpc_tcase_add_test(tcase, "Insert", test_Insert); - torture_rpc_tcase_add_test(tcase, "InqObject", test_InqObject); return suite; |