diff options
89 files changed, 2351 insertions, 3955 deletions
diff --git a/lib/crypto/hmacmd5test.c b/lib/crypto/hmacmd5test.c index 0a98404eda..77f305a5d3 100644 --- a/lib/crypto/hmacmd5test.c +++ b/lib/crypto/hmacmd5test.c @@ -41,34 +41,37 @@ bool torture_local_crypto_hmacmd5(struct torture_context *torture) DATA_BLOB md5; } testarray[8]; + TALLOC_CTX *tctx = talloc_new(torture); + if (!tctx) { return false; }; + testarray[0].key = data_blob_repeat_byte(0x0b, 16); testarray[0].data = data_blob_string_const("Hi There"); - testarray[0].md5 = strhex_to_data_blob("9294727a3638bb1c13f48ef8158bfc9d"); + testarray[0].md5 = strhex_to_data_blob(tctx, "9294727a3638bb1c13f48ef8158bfc9d"); testarray[1].key = data_blob_string_const("Jefe"); testarray[1].data = data_blob_string_const("what do ya want for nothing?"); - testarray[1].md5 = strhex_to_data_blob("750c783e6ab0b503eaa86e310a5db738"); + testarray[1].md5 = strhex_to_data_blob(tctx, "750c783e6ab0b503eaa86e310a5db738"); testarray[2].key = data_blob_repeat_byte(0xaa, 16); testarray[2].data = data_blob_repeat_byte(0xdd, 50); - testarray[2].md5 = strhex_to_data_blob("56be34521d144c88dbb8c733f0e8b3f6"); + testarray[2].md5 = strhex_to_data_blob(tctx, "56be34521d144c88dbb8c733f0e8b3f6"); - testarray[3].key = strhex_to_data_blob("0102030405060708090a0b0c0d0e0f10111213141516171819"); + testarray[3].key = strhex_to_data_blob(tctx, "0102030405060708090a0b0c0d0e0f10111213141516171819"); testarray[3].data = data_blob_repeat_byte(0xcd, 50); - testarray[3].md5 = strhex_to_data_blob("697eaf0aca3a3aea3a75164746ffaa79"); + testarray[3].md5 = strhex_to_data_blob(tctx, "697eaf0aca3a3aea3a75164746ffaa79"); testarray[4].key = data_blob_repeat_byte(0x0c, 16); testarray[4].data = data_blob_string_const("Test With Truncation"); - testarray[4].md5 = strhex_to_data_blob("56461ef2342edc00f9bab995690efd4c"); + testarray[4].md5 = strhex_to_data_blob(tctx, "56461ef2342edc00f9bab995690efd4c"); testarray[5].key = data_blob_repeat_byte(0xaa, 80); testarray[5].data = data_blob_string_const("Test Using Larger Than Block-Size Key - Hash Key First"); - testarray[5].md5 = strhex_to_data_blob("6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd"); + testarray[5].md5 = strhex_to_data_blob(tctx, "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd"); testarray[6].key = data_blob_repeat_byte(0xaa, 80); testarray[6].data = data_blob_string_const("Test Using Larger Than Block-Size Key " "and Larger Than One Block-Size Data"); - testarray[6].md5 = strhex_to_data_blob("6f630fad67cda0ee1fb1f562db3aa53e"); + testarray[6].md5 = strhex_to_data_blob(tctx, "6f630fad67cda0ee1fb1f562db3aa53e"); testarray[7].key = data_blob(NULL, 0); @@ -93,6 +96,6 @@ bool torture_local_crypto_hmacmd5(struct torture_context *torture) ret = false; } } - + talloc_free(tctx); return ret; } diff --git a/lib/crypto/md4test.c b/lib/crypto/md4test.c index dddf9e61a0..a6080cff82 100644 --- a/lib/crypto/md4test.c +++ b/lib/crypto/md4test.c @@ -64,7 +64,7 @@ bool torture_local_crypto_md4(struct torture_context *torture) DATA_BLOB md4blob; data = data_blob_string_const(testarray[i].data); - md4blob = strhex_to_data_blob(testarray[i].md4); + md4blob = strhex_to_data_blob(NULL, testarray[i].md4); mdfour(md4, data.data, data.length); diff --git a/lib/crypto/md5test.c b/lib/crypto/md5test.c index 1244dca753..7223af2114 100644 --- a/lib/crypto/md5test.c +++ b/lib/crypto/md5test.c @@ -70,7 +70,7 @@ bool torture_local_crypto_md5(struct torture_context *torture) DATA_BLOB md5blob; data = data_blob_string_const(testarray[i].data); - md5blob = strhex_to_data_blob(testarray[i].md5); + md5blob = strhex_to_data_blob(NULL, testarray[i].md5); MD5Init(&ctx); MD5Update(&ctx, data.data, data.length); diff --git a/lib/util/debug.c b/lib/util/debug.c index b6edb908c7..faec52aec8 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -33,7 +33,10 @@ */ int _debug_level = 0; _PUBLIC_ int *debug_level = &_debug_level; -int *DEBUGLEVEL_CLASS = NULL; /* For samba 3 */ +static int debug_all_class_hack = 1; +int *DEBUGLEVEL_CLASS = &debug_all_class_hack; /* For samba 3 */ +static bool debug_all_class_isset_hack = true; +bool *DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack; /* For samba 3 */ /* the registered mutex handlers */ static struct { diff --git a/lib/util/params.c b/lib/util/params.c index c03edec272..7af7ac7348 100644 --- a/lib/util/params.c +++ b/lib/util/params.c @@ -105,11 +105,6 @@ static int mygetc(myFILE *f) return (int)( *(f->p++) & 0x00FF ); } -static void myfile_close(myFILE *f) -{ - talloc_free(f); -} - /* -------------------------------------------------------------------------- ** * Functions... */ @@ -565,7 +560,7 @@ bool pm_process( const char *FileName, if( NULL == InFile->bufr ) { DEBUG(0,("%s memory allocation failure.\n", func)); - myfile_close(InFile); + talloc_free(InFile); return( false ); } result = Parse( InFile, sfunc, pfunc, userdata ); @@ -573,7 +568,7 @@ bool pm_process( const char *FileName, InFile->bSize = 0; } - myfile_close(InFile); + talloc_free(InFile); if( !result ) /* Generic failure. */ { diff --git a/lib/util/util.c b/lib/util/util.c index fc55629c4c..1e7991dbf1 100644 --- a/lib/util/util.c +++ b/lib/util/util.c @@ -27,6 +27,7 @@ #include "system/locale.h" #undef malloc #undef strcasecmp +#undef strncasecmp #undef strdup #undef realloc @@ -559,3 +560,280 @@ _PUBLIC_ void *talloc_check_name_abort(const void *ptr, const char *name) return NULL; } +/** + Trim the specified elements off the front and back of a string. +**/ +_PUBLIC_ bool trim_string(char *s, const char *front, const char *back) +{ + bool ret = false; + size_t front_len; + size_t back_len; + size_t len; + + /* Ignore null or empty strings. */ + if (!s || (s[0] == '\0')) + return false; + + front_len = front? strlen(front) : 0; + back_len = back? strlen(back) : 0; + + len = strlen(s); + + if (front_len) { + while (len && strncmp(s, front, front_len)==0) { + /* Must use memmove here as src & dest can + * easily overlap. Found by valgrind. JRA. */ + memmove(s, s+front_len, (len-front_len)+1); + len -= front_len; + ret=true; + } + } + + if (back_len) { + while ((len >= back_len) && strncmp(s+len-back_len,back,back_len)==0) { + s[len-back_len]='\0'; + len -= back_len; + ret=true; + } + } + return ret; +} + +/** + Find the number of 'c' chars in a string +**/ +_PUBLIC_ _PURE_ size_t count_chars(const char *s, char c) +{ + size_t count = 0; + + while (*s) { + if (*s == c) count++; + s ++; + } + + return count; +} + +/** + Routine to get hex characters and turn them into a 16 byte array. + the array can be variable length, and any non-hex-numeric + characters are skipped. "0xnn" or "0Xnn" is specially catered + for. + + valid examples: "0A5D15"; "0x15, 0x49, 0xa2"; "59\ta9\te3\n" + + +**/ +_PUBLIC_ size_t strhex_to_str(char *p, size_t p_len, const char *strhex, size_t strhex_len) +{ + size_t i; + size_t num_chars = 0; + uint8_t lonybble, hinybble; + const char *hexchars = "0123456789ABCDEF"; + char *p1 = NULL, *p2 = NULL; + + for (i = 0; i < strhex_len && strhex[i] != 0; i++) { + if (strncasecmp(hexchars, "0x", 2) == 0) { + i++; /* skip two chars */ + continue; + } + + if (!(p1 = strchr(hexchars, toupper((unsigned char)strhex[i])))) + break; + + i++; /* next hex digit */ + + if (!(p2 = strchr(hexchars, toupper((unsigned char)strhex[i])))) + break; + + /* get the two nybbles */ + hinybble = PTR_DIFF(p1, hexchars); + lonybble = PTR_DIFF(p2, hexchars); + + if (num_chars >= p_len) { + break; + } + + p[num_chars] = (hinybble << 4) | lonybble; + num_chars++; + + p1 = NULL; + p2 = NULL; + } + return num_chars; +} + +/** + * Parse a hex string and return a data blob. + */ +_PUBLIC_ _PURE_ DATA_BLOB strhex_to_data_blob(TALLOC_CTX *mem_ctx, const char *strhex) +{ + DATA_BLOB ret_blob = data_blob_talloc(mem_ctx, NULL, strlen(strhex)/2+1); + + ret_blob.length = strhex_to_str((char *)ret_blob.data, ret_blob.length, + strhex, + strlen(strhex)); + + return ret_blob; +} + + +/** + * Routine to print a buffer as HEX digits, into an allocated string. + */ +_PUBLIC_ void hex_encode(const unsigned char *buff_in, size_t len, char **out_hex_buffer) +{ + int i; + char *hex_buffer; + + *out_hex_buffer = malloc_array_p(char, (len*2)+1); + hex_buffer = *out_hex_buffer; + + for (i = 0; i < len; i++) + slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]); +} + +/** + * talloc version of hex_encode() + */ +_PUBLIC_ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len) +{ + int i; + char *hex_buffer; + + hex_buffer = talloc_array(mem_ctx, char, (len*2)+1); + + for (i = 0; i < len; i++) + slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]); + + return hex_buffer; +} + +/** + Unescape a URL encoded string, in place. +**/ + +_PUBLIC_ void rfc1738_unescape(char *buf) +{ + char *p=buf; + + while ((p=strchr(p,'+'))) + *p = ' '; + + p = buf; + + while (p && *p && (p=strchr(p,'%'))) { + int c1 = p[1]; + int c2 = p[2]; + + if (c1 >= '0' && c1 <= '9') + c1 = c1 - '0'; + else if (c1 >= 'A' && c1 <= 'F') + c1 = 10 + c1 - 'A'; + else if (c1 >= 'a' && c1 <= 'f') + c1 = 10 + c1 - 'a'; + else {p++; continue;} + + if (c2 >= '0' && c2 <= '9') + c2 = c2 - '0'; + else if (c2 >= 'A' && c2 <= 'F') + c2 = 10 + c2 - 'A'; + else if (c2 >= 'a' && c2 <= 'f') + c2 = 10 + c2 - 'a'; + else {p++; continue;} + + *p = (c1<<4) | c2; + + memmove(p+1, p+3, strlen(p+3)+1); + p++; + } +} + +/** + varient of strcmp() that handles NULL ptrs +**/ +_PUBLIC_ int strcmp_safe(const char *s1, const char *s2) +{ + if (s1 == s2) { + return 0; + } + if (s1 == NULL || s2 == NULL) { + return s1?-1:1; + } + return strcmp(s1, s2); +} + + +/** +return the number of bytes occupied by a buffer in ASCII format +the result includes the null termination +limited by 'n' bytes +**/ +_PUBLIC_ size_t ascii_len_n(const char *src, size_t n) +{ + size_t len; + + len = strnlen(src, n); + if (len+1 <= n) { + len += 1; + } + + return len; +} + +/** + Set a boolean variable from the text value stored in the passed string. + Returns true in success, false if the passed string does not correctly + represent a boolean. +**/ + +_PUBLIC_ bool set_boolean(const char *boolean_string, bool *boolean) +{ + if (strwicmp(boolean_string, "yes") == 0 || + strwicmp(boolean_string, "true") == 0 || + strwicmp(boolean_string, "on") == 0 || + strwicmp(boolean_string, "1") == 0) { + *boolean = true; + return true; + } else if (strwicmp(boolean_string, "no") == 0 || + strwicmp(boolean_string, "false") == 0 || + strwicmp(boolean_string, "off") == 0 || + strwicmp(boolean_string, "0") == 0) { + *boolean = false; + return true; + } + return false; +} + +/** +return the number of bytes occupied by a buffer in CH_UTF16 format +the result includes the null termination +**/ +_PUBLIC_ size_t utf16_len(const void *buf) +{ + size_t len; + + for (len = 0; SVAL(buf,len); len += 2) ; + + return len + 2; +} + +/** +return the number of bytes occupied by a buffer in CH_UTF16 format +the result includes the null termination +limited by 'n' bytes +**/ +_PUBLIC_ size_t utf16_len_n(const void *src, size_t n) +{ + size_t len; + + for (len = 0; (len+2 < n) && SVAL(src, len); len += 2) ; + + if (len+2 <= n) { + len += 2; + } + + return len; +} + + diff --git a/lib/util/util.h b/lib/util/util.h index 47adf067f0..4c9a223093 100644 --- a/lib/util/util.h +++ b/lib/util/util.h @@ -236,12 +236,12 @@ _PUBLIC_ char *safe_strcat(char *dest, const char *src, size_t maxlength); **/ -_PUBLIC_ size_t strhex_to_str(char *p, size_t len, const char *strhex); +_PUBLIC_ size_t strhex_to_str(char *p, size_t p_len, const char *strhex, size_t strhex_len); /** * Parse a hex string and return a data blob. */ -_PUBLIC_ _PURE_ DATA_BLOB strhex_to_data_blob(const char *strhex) ; +_PUBLIC_ _PURE_ DATA_BLOB strhex_to_data_blob(TALLOC_CTX *mem_ctx, const char *strhex) ; /** * Routine to print a buffer as HEX digits, into an allocated string. diff --git a/lib/util/util_str.c b/lib/util/util_str.c index bf4ae4d36e..7dcefc90dd 100644 --- a/lib/util/util_str.c +++ b/lib/util/util_str.c @@ -22,71 +22,15 @@ */ #include "includes.h" -#include "libcli/raw/smb.h" #include "system/locale.h" +#undef strncasecmp +#undef strcasemp /** * @file * @brief String utilities. **/ - -/** - Trim the specified elements off the front and back of a string. -**/ -_PUBLIC_ bool trim_string(char *s, const char *front, const char *back) -{ - bool ret = false; - size_t front_len; - size_t back_len; - size_t len; - - /* Ignore null or empty strings. */ - if (!s || (s[0] == '\0')) - return false; - - front_len = front? strlen(front) : 0; - back_len = back? strlen(back) : 0; - - len = strlen(s); - - if (front_len) { - while (len && strncmp(s, front, front_len)==0) { - /* Must use memmove here as src & dest can - * easily overlap. Found by valgrind. JRA. */ - memmove(s, s+front_len, (len-front_len)+1); - len -= front_len; - ret=true; - } - } - - if (back_len) { - while ((len >= back_len) && strncmp(s+len-back_len,back,back_len)==0) { - s[len-back_len]='\0'; - len -= back_len; - ret=true; - } - } - return ret; -} - -/** - Find the number of 'c' chars in a string -**/ -_PUBLIC_ _PURE_ size_t count_chars(const char *s, char c) -{ - size_t count = 0; - - while (*s) { - if (*s == c) count++; - s ++; - } - - return count; -} - - - /** Safe string copy into a known length string. maxlength does not include the terminating zero. @@ -168,137 +112,6 @@ _PUBLIC_ char *safe_strcat(char *dest, const char *src, size_t maxlength) return dest; } -/** - Routine to get hex characters and turn them into a 16 byte array. - the array can be variable length, and any non-hex-numeric - characters are skipped. "0xnn" or "0Xnn" is specially catered - for. - - valid examples: "0A5D15"; "0x15, 0x49, 0xa2"; "59\ta9\te3\n" - - -**/ -_PUBLIC_ size_t strhex_to_str(char *p, size_t len, const char *strhex) -{ - size_t i; - size_t num_chars = 0; - uint8_t lonybble, hinybble; - const char *hexchars = "0123456789ABCDEF"; - char *p1 = NULL, *p2 = NULL; - - for (i = 0; i < len && strhex[i] != 0; i++) { - if (strncasecmp(hexchars, "0x", 2) == 0) { - i++; /* skip two chars */ - continue; - } - - if (!(p1 = strchr(hexchars, toupper((unsigned char)strhex[i])))) - break; - - i++; /* next hex digit */ - - if (!(p2 = strchr(hexchars, toupper((unsigned char)strhex[i])))) - break; - - /* get the two nybbles */ - hinybble = PTR_DIFF(p1, hexchars); - lonybble = PTR_DIFF(p2, hexchars); - - p[num_chars] = (hinybble << 4) | lonybble; - num_chars++; - - p1 = NULL; - p2 = NULL; - } - return num_chars; -} - -/** - * Parse a hex string and return a data blob. - */ -_PUBLIC_ _PURE_ DATA_BLOB strhex_to_data_blob(const char *strhex) -{ - DATA_BLOB ret_blob = data_blob(NULL, strlen(strhex)/2+1); - - ret_blob.length = strhex_to_str((char *)ret_blob.data, - strlen(strhex), - strhex); - - return ret_blob; -} - - -/** - * Routine to print a buffer as HEX digits, into an allocated string. - */ -_PUBLIC_ void hex_encode(const unsigned char *buff_in, size_t len, char **out_hex_buffer) -{ - int i; - char *hex_buffer; - - *out_hex_buffer = malloc_array_p(char, (len*2)+1); - hex_buffer = *out_hex_buffer; - - for (i = 0; i < len; i++) - slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]); -} - -/** - * talloc version of hex_encode() - */ -_PUBLIC_ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len) -{ - int i; - char *hex_buffer; - - hex_buffer = talloc_array(mem_ctx, char, (len*2)+1); - - for (i = 0; i < len; i++) - slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]); - - return hex_buffer; -} - -/** - Unescape a URL encoded string, in place. -**/ - -_PUBLIC_ void rfc1738_unescape(char *buf) -{ - char *p=buf; - - while ((p=strchr(p,'+'))) - *p = ' '; - - p = buf; - - while (p && *p && (p=strchr(p,'%'))) { - int c1 = p[1]; - int c2 = p[2]; - - if (c1 >= '0' && c1 <= '9') - c1 = c1 - '0'; - else if (c1 >= 'A' && c1 <= 'F') - c1 = 10 + c1 - 'A'; - else if (c1 >= 'a' && c1 <= 'f') - c1 = 10 + c1 - 'a'; - else {p++; continue;} - - if (c2 >= '0' && c2 <= '9') - c2 = c2 - '0'; - else if (c2 >= 'A' && c2 <= 'F') - c2 = 10 + c2 - 'A'; - else if (c2 >= 'a' && c2 <= 'f') - c2 = 10 + c2 - 'a'; - else {p++; continue;} - - *p = (c1<<4) | c2; - - memmove(p+1, p+3, strlen(p+3)+1); - p++; - } -} - #ifdef VALGRIND size_t valgrind_strlen(const char *s) { @@ -367,109 +180,6 @@ _PUBLIC_ bool add_string_to_array(TALLOC_CTX *mem_ctx, return true; } - - -/** - varient of strcmp() that handles NULL ptrs -**/ -_PUBLIC_ int strcmp_safe(const char *s1, const char *s2) -{ - if (s1 == s2) { - return 0; - } - if (s1 == NULL || s2 == NULL) { - return s1?-1:1; - } - return strcmp(s1, s2); -} - - -/** -return the number of bytes occupied by a buffer in ASCII format -the result includes the null termination -limited by 'n' bytes -**/ -_PUBLIC_ size_t ascii_len_n(const char *src, size_t n) -{ - size_t len; - - len = strnlen(src, n); - if (len+1 <= n) { - len += 1; - } - - return len; -} - - -/** - Return a string representing a CIFS attribute for a file. -**/ -_PUBLIC_ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib) -{ - int i, len; - const struct { - char c; - uint16_t attr; - } attr_strs[] = { - {'V', FILE_ATTRIBUTE_VOLUME}, - {'D', FILE_ATTRIBUTE_DIRECTORY}, - {'A', FILE_ATTRIBUTE_ARCHIVE}, - {'H', FILE_ATTRIBUTE_HIDDEN}, - {'S', FILE_ATTRIBUTE_SYSTEM}, - {'N', FILE_ATTRIBUTE_NORMAL}, - {'R', FILE_ATTRIBUTE_READONLY}, - {'d', FILE_ATTRIBUTE_DEVICE}, - {'t', FILE_ATTRIBUTE_TEMPORARY}, - {'s', FILE_ATTRIBUTE_SPARSE}, - {'r', FILE_ATTRIBUTE_REPARSE_POINT}, - {'c', FILE_ATTRIBUTE_COMPRESSED}, - {'o', FILE_ATTRIBUTE_OFFLINE}, - {'n', FILE_ATTRIBUTE_NONINDEXED}, - {'e', FILE_ATTRIBUTE_ENCRYPTED} - }; - char *ret; - - ret = talloc_array(mem_ctx, char, ARRAY_SIZE(attr_strs)+1); - if (!ret) { - return NULL; - } - - for (len=i=0; i<ARRAY_SIZE(attr_strs); i++) { - if (attrib & attr_strs[i].attr) { - ret[len++] = attr_strs[i].c; - } - } - - ret[len] = 0; - - return ret; -} - -/** - Set a boolean variable from the text value stored in the passed string. - Returns true in success, false if the passed string does not correctly - represent a boolean. -**/ - -_PUBLIC_ bool set_boolean(const char *boolean_string, bool *boolean) -{ - if (strwicmp(boolean_string, "yes") == 0 || - strwicmp(boolean_string, "true") == 0 || - strwicmp(boolean_string, "on") == 0 || - strwicmp(boolean_string, "1") == 0) { - *boolean = true; - return true; - } else if (strwicmp(boolean_string, "no") == 0 || - strwicmp(boolean_string, "false") == 0 || - strwicmp(boolean_string, "off") == 0 || - strwicmp(boolean_string, "0") == 0) { - *boolean = false; - return true; - } - return false; -} - /** * Parse a string containing a boolean value. * @@ -558,44 +268,6 @@ _PUBLIC_ bool conv_str_u64(const char * str, uint64_t * val) } /** -return the number of bytes occupied by a buffer in CH_UTF16 format -the result includes the null termination -**/ -_PUBLIC_ size_t utf16_len(const void *buf) -{ - size_t len; - - for (len = 0; SVAL(buf,len); len += 2) ; - - return len + 2; -} - -/** -return the number of bytes occupied by a buffer in CH_UTF16 format -the result includes the null termination -limited by 'n' bytes -**/ -_PUBLIC_ size_t utf16_len_n(const void *src, size_t n) -{ - size_t len; - - for (len = 0; (len+2 < n) && SVAL(src, len); len += 2) ; - - if (len+2 <= n) { - len += 2; - } - - return len; -} - -_PUBLIC_ size_t ucs2_align(const void *base_ptr, const void *p, int flags) -{ - if (flags & (STR_NOALIGN|STR_ASCII)) - return 0; - return PTR_DIFF(p, base_ptr) & 1; -} - -/** Do a case-insensitive, whitespace-ignoring string compare. **/ _PUBLIC_ int strwicmp(const char *psz1, const char *psz2) @@ -626,17 +298,6 @@ _PUBLIC_ int strwicmp(const char *psz1, const char *psz2) } /** - String replace. -**/ -_PUBLIC_ void string_replace(char *s, char oldc, char newc) -{ - while (*s) { - if (*s == oldc) *s = newc; - s++; - } -} - -/** * Compare 2 strings. * * @note The comparison is case-insensitive. @@ -650,3 +311,23 @@ _PUBLIC_ bool strequal(const char *s1, const char *s2) return strcasecmp(s1,s2) == 0; } + +_PUBLIC_ size_t ucs2_align(const void *base_ptr, const void *p, int flags) +{ + if (flags & (STR_NOALIGN|STR_ASCII)) + return 0; + return PTR_DIFF(p, base_ptr) & 1; +} + +/** + String replace. +**/ +_PUBLIC_ void string_replace(char *s, char oldc, char newc) +{ + while (*s) { + if (*s == oldc) *s = newc; + s++; + } +} + + diff --git a/source4/librpc/idl/drsblobs.idl b/librpc/idl/drsblobs.idl index 087f0c982d..087f0c982d 100644 --- a/source4/librpc/idl/drsblobs.idl +++ b/librpc/idl/drsblobs.idl diff --git a/source3/librpc/idl/drsuapi.idl b/librpc/idl/drsuapi.idl index 9d7c9d9789..e4b5dc1fd9 100644 --- a/source3/librpc/idl/drsuapi.idl +++ b/librpc/idl/drsuapi.idl @@ -2,13 +2,13 @@ import "security.idl", "misc.idl", "samr.idl"; -[ +[ uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"), version(4.0), endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"), authservice("ldap"), helpstring("Active Directory Replication"), - helper("librpc/ndr/ndr_drsuapi.h"), + helper("../librpc/ndr/ndr_drsuapi.h"), pointer_default(unique) ] interface drsuapi @@ -115,11 +115,11 @@ interface drsuapi } drsuapi_DsBindInfoCtr; /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work - * + * * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04 */ const char *DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d"; - /* + /* * this magic guid are needed to fetch the whole tree with drsuapi_DsGetNCChanges() * as administrator and this values are also used in the destination_dsa_guid field * of drsuapi_DsGetNCChangesReq5/8 and the source_dsa_guid is zero. @@ -232,7 +232,7 @@ interface drsuapi DRSUAPI_DS_REPLICA_NEIGHBOUR_PREEMPTED = 0x01000000, DRSUAPI_DS_REPLICA_NEIGHBOUR_IGNORE_CHANGE_NOTIFICATIONS = 0x04000000, DRSUAPI_DS_REPLICA_NEIGHBOUR_DISABLE_SCHEDULED_SYNC = 0x08000000, - /* + /* * the following NOTE applies to DsGetNCChangesRequest5: * - the data is only compressed when 10 or more objects are replicated * - but there could also be a size limit of 35 KBytes or something like that @@ -454,7 +454,7 @@ interface drsuapi DRSUAPI_ATTRIBUTE_objectCategory = 0x0009030e, DRSUAPI_ATTRIBUTE_gPLink = 0x0009037b, DRSUAPI_ATTRIBUTE_msDS_Behavior_Version = 0x000905b3, - DRSUAPI_ATTRIBUTE_msDS_KeyVersionNumber = 0x000906f6, + DRSUAPI_ATTRIBUTE_msDS_KeyVersionNumber = 0x000906f6, DRSUAPI_ATTRIBUTE_msDS_HasDomainNCs = 0x0009071c, DRSUAPI_ATTRIBUTE_msDS_hasMasterNCs = 0x0009072c } drsuapi_DsAttributeId; @@ -1144,7 +1144,7 @@ interface drsuapi /* * please note the the current idl - * for DsAddEntry does only parse + * for DsAddEntry does only parse * what I saw between 2 w2k3 boxes * in my dssync experiments I got some other replies * so all I want to say is that this is very incomplete yet... diff --git a/librpc/idl/ntsvcs.idl b/librpc/idl/ntsvcs.idl index cfafbead6c..809ead90c3 100644 --- a/librpc/idl/ntsvcs.idl +++ b/librpc/idl/ntsvcs.idl @@ -67,7 +67,12 @@ interface ntsvcs /******************/ /* Function: 0x0a */ - [todo] WERROR PNP_GetDeviceList(); + [todo] WERROR PNP_GetDeviceList( + [in,unique] [string,charset(UTF16)] uint16 *filter, + [out,ref] [size_is(*length),length_is(*length)] uint16 *buffer, + [in,out,ref] uint32 *length, + [in] uint32 flags + ); /******************/ /* Function: 0x0b */ @@ -91,11 +96,11 @@ interface ntsvcs WERROR PNP_GetDeviceRegProp( [in,ref] [string,charset(UTF16)] uint16 *devicepath, [in] uint32 property, - [in,out,ref] uint32 *unknown1, + [in,out,ref] uint32 *reg_data_type, [out,ref] [size_is(*buffer_size)] [length_is(*buffer_size)] uint8 *buffer, [in,out,ref] uint32 *buffer_size, [in,out,ref] uint32 *needed, - [in] uint32 unknown3 + [in] uint32 flags ); /******************/ diff --git a/source4/librpc/ndr/ndr_drsblobs.c b/librpc/ndr/ndr_drsblobs.c index aecb0c3b16..aecb0c3b16 100644 --- a/source4/librpc/ndr/ndr_drsblobs.c +++ b/librpc/ndr/ndr_drsblobs.c diff --git a/source4/librpc/ndr/ndr_drsuapi.c b/librpc/ndr/ndr_drsuapi.c index cb022d2ad3..4d1ae8b163 100644 --- a/source4/librpc/ndr/ndr_drsuapi.c +++ b/librpc/ndr/ndr_drsuapi.c @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. routines for printing some linked list structs in DRSUAPI @@ -9,12 +9,12 @@ 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/>. */ @@ -25,8 +25,10 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "../lib/util/asn1.h" #include "librpc/ndr/ndr_compression.h" +/* We don't need multibyte if we're just comparing to 'ff' */ +#undef strncasecmp -void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name, +void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaObjectListItem *r) { ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItem"); @@ -92,7 +94,7 @@ enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_fl DATA_BLOB blob; if (strncasecmp("ff", r->oid, 2) == 0) { - blob = strhex_to_data_blob(r->oid); + blob = strhex_to_data_blob(ndr, r->oid); if (!blob.data) { return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "HEX String Conversion Error: %s\n", @@ -101,7 +103,6 @@ enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_fl } else { _OID_PUSH_CHECK(ber_write_OID_String(&blob, r->oid)); } - talloc_steal(ndr, blob.data); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length)); NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, blob.data, blob.length)); @@ -165,7 +166,7 @@ size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags) if (!oid) return 0; if (strncasecmp("ff", oid, 2) == 0) { - _blob = strhex_to_data_blob(oid); + _blob = strhex_to_data_blob(NULL, oid); if (_blob.data) { ret = _blob.length; } diff --git a/source4/librpc/ndr/ndr_drsuapi.h b/librpc/ndr/ndr_drsuapi.h index c663eadd7a..12c2c78bde 100644 --- a/source4/librpc/ndr/ndr_drsuapi.h +++ b/librpc/ndr/ndr_drsuapi.h @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. routines for printing some linked list structs in DRSUAPI @@ -9,12 +9,12 @@ 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/>. */ @@ -22,7 +22,7 @@ #ifndef _LIBRPC_NDR_NDR_DRSUAPI_H #define _LIBRPC_NDR_NDR_DRSUAPI_H -void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name, +void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaObjectListItem *r); void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name, diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c index 3ecf10a167..b24868eace 100644 --- a/librpc/tools/ndrdump.c +++ b/librpc/tools/ndrdump.c @@ -26,8 +26,6 @@ #include "librpc/ndr/libndr.h" #include "librpc/ndr/ndr_table.h" #include "param/param.h" -#else -#define _NORETURN_ #endif static const struct ndr_interface_call *find_function( diff --git a/packaging/README.Debian b/packaging4/README.Debian index 2eedd7a1ec..2eedd7a1ec 100644 --- a/packaging/README.Debian +++ b/packaging4/README.Debian diff --git a/source4/selftest/README b/selftest/README index f8be20a569..f8be20a569 100644 --- a/source4/selftest/README +++ b/selftest/README diff --git a/source4/selftest/SocketWrapper.pm b/selftest/SocketWrapper.pm index e63605b8df..e63605b8df 100644 --- a/source4/selftest/SocketWrapper.pm +++ b/selftest/SocketWrapper.pm diff --git a/source4/selftest/Subunit.pm b/selftest/Subunit.pm index 05e51da541..05e51da541 100644 --- a/source4/selftest/Subunit.pm +++ b/selftest/Subunit.pm diff --git a/source4/selftest/TODO b/selftest/TODO index 67776ffc76..67776ffc76 100644 --- a/source4/selftest/TODO +++ b/selftest/TODO diff --git a/source4/selftest/output/buildfarm.pm b/selftest/output/buildfarm.pm index cee6c1e63a..cee6c1e63a 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/selftest/output/buildfarm.pm diff --git a/source4/selftest/output/html.pm b/selftest/output/html.pm index 1049527129..1049527129 100644 --- a/source4/selftest/output/html.pm +++ b/selftest/output/html.pm diff --git a/source4/selftest/output/plain.pm b/selftest/output/plain.pm index 4e1e290534..4e1e290534 100644 --- a/source4/selftest/output/plain.pm +++ b/selftest/output/plain.pm diff --git a/source4/selftest/output/testresults.css b/selftest/output/testresults.css index 66d1d6b2ad..66d1d6b2ad 100644 --- a/source4/selftest/output/testresults.css +++ b/selftest/output/testresults.css diff --git a/source4/selftest/selftest.pl b/selftest/selftest.pl index 92aa67e8d3..1477d10d46 100755 --- a/source4/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -405,8 +405,8 @@ if (defined($ENV{RUN_FROM_BUILD_FARM}) and my $tls_enabled = not $opt_quick; $ENV{TLS_ENABLED} = ($tls_enabled?"yes":"no"); -$ENV{LDB_MODULES_PATH} = "$old_pwd/bin/modules/ldb"; -$ENV{LD_SAMBA_MODULE_PATH} = "$old_pwd/bin/modules"; +$ENV{LDB_MODULES_PATH} = "$old_pwd/source4/bin/modules/ldb"; +$ENV{LD_SAMBA_MODULE_PATH} = "$old_pwd/source4/bin/modules"; sub prefix_pathvar($$) { my ($name, $newpath) = @_; @@ -416,8 +416,8 @@ sub prefix_pathvar($$) $ENV{$name} = $newpath; } } -prefix_pathvar("PKG_CONFIG_PATH", "$old_pwd/bin/pkgconfig"); -prefix_pathvar("PYTHONPATH", "$old_pwd/bin/python"); +prefix_pathvar("PKG_CONFIG_PATH", "$old_pwd/source4/bin/pkgconfig"); +prefix_pathvar("PYTHONPATH", "$old_pwd/source4/bin/python"); if ($opt_socket_wrapper_keep_pcap) { # Socket wrapper keep pcap implies socket wrapper pcap diff --git a/source4/selftest/target/Kvm.pm b/selftest/target/Kvm.pm index 3b17a2909c..3b17a2909c 100644 --- a/source4/selftest/target/Kvm.pm +++ b/selftest/target/Kvm.pm diff --git a/source4/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index b0c4eb22bd..b0c4eb22bd 100644 --- a/source4/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm diff --git a/source4/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 9364008ee2..9364008ee2 100644 --- a/source4/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm diff --git a/source4/selftest/target/Windows.pm b/selftest/target/Windows.pm index d0c90d7f7b..d0c90d7f7b 100644 --- a/source4/selftest/target/Windows.pm +++ b/selftest/target/Windows.pm diff --git a/source4/selftest/test_samba4.pl b/selftest/test_samba4.pl index f2935be66b..f2935be66b 100755 --- a/source4/selftest/test_samba4.pl +++ b/selftest/test_samba4.pl diff --git a/source4/selftest/test_subunit.pl b/selftest/test_subunit.pl index 28522ed49f..28522ed49f 100755 --- a/source4/selftest/test_subunit.pl +++ b/selftest/test_subunit.pl diff --git a/source3/Makefile.in b/source3/Makefile.in index 1a607c463d..12d37ce6b0 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -196,7 +196,7 @@ TORTURE_PROGS = bin/smbtorture@EXEEXT@ bin/msgtest@EXEEXT@ \ bin/locktest2@EXEEXT@ bin/nsstest@EXEEXT@ bin/vfstest@EXEEXT@ \ bin/pdbtest@EXEEXT@ bin/talloctort@EXEEXT@ bin/replacetort@EXEEXT@ \ bin/tdbtorture@EXEEXT@ \ - bin/smbconftort@EXEEXT@ + bin/smbconftort@EXEEXT@ bin/vlp@EXEEXT@ BIN_PROGS = @EXTRA_BIN_PROGS@ \ $(BIN_PROGS1) $(BIN_PROGS2) $(BIN_PROGS3) $(BIN_PROGS4) @@ -247,9 +247,10 @@ SERVER_MUTEX_OBJ = lib/server_mutex.o PASSCHANGE_OBJ = libsmb/passchange.o -LIBNDR_DRSUAPI_OBJ = librpc/ndr/ndr_drsuapi.o \ +LIBNDR_DRSUAPI_OBJ = ../librpc/ndr/ndr_drsuapi.o \ ../librpc/ndr/ndr_compression.o \ librpc/gen_ndr/ndr_drsuapi.o \ + ../librpc/ndr/ndr_drsblobs.o \ librpc/gen_ndr/ndr_drsblobs.o ZLIB_OBJ = @ZLIB_OBJS@ @@ -318,7 +319,8 @@ LIBSAMBAUTIL_OBJ = @LIBTALLOC_STATIC@ \ UTIL_OBJ = ../lib/util/rbtree.o ../lib/util/signal.o ../lib/util/time.o \ ../lib/util/xfile.o ../lib/util/util_strlist.o \ ../lib/util/util_file.o ../lib/util/data_blob.o \ - ../lib/util/util.o ../lib/util/fsusage.o + ../lib/util/util.o ../lib/util/fsusage.o \ + ../lib/util/params.o CRYPTO_OBJ = ../lib/crypto/crc32.o ../lib/crypto/md5.o \ ../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \ @@ -360,7 +362,7 @@ READLINE_OBJ = lib/readline.o # Be sure to include them into your application POPT_LIB_OBJ = lib/popt_common.o -PARAM_WITHOUT_REG_OBJ = dynconfig.o param/loadparm.o ../lib/util/params.o param/util.o lib/sharesec.o lib/ldap_debug_handler.o +PARAM_WITHOUT_REG_OBJ = dynconfig.o param/loadparm.o param/util.o lib/sharesec.o lib/ldap_debug_handler.o PARAM_REG_ADD_OBJ = $(REG_SMBCONF_OBJ) $(LIBSMBCONF_OBJ) $(PRIVILEGES_BASIC_OBJ) PARAM_OBJ = $(PARAM_WITHOUT_REG_OBJ) $(PARAM_REG_ADD_OBJ) @@ -918,7 +920,7 @@ SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) \ MASKTEST_OBJ = torture/masktest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(LIB_NONSMBD_OBJ) \ - $(LIBNDR_GEN_OBJ0) + $(LIBNDR_GEN_OBJ0) $(ZLIB_LIBS) MSGTEST_OBJ = torture/msgtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(LIB_NONSMBD_OBJ) \ @@ -926,7 +928,7 @@ MSGTEST_OBJ = torture/msgtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ LOCKTEST_OBJ = torture/locktest.o $(PARAM_OBJ) $(LOCKING_OBJ) $(KRBCLIENT_OBJ) \ $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) \ - $(LIBNDR_GEN_OBJ0) + $(LIBNDR_GEN_OBJ0) $(ZLIB_LIBS) NSSTEST_OBJ = torture/nsstest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(LIB_NONSMBD_OBJ) \ @@ -945,7 +947,7 @@ LOG2PCAP_OBJ = utils/log2pcaphex.o LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \ $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \ - $(LIBNDR_GEN_OBJ0) + $(LIBNDR_GEN_OBJ0) $(ZLIB_LIBS) SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \ @@ -1161,7 +1163,7 @@ pam_winbind: SHOWFLAGS bin/pam_winbind.@SHLIBEXT@ gpext_modules:: $(GPEXT_MODULES) -torture:: SHOWFLAGS $(TORTURE_PROGS) +torture:: SHOWFLAGS $(TORTURE_PROGS) smbtorture : SHOWFLAGS bin/smbtorture@EXEEXT@ @@ -1212,8 +1214,8 @@ samba3-idl:: ../librpc/idl/notify.idl ../librpc/idl/epmapper.idl librpc/idl/messaging.idl \ ../librpc/idl/xattr.idl ../librpc/idl/misc.idl librpc/idl/samr.idl \ ../librpc/idl/security.idl ../librpc/idl/dssetup.idl librpc/idl/krb5pac.idl \ - ../librpc/idl/ntsvcs.idl librpc/idl/libnetapi.idl librpc/idl/drsuapi.idl \ - librpc/idl/drsblobs.idl ../librpc/idl/nbt.idl + ../librpc/idl/ntsvcs.idl librpc/idl/libnetapi.idl ../librpc/idl/drsuapi.idl \ + ../librpc/idl/drsblobs.idl ../librpc/idl/nbt.idl ##################################################################### @@ -1327,40 +1329,41 @@ bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARE $(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \ $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) \ $(POPT_LIBS) @SMBD_LIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \ - $(WINBIND_LIBS) + $(WINBIND_LIBS) $(ZLIB_LIBS) bin/nmbd@EXEEXT@: $(BINARY_PREREQS) $(NMBD_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(POPT_LIBS) \ - $(KRB5LIBS) $(LDAP_LIBS) + $(KRB5LIBS) $(LDAP_LIBS) $(ZLIB_LIBS) bin/swat@EXEEXT@: $(BINARY_PREREQS) $(SWAT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINT_LIBS) \ $(AUTH_LIBS) $(LIBS) $(PASSDB_LIBS) $(POPT_LIBS) $(KRB5LIBS) \ - $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS) bin/rpcclient@EXEEXT@: $(BINARY_PREREQS) $(RPCCLIENT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(PASSDB_LIBS) $(RPCCLIENT_OBJ) \ $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) $(POPT_LIBS) \ $(KRB5LIBS) $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \ - $(WINBIND_LIBS) + $(WINBIND_LIBS) $(ZLIB_LIBS) bin/smbclient@EXEEXT@: $(BINARY_PREREQS) $(CLIENT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(DYNEXP) \ $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) $(POPT_LIBS) \ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(DNSSD_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS) bin/net@EXEEXT@: $(BINARY_PREREQS) $(NET_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @LIBNETAPI_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \ $(POPT_LIBS) $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) \ $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) \ - @INIPARSERLIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(LIBNETAPI_LIBS) + @INIPARSERLIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(LIBNETAPI_LIBS) \ + $(ZLIB_LIBS) bin/profiles@EXEEXT@: $(BINARY_PREREQS) $(PROFILES_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @@ -1370,7 +1373,7 @@ bin/profiles@EXEEXT@: $(BINARY_PREREQS) $(PROFILES_OBJ) @BUILD_POPT@ @LIBTALLOC_ bin/smbspool@EXEEXT@: $(BINARY_PREREQS) $(CUPS_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(CUPS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \ - $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) + $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS) bin/mount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ) @BUILD_POPT@ @echo Linking $@ @@ -1408,13 +1411,13 @@ bin/smbtree@EXEEXT@: $(BINARY_PREREQS) $(SMBTREE_OBJ) @BUILD_POPT@ @LIBTALLOC_SH @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(DYNEXP) \ $(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS) bin/smbpasswd@EXEEXT@: $(BINARY_PREREQS) $(SMBPASSWD_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(PASSDB_LIBS) \ $(DYNEXP) $(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS) bin/pdbedit@EXEEXT@: $(BINARY_PREREQS) $(PDBEDIT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @@ -1426,7 +1429,7 @@ bin/smbget@EXEEXT@: $(BINARY_PREREQS) $(SMBGET_OBJ) @BUILD_POPT@ @LIBTALLOC_SHAR @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS) bin/nmblookup@EXEEXT@: $(BINARY_PREREQS) $(NMBLOOKUP_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @@ -1437,7 +1440,7 @@ bin/smbtorture@EXEEXT@: $(BINARY_PREREQS) $(SMBTORTURE_OBJ) @BUILD_POPT@ @LIBTAL @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBTORTURE_OBJ) $(LDFLAGS) $(DYNEXP) \ $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) \ - $(LIBTDB_LIBS) + $(LIBTDB_LIBS) $(ZLIB_LIBS) bin/talloctort@EXEEXT@: $(BINARY_PREREQS) $(TALLOCTORT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @@ -1460,25 +1463,25 @@ bin/masktest@EXEEXT@: $(BINARY_PREREQS) $(MASKTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(MASKTEST_OBJ) $(LDFLAGS) $(DYNEXP) \ $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS) bin/msgtest@EXEEXT@: $(BINARY_PREREQS) $(MSGTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(MSGTEST_OBJ) $(LDFLAGS) $(DYNEXP) \ $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS) bin/smbcacls@EXEEXT@: $(BINARY_PREREQS) $(SMBCACLS_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBCACLS_OBJ) $(DYNEXP) $(LDFLAGS) \ $(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS) bin/smbcquotas@EXEEXT@: $(BINARY_PREREQS) $(SMBCQUOTAS_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBCQUOTAS_OBJ) $(DYNEXP) $(LDFLAGS) \ $(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS) bin/eventlogadm@EXEEXT@: $(BINARY_PREREQS) $(EVTLOGADM_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @@ -1494,19 +1497,19 @@ bin/locktest@EXEEXT@: $(BINARY_PREREQS) $(LOCKTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(LOCKTEST_OBJ) $(LDFLAGS) $(DYNEXP) \ $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS) bin/nsstest@EXEEXT@: $(BINARY_PREREQS) $(NSSTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(NSSTEST_OBJ) $(LDFLAGS) $(DYNEXP) \ $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS) bin/pdbtest@EXEEXT@: $(BINARY_PREREQS) $(PDBTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(PDBTEST_OBJ) $(LDFLAGS) $(DYNEXP) \ $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ - $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS) bin/vfstest@EXEEXT@: $(BINARY_PREREQS) $(VFSTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @@ -1514,7 +1517,7 @@ bin/vfstest@EXEEXT@: $(BINARY_PREREQS) $(VFSTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SH $(TERMLIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \ $(ACL_LIBS) $(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) \ @SMBD_LIBS@ $(NSCD_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \ - $(WINBIND_LIBS) + $(WINBIND_LIBS) $(ZLIB_LIBS) bin/smbiconv@EXEEXT@: $(BINARY_PREREQS) $(SMBICONV_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @@ -1531,7 +1534,7 @@ bin/locktest2@EXEEXT@: $(BINARY_PREREQS) $(LOCKTEST2_OBJ) @BUILD_POPT@ @LIBTALLO @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(LOCKTEST2_OBJ) $(LDFLAGS) $(DYNEXP) \ $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS) bin/ndrdump@EXEEXT@: $(BINARY_PREREQS) $(NDRDUMP_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @echo Linking $@ @@ -1547,7 +1550,7 @@ bin/smbfilter@EXEEXT@: $(BINARY_PREREQS) $(SMBFILTER_OBJ) @BUILD_POPT@ @LIBTALLO @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBFILTER_OBJ) $(LDFLAGS) $(LIBS) \ $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS) bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @@ -2171,14 +2174,16 @@ bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ @LIBTALLOC_ @echo "Linking $@" @$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) \ - $(PASSDB_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(PASSDB_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) \ + $(ZLIB_LIBS) bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @echo "Linking $@" @$(CC) $(FLAGS) -o $@ $(VLP_OBJ) $(LDFLAGS) $(DYNEXP) \ $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) $(POPT_LIBS) \ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \ - $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) + $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) \ + $(ZLIB_LIBS) @WINBIND_NSS@: $(BINARY_PREREQS) $(WINBIND_NSS_OBJ) @echo "Linking $@" diff --git a/source3/include/includes.h b/source3/include/includes.h index 9594393474..ac5b2b215c 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -71,23 +71,6 @@ #undef HAVE_TERMIOS_H #endif -#ifndef _PUBLIC_ -#ifdef HAVE_VISIBILITY_ATTR -# define _PUBLIC_ __attribute__((visibility("default"))) -#else -# define _PUBLIC_ -#endif -#endif - -#if defined(__GNUC__) && !defined(__cplusplus) -/** gcc attribute used on function parameters so that it does not emit - * warnings about them being unused. **/ -# define UNUSED(param) param __attribute__ ((unused)) -#else -# define UNUSED(param) param -/** Feel free to add definitions for other compilers here. */ -#endif - #ifdef RELIANTUNIX /* * <unistd.h> has to be included before any other to get @@ -288,12 +271,10 @@ typedef int ber_int_t; /* * Define additional missing types */ -#if defined(HAVE_SIG_ATOMIC_T_TYPE) && defined(AIX) +#if defined(AIX) typedef sig_atomic_t SIG_ATOMIC_T; -#elif defined(HAVE_SIG_ATOMIC_T_TYPE) && !defined(AIX) -typedef sig_atomic_t volatile SIG_ATOMIC_T; #else -typedef int volatile SIG_ATOMIC_T; +typedef sig_atomic_t volatile SIG_ATOMIC_T; #endif #ifndef uchar @@ -593,6 +574,7 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx); /* Lists, trees, caching, database... */ #include "../lib/util/xfile.h" #include "../lib/util/memory.h" +#include "../lib/util/attr.h" #include "intl.h" #include "../lib/util/dlinklist.h" #include "tdb.h" @@ -782,14 +764,6 @@ enum flush_reason_enum { /* prototypes from lib/util_transfer_file.c */ #include "transfer_file.h" -#ifdef __COMPAR_FN_T -#define QSORT_CAST (__compar_fn_t) -#endif - -#ifndef QSORT_CAST -#define QSORT_CAST (int (*)(const void *, const void *)) -#endif - #ifndef DEFAULT_PRINTING #ifdef HAVE_CUPS #define DEFAULT_PRINTING PRINT_CUPS @@ -1107,19 +1081,11 @@ ssize_t readahead(int fd, off64_t offset, size_t count); #define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr))) #define CONST_ADD(type, ptr) ((type) ((const void *) (ptr))) -#ifndef NORETURN_ATTRIBUTE -#if (__GNUC__ >= 3) -#define NORETURN_ATTRIBUTE __attribute__ ((noreturn)) -#else -#define NORETURN_ATTRIBUTE -#endif -#endif - -void smb_panic( const char *why ) NORETURN_ATTRIBUTE ; -void dump_core(void) NORETURN_ATTRIBUTE ; -void exit_server(const char *const reason) NORETURN_ATTRIBUTE ; -void exit_server_cleanly(const char *const reason) NORETURN_ATTRIBUTE ; -void exit_server_fault(void) NORETURN_ATTRIBUTE ; +void smb_panic( const char *why ) _NORETURN_; +void dump_core(void) _NORETURN_; +void exit_server(const char *const reason) _NORETURN_; +void exit_server_cleanly(const char *const reason) _NORETURN_; +void exit_server_fault(void) _NORETURN_; #ifdef HAVE_LIBNSCD #include "libnscd.h" diff --git a/source3/include/msdfs.h b/source3/include/msdfs.h index 4551325843..800393c75d 100644 --- a/source3/include/msdfs.h +++ b/source3/include/msdfs.h @@ -64,12 +64,4 @@ struct dfs_path { bool posix_path; }; -#define init_dfsroot(conn, inbuf, outbuf) \ -{ if (lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) { \ - DEBUG(2,("Serving %s as a Dfs root\n", \ - lp_servicename(SNUM(conn)) )); \ - SSVAL(outbuf, smb_vwv2, SMB_SHARE_IN_DFS \ - | SVAL(outbuf, smb_vwv2)); \ -} } - #endif /* _MSDFS_H */ diff --git a/source3/include/proto.h b/source3/include/proto.h index c4c89b0448..18bbd11ab9 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -577,8 +577,8 @@ void gencache_unlock_entry( const char *key ); void set_rand_reseed_callback(void (*fn)(int *)); void set_need_random_reseed(void); -void generate_random_buffer( unsigned char *out, int len); -char *generate_random_str(size_t len); +void generate_random_buffer(uint8_t *out, int len); +char *generate_random_str(TALLOC_CTX *mem_ctx, size_t len); /* The following definitions come from lib/iconv.c */ @@ -770,12 +770,6 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf /* The following definitions come from lib/sendfile.c */ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); /* The following definitions come from lib/server_mutex.c */ diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c index 57314c55df..076a2fd518 100644 --- a/source3/lib/genrand.c +++ b/source3/lib/genrand.c @@ -156,7 +156,7 @@ static int do_reseed(bool use_fd, int fd) Interface to the (hopefully) good crypto random number generator. ********************************************************************/ -void generate_random_buffer( unsigned char *out, int len) +void generate_random_buffer(uint8_t *out, int len) { static int urand_fd = -1; unsigned char md4_buf[64]; @@ -205,15 +205,11 @@ void generate_random_buffer( unsigned char *out, int len) static char c_list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_-#.,"; -char *generate_random_str(size_t len) +char *generate_random_str(TALLOC_CTX *mem_ctx, size_t len) { - static unsigned char retstr[256]; + unsigned char *retstr = talloc_zero_array(mem_ctx, unsigned char, len); size_t i; - memset(retstr, '\0', sizeof(retstr)); - - if (len > sizeof(retstr)-1) - len = sizeof(retstr) -1; generate_random_buffer( retstr, len); for (i = 0; i < len; i++) retstr[i] = c_list[ retstr[i] % (sizeof(c_list)-1) ]; diff --git a/source3/lib/util.c b/source3/lib/util.c index 92b818b0aa..820cf376be 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1228,17 +1228,6 @@ void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size, } /**************************************************************************** - Free memory, checks for NULL. - Use directly SAFE_FREE() - Exists only because we need to pass a function pointer somewhere --SSS -****************************************************************************/ - -void safe_free(void *p) -{ - SAFE_FREE(p); -} - -/**************************************************************************** Get my own name and IP. ****************************************************************************/ diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index f6783f10ff..046ce61ea3 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -558,47 +558,6 @@ bool trim_char(char *s,char cfront,char cback) } /** - Trim the specified elements off the front and back of a string. -**/ - -bool trim_string(char *s,const char *front,const char *back) -{ - bool ret = false; - size_t front_len; - size_t back_len; - size_t len; - - /* Ignore null or empty strings. */ - if (!s || (s[0] == '\0')) - return false; - - front_len = front? strlen(front) : 0; - back_len = back? strlen(back) : 0; - - len = strlen(s); - - if (front_len) { - while (len && strncmp(s, front, front_len)==0) { - /* Must use memmove here as src & dest can - * easily overlap. Found by valgrind. JRA. */ - memmove(s, s+front_len, (len-front_len)+1); - len -= front_len; - ret=true; - } - } - - if (back_len) { - while ((len >= back_len) && - strncmp(s+len-back_len,back,back_len)==0) { - s[len-back_len]='\0'; - len -= back_len; - ret=true; - } - } - return ret; -} - -/** Does a string have any uppercase chars in it? **/ @@ -649,29 +608,6 @@ bool strhaslower(const char *s) } /** - Find the number of 'c' chars in a string -**/ - -size_t count_chars(const char *s,char c) -{ - smb_ucs2_t *ptr; - int count; - smb_ucs2_t *alloc_tmpbuf = NULL; - size_t converted_size; - - if (!push_ucs2_allocate(&alloc_tmpbuf, s, &converted_size)) { - return 0; - } - - for(count=0,ptr=alloc_tmpbuf;*ptr;ptr++) - if(*ptr==UCS2_CHAR(c)) - count++; - - SAFE_FREE(alloc_tmpbuf); - return(count); -} - -/** Safe string copy into a known length string. maxlength does not include the terminating zero. **/ @@ -871,88 +807,6 @@ static char *strncpyn(char *dest, const char *src, size_t n, char c) #endif /** - Routine to get hex characters and turn them into a 16 byte array. - the array can be variable length, and any non-hex-numeric - characters are skipped. "0xnn" or "0Xnn" is specially catered - for. - - valid examples: "0A5D15"; "0x15, 0x49, 0xa2"; "59\ta9\te3\n" - -**/ - -size_t strhex_to_str(char *buf, size_t buf_len, const char *strhex, size_t strhex_len) -{ - size_t i; - size_t num_chars = 0; - unsigned char lonybble, hinybble; - const char *hexchars = "0123456789ABCDEF"; - char *p1 = NULL, *p2 = NULL; - - for (i = 0; i < strhex_len && strhex[i] != 0; i++) { - if (strnequal(hexchars, "0x", 2)) { - i++; /* skip two chars */ - continue; - } - - if (!(p1 = strchr_m(hexchars, toupper_ascii(strhex[i])))) - break; - - i++; /* next hex digit */ - - if (!(p2 = strchr_m(hexchars, toupper_ascii(strhex[i])))) - break; - - /* get the two nybbles */ - hinybble = PTR_DIFF(p1, hexchars); - lonybble = PTR_DIFF(p2, hexchars); - - if (num_chars >= buf_len) { - break; - } - buf[num_chars] = (hinybble << 4) | lonybble; - num_chars++; - - p1 = NULL; - p2 = NULL; - } - return num_chars; -} - -DATA_BLOB strhex_to_data_blob(TALLOC_CTX *mem_ctx, const char *strhex) -{ - DATA_BLOB ret_blob; - - if (mem_ctx != NULL) - ret_blob = data_blob_talloc(mem_ctx, NULL, strlen(strhex)/2+1); - else - ret_blob = data_blob(NULL, strlen(strhex)/2+1); - - ret_blob.length = strhex_to_str((char*)ret_blob.data, - ret_blob.length, - strhex, - strlen(strhex)); - - return ret_blob; -} - -/** - * Routine to print a buffer as HEX digits, into an allocated string. - */ - -char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len) -{ - int i; - char *hex_buffer; - - hex_buffer = TALLOC_ARRAY(mem_ctx, char, (len*2)+1); - - for (i = 0; i < len; i++) - slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]); - - return hex_buffer; -} - -/** Check if a string is part of a list. **/ @@ -2105,41 +1959,6 @@ void ipstr_list_free(char* ipstr_list) SAFE_FREE(ipstr_list); } -/** - Unescape a URL encoded string, in place. -**/ - -void rfc1738_unescape(char *buf) -{ - char *p=buf; - - while (p && *p && (p=strchr_m(p,'%'))) { - int c1 = p[1]; - int c2 = p[2]; - - if (c1 >= '0' && c1 <= '9') - c1 = c1 - '0'; - else if (c1 >= 'A' && c1 <= 'F') - c1 = 10 + c1 - 'A'; - else if (c1 >= 'a' && c1 <= 'f') - c1 = 10 + c1 - 'a'; - else {p++; continue;} - - if (c2 >= '0' && c2 <= '9') - c2 = c2 - '0'; - else if (c2 >= 'A' && c2 <= 'F') - c2 = 10 + c2 - 'A'; - else if (c2 >= 'a' && c2 <= 'f') - c2 = 10 + c2 - 'a'; - else {p++; continue;} - - *p = (c1<<4) | c2; - - memmove(p+1, p+3, strlen(p+3)+1); - p++; - } -} - static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** @@ -2550,54 +2369,6 @@ bool validate_net_name( const char *name, } -/** -return the number of bytes occupied by a buffer in ASCII format -the result includes the null termination -limited by 'n' bytes -**/ -size_t ascii_len_n(const char *src, size_t n) -{ - size_t len; - - len = strnlen(src, n); - if (len+1 <= n) { - len += 1; - } - - return len; -} - -/** -return the number of bytes occupied by a buffer in CH_UTF16 format -the result includes the null termination -**/ -size_t utf16_len(const void *buf) -{ - size_t len; - - for (len = 0; SVAL(buf,len); len += 2) ; - - return len + 2; -} - -/** -return the number of bytes occupied by a buffer in CH_UTF16 format -the result includes the null termination -limited by 'n' bytes -**/ -size_t utf16_len_n(const void *src, size_t n) -{ - size_t len; - - for (len = 0; (len+2 < n) && SVAL(src, len); len += 2) ; - - if (len+2 <= n) { - len += 2; - } - - return len; -} - /******************************************************************* Add a shell escape character '\' to any character not in a known list of characters. UNIX charset format. diff --git a/source3/libads/util.c b/source3/libads/util.c index d23c36f326..9866a15285 100644 --- a/source3/libads/util.c +++ b/source3/libads/util.c @@ -33,7 +33,7 @@ ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_princip return ADS_ERROR_SYSTEM(ENOENT); } - new_password = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH); + new_password = generate_random_str(talloc_tos(), DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH); ret = kerberos_set_password(ads->auth.kdc_server, host_principal, password, host_principal, new_password, ads->auth.time_offset); diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index ab8af0be6b..6935e000dc 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -775,7 +775,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, ZERO_STRUCT(user_pol); if (!r->in.machine_password) { - r->in.machine_password = talloc_strdup(mem_ctx, generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH)); + r->in.machine_password = generate_random_str(mem_ctx, DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH); NT_STATUS_HAVE_NO_MEMORY(r->in.machine_password); } diff --git a/source3/librpc/gen_ndr/cli_ntsvcs.c b/source3/librpc/gen_ndr/cli_ntsvcs.c index bc5dba4d91..f8ef7a99ad 100644 --- a/source3/librpc/gen_ndr/cli_ntsvcs.c +++ b/source3/librpc/gen_ndr/cli_ntsvcs.c @@ -424,12 +424,19 @@ NTSTATUS rpccli_PNP_EnumerateSubKeys(struct rpc_pipe_client *cli, NTSTATUS rpccli_PNP_GetDeviceList(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *filter /* [in] [unique,charset(UTF16)] */, + uint16_t *buffer /* [out] [ref,length_is(*length),size_is(*length)] */, + uint32_t *length /* [in,out] [ref] */, + uint32_t flags /* [in] */, WERROR *werror) { struct PNP_GetDeviceList r; NTSTATUS status; /* In parameters */ + r.in.filter = filter; + r.in.length = length; + r.in.flags = flags; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(PNP_GetDeviceList, &r); @@ -454,6 +461,8 @@ NTSTATUS rpccli_PNP_GetDeviceList(struct rpc_pipe_client *cli, } /* Return variables */ + memcpy(buffer, r.out.buffer, *r.in.length * sizeof(*buffer)); + *length = *r.out.length; /* Return result */ if (werror) { @@ -555,11 +564,11 @@ NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *devicepath /* [in] [ref,charset(UTF16)] */, uint32_t property /* [in] */, - uint32_t *unknown1 /* [in,out] [ref] */, + uint32_t *reg_data_type /* [in,out] [ref] */, uint8_t *buffer /* [out] [ref,length_is(*buffer_size),size_is(*buffer_size)] */, uint32_t *buffer_size /* [in,out] [ref] */, uint32_t *needed /* [in,out] [ref] */, - uint32_t unknown3 /* [in] */, + uint32_t flags /* [in] */, WERROR *werror) { struct PNP_GetDeviceRegProp r; @@ -568,10 +577,10 @@ NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli, /* In parameters */ r.in.devicepath = devicepath; r.in.property = property; - r.in.unknown1 = unknown1; + r.in.reg_data_type = reg_data_type; r.in.buffer_size = buffer_size; r.in.needed = needed; - r.in.unknown3 = unknown3; + r.in.flags = flags; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(PNP_GetDeviceRegProp, &r); @@ -596,7 +605,7 @@ NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli, } /* Return variables */ - *unknown1 = *r.out.unknown1; + *reg_data_type = *r.out.reg_data_type; memcpy(buffer, r.out.buffer, *r.in.buffer_size * sizeof(*buffer)); *buffer_size = *r.out.buffer_size; *needed = *r.out.needed; diff --git a/source3/librpc/gen_ndr/cli_ntsvcs.h b/source3/librpc/gen_ndr/cli_ntsvcs.h index a52a79ecc5..4ed8a401ec 100644 --- a/source3/librpc/gen_ndr/cli_ntsvcs.h +++ b/source3/librpc/gen_ndr/cli_ntsvcs.h @@ -36,6 +36,10 @@ NTSTATUS rpccli_PNP_EnumerateSubKeys(struct rpc_pipe_client *cli, WERROR *werror); NTSTATUS rpccli_PNP_GetDeviceList(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *filter /* [in] [unique,charset(UTF16)] */, + uint16_t *buffer /* [out] [ref,length_is(*length),size_is(*length)] */, + uint32_t *length /* [in,out] [ref] */, + uint32_t flags /* [in] */, WERROR *werror); NTSTATUS rpccli_PNP_GetDeviceListSize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -50,11 +54,11 @@ NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *devicepath /* [in] [ref,charset(UTF16)] */, uint32_t property /* [in] */, - uint32_t *unknown1 /* [in,out] [ref] */, + uint32_t *reg_data_type /* [in,out] [ref] */, uint8_t *buffer /* [out] [ref,length_is(*buffer_size),size_is(*buffer_size)] */, uint32_t *buffer_size /* [in,out] [ref] */, uint32_t *needed /* [in,out] [ref] */, - uint32_t unknown3 /* [in] */, + uint32_t flags /* [in] */, WERROR *werror); NTSTATUS rpccli_PNP_SetDeviceRegProp(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/librpc/gen_ndr/drsblobs.h b/source3/librpc/gen_ndr/drsblobs.h index b0ab9aea2a..692746468e 100644 --- a/source3/librpc/gen_ndr/drsblobs.h +++ b/source3/librpc/gen_ndr/drsblobs.h @@ -4,12 +4,16 @@ #include "librpc/gen_ndr/drsuapi.h" #include "librpc/gen_ndr/misc.h" +#include "librpc/gen_ndr/samr.h" +#include "librpc/gen_ndr/lsa.h" #ifndef _HEADER_drsblobs #define _HEADER_drsblobs #define SUPPLEMENTAL_CREDENTIALS_PREFIX ( " " ) enum drsuapi_DsAttributeId; +enum lsa_TrustAuthType; + struct replPropertyMetaData1 { enum drsuapi_DsAttributeId attid; uint32_t version; @@ -247,7 +251,7 @@ struct package_PrimaryKerberosBlob { }/* [public] */; struct package_PrimaryCLEARTEXTBlob { - const char * cleartext;/* [flag(LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING)] */ + DATA_BLOB cleartext;/* [flag(LIBNDR_FLAG_REMAINING)] */ }/* [public] */; struct package_PrimaryWDigestHash { @@ -263,63 +267,158 @@ struct package_PrimaryWDigestBlob { struct package_PrimaryWDigestHash *hashes; }/* [public] */; -struct trustAuthInOutSecret1 { - NTTIME time1; - uint32_t unknown1; - DATA_BLOB value; - DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */ +struct AuthInfoNone { + uint32_t size;/* [value(0)] */ }; -struct trustAuthInOutCtr1 { - struct trustAuthInOutSecret1 *value1;/* [relative] */ - struct trustAuthInOutSecret1 *value2;/* [relative] */ +struct AuthInfoNT4Owf { + uint32_t size;/* [value(16)] */ + struct samr_Password password; }; -struct trustAuthInOutSecret2V1 { - NTTIME time1; - uint32_t unknown1; - DATA_BLOB value; - NTTIME time2; - uint32_t unknown2; - uint32_t unknown3; - uint32_t unknown4; - DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */ +struct AuthInfoClear { + uint32_t size; + uint8_t *password; }; -struct trustAuthInOutSecret2V2 { - NTTIME time1; - uint32_t unknown1; - DATA_BLOB value; - NTTIME time2; - uint32_t unknown2; - uint32_t unknown3; - DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */ -}; - -struct trustAuthInOutCtr2 { - struct trustAuthInOutSecret2V1 *value1;/* [relative] */ - struct trustAuthInOutSecret2V2 *value2;/* [relative] */ +struct AuthInfoVersion { + uint32_t size;/* [value(4)] */ + uint32_t version; }; -union trustAuthInOutCtr { - struct trustAuthInOutCtr1 ctr1;/* [case] */ - struct trustAuthInOutCtr2 ctr2;/* [case(2)] */ +union AuthInfo { + struct AuthInfoNone none;/* [case(TRUST_AUTH_TYPE_NONE)] */ + struct AuthInfoNT4Owf nt4owf;/* [case(TRUST_AUTH_TYPE_NT4OWF)] */ + struct AuthInfoClear clear;/* [case(TRUST_AUTH_TYPE_CLEAR)] */ + struct AuthInfoVersion version;/* [case(TRUST_AUTH_TYPE_VERSION)] */ }/* [nodiscriminant] */; -struct trustAuthInOutBlob { - uint32_t version; - union trustAuthInOutCtr ctr;/* [switch_is(version)] */ +struct AuthenticationInformation { + NTTIME LastUpdateTime; + enum lsa_TrustAuthType AuthType; + union AuthInfo AuthInfo;/* [switch_is(AuthType)] */ + DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */ }/* [public] */; +struct AuthenticationInformationArray { + struct AuthenticationInformation *array;/* [size_is] */ +}/* [noprint,nopush,nopull] */; + +struct trustAuthInOutBlob { + uint32_t count; + struct AuthenticationInformationArray *current;/* [relative] */ + struct AuthenticationInformationArray *previous;/* [relative] */ +}/* [noprint,gensize,nopull,public,nopush] */; + +struct trustCurrentPasswords { + uint32_t count; + struct AuthenticationInformation **current;/* [relative] */ +}/* [gensize,public] */; + +struct trustDomainPasswords { + uint8_t confounder[512]; + struct trustCurrentPasswords outgoing;/* [subcontext_size(outgoing_size),subcontext(0)] */ + struct trustCurrentPasswords incoming;/* [subcontext_size(incoming_size),subcontext(0)] */ + uint32_t outgoing_size;/* [value(ndr_size_trustCurrentPasswords(&outgoing,ndr->flags))] */ + uint32_t incoming_size;/* [value(ndr_size_trustCurrentPasswords(&incoming,ndr->flags))] */ +}/* [public,nopull] */; + struct DsCompressedChunk { uint32_t marker; DATA_BLOB data; }/* [public] */; -struct DsCompressedBlob { - struct DsCompressedChunk chunks[5]; +struct ExtendedErrorAString { + uint16_t __size; + const char *string;/* [unique,charset(DOS),size_is(__size)] */ +}; + +struct ExtendedErrorUString { + uint16_t __size; + const char *string;/* [unique,charset(UTF16),size_is(__size)] */ +}; + +struct ExtendedErrorBlob { + uint16_t length; + uint8_t *data;/* [unique,size_is(length)] */ +}; + +enum ExtendedErrorComputerNamePresent +#ifndef USE_UINT_ENUMS + { + EXTENDED_ERROR_COMPUTER_NAME_PRESENT=1, + EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT=2 +} +#else + { __donnot_use_enum_ExtendedErrorComputerNamePresent=0x7FFFFFFF} +#define EXTENDED_ERROR_COMPUTER_NAME_PRESENT ( 1 ) +#define EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT ( 2 ) +#endif +; + +union ExtendedErrorComputerNameU { + struct ExtendedErrorUString name;/* [case(EXTENDED_ERROR_COMPUTER_NAME_PRESENT)] */ +}/* [switch_type(ExtendedErrorComputerNamePresent)] */; + +struct ExtendedErrorComputerName { + enum ExtendedErrorComputerNamePresent present; + union ExtendedErrorComputerNameU n;/* [switch_is(present)] */ +}; + +enum ExtendedErrorParamType +#ifndef USE_UINT_ENUMS + { + EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING=1, + EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING=2, + EXTENDED_ERROR_PARAM_TYPE_UINT32=3, + EXTENDED_ERROR_PARAM_TYPE_UINT16=4, + EXTENDED_ERROR_PARAM_TYPE_UINT64=5, + EXTENDED_ERROR_PARAM_TYPE_NONE=6, + EXTENDED_ERROR_PARAM_TYPE_BLOB=7 +} +#else + { __donnot_use_enum_ExtendedErrorParamType=0x7FFFFFFF} +#define EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING ( 1 ) +#define EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING ( 2 ) +#define EXTENDED_ERROR_PARAM_TYPE_UINT32 ( 3 ) +#define EXTENDED_ERROR_PARAM_TYPE_UINT16 ( 4 ) +#define EXTENDED_ERROR_PARAM_TYPE_UINT64 ( 5 ) +#define EXTENDED_ERROR_PARAM_TYPE_NONE ( 6 ) +#define EXTENDED_ERROR_PARAM_TYPE_BLOB ( 7 ) +#endif +; + +union ExtendedErrorParamU { + struct ExtendedErrorAString a_string;/* [case(EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING)] */ + struct ExtendedErrorUString u_string;/* [case(EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING)] */ + uint32_t uint32;/* [case(EXTENDED_ERROR_PARAM_TYPE_UINT32)] */ + uint16_t uint16;/* [case(EXTENDED_ERROR_PARAM_TYPE_UINT16)] */ + uint64_t uint64;/* [case(EXTENDED_ERROR_PARAM_TYPE_UINT64)] */ + struct ExtendedErrorBlob blob;/* [case(EXTENDED_ERROR_PARAM_TYPE_BLOB)] */ +}/* [switch_type(ExtendedErrorParamType)] */; + +struct ExtendedErrorParam { + enum ExtendedErrorParamType type; + union ExtendedErrorParamU p;/* [switch_is(type)] */ +}; + +struct ExtendedErrorInfo { + struct ExtendedErrorInfo *next;/* [unique] */ + struct ExtendedErrorComputerName computer_name; + uint64_t pid; + NTTIME time; + uint32_t generating_component; + WERROR status; + uint16_t detection_location; + uint16_t flags; + uint16_t num_params; + struct ExtendedErrorParam *params;/* [size_is(num_params)] */ }/* [public] */; +struct ExtendedErrorInfoPtr { + struct ExtendedErrorInfo *info;/* [unique] */ +}; + struct decode_replPropertyMetaData { struct { @@ -417,9 +516,17 @@ struct decode_trustAuthInOut { }; -struct decode_DsCompressed { +struct decode_trustDomainPasswords { + struct { + struct trustDomainPasswords blob; + } in; + +}; + + +struct decode_ExtendedErrorInfo { struct { - struct DsCompressedBlob blob; + struct ExtendedErrorInfoPtr ptr;/* [subcontext(0xFFFFFC01)] */ } in; }; diff --git a/source3/librpc/gen_ndr/ndr_drsblobs.c b/source3/librpc/gen_ndr/ndr_drsblobs.c index 41a448cbe3..dd8d77ea15 100644 --- a/source3/librpc/gen_ndr/ndr_drsblobs.c +++ b/source3/librpc/gen_ndr/ndr_drsblobs.c @@ -5,6 +5,8 @@ #include "librpc/gen_ndr/ndr_drsuapi.h" #include "librpc/gen_ndr/ndr_misc.h" +#include "librpc/gen_ndr/ndr_samr.h" +#include "librpc/gen_ndr/ndr_lsa.h" static enum ndr_err_code ndr_push_replPropertyMetaData1(struct ndr_push *ndr, int ndr_flags, const struct replPropertyMetaData1 *r) { if (ndr_flags & NDR_SCALARS) { @@ -2165,10 +2167,10 @@ _PUBLIC_ enum ndr_err_code ndr_push_package_PrimaryCLEARTEXTBlob(struct ndr_push if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); { - uint32_t _flags_save_string = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING); - NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->cleartext)); - ndr->flags = _flags_save_string; + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->cleartext)); + ndr->flags = _flags_save_DATA_BLOB; } } if (ndr_flags & NDR_BUFFERS) { @@ -2181,10 +2183,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_package_PrimaryCLEARTEXTBlob(struct ndr_pull if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); { - uint32_t _flags_save_string = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING); - NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->cleartext)); - ndr->flags = _flags_save_string; + uint32_t _flags_save_DATA_BLOB = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->cleartext)); + ndr->flags = _flags_save_DATA_BLOB; } } if (ndr_flags & NDR_BUFFERS) { @@ -2196,7 +2198,7 @@ _PUBLIC_ void ndr_print_package_PrimaryCLEARTEXTBlob(struct ndr_print *ndr, cons { ndr_print_struct(ndr, name, "package_PrimaryCLEARTEXTBlob"); ndr->depth++; - ndr_print_string(ndr, "cleartext", r->cleartext); + ndr_print_DATA_BLOB(ndr, "cleartext", r->cleartext); ndr->depth--; } @@ -2311,13 +2313,269 @@ _PUBLIC_ void ndr_print_package_PrimaryWDigestBlob(struct ndr_print *ndr, const ndr->depth--; } -static enum ndr_err_code ndr_push_trustAuthInOutSecret1(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutSecret1 *r) +static enum ndr_err_code ndr_push_AuthInfoNone(struct ndr_push *ndr, int ndr_flags, const struct AuthInfoNone *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_AuthInfoNone(struct ndr_pull *ndr, int ndr_flags, struct AuthInfoNone *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_AuthInfoNone(struct ndr_print *ndr, const char *name, const struct AuthInfoNone *r) +{ + ndr_print_struct(ndr, name, "AuthInfoNone"); + ndr->depth++; + ndr_print_uint32(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->size); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_AuthInfoNT4Owf(struct ndr_push *ndr, int ndr_flags, const struct AuthInfoNT4Owf *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 16)); + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, &r->password)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_BUFFERS, &r->password)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_AuthInfoNT4Owf(struct ndr_pull *ndr, int ndr_flags, struct AuthInfoNT4Owf *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size)); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, &r->password)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_BUFFERS, &r->password)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_AuthInfoNT4Owf(struct ndr_print *ndr, const char *name, const struct AuthInfoNT4Owf *r) +{ + ndr_print_struct(ndr, name, "AuthInfoNT4Owf"); + ndr->depth++; + ndr_print_uint32(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?16:r->size); + ndr_print_samr_Password(ndr, "password", &r->password); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_AuthInfoClear(struct ndr_push *ndr, int ndr_flags, const struct AuthInfoClear *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->password, r->size)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_AuthInfoClear(struct ndr_pull *ndr, int ndr_flags, struct AuthInfoClear *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size)); + NDR_PULL_ALLOC_N(ndr, r->password, r->size); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->password, r->size)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_AuthInfoClear(struct ndr_print *ndr, const char *name, const struct AuthInfoClear *r) +{ + ndr_print_struct(ndr, name, "AuthInfoClear"); + ndr->depth++; + ndr_print_uint32(ndr, "size", r->size); + ndr_print_array_uint8(ndr, "password", r->password, r->size); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_AuthInfoVersion(struct ndr_push *ndr, int ndr_flags, const struct AuthInfoVersion *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time1)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1)); - NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_AuthInfoVersion(struct ndr_pull *ndr, int ndr_flags, struct AuthInfoVersion *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->version)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_AuthInfoVersion(struct ndr_print *ndr, const char *name, const struct AuthInfoVersion *r) +{ + ndr_print_struct(ndr, name, "AuthInfoVersion"); + ndr->depth++; + ndr_print_uint32(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?4:r->size); + ndr_print_uint32(ndr, "version", r->version); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_AuthInfo(struct ndr_push *ndr, int ndr_flags, const union AuthInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case TRUST_AUTH_TYPE_NONE: { + NDR_CHECK(ndr_push_AuthInfoNone(ndr, NDR_SCALARS, &r->none)); + break; } + + case TRUST_AUTH_TYPE_NT4OWF: { + NDR_CHECK(ndr_push_AuthInfoNT4Owf(ndr, NDR_SCALARS, &r->nt4owf)); + break; } + + case TRUST_AUTH_TYPE_CLEAR: { + NDR_CHECK(ndr_push_AuthInfoClear(ndr, NDR_SCALARS, &r->clear)); + break; } + + case TRUST_AUTH_TYPE_VERSION: { + NDR_CHECK(ndr_push_AuthInfoVersion(ndr, NDR_SCALARS, &r->version)); + break; } + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case TRUST_AUTH_TYPE_NONE: + break; + + case TRUST_AUTH_TYPE_NT4OWF: + NDR_CHECK(ndr_push_AuthInfoNT4Owf(ndr, NDR_BUFFERS, &r->nt4owf)); + break; + + case TRUST_AUTH_TYPE_CLEAR: + break; + + case TRUST_AUTH_TYPE_VERSION: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_AuthInfo(struct ndr_pull *ndr, int ndr_flags, union AuthInfo *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + switch (level) { + case TRUST_AUTH_TYPE_NONE: { + NDR_CHECK(ndr_pull_AuthInfoNone(ndr, NDR_SCALARS, &r->none)); + break; } + + case TRUST_AUTH_TYPE_NT4OWF: { + NDR_CHECK(ndr_pull_AuthInfoNT4Owf(ndr, NDR_SCALARS, &r->nt4owf)); + break; } + + case TRUST_AUTH_TYPE_CLEAR: { + NDR_CHECK(ndr_pull_AuthInfoClear(ndr, NDR_SCALARS, &r->clear)); + break; } + + case TRUST_AUTH_TYPE_VERSION: { + NDR_CHECK(ndr_pull_AuthInfoVersion(ndr, NDR_SCALARS, &r->version)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case TRUST_AUTH_TYPE_NONE: + break; + + case TRUST_AUTH_TYPE_NT4OWF: + NDR_CHECK(ndr_pull_AuthInfoNT4Owf(ndr, NDR_BUFFERS, &r->nt4owf)); + break; + + case TRUST_AUTH_TYPE_CLEAR: + break; + + case TRUST_AUTH_TYPE_VERSION: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_AuthInfo(struct ndr_print *ndr, const char *name, const union AuthInfo *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "AuthInfo"); + switch (level) { + case TRUST_AUTH_TYPE_NONE: + ndr_print_AuthInfoNone(ndr, "none", &r->none); + break; + + case TRUST_AUTH_TYPE_NT4OWF: + ndr_print_AuthInfoNT4Owf(ndr, "nt4owf", &r->nt4owf); + break; + + case TRUST_AUTH_TYPE_CLEAR: + ndr_print_AuthInfoClear(ndr, "clear", &r->clear); + break; + + case TRUST_AUTH_TYPE_VERSION: + ndr_print_AuthInfoVersion(ndr, "version", &r->version); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_AuthenticationInformation(struct ndr_push *ndr, int ndr_flags, const struct AuthenticationInformation *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->LastUpdateTime)); + NDR_CHECK(ndr_push_lsa_TrustAuthType(ndr, NDR_SCALARS, r->AuthType)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->AuthInfo, r->AuthType)); + NDR_CHECK(ndr_push_AuthInfo(ndr, NDR_SCALARS, &r->AuthInfo)); { uint32_t _flags_save_DATA_BLOB = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); @@ -2326,17 +2584,19 @@ static enum ndr_err_code ndr_push_trustAuthInOutSecret1(struct ndr_push *ndr, in } } if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_AuthInfo(ndr, NDR_BUFFERS, &r->AuthInfo)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_trustAuthInOutSecret1(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutSecret1 *r) +_PUBLIC_ enum ndr_err_code ndr_pull_AuthenticationInformation(struct ndr_pull *ndr, int ndr_flags, struct AuthenticationInformation *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time1)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1)); - NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->LastUpdateTime)); + NDR_CHECK(ndr_pull_lsa_TrustAuthType(ndr, NDR_SCALARS, &r->AuthType)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->AuthInfo, r->AuthType)); + NDR_CHECK(ndr_pull_AuthInfo(ndr, NDR_SCALARS, &r->AuthInfo)); { uint32_t _flags_save_DATA_BLOB = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); @@ -2345,325 +2605,405 @@ static enum ndr_err_code ndr_pull_trustAuthInOutSecret1(struct ndr_pull *ndr, in } } if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_AuthInfo(ndr, NDR_BUFFERS, &r->AuthInfo)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_trustAuthInOutSecret1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret1 *r) +_PUBLIC_ void ndr_print_AuthenticationInformation(struct ndr_print *ndr, const char *name, const struct AuthenticationInformation *r) { - ndr_print_struct(ndr, name, "trustAuthInOutSecret1"); + ndr_print_struct(ndr, name, "AuthenticationInformation"); ndr->depth++; - ndr_print_NTTIME(ndr, "time1", r->time1); - ndr_print_uint32(ndr, "unknown1", r->unknown1); - ndr_print_DATA_BLOB(ndr, "value", r->value); + ndr_print_NTTIME(ndr, "LastUpdateTime", r->LastUpdateTime); + ndr_print_lsa_TrustAuthType(ndr, "AuthType", r->AuthType); + ndr_print_set_switch_value(ndr, &r->AuthInfo, r->AuthType); + ndr_print_AuthInfo(ndr, "AuthInfo", &r->AuthInfo); ndr_print_DATA_BLOB(ndr, "_pad", r->_pad); ndr->depth--; } -static enum ndr_err_code ndr_push_trustAuthInOutCtr1(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutCtr1 *r) +_PUBLIC_ size_t ndr_size_trustAuthInOutBlob(const struct trustAuthInOutBlob *r, int flags) { + return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_trustAuthInOutBlob); +} + +_PUBLIC_ enum ndr_err_code ndr_push_trustCurrentPasswords(struct ndr_push *ndr, int ndr_flags, const struct trustCurrentPasswords *r) +{ + uint32_t cntr_current_0; if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_relative_ptr1(ndr, r->value1)); - NDR_CHECK(ndr_push_relative_ptr1(ndr, r->value2)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_current_0 = 0; cntr_current_0 < r->count; cntr_current_0++) { + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->current[cntr_current_0])); + } } if (ndr_flags & NDR_BUFFERS) { - if (r->value1) { - NDR_CHECK(ndr_push_relative_ptr2(ndr, r->value1)); - NDR_CHECK(ndr_push_trustAuthInOutSecret1(ndr, NDR_SCALARS, r->value1)); - } - if (r->value2) { - NDR_CHECK(ndr_push_relative_ptr2(ndr, r->value2)); - NDR_CHECK(ndr_push_trustAuthInOutSecret1(ndr, NDR_SCALARS, r->value2)); + for (cntr_current_0 = 0; cntr_current_0 < r->count; cntr_current_0++) { + if (r->current[cntr_current_0]) { + NDR_CHECK(ndr_push_relative_ptr2(ndr, r->current[cntr_current_0])); + NDR_CHECK(ndr_push_AuthenticationInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->current[cntr_current_0])); + } } } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_trustAuthInOutCtr1(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutCtr1 *r) +_PUBLIC_ enum ndr_err_code ndr_pull_trustCurrentPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustCurrentPasswords *r) { - uint32_t _ptr_value1; - TALLOC_CTX *_mem_save_value1_0; - uint32_t _ptr_value2; - TALLOC_CTX *_mem_save_value2_0; + uint32_t _ptr_current; + uint32_t cntr_current_0; + TALLOC_CTX *_mem_save_current_0; + TALLOC_CTX *_mem_save_current_1; if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value1)); - if (_ptr_value1) { - NDR_PULL_ALLOC(ndr, r->value1); - NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->value1, _ptr_value1)); - } else { - r->value1 = NULL; - } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value2)); - if (_ptr_value2) { - NDR_PULL_ALLOC(ndr, r->value2); - NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->value2, _ptr_value2)); - } else { - r->value2 = NULL; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_PULL_ALLOC_N(ndr, r->current, r->count); + _mem_save_current_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->current, 0); + for (cntr_current_0 = 0; cntr_current_0 < r->count; cntr_current_0++) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_current)); + if (_ptr_current) { + NDR_PULL_ALLOC(ndr, r->current[cntr_current_0]); + NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->current[cntr_current_0], _ptr_current)); + } else { + r->current[cntr_current_0] = NULL; + } } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_current_0, 0); } if (ndr_flags & NDR_BUFFERS) { - if (r->value1) { - uint32_t _relative_save_offset; - _relative_save_offset = ndr->offset; - NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->value1)); - _mem_save_value1_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->value1, 0); - NDR_CHECK(ndr_pull_trustAuthInOutSecret1(ndr, NDR_SCALARS, r->value1)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value1_0, 0); - ndr->offset = _relative_save_offset; - } - if (r->value2) { - uint32_t _relative_save_offset; - _relative_save_offset = ndr->offset; - NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->value2)); - _mem_save_value2_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->value2, 0); - NDR_CHECK(ndr_pull_trustAuthInOutSecret1(ndr, NDR_SCALARS, r->value2)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value2_0, 0); - ndr->offset = _relative_save_offset; + _mem_save_current_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->current, 0); + for (cntr_current_0 = 0; cntr_current_0 < r->count; cntr_current_0++) { + if (r->current[cntr_current_0]) { + uint32_t _relative_save_offset; + _relative_save_offset = ndr->offset; + NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->current[cntr_current_0])); + _mem_save_current_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->current[cntr_current_0], 0); + NDR_CHECK(ndr_pull_AuthenticationInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->current[cntr_current_0])); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_current_1, 0); + ndr->offset = _relative_save_offset; + } } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_current_0, 0); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_trustAuthInOutCtr1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutCtr1 *r) +_PUBLIC_ void ndr_print_trustCurrentPasswords(struct ndr_print *ndr, const char *name, const struct trustCurrentPasswords *r) { - ndr_print_struct(ndr, name, "trustAuthInOutCtr1"); + uint32_t cntr_current_0; + ndr_print_struct(ndr, name, "trustCurrentPasswords"); ndr->depth++; - ndr_print_ptr(ndr, "value1", r->value1); - ndr->depth++; - if (r->value1) { - ndr_print_trustAuthInOutSecret1(ndr, "value1", r->value1); - } - ndr->depth--; - ndr_print_ptr(ndr, "value2", r->value2); + ndr_print_uint32(ndr, "count", r->count); + ndr->print(ndr, "%s: ARRAY(%d)", "current", (int)r->count); ndr->depth++; - if (r->value2) { - ndr_print_trustAuthInOutSecret1(ndr, "value2", r->value2); + for (cntr_current_0=0;cntr_current_0<r->count;cntr_current_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_current_0) != -1) { + ndr_print_ptr(ndr, "current", r->current[cntr_current_0]); + ndr->depth++; + if (r->current[cntr_current_0]) { + ndr_print_AuthenticationInformation(ndr, "current", r->current[cntr_current_0]); + } + ndr->depth--; + free(idx_0); + } } ndr->depth--; ndr->depth--; } -static enum ndr_err_code ndr_push_trustAuthInOutSecret2V1(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutSecret2V1 *r) +_PUBLIC_ size_t ndr_size_trustCurrentPasswords(const struct trustCurrentPasswords *r, int flags) +{ + return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_trustCurrentPasswords); +} + +_PUBLIC_ enum ndr_err_code ndr_push_trustDomainPasswords(struct ndr_push *ndr, int ndr_flags, const struct trustDomainPasswords *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time1)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1)); - NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value)); - NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time2)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown4)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->confounder, 512)); { - uint32_t _flags_save_DATA_BLOB = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); - NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad)); - ndr->flags = _flags_save_DATA_BLOB; + struct ndr_push *_ndr_outgoing; + NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_outgoing, 0, ndr_size_trustCurrentPasswords(&r->outgoing, ndr->flags))); + NDR_CHECK(ndr_push_trustCurrentPasswords(_ndr_outgoing, NDR_SCALARS|NDR_BUFFERS, &r->outgoing)); + NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_outgoing, 0, ndr_size_trustCurrentPasswords(&r->outgoing, ndr->flags))); } + { + struct ndr_push *_ndr_incoming; + NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_incoming, 0, ndr_size_trustCurrentPasswords(&r->incoming, ndr->flags))); + NDR_CHECK(ndr_push_trustCurrentPasswords(_ndr_incoming, NDR_SCALARS|NDR_BUFFERS, &r->incoming)); + NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_incoming, 0, ndr_size_trustCurrentPasswords(&r->incoming, ndr->flags))); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_trustCurrentPasswords(&r->outgoing, ndr->flags))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_trustCurrentPasswords(&r->incoming, ndr->flags))); } if (ndr_flags & NDR_BUFFERS) { } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_trustAuthInOutSecret2V1(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutSecret2V1 *r) +_PUBLIC_ void ndr_print_trustDomainPasswords(struct ndr_print *ndr, const char *name, const struct trustDomainPasswords *r) +{ + ndr_print_struct(ndr, name, "trustDomainPasswords"); + ndr->depth++; + ndr_print_array_uint8(ndr, "confounder", r->confounder, 512); + ndr_print_trustCurrentPasswords(ndr, "outgoing", &r->outgoing); + ndr_print_trustCurrentPasswords(ndr, "incoming", &r->incoming); + ndr_print_uint32(ndr, "outgoing_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_trustCurrentPasswords(&r->outgoing, ndr->flags):r->outgoing_size); + ndr_print_uint32(ndr, "incoming_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_trustCurrentPasswords(&r->incoming, ndr->flags):r->incoming_size); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_DsCompressedChunk(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedChunk *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->marker)); + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->data)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_DsCompressedChunk(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedChunk *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time1)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1)); - NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value)); - NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time2)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown4)); - { - uint32_t _flags_save_DATA_BLOB = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); - NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad)); - ndr->flags = _flags_save_DATA_BLOB; - } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->marker)); + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->data)); } if (ndr_flags & NDR_BUFFERS) { } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_trustAuthInOutSecret2V1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret2V1 *r) +_PUBLIC_ void ndr_print_DsCompressedChunk(struct ndr_print *ndr, const char *name, const struct DsCompressedChunk *r) { - ndr_print_struct(ndr, name, "trustAuthInOutSecret2V1"); + ndr_print_struct(ndr, name, "DsCompressedChunk"); ndr->depth++; - ndr_print_NTTIME(ndr, "time1", r->time1); - ndr_print_uint32(ndr, "unknown1", r->unknown1); - ndr_print_DATA_BLOB(ndr, "value", r->value); - ndr_print_NTTIME(ndr, "time2", r->time2); - ndr_print_uint32(ndr, "unknown2", r->unknown2); - ndr_print_uint32(ndr, "unknown3", r->unknown3); - ndr_print_uint32(ndr, "unknown4", r->unknown4); - ndr_print_DATA_BLOB(ndr, "_pad", r->_pad); + ndr_print_uint32(ndr, "marker", r->marker); + ndr_print_DATA_BLOB(ndr, "data", r->data); ndr->depth--; } -static enum ndr_err_code ndr_push_trustAuthInOutSecret2V2(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutSecret2V2 *r) +static enum ndr_err_code ndr_push_ExtendedErrorAString(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorAString *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time1)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1)); - NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value)); - NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time2)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3)); - { - uint32_t _flags_save_DATA_BLOB = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); - NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad)); - ndr->flags = _flags_save_DATA_BLOB; - } + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->__size)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->string)); } if (ndr_flags & NDR_BUFFERS) { + if (r->string) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->__size)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->string, r->__size, sizeof(uint8_t), CH_DOS)); + } } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_trustAuthInOutSecret2V2(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutSecret2V2 *r) +static enum ndr_err_code ndr_pull_ExtendedErrorAString(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorAString *r) { + uint32_t _ptr_string; + TALLOC_CTX *_mem_save_string_0; if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time1)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1)); - NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value)); - NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time2)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3)); - { - uint32_t _flags_save_DATA_BLOB = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); - NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad)); - ndr->flags = _flags_save_DATA_BLOB; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->__size)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_string)); + if (_ptr_string) { + NDR_PULL_ALLOC(ndr, r->string); + } else { + r->string = NULL; } } if (ndr_flags & NDR_BUFFERS) { + if (r->string) { + _mem_save_string_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->string, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->string)); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->string, ndr_get_array_size(ndr, &r->string), sizeof(uint8_t), CH_DOS)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_string_0, 0); + } + if (r->string) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->string, r->__size)); + } } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_trustAuthInOutSecret2V2(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret2V2 *r) +_PUBLIC_ void ndr_print_ExtendedErrorAString(struct ndr_print *ndr, const char *name, const struct ExtendedErrorAString *r) { - ndr_print_struct(ndr, name, "trustAuthInOutSecret2V2"); + ndr_print_struct(ndr, name, "ExtendedErrorAString"); ndr->depth++; - ndr_print_NTTIME(ndr, "time1", r->time1); - ndr_print_uint32(ndr, "unknown1", r->unknown1); - ndr_print_DATA_BLOB(ndr, "value", r->value); - ndr_print_NTTIME(ndr, "time2", r->time2); - ndr_print_uint32(ndr, "unknown2", r->unknown2); - ndr_print_uint32(ndr, "unknown3", r->unknown3); - ndr_print_DATA_BLOB(ndr, "_pad", r->_pad); + ndr_print_uint16(ndr, "__size", r->__size); + ndr_print_ptr(ndr, "string", r->string); + ndr->depth++; + if (r->string) { + ndr_print_string(ndr, "string", r->string); + } + ndr->depth--; ndr->depth--; } -static enum ndr_err_code ndr_push_trustAuthInOutCtr2(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutCtr2 *r) +static enum ndr_err_code ndr_push_ExtendedErrorUString(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorUString *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_relative_ptr1(ndr, r->value1)); - NDR_CHECK(ndr_push_relative_ptr1(ndr, r->value2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->__size)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->string)); } if (ndr_flags & NDR_BUFFERS) { - if (r->value1) { - NDR_CHECK(ndr_push_relative_ptr2(ndr, r->value1)); - NDR_CHECK(ndr_push_trustAuthInOutSecret2V1(ndr, NDR_SCALARS, r->value1)); - } - if (r->value2) { - NDR_CHECK(ndr_push_relative_ptr2(ndr, r->value2)); - NDR_CHECK(ndr_push_trustAuthInOutSecret2V2(ndr, NDR_SCALARS, r->value2)); + if (r->string) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->__size)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->string, r->__size, sizeof(uint16_t), CH_UTF16)); } } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_trustAuthInOutCtr2(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutCtr2 *r) +static enum ndr_err_code ndr_pull_ExtendedErrorUString(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorUString *r) { - uint32_t _ptr_value1; - TALLOC_CTX *_mem_save_value1_0; - uint32_t _ptr_value2; - TALLOC_CTX *_mem_save_value2_0; + uint32_t _ptr_string; + TALLOC_CTX *_mem_save_string_0; if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value1)); - if (_ptr_value1) { - NDR_PULL_ALLOC(ndr, r->value1); - NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->value1, _ptr_value1)); - } else { - r->value1 = NULL; - } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value2)); - if (_ptr_value2) { - NDR_PULL_ALLOC(ndr, r->value2); - NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->value2, _ptr_value2)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->__size)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_string)); + if (_ptr_string) { + NDR_PULL_ALLOC(ndr, r->string); } else { - r->value2 = NULL; + r->string = NULL; } } if (ndr_flags & NDR_BUFFERS) { - if (r->value1) { - uint32_t _relative_save_offset; - _relative_save_offset = ndr->offset; - NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->value1)); - _mem_save_value1_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->value1, 0); - NDR_CHECK(ndr_pull_trustAuthInOutSecret2V1(ndr, NDR_SCALARS, r->value1)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value1_0, 0); - ndr->offset = _relative_save_offset; + if (r->string) { + _mem_save_string_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->string, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->string)); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->string, ndr_get_array_size(ndr, &r->string), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_string_0, 0); } - if (r->value2) { - uint32_t _relative_save_offset; - _relative_save_offset = ndr->offset; - NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->value2)); - _mem_save_value2_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->value2, 0); - NDR_CHECK(ndr_pull_trustAuthInOutSecret2V2(ndr, NDR_SCALARS, r->value2)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value2_0, 0); - ndr->offset = _relative_save_offset; + if (r->string) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->string, r->__size)); } } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_trustAuthInOutCtr2(struct ndr_print *ndr, const char *name, const struct trustAuthInOutCtr2 *r) +_PUBLIC_ void ndr_print_ExtendedErrorUString(struct ndr_print *ndr, const char *name, const struct ExtendedErrorUString *r) { - ndr_print_struct(ndr, name, "trustAuthInOutCtr2"); + ndr_print_struct(ndr, name, "ExtendedErrorUString"); ndr->depth++; - ndr_print_ptr(ndr, "value1", r->value1); + ndr_print_uint16(ndr, "__size", r->__size); + ndr_print_ptr(ndr, "string", r->string); ndr->depth++; - if (r->value1) { - ndr_print_trustAuthInOutSecret2V1(ndr, "value1", r->value1); + if (r->string) { + ndr_print_string(ndr, "string", r->string); } ndr->depth--; - ndr_print_ptr(ndr, "value2", r->value2); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_ExtendedErrorBlob(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorBlob *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->data)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length)); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_ExtendedErrorBlob(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorBlob *r) +{ + uint32_t _ptr_data; + TALLOC_CTX *_mem_save_data_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->data); + } else { + r->data = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->data)); + NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + } + if (r->data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->length)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ExtendedErrorBlob(struct ndr_print *ndr, const char *name, const struct ExtendedErrorBlob *r) +{ + ndr_print_struct(ndr, name, "ExtendedErrorBlob"); ndr->depth++; - if (r->value2) { - ndr_print_trustAuthInOutSecret2V2(ndr, "value2", r->value2); + ndr_print_uint16(ndr, "length", r->length); + ndr_print_ptr(ndr, "data", r->data); + ndr->depth++; + if (r->data) { + ndr_print_array_uint8(ndr, "data", r->data, r->length); } ndr->depth--; ndr->depth--; } -static enum ndr_err_code ndr_push_trustAuthInOutCtr(struct ndr_push *ndr, int ndr_flags, const union trustAuthInOutCtr *r) +static enum ndr_err_code ndr_push_ExtendedErrorComputerNamePresent(struct ndr_push *ndr, int ndr_flags, enum ExtendedErrorComputerNamePresent r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_ExtendedErrorComputerNamePresent(struct ndr_pull *ndr, int ndr_flags, enum ExtendedErrorComputerNamePresent *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ExtendedErrorComputerNamePresent(struct ndr_print *ndr, const char *name, enum ExtendedErrorComputerNamePresent r) +{ + const char *val = NULL; + + switch (r) { + case EXTENDED_ERROR_COMPUTER_NAME_PRESENT: val = "EXTENDED_ERROR_COMPUTER_NAME_PRESENT"; break; + case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT: val = "EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_ExtendedErrorComputerNameU(struct ndr_push *ndr, int ndr_flags, const union ExtendedErrorComputerNameU *r) { if (ndr_flags & NDR_SCALARS) { int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_ExtendedErrorComputerNamePresent(ndr, NDR_SCALARS, level)); switch (level) { - case 1: { - NDR_CHECK(ndr_push_trustAuthInOutCtr1(ndr, NDR_SCALARS, &r->ctr1)); + case EXTENDED_ERROR_COMPUTER_NAME_PRESENT: { + NDR_CHECK(ndr_push_ExtendedErrorUString(ndr, NDR_SCALARS, &r->name)); break; } - case 2: { - NDR_CHECK(ndr_push_trustAuthInOutCtr2(ndr, NDR_SCALARS, &r->ctr2)); + case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT: { break; } default: @@ -2673,12 +3013,11 @@ static enum ndr_err_code ndr_push_trustAuthInOutCtr(struct ndr_push *ndr, int nd if (ndr_flags & NDR_BUFFERS) { int level = ndr_push_get_switch_value(ndr, r); switch (level) { - case 1: - NDR_CHECK(ndr_push_trustAuthInOutCtr1(ndr, NDR_BUFFERS, &r->ctr1)); + case EXTENDED_ERROR_COMPUTER_NAME_PRESENT: + NDR_CHECK(ndr_push_ExtendedErrorUString(ndr, NDR_BUFFERS, &r->name)); break; - case 2: - NDR_CHECK(ndr_push_trustAuthInOutCtr2(ndr, NDR_BUFFERS, &r->ctr2)); + case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT: break; default: @@ -2688,18 +3027,22 @@ static enum ndr_err_code ndr_push_trustAuthInOutCtr(struct ndr_push *ndr, int nd return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_trustAuthInOutCtr(struct ndr_pull *ndr, int ndr_flags, union trustAuthInOutCtr *r) +static enum ndr_err_code ndr_pull_ExtendedErrorComputerNameU(struct ndr_pull *ndr, int ndr_flags, union ExtendedErrorComputerNameU *r) { int level; + uint16_t _level; level = ndr_pull_get_switch_value(ndr, r); if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } switch (level) { - case 1: { - NDR_CHECK(ndr_pull_trustAuthInOutCtr1(ndr, NDR_SCALARS, &r->ctr1)); + case EXTENDED_ERROR_COMPUTER_NAME_PRESENT: { + NDR_CHECK(ndr_pull_ExtendedErrorUString(ndr, NDR_SCALARS, &r->name)); break; } - case 2: { - NDR_CHECK(ndr_pull_trustAuthInOutCtr2(ndr, NDR_SCALARS, &r->ctr2)); + case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT: { break; } default: @@ -2708,12 +3051,11 @@ static enum ndr_err_code ndr_pull_trustAuthInOutCtr(struct ndr_pull *ndr, int nd } if (ndr_flags & NDR_BUFFERS) { switch (level) { - case 1: - NDR_CHECK(ndr_pull_trustAuthInOutCtr1(ndr, NDR_BUFFERS, &r->ctr1)); + case EXTENDED_ERROR_COMPUTER_NAME_PRESENT: + NDR_CHECK(ndr_pull_ExtendedErrorUString(ndr, NDR_BUFFERS, &r->name)); break; - case 2: - NDR_CHECK(ndr_pull_trustAuthInOutCtr2(ndr, NDR_BUFFERS, &r->ctr2)); + case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT: break; default: @@ -2723,18 +3065,17 @@ static enum ndr_err_code ndr_pull_trustAuthInOutCtr(struct ndr_pull *ndr, int nd return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_trustAuthInOutCtr(struct ndr_print *ndr, const char *name, const union trustAuthInOutCtr *r) +_PUBLIC_ void ndr_print_ExtendedErrorComputerNameU(struct ndr_print *ndr, const char *name, const union ExtendedErrorComputerNameU *r) { int level; level = ndr_print_get_switch_value(ndr, r); - ndr_print_union(ndr, name, level, "trustAuthInOutCtr"); + ndr_print_union(ndr, name, level, "ExtendedErrorComputerNameU"); switch (level) { - case 1: - ndr_print_trustAuthInOutCtr1(ndr, "ctr1", &r->ctr1); + case EXTENDED_ERROR_COMPUTER_NAME_PRESENT: + ndr_print_ExtendedErrorUString(ndr, "name", &r->name); break; - case 2: - ndr_print_trustAuthInOutCtr2(ndr, "ctr2", &r->ctr2); + case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT: break; default: @@ -2742,116 +3083,404 @@ _PUBLIC_ void ndr_print_trustAuthInOutCtr(struct ndr_print *ndr, const char *nam } } -_PUBLIC_ enum ndr_err_code ndr_push_trustAuthInOutBlob(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutBlob *r) +static enum ndr_err_code ndr_push_ExtendedErrorComputerName(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorComputerName *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version)); - NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->version)); - NDR_CHECK(ndr_push_trustAuthInOutCtr(ndr, NDR_SCALARS, &r->ctr)); + NDR_CHECK(ndr_push_ExtendedErrorComputerNamePresent(ndr, NDR_SCALARS, r->present)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->n, r->present)); + NDR_CHECK(ndr_push_ExtendedErrorComputerNameU(ndr, NDR_SCALARS, &r->n)); } if (ndr_flags & NDR_BUFFERS) { - NDR_CHECK(ndr_push_trustAuthInOutCtr(ndr, NDR_BUFFERS, &r->ctr)); + NDR_CHECK(ndr_push_ExtendedErrorComputerNameU(ndr, NDR_BUFFERS, &r->n)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ enum ndr_err_code ndr_pull_trustAuthInOutBlob(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutBlob *r) +static enum ndr_err_code ndr_pull_ExtendedErrorComputerName(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorComputerName *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->version)); - NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->ctr, r->version)); - NDR_CHECK(ndr_pull_trustAuthInOutCtr(ndr, NDR_SCALARS, &r->ctr)); + NDR_CHECK(ndr_pull_ExtendedErrorComputerNamePresent(ndr, NDR_SCALARS, &r->present)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->n, r->present)); + NDR_CHECK(ndr_pull_ExtendedErrorComputerNameU(ndr, NDR_SCALARS, &r->n)); } if (ndr_flags & NDR_BUFFERS) { - NDR_CHECK(ndr_pull_trustAuthInOutCtr(ndr, NDR_BUFFERS, &r->ctr)); + NDR_CHECK(ndr_pull_ExtendedErrorComputerNameU(ndr, NDR_BUFFERS, &r->n)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_trustAuthInOutBlob(struct ndr_print *ndr, const char *name, const struct trustAuthInOutBlob *r) +_PUBLIC_ void ndr_print_ExtendedErrorComputerName(struct ndr_print *ndr, const char *name, const struct ExtendedErrorComputerName *r) { - ndr_print_struct(ndr, name, "trustAuthInOutBlob"); + ndr_print_struct(ndr, name, "ExtendedErrorComputerName"); ndr->depth++; - ndr_print_uint32(ndr, "version", r->version); - ndr_print_set_switch_value(ndr, &r->ctr, r->version); - ndr_print_trustAuthInOutCtr(ndr, "ctr", &r->ctr); + ndr_print_ExtendedErrorComputerNamePresent(ndr, "present", r->present); + ndr_print_set_switch_value(ndr, &r->n, r->present); + ndr_print_ExtendedErrorComputerNameU(ndr, "n", &r->n); ndr->depth--; } -_PUBLIC_ enum ndr_err_code ndr_push_DsCompressedChunk(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedChunk *r) +static enum ndr_err_code ndr_push_ExtendedErrorParamType(struct ndr_push *ndr, int ndr_flags, enum ExtendedErrorParamType r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_ExtendedErrorParamType(struct ndr_pull *ndr, int ndr_flags, enum ExtendedErrorParamType *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ExtendedErrorParamType(struct ndr_print *ndr, const char *name, enum ExtendedErrorParamType r) +{ + const char *val = NULL; + + switch (r) { + case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING: val = "EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING"; break; + case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING: val = "EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING"; break; + case EXTENDED_ERROR_PARAM_TYPE_UINT32: val = "EXTENDED_ERROR_PARAM_TYPE_UINT32"; break; + case EXTENDED_ERROR_PARAM_TYPE_UINT16: val = "EXTENDED_ERROR_PARAM_TYPE_UINT16"; break; + case EXTENDED_ERROR_PARAM_TYPE_UINT64: val = "EXTENDED_ERROR_PARAM_TYPE_UINT64"; break; + case EXTENDED_ERROR_PARAM_TYPE_NONE: val = "EXTENDED_ERROR_PARAM_TYPE_NONE"; break; + case EXTENDED_ERROR_PARAM_TYPE_BLOB: val = "EXTENDED_ERROR_PARAM_TYPE_BLOB"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_ExtendedErrorParamU(struct ndr_push *ndr, int ndr_flags, const union ExtendedErrorParamU *r) { if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->marker)); - NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->data)); + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_ExtendedErrorParamType(ndr, NDR_SCALARS, level)); + switch (level) { + case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING: { + NDR_CHECK(ndr_push_ExtendedErrorAString(ndr, NDR_SCALARS, &r->a_string)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING: { + NDR_CHECK(ndr_push_ExtendedErrorUString(ndr, NDR_SCALARS, &r->u_string)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_UINT32: { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->uint32)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_UINT16: { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->uint16)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_UINT64: { + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->uint64)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_NONE: { + break; } + + case EXTENDED_ERROR_PARAM_TYPE_BLOB: { + NDR_CHECK(ndr_push_ExtendedErrorBlob(ndr, NDR_SCALARS, &r->blob)); + break; } + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } } if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING: + NDR_CHECK(ndr_push_ExtendedErrorAString(ndr, NDR_BUFFERS, &r->a_string)); + break; + + case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING: + NDR_CHECK(ndr_push_ExtendedErrorUString(ndr, NDR_BUFFERS, &r->u_string)); + break; + + case EXTENDED_ERROR_PARAM_TYPE_UINT32: + break; + + case EXTENDED_ERROR_PARAM_TYPE_UINT16: + break; + + case EXTENDED_ERROR_PARAM_TYPE_UINT64: + break; + + case EXTENDED_ERROR_PARAM_TYPE_NONE: + break; + + case EXTENDED_ERROR_PARAM_TYPE_BLOB: + NDR_CHECK(ndr_push_ExtendedErrorBlob(ndr, NDR_BUFFERS, &r->blob)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } } return NDR_ERR_SUCCESS; } -_PUBLIC_ enum ndr_err_code ndr_pull_DsCompressedChunk(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedChunk *r) +static enum ndr_err_code ndr_pull_ExtendedErrorParamU(struct ndr_pull *ndr, int ndr_flags, union ExtendedErrorParamU *r) { + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->marker)); - NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->data)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING: { + NDR_CHECK(ndr_pull_ExtendedErrorAString(ndr, NDR_SCALARS, &r->a_string)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING: { + NDR_CHECK(ndr_pull_ExtendedErrorUString(ndr, NDR_SCALARS, &r->u_string)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_UINT32: { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->uint32)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_UINT16: { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->uint16)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_UINT64: { + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->uint64)); + break; } + + case EXTENDED_ERROR_PARAM_TYPE_NONE: { + break; } + + case EXTENDED_ERROR_PARAM_TYPE_BLOB: { + NDR_CHECK(ndr_pull_ExtendedErrorBlob(ndr, NDR_SCALARS, &r->blob)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING: + NDR_CHECK(ndr_pull_ExtendedErrorAString(ndr, NDR_BUFFERS, &r->a_string)); + break; + + case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING: + NDR_CHECK(ndr_pull_ExtendedErrorUString(ndr, NDR_BUFFERS, &r->u_string)); + break; + + case EXTENDED_ERROR_PARAM_TYPE_UINT32: + break; + + case EXTENDED_ERROR_PARAM_TYPE_UINT16: + break; + + case EXTENDED_ERROR_PARAM_TYPE_UINT64: + break; + + case EXTENDED_ERROR_PARAM_TYPE_NONE: + break; + + case EXTENDED_ERROR_PARAM_TYPE_BLOB: + NDR_CHECK(ndr_pull_ExtendedErrorBlob(ndr, NDR_BUFFERS, &r->blob)); + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ExtendedErrorParamU(struct ndr_print *ndr, const char *name, const union ExtendedErrorParamU *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "ExtendedErrorParamU"); + switch (level) { + case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING: + ndr_print_ExtendedErrorAString(ndr, "a_string", &r->a_string); + break; + + case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING: + ndr_print_ExtendedErrorUString(ndr, "u_string", &r->u_string); + break; + + case EXTENDED_ERROR_PARAM_TYPE_UINT32: + ndr_print_uint32(ndr, "uint32", r->uint32); + break; + + case EXTENDED_ERROR_PARAM_TYPE_UINT16: + ndr_print_uint16(ndr, "uint16", r->uint16); + break; + + case EXTENDED_ERROR_PARAM_TYPE_UINT64: + ndr_print_hyper(ndr, "uint64", r->uint64); + break; + + case EXTENDED_ERROR_PARAM_TYPE_NONE: + break; + + case EXTENDED_ERROR_PARAM_TYPE_BLOB: + ndr_print_ExtendedErrorBlob(ndr, "blob", &r->blob); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_ExtendedErrorParam(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorParam *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_ExtendedErrorParamType(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->p, r->type)); + NDR_CHECK(ndr_push_ExtendedErrorParamU(ndr, NDR_SCALARS, &r->p)); } if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_ExtendedErrorParamU(ndr, NDR_BUFFERS, &r->p)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_DsCompressedChunk(struct ndr_print *ndr, const char *name, const struct DsCompressedChunk *r) +static enum ndr_err_code ndr_pull_ExtendedErrorParam(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorParam *r) { - ndr_print_struct(ndr, name, "DsCompressedChunk"); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_ExtendedErrorParamType(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->p, r->type)); + NDR_CHECK(ndr_pull_ExtendedErrorParamU(ndr, NDR_SCALARS, &r->p)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_ExtendedErrorParamU(ndr, NDR_BUFFERS, &r->p)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ExtendedErrorParam(struct ndr_print *ndr, const char *name, const struct ExtendedErrorParam *r) +{ + ndr_print_struct(ndr, name, "ExtendedErrorParam"); ndr->depth++; - ndr_print_uint32(ndr, "marker", r->marker); - ndr_print_DATA_BLOB(ndr, "data", r->data); + ndr_print_ExtendedErrorParamType(ndr, "type", r->type); + ndr_print_set_switch_value(ndr, &r->p, r->type); + ndr_print_ExtendedErrorParamU(ndr, "p", &r->p); ndr->depth--; } -_PUBLIC_ enum ndr_err_code ndr_push_DsCompressedBlob(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedBlob *r) +_PUBLIC_ enum ndr_err_code ndr_push_ExtendedErrorInfo(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorInfo *r) { - uint32_t cntr_chunks_0; + uint32_t cntr_params_0; if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - for (cntr_chunks_0 = 0; cntr_chunks_0 < 5; cntr_chunks_0++) { - NDR_CHECK(ndr_push_DsCompressedChunk(ndr, NDR_SCALARS, &r->chunks[cntr_chunks_0])); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_params)); + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->next)); + NDR_CHECK(ndr_push_ExtendedErrorComputerName(ndr, NDR_SCALARS, &r->computer_name)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->pid)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->generating_component)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->status)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->detection_location)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->flags)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_params)); + for (cntr_params_0 = 0; cntr_params_0 < r->num_params; cntr_params_0++) { + NDR_CHECK(ndr_push_ExtendedErrorParam(ndr, NDR_SCALARS, &r->params[cntr_params_0])); } } if (ndr_flags & NDR_BUFFERS) { + if (r->next) { + NDR_CHECK(ndr_push_ExtendedErrorInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->next)); + } + NDR_CHECK(ndr_push_ExtendedErrorComputerName(ndr, NDR_BUFFERS, &r->computer_name)); + for (cntr_params_0 = 0; cntr_params_0 < r->num_params; cntr_params_0++) { + NDR_CHECK(ndr_push_ExtendedErrorParam(ndr, NDR_BUFFERS, &r->params[cntr_params_0])); + } } return NDR_ERR_SUCCESS; } -_PUBLIC_ enum ndr_err_code ndr_pull_DsCompressedBlob(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedBlob *r) +_PUBLIC_ enum ndr_err_code ndr_pull_ExtendedErrorInfo(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorInfo *r) { - uint32_t cntr_chunks_0; + uint32_t _ptr_next; + TALLOC_CTX *_mem_save_next_0; + uint32_t cntr_params_0; + TALLOC_CTX *_mem_save_params_0; if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - for (cntr_chunks_0 = 0; cntr_chunks_0 < 5; cntr_chunks_0++) { - NDR_CHECK(ndr_pull_DsCompressedChunk(ndr, NDR_SCALARS, &r->chunks[cntr_chunks_0])); + NDR_CHECK(ndr_pull_array_size(ndr, &r->params)); + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_next)); + if (_ptr_next) { + NDR_PULL_ALLOC(ndr, r->next); + } else { + r->next = NULL; + } + NDR_CHECK(ndr_pull_ExtendedErrorComputerName(ndr, NDR_SCALARS, &r->computer_name)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->pid)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->generating_component)); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->status)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->detection_location)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->flags)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->num_params)); + NDR_PULL_ALLOC_N(ndr, r->params, ndr_get_array_size(ndr, &r->params)); + _mem_save_params_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->params, 0); + for (cntr_params_0 = 0; cntr_params_0 < r->num_params; cntr_params_0++) { + NDR_CHECK(ndr_pull_ExtendedErrorParam(ndr, NDR_SCALARS, &r->params[cntr_params_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_params_0, 0); + if (r->params) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->params, r->num_params)); } } if (ndr_flags & NDR_BUFFERS) { + if (r->next) { + _mem_save_next_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->next, 0); + NDR_CHECK(ndr_pull_ExtendedErrorInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->next)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_next_0, 0); + } + NDR_CHECK(ndr_pull_ExtendedErrorComputerName(ndr, NDR_BUFFERS, &r->computer_name)); + _mem_save_params_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->params, 0); + for (cntr_params_0 = 0; cntr_params_0 < r->num_params; cntr_params_0++) { + NDR_CHECK(ndr_pull_ExtendedErrorParam(ndr, NDR_BUFFERS, &r->params[cntr_params_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_params_0, 0); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_DsCompressedBlob(struct ndr_print *ndr, const char *name, const struct DsCompressedBlob *r) +_PUBLIC_ void ndr_print_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfo *r) { - uint32_t cntr_chunks_0; - ndr_print_struct(ndr, name, "DsCompressedBlob"); + uint32_t cntr_params_0; + ndr_print_struct(ndr, name, "ExtendedErrorInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "next", r->next); ndr->depth++; - ndr->print(ndr, "%s: ARRAY(%d)", "chunks", (int)5); + if (r->next) { + ndr_print_ExtendedErrorInfo(ndr, "next", r->next); + } + ndr->depth--; + ndr_print_ExtendedErrorComputerName(ndr, "computer_name", &r->computer_name); + ndr_print_hyper(ndr, "pid", r->pid); + ndr_print_NTTIME(ndr, "time", r->time); + ndr_print_uint32(ndr, "generating_component", r->generating_component); + ndr_print_WERROR(ndr, "status", r->status); + ndr_print_uint16(ndr, "detection_location", r->detection_location); + ndr_print_uint16(ndr, "flags", r->flags); + ndr_print_uint16(ndr, "num_params", r->num_params); + ndr->print(ndr, "%s: ARRAY(%d)", "params", (int)r->num_params); ndr->depth++; - for (cntr_chunks_0=0;cntr_chunks_0<5;cntr_chunks_0++) { + for (cntr_params_0=0;cntr_params_0<r->num_params;cntr_params_0++) { char *idx_0=NULL; - if (asprintf(&idx_0, "[%d]", cntr_chunks_0) != -1) { - ndr_print_DsCompressedChunk(ndr, "chunks", &r->chunks[cntr_chunks_0]); + if (asprintf(&idx_0, "[%d]", cntr_params_0) != -1) { + ndr_print_ExtendedErrorParam(ndr, "params", &r->params[cntr_params_0]); free(idx_0); } } @@ -2859,6 +3488,57 @@ _PUBLIC_ void ndr_print_DsCompressedBlob(struct ndr_print *ndr, const char *name ndr->depth--; } +static enum ndr_err_code ndr_push_ExtendedErrorInfoPtr(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorInfoPtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->info)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->info) { + NDR_CHECK(ndr_push_ExtendedErrorInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->info)); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_ExtendedErrorInfoPtr(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorInfoPtr *r) +{ + uint32_t _ptr_info; + TALLOC_CTX *_mem_save_info_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { + NDR_PULL_ALLOC(ndr, r->info); + } else { + r->info = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->info) { + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->info, 0); + NDR_CHECK(ndr_pull_ExtendedErrorInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ExtendedErrorInfoPtr(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfoPtr *r) +{ + ndr_print_struct(ndr, name, "ExtendedErrorInfoPtr"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->info); + ndr->depth++; + if (r->info) { + ndr_print_ExtendedErrorInfo(ndr, "info", r->info); + } + ndr->depth--; + ndr->depth--; +} + static enum ndr_err_code ndr_push_decode_replPropertyMetaData(struct ndr_push *ndr, int flags, const struct decode_replPropertyMetaData *r) { if (flags & NDR_IN) { @@ -3351,41 +4031,92 @@ _PUBLIC_ void ndr_print_decode_trustAuthInOut(struct ndr_print *ndr, const char ndr->depth--; } -static enum ndr_err_code ndr_push_decode_DsCompressed(struct ndr_push *ndr, int flags, const struct decode_DsCompressed *r) +static enum ndr_err_code ndr_push_decode_trustDomainPasswords(struct ndr_push *ndr, int flags, const struct decode_trustDomainPasswords *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_trustDomainPasswords(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.blob)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_decode_trustDomainPasswords(struct ndr_pull *ndr, int flags, struct decode_trustDomainPasswords *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_trustDomainPasswords(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.blob)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_decode_trustDomainPasswords(struct ndr_print *ndr, const char *name, int flags, const struct decode_trustDomainPasswords *r) +{ + ndr_print_struct(ndr, name, "decode_trustDomainPasswords"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "decode_trustDomainPasswords"); + ndr->depth++; + ndr_print_trustDomainPasswords(ndr, "blob", &r->in.blob); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "decode_trustDomainPasswords"); + ndr->depth++; + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_decode_ExtendedErrorInfo(struct ndr_push *ndr, int flags, const struct decode_ExtendedErrorInfo *r) { if (flags & NDR_IN) { - NDR_CHECK(ndr_push_DsCompressedBlob(ndr, NDR_SCALARS, &r->in.blob)); + { + struct ndr_push *_ndr_ptr; + NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ptr, 0xFFFFFC01, -1)); + NDR_CHECK(ndr_push_ExtendedErrorInfoPtr(_ndr_ptr, NDR_SCALARS|NDR_BUFFERS, &r->in.ptr)); + NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ptr, 0xFFFFFC01, -1)); + } } if (flags & NDR_OUT) { } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_decode_DsCompressed(struct ndr_pull *ndr, int flags, struct decode_DsCompressed *r) +static enum ndr_err_code ndr_pull_decode_ExtendedErrorInfo(struct ndr_pull *ndr, int flags, struct decode_ExtendedErrorInfo *r) { if (flags & NDR_IN) { - NDR_CHECK(ndr_pull_DsCompressedBlob(ndr, NDR_SCALARS, &r->in.blob)); + { + struct ndr_pull *_ndr_ptr; + NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ptr, 0xFFFFFC01, -1)); + NDR_CHECK(ndr_pull_ExtendedErrorInfoPtr(_ndr_ptr, NDR_SCALARS|NDR_BUFFERS, &r->in.ptr)); + NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ptr, 0xFFFFFC01, -1)); + } } if (flags & NDR_OUT) { } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_decode_DsCompressed(struct ndr_print *ndr, const char *name, int flags, const struct decode_DsCompressed *r) +_PUBLIC_ void ndr_print_decode_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, int flags, const struct decode_ExtendedErrorInfo *r) { - ndr_print_struct(ndr, name, "decode_DsCompressed"); + ndr_print_struct(ndr, name, "decode_ExtendedErrorInfo"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "decode_DsCompressed"); + ndr_print_struct(ndr, "in", "decode_ExtendedErrorInfo"); ndr->depth++; - ndr_print_DsCompressedBlob(ndr, "blob", &r->in.blob); + ndr_print_ExtendedErrorInfoPtr(ndr, "ptr", &r->in.ptr); ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "decode_DsCompressed"); + ndr_print_struct(ndr, "out", "decode_ExtendedErrorInfo"); ndr->depth++; ndr->depth--; } @@ -3490,11 +4221,19 @@ static const struct ndr_interface_call drsblobs_calls[] = { false, }, { - "decode_DsCompressed", - sizeof(struct decode_DsCompressed), - (ndr_push_flags_fn_t) ndr_push_decode_DsCompressed, - (ndr_pull_flags_fn_t) ndr_pull_decode_DsCompressed, - (ndr_print_function_t) ndr_print_decode_DsCompressed, + "decode_trustDomainPasswords", + sizeof(struct decode_trustDomainPasswords), + (ndr_push_flags_fn_t) ndr_push_decode_trustDomainPasswords, + (ndr_pull_flags_fn_t) ndr_pull_decode_trustDomainPasswords, + (ndr_print_function_t) ndr_print_decode_trustDomainPasswords, + false, + }, + { + "decode_ExtendedErrorInfo", + sizeof(struct decode_ExtendedErrorInfo), + (ndr_push_flags_fn_t) ndr_push_decode_ExtendedErrorInfo, + (ndr_pull_flags_fn_t) ndr_pull_decode_ExtendedErrorInfo, + (ndr_print_function_t) ndr_print_decode_ExtendedErrorInfo, false, }, { NULL, 0, NULL, NULL, NULL, false } @@ -3526,7 +4265,7 @@ const struct ndr_interface_table ndr_table_drsblobs = { NDR_DRSBLOBS_VERSION }, .helpstring = NDR_DRSBLOBS_HELPSTRING, - .num_calls = 13, + .num_calls = 14, .calls = drsblobs_calls, .endpoints = &drsblobs_endpoints, .authservices = &drsblobs_authservices diff --git a/source3/librpc/gen_ndr/ndr_drsblobs.h b/source3/librpc/gen_ndr/ndr_drsblobs.h index 171e7e25a1..8a5298874a 100644 --- a/source3/librpc/gen_ndr/ndr_drsblobs.h +++ b/source3/librpc/gen_ndr/ndr_drsblobs.h @@ -35,9 +35,11 @@ extern const struct ndr_interface_table ndr_table_drsblobs; #define NDR_DECODE_TRUSTAUTHINOUT (0x0b) -#define NDR_DECODE_DSCOMPRESSED (0x0c) +#define NDR_DECODE_TRUSTDOMAINPASSWORDS (0x0c) -#define NDR_DRSBLOBS_CALL_COUNT (13) +#define NDR_DECODE_EXTENDEDERRORINFO (0x0d) + +#define NDR_DRSBLOBS_CALL_COUNT (14) void ndr_print_replPropertyMetaData1(struct ndr_print *ndr, const char *name, const struct replPropertyMetaData1 *r); void ndr_print_replPropertyMetaDataCtr1(struct ndr_print *ndr, const char *name, const struct replPropertyMetaDataCtr1 *r); void ndr_print_replPropertyMetaDataCtr(struct ndr_print *ndr, const char *name, const union replPropertyMetaDataCtr *r); @@ -102,21 +104,44 @@ void ndr_print_package_PrimaryWDigestHash(struct ndr_print *ndr, const char *nam enum ndr_err_code ndr_push_package_PrimaryWDigestBlob(struct ndr_push *ndr, int ndr_flags, const struct package_PrimaryWDigestBlob *r); enum ndr_err_code ndr_pull_package_PrimaryWDigestBlob(struct ndr_pull *ndr, int ndr_flags, struct package_PrimaryWDigestBlob *r); void ndr_print_package_PrimaryWDigestBlob(struct ndr_print *ndr, const char *name, const struct package_PrimaryWDigestBlob *r); -void ndr_print_trustAuthInOutSecret1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret1 *r); -void ndr_print_trustAuthInOutCtr1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutCtr1 *r); -void ndr_print_trustAuthInOutSecret2V1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret2V1 *r); -void ndr_print_trustAuthInOutSecret2V2(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret2V2 *r); -void ndr_print_trustAuthInOutCtr2(struct ndr_print *ndr, const char *name, const struct trustAuthInOutCtr2 *r); -void ndr_print_trustAuthInOutCtr(struct ndr_print *ndr, const char *name, const union trustAuthInOutCtr *r); +void ndr_print_AuthInfoNone(struct ndr_print *ndr, const char *name, const struct AuthInfoNone *r); +void ndr_print_AuthInfoNT4Owf(struct ndr_print *ndr, const char *name, const struct AuthInfoNT4Owf *r); +void ndr_print_AuthInfoClear(struct ndr_print *ndr, const char *name, const struct AuthInfoClear *r); +void ndr_print_AuthInfoVersion(struct ndr_print *ndr, const char *name, const struct AuthInfoVersion *r); +void ndr_print_AuthInfo(struct ndr_print *ndr, const char *name, const union AuthInfo *r); +enum ndr_err_code ndr_push_AuthenticationInformation(struct ndr_push *ndr, int ndr_flags, const struct AuthenticationInformation *r); +enum ndr_err_code ndr_pull_AuthenticationInformation(struct ndr_pull *ndr, int ndr_flags, struct AuthenticationInformation *r); +void ndr_print_AuthenticationInformation(struct ndr_print *ndr, const char *name, const struct AuthenticationInformation *r); +enum ndr_err_code ndr_push_AuthenticationInformationArray(struct ndr_push *ndr, int ndr_flags, const struct AuthenticationInformationArray *r); +enum ndr_err_code ndr_pull_AuthenticationInformationArray(struct ndr_pull *ndr, int ndr_flags, struct AuthenticationInformationArray *r); +void ndr_print_AuthenticationInformationArray(struct ndr_print *ndr, const char *name, const struct AuthenticationInformationArray *r); enum ndr_err_code ndr_push_trustAuthInOutBlob(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutBlob *r); enum ndr_err_code ndr_pull_trustAuthInOutBlob(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutBlob *r); void ndr_print_trustAuthInOutBlob(struct ndr_print *ndr, const char *name, const struct trustAuthInOutBlob *r); +size_t ndr_size_trustAuthInOutBlob(const struct trustAuthInOutBlob *r, int flags); +enum ndr_err_code ndr_push_trustCurrentPasswords(struct ndr_push *ndr, int ndr_flags, const struct trustCurrentPasswords *r); +enum ndr_err_code ndr_pull_trustCurrentPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustCurrentPasswords *r); +void ndr_print_trustCurrentPasswords(struct ndr_print *ndr, const char *name, const struct trustCurrentPasswords *r); +size_t ndr_size_trustCurrentPasswords(const struct trustCurrentPasswords *r, int flags); +enum ndr_err_code ndr_push_trustDomainPasswords(struct ndr_push *ndr, int ndr_flags, const struct trustDomainPasswords *r); +enum ndr_err_code ndr_pull_trustDomainPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustDomainPasswords *r); +void ndr_print_trustDomainPasswords(struct ndr_print *ndr, const char *name, const struct trustDomainPasswords *r); enum ndr_err_code ndr_push_DsCompressedChunk(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedChunk *r); enum ndr_err_code ndr_pull_DsCompressedChunk(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedChunk *r); void ndr_print_DsCompressedChunk(struct ndr_print *ndr, const char *name, const struct DsCompressedChunk *r); -enum ndr_err_code ndr_push_DsCompressedBlob(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedBlob *r); -enum ndr_err_code ndr_pull_DsCompressedBlob(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedBlob *r); -void ndr_print_DsCompressedBlob(struct ndr_print *ndr, const char *name, const struct DsCompressedBlob *r); +void ndr_print_ExtendedErrorAString(struct ndr_print *ndr, const char *name, const struct ExtendedErrorAString *r); +void ndr_print_ExtendedErrorUString(struct ndr_print *ndr, const char *name, const struct ExtendedErrorUString *r); +void ndr_print_ExtendedErrorBlob(struct ndr_print *ndr, const char *name, const struct ExtendedErrorBlob *r); +void ndr_print_ExtendedErrorComputerNamePresent(struct ndr_print *ndr, const char *name, enum ExtendedErrorComputerNamePresent r); +void ndr_print_ExtendedErrorComputerNameU(struct ndr_print *ndr, const char *name, const union ExtendedErrorComputerNameU *r); +void ndr_print_ExtendedErrorComputerName(struct ndr_print *ndr, const char *name, const struct ExtendedErrorComputerName *r); +void ndr_print_ExtendedErrorParamType(struct ndr_print *ndr, const char *name, enum ExtendedErrorParamType r); +void ndr_print_ExtendedErrorParamU(struct ndr_print *ndr, const char *name, const union ExtendedErrorParamU *r); +void ndr_print_ExtendedErrorParam(struct ndr_print *ndr, const char *name, const struct ExtendedErrorParam *r); +enum ndr_err_code ndr_push_ExtendedErrorInfo(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorInfo *r); +enum ndr_err_code ndr_pull_ExtendedErrorInfo(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorInfo *r); +void ndr_print_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfo *r); +void ndr_print_ExtendedErrorInfoPtr(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfoPtr *r); void ndr_print_decode_replPropertyMetaData(struct ndr_print *ndr, const char *name, int flags, const struct decode_replPropertyMetaData *r); void ndr_print_decode_replUpToDateVector(struct ndr_print *ndr, const char *name, int flags, const struct decode_replUpToDateVector *r); void ndr_print_decode_repsFromTo(struct ndr_print *ndr, const char *name, int flags, const struct decode_repsFromTo *r); @@ -129,5 +154,6 @@ void ndr_print_decode_PrimaryKerberos(struct ndr_print *ndr, const char *name, i void ndr_print_decode_PrimaryCLEARTEXT(struct ndr_print *ndr, const char *name, int flags, const struct decode_PrimaryCLEARTEXT *r); void ndr_print_decode_PrimaryWDigest(struct ndr_print *ndr, const char *name, int flags, const struct decode_PrimaryWDigest *r); void ndr_print_decode_trustAuthInOut(struct ndr_print *ndr, const char *name, int flags, const struct decode_trustAuthInOut *r); -void ndr_print_decode_DsCompressed(struct ndr_print *ndr, const char *name, int flags, const struct decode_DsCompressed *r); +void ndr_print_decode_trustDomainPasswords(struct ndr_print *ndr, const char *name, int flags, const struct decode_trustDomainPasswords *r); +void ndr_print_decode_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, int flags, const struct decode_ExtendedErrorInfo *r); #endif /* _HEADER_NDR_drsblobs */ diff --git a/source3/librpc/gen_ndr/ndr_drsuapi.h b/source3/librpc/gen_ndr/ndr_drsuapi.h index e65bc62301..4b5ead467f 100644 --- a/source3/librpc/gen_ndr/ndr_drsuapi.h +++ b/source3/librpc/gen_ndr/ndr_drsuapi.h @@ -6,7 +6,7 @@ #ifndef _HEADER_NDR_drsuapi #define _HEADER_NDR_drsuapi -#include "librpc/ndr/ndr_drsuapi.h" +#include "../librpc/ndr/ndr_drsuapi.h" #define NDR_DRSUAPI_UUID "e3514235-4b06-11d1-ab04-00c04fc2dcd2" #define NDR_DRSUAPI_VERSION 4.0 #define NDR_DRSUAPI_NAME "drsuapi" diff --git a/source3/librpc/gen_ndr/ndr_ntsvcs.c b/source3/librpc/gen_ndr/ndr_ntsvcs.c index 62acf474ae..35d02a0dcb 100644 --- a/source3/librpc/gen_ndr/ndr_ntsvcs.c +++ b/source3/librpc/gen_ndr/ndr_ntsvcs.c @@ -508,9 +508,35 @@ _PUBLIC_ void ndr_print_PNP_EnumerateSubKeys(struct ndr_print *ndr, const char * static enum ndr_err_code ndr_push_PNP_GetDeviceList(struct ndr_push *ndr, int flags, const struct PNP_GetDeviceList *r) { + uint32_t cntr_buffer_1; if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.filter)); + if (r->in.filter) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.filter, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.filter, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.filter, ndr_charset_length(r->in.filter, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + if (r->in.length == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags)); } if (flags & NDR_OUT) { + if (r->out.buffer == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); + for (cntr_buffer_1 = 0; cntr_buffer_1 < *r->out.length; cntr_buffer_1++) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->out.buffer[cntr_buffer_1])); + } + if (r->out.length == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -518,16 +544,81 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceList(struct ndr_push *ndr, int fl static enum ndr_err_code ndr_pull_PNP_GetDeviceList(struct ndr_pull *ndr, int flags, struct PNP_GetDeviceList *r) { + uint32_t _ptr_filter; + uint32_t cntr_buffer_1; + TALLOC_CTX *_mem_save_filter_0; + TALLOC_CTX *_mem_save_buffer_1; + TALLOC_CTX *_mem_save_length_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_filter)); + if (_ptr_filter) { + NDR_PULL_ALLOC(ndr, r->in.filter); + } else { + r->in.filter = NULL; + } + if (r->in.filter) { + _mem_save_filter_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.filter, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.filter)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.filter)); + if (ndr_get_array_length(ndr, &r->in.filter) > ndr_get_array_size(ndr, &r->in.filter)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.filter), ndr_get_array_length(ndr, &r->in.filter)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.filter), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.filter, ndr_get_array_length(ndr, &r->in.filter), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filter_0, 0); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.length); + } + _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.length, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.length)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags)); + NDR_PULL_ALLOC_N(ndr, r->out.buffer, *r->in.length); + memset(r->out.buffer, 0, (*r->in.length) * sizeof(*r->out.buffer)); + NDR_PULL_ALLOC(ndr, r->out.length); + *r->out.length = *r->in.length; } if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.buffer)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->out.buffer)); + if (ndr_get_array_length(ndr, &r->out.buffer) > ndr_get_array_size(ndr, &r->out.buffer)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.buffer), ndr_get_array_length(ndr, &r->out.buffer)); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC_N(ndr, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer)); + } + _mem_save_buffer_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.buffer, 0); + for (cntr_buffer_1 = 0; cntr_buffer_1 < *r->out.length; cntr_buffer_1++) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->out.buffer[cntr_buffer_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_1, 0); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.length); + } + _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.length, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.length)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + if (r->out.buffer) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.buffer, *r->out.length)); + } + if (r->out.buffer) { + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.buffer, *r->out.length)); + } } return NDR_ERR_SUCCESS; } _PUBLIC_ void ndr_print_PNP_GetDeviceList(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceList *r) { + uint32_t cntr_buffer_1; ndr_print_struct(ndr, name, "PNP_GetDeviceList"); ndr->depth++; if (flags & NDR_SET_VALUES) { @@ -536,11 +627,39 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceList(struct ndr_print *ndr, const char *nam if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "PNP_GetDeviceList"); ndr->depth++; + ndr_print_ptr(ndr, "filter", r->in.filter); + ndr->depth++; + if (r->in.filter) { + ndr_print_string(ndr, "filter", r->in.filter); + } + ndr->depth--; + ndr_print_ptr(ndr, "length", r->in.length); + ndr->depth++; + ndr_print_uint32(ndr, "length", *r->in.length); + ndr->depth--; + ndr_print_uint32(ndr, "flags", r->in.flags); ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "PNP_GetDeviceList"); ndr->depth++; + ndr_print_ptr(ndr, "buffer", r->out.buffer); + ndr->depth++; + ndr->print(ndr, "%s: ARRAY(%d)", "buffer", (int)*r->out.length); + ndr->depth++; + for (cntr_buffer_1=0;cntr_buffer_1<*r->out.length;cntr_buffer_1++) { + char *idx_1=NULL; + if (asprintf(&idx_1, "[%d]", cntr_buffer_1) != -1) { + ndr_print_uint16(ndr, "buffer", r->out.buffer[cntr_buffer_1]); + free(idx_1); + } + } + ndr->depth--; + ndr->depth--; + ndr_print_ptr(ndr, "length", r->out.length); + ndr->depth++; + ndr_print_uint32(ndr, "length", *r->out.length); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -696,10 +815,10 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceRegProp(struct ndr_push *ndr, int NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.devicepath, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.devicepath, ndr_charset_length(r->in.devicepath, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.property)); - if (r->in.unknown1 == NULL) { + if (r->in.reg_data_type == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.unknown1)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.reg_data_type)); if (r->in.buffer_size == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -708,13 +827,13 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceRegProp(struct ndr_push *ndr, int return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.needed)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown3)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags)); } if (flags & NDR_OUT) { - if (r->out.unknown1 == NULL) { + if (r->out.reg_data_type == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.unknown1)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.reg_data_type)); if (r->out.buffer == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -737,7 +856,7 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceRegProp(struct ndr_push *ndr, int static enum ndr_err_code ndr_pull_PNP_GetDeviceRegProp(struct ndr_pull *ndr, int flags, struct PNP_GetDeviceRegProp *r) { - TALLOC_CTX *_mem_save_unknown1_0; + TALLOC_CTX *_mem_save_reg_data_type_0; TALLOC_CTX *_mem_save_buffer_size_0; TALLOC_CTX *_mem_save_needed_0; if (flags & NDR_IN) { @@ -752,12 +871,12 @@ static enum ndr_err_code ndr_pull_PNP_GetDeviceRegProp(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.devicepath, ndr_get_array_length(ndr, &r->in.devicepath), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.property)); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->in.unknown1); + NDR_PULL_ALLOC(ndr, r->in.reg_data_type); } - _mem_save_unknown1_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->in.unknown1, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.unknown1)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_unknown1_0, LIBNDR_FLAG_REF_ALLOC); + _mem_save_reg_data_type_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.reg_data_type, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.reg_data_type)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reg_data_type_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.buffer_size); } @@ -772,9 +891,9 @@ static enum ndr_err_code ndr_pull_PNP_GetDeviceRegProp(struct ndr_pull *ndr, int NDR_PULL_SET_MEM_CTX(ndr, r->in.needed, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.needed)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_needed_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown3)); - NDR_PULL_ALLOC(ndr, r->out.unknown1); - *r->out.unknown1 = *r->in.unknown1; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags)); + NDR_PULL_ALLOC(ndr, r->out.reg_data_type); + *r->out.reg_data_type = *r->in.reg_data_type; NDR_PULL_ALLOC_N(ndr, r->out.buffer, *r->in.buffer_size); memset(r->out.buffer, 0, (*r->in.buffer_size) * sizeof(*r->out.buffer)); NDR_PULL_ALLOC(ndr, r->out.buffer_size); @@ -784,12 +903,12 @@ static enum ndr_err_code ndr_pull_PNP_GetDeviceRegProp(struct ndr_pull *ndr, int } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.unknown1); + NDR_PULL_ALLOC(ndr, r->out.reg_data_type); } - _mem_save_unknown1_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.unknown1, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.unknown1)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_unknown1_0, LIBNDR_FLAG_REF_ALLOC); + _mem_save_reg_data_type_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.reg_data_type, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.reg_data_type)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reg_data_type_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_array_size(ndr, &r->out.buffer)); NDR_CHECK(ndr_pull_array_length(ndr, &r->out.buffer)); if (ndr_get_array_length(ndr, &r->out.buffer) > ndr_get_array_size(ndr, &r->out.buffer)) { @@ -839,9 +958,9 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceRegProp(struct ndr_print *ndr, const char * ndr_print_string(ndr, "devicepath", r->in.devicepath); ndr->depth--; ndr_print_uint32(ndr, "property", r->in.property); - ndr_print_ptr(ndr, "unknown1", r->in.unknown1); + ndr_print_ptr(ndr, "reg_data_type", r->in.reg_data_type); ndr->depth++; - ndr_print_uint32(ndr, "unknown1", *r->in.unknown1); + ndr_print_uint32(ndr, "reg_data_type", *r->in.reg_data_type); ndr->depth--; ndr_print_ptr(ndr, "buffer_size", r->in.buffer_size); ndr->depth++; @@ -851,15 +970,15 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceRegProp(struct ndr_print *ndr, const char * ndr->depth++; ndr_print_uint32(ndr, "needed", *r->in.needed); ndr->depth--; - ndr_print_uint32(ndr, "unknown3", r->in.unknown3); + ndr_print_uint32(ndr, "flags", r->in.flags); ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "PNP_GetDeviceRegProp"); ndr->depth++; - ndr_print_ptr(ndr, "unknown1", r->out.unknown1); + ndr_print_ptr(ndr, "reg_data_type", r->out.reg_data_type); ndr->depth++; - ndr_print_uint32(ndr, "unknown1", *r->out.unknown1); + ndr_print_uint32(ndr, "reg_data_type", *r->out.reg_data_type); ndr->depth--; ndr_print_ptr(ndr, "buffer", r->out.buffer); ndr->depth++; diff --git a/source3/librpc/gen_ndr/ntsvcs.h b/source3/librpc/gen_ndr/ntsvcs.h index 95484e49f5..b56b552ae2 100644 --- a/source3/librpc/gen_ndr/ntsvcs.h +++ b/source3/librpc/gen_ndr/ntsvcs.h @@ -101,6 +101,14 @@ struct PNP_EnumerateSubKeys { struct PNP_GetDeviceList { struct { + const char *filter;/* [unique,charset(UTF16)] */ + uint32_t flags; + uint32_t *length;/* [ref] */ + } in; + + struct { + uint16_t *buffer;/* [ref,length_is(*length),size_is(*length)] */ + uint32_t *length;/* [ref] */ WERROR result; } out; @@ -133,15 +141,15 @@ struct PNP_GetDeviceRegProp { struct { const char *devicepath;/* [ref,charset(UTF16)] */ uint32_t property; - uint32_t unknown3; - uint32_t *unknown1;/* [ref] */ + uint32_t flags; + uint32_t *reg_data_type;/* [ref] */ uint32_t *buffer_size;/* [ref] */ uint32_t *needed;/* [ref] */ } in; struct { uint8_t *buffer;/* [ref,length_is(*buffer_size),size_is(*buffer_size)] */ - uint32_t *unknown1;/* [ref] */ + uint32_t *reg_data_type;/* [ref] */ uint32_t *buffer_size;/* [ref] */ uint32_t *needed;/* [ref] */ WERROR result; diff --git a/source3/librpc/gen_ndr/srv_ntsvcs.c b/source3/librpc/gen_ndr/srv_ntsvcs.c index 184d8608fb..87f5d51695 100644 --- a/source3/librpc/gen_ndr/srv_ntsvcs.c +++ b/source3/librpc/gen_ndr/srv_ntsvcs.c @@ -781,6 +781,14 @@ static bool api_PNP_GetDeviceList(pipes_struct *p) NDR_PRINT_IN_DEBUG(PNP_GetDeviceList, r); } + ZERO_STRUCT(r->out); + r->out.buffer = talloc_zero_array(r, uint16_t, *r->out.length); + if (r->out.buffer == NULL) { + talloc_free(r); + return false; + } + + r->out.length = r->in.length; r->out.result = _PNP_GetDeviceList(p, r); if (p->rng_fault_state) { @@ -1008,7 +1016,7 @@ static bool api_PNP_GetDeviceRegProp(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.unknown1 = r->in.unknown1; + r->out.reg_data_type = r->in.reg_data_type; r->out.buffer = talloc_zero_array(r, uint8_t, *r->out.buffer_size); if (r->out.buffer == NULL) { talloc_free(r); diff --git a/source3/librpc/idl/drsblobs.idl b/source3/librpc/idl/drsblobs.idl deleted file mode 100644 index 6fdca0ec43..0000000000 --- a/source3/librpc/idl/drsblobs.idl +++ /dev/null @@ -1,436 +0,0 @@ -#include "idl_types.h" - -import "drsuapi.idl", "misc.idl"; - -[ - uuid("12345778-1234-abcd-0001-00000001"), - version(0.0), - pointer_default(unique), - helpstring("Active Directory Replication LDAP Blobs") -] -interface drsblobs { - typedef bitmap drsuapi_DsReplicaSyncOptions drsuapi_DsReplicaSyncOptions; - typedef bitmap drsuapi_DsReplicaNeighbourFlags drsuapi_DsReplicaNeighbourFlags; - typedef [v1_enum] enum drsuapi_DsAttributeId drsuapi_DsAttributeId; - - /* - * replPropertyMetaData - * w2k uses version 1 - * w2k3 uses version 1 - */ - typedef struct { - drsuapi_DsAttributeId attid; - uint32 version; - NTTIME_1sec originating_change_time; - GUID originating_invocation_id; - hyper originating_usn; - hyper local_usn; - } replPropertyMetaData1; - - typedef struct { - uint32 count; - uint32 reserved; - replPropertyMetaData1 array[count]; - } replPropertyMetaDataCtr1; - - typedef [nodiscriminant] union { - [case(1)] replPropertyMetaDataCtr1 ctr1; - } replPropertyMetaDataCtr; - - typedef [public] struct { - uint32 version; - uint32 reserved; - [switch_is(version)] replPropertyMetaDataCtr ctr; - } replPropertyMetaDataBlob; - - void decode_replPropertyMetaData( - [in] replPropertyMetaDataBlob blob - ); - - /* - * replUpToDateVector - * w2k uses version 1 - * w2k3 uses version 2 - */ - typedef struct { - uint32 count; - uint32 reserved; - drsuapi_DsReplicaCursor cursors[count]; - } replUpToDateVectorCtr1; - - typedef struct { - uint32 count; - uint32 reserved; - drsuapi_DsReplicaCursor2 cursors[count]; - } replUpToDateVectorCtr2; - - typedef [nodiscriminant] union { - [case(1)] replUpToDateVectorCtr1 ctr1; - [case(2)] replUpToDateVectorCtr2 ctr2; - } replUpToDateVectorCtr; - - typedef [public] struct { - uint32 version; - uint32 reserved; - [switch_is(version)] replUpToDateVectorCtr ctr; - } replUpToDateVectorBlob; - - void decode_replUpToDateVector( - [in] replUpToDateVectorBlob blob - ); - - /* - * repsFrom/repsTo - * w2k uses version 1 - * w2k3 uses version 1 - */ - typedef [public,gensize] struct { - [value(strlen(dns_name)+1)] uint32 __dns_name_size; - [charset(DOS)] uint8 dns_name[__dns_name_size]; - } repsFromTo1OtherInfo; - - typedef [public,gensize,flag(NDR_PAHEX)] struct { - /* this includes the 8 bytes of the repsFromToBlob header */ - [value(ndr_size_repsFromTo1(this, ndr->flags)+8)] uint32 blobsize; - uint32 consecutive_sync_failures; - NTTIME_1sec last_success; - NTTIME_1sec last_attempt; - WERROR result_last_attempt; - [relative] repsFromTo1OtherInfo *other_info; - [value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length; - drsuapi_DsReplicaNeighbourFlags replica_flags; - uint8 schedule[84]; - uint32 reserved; - drsuapi_DsReplicaHighWaterMark highwatermark; - GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */ - GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ - GUID transport_guid; - } repsFromTo1; - - typedef [nodiscriminant] union { - [case(1)] repsFromTo1 ctr1; - } repsFromTo; - - typedef [public] struct { - uint32 version; - uint32 reserved; - [switch_is(version)] repsFromTo ctr; - } repsFromToBlob; - - void decode_repsFromTo( - [in] repsFromToBlob blob - ); - - /* - * partialAttributeSet - * w2k uses version 1 - * w2k3 uses version 1 - */ - typedef struct { - uint32 count; - drsuapi_DsAttributeId array[count]; - } partialAttributeSetCtr1; - - typedef [nodiscriminant] union { - [case(1)] partialAttributeSetCtr1 ctr1; - } partialAttributeSetCtr; - - typedef [public] struct { - uint32 version; - uint32 reserved; - [switch_is(version)] partialAttributeSetCtr ctr; - } partialAttributeSetBlob; - - void decode_partialAttributeSet( - [in] partialAttributeSetBlob blob - ); - - /* - * prefixMap - * w2k unknown - * w2k3 unknown - * samba4 uses 0x44534442 'DSDB' - * - * as we windows don't return the prefixMap attribute when you ask for - * we don't know the format, but the attribute is not replicated - * so that we can choose our own format... - */ - typedef [v1_enum] enum { - PREFIX_MAP_VERSION_DSDB = 0x44534442 - } prefixMapVersion; - - typedef [nodiscriminant] union { - [case(PREFIX_MAP_VERSION_DSDB)] drsuapi_DsReplicaOIDMapping_Ctr dsdb; - } prefixMapCtr; - - typedef [public] struct { - prefixMapVersion version; - uint32 reserved; - [switch_is(version)] prefixMapCtr ctr; - } prefixMapBlob; - - void decode_prefixMap( - [in] prefixMapBlob blob - ); - - /* - * the cookie for the LDAP dirsync control - */ - typedef [nodiscriminant,gensize] union { - [case(0)]; - [default] replUpToDateVectorBlob uptodateness_vector; - } ldapControlDirSyncExtra; - - typedef struct { - [value(3)] uint32 u1; - NTTIME time; - uint32 u2; - uint32 u3; - [value(ndr_size_ldapControlDirSyncExtra(&extra, extra.uptodateness_vector.version, 0))] - uint32 extra_length; - drsuapi_DsReplicaHighWaterMark highwatermark; - GUID guid1; - [switch_is(extra_length)] ldapControlDirSyncExtra extra; - } ldapControlDirSyncBlob; - - typedef [public,relative_base] struct { - [charset(DOS),value("MSDS")] uint8 msds[4]; - [subcontext(0)] ldapControlDirSyncBlob blob; - } ldapControlDirSyncCookie; - - void decode_ldapControlDirSync( - [in] ldapControlDirSyncCookie cookie - ); - - typedef struct { - [value(2*strlen_m(name))] uint16 name_len; - [value(strlen(data))] uint16 data_len; - uint16 reserved; /* 2 for 'Packages', 1 for 'Primary:*', but should be ignored */ - [charset(UTF16)] uint8 name[name_len]; - /* - * the data field contains data as HEX strings - * - * 'Packages': - * data contains the list of packages - * as non termiated UTF16 strings with - * a UTF16 NULL byte as separator - * - * 'Primary:Kerberos-Newer-Keys': - * ... - * - * 'Primary:Kerberos': - * ... - * - * 'Primary:WDigest': - * ... - * - * 'Primary:CLEARTEXT': - * data contains the cleartext password - * as UTF16 string encoded as HEX string - */ - [charset(DOS)] uint8 data[data_len]; - } supplementalCredentialsPackage; - - /* this are 0x30 (48) whitespaces (0x20) */ - const string SUPPLEMENTAL_CREDENTIALS_PREFIX = " "; - - typedef [flag(NDR_PAHEX)] enum { - SUPPLEMENTAL_CREDENTIALS_SIGNATURE = 0x0050 - } supplementalCredentialsSignature; - - typedef [gensize] struct { - [value(SUPPLEMENTAL_CREDENTIALS_PREFIX),charset(UTF16)] uint16 prefix[0x30]; - [value(SUPPLEMENTAL_CREDENTIALS_SIGNATURE)] supplementalCredentialsSignature signature; - uint16 num_packages; - supplementalCredentialsPackage packages[num_packages]; - } supplementalCredentialsSubBlob; - - typedef [public] struct { - [value(0)] uint32 unknown1; - [value(ndr_size_supplementalCredentialsSubBlob(&sub, ndr->flags))] uint32 __ndr_size; - [value(0)] uint32 unknown2; - [subcontext(0),subcontext_size(__ndr_size)] supplementalCredentialsSubBlob sub; - [value(0)] uint8 unknown3; - } supplementalCredentialsBlob; - - void decode_supplementalCredentials( - [in] supplementalCredentialsBlob blob - ); - - typedef [public] struct { - [flag(STR_NOTERM|NDR_REMAINING)] string_array names; - } package_PackagesBlob; - - void decode_Packages( - [in] package_PackagesBlob blob - ); - - typedef struct { - [value(2*strlen_m(string))] uint16 length; - [value(2*strlen_m(string))] uint16 size; - [relative,subcontext(0),subcontext_size(size),flag(STR_NOTERM|NDR_REMAINING)] string *string; - } package_PrimaryKerberosString; - - typedef struct { - [value(0)] uint16 reserved1; - [value(0)] uint16 reserved2; - [value(0)] uint32 reserved3; - uint32 keytype; - [value((value?value->length:0))] uint32 value_len; - [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value; - } package_PrimaryKerberosKey3; - - typedef struct { - uint16 num_keys; - uint16 num_old_keys; - package_PrimaryKerberosString salt; - package_PrimaryKerberosKey3 keys[num_keys]; - package_PrimaryKerberosKey3 old_keys[num_old_keys]; - [value(0)] uint32 padding1; - [value(0)] uint32 padding2; - [value(0)] uint32 padding3; - [value(0)] uint32 padding4; - [value(0)] uint32 padding5; - } package_PrimaryKerberosCtr3; - - typedef struct { - [value(0)] uint16 reserved1; - [value(0)] uint16 reserved2; - [value(0)] uint32 reserved3; - uint32 iteration_count; - uint32 keytype; - [value((value?value->length:0))] uint32 value_len; - [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value; - } package_PrimaryKerberosKey4; - - typedef struct { - uint16 num_keys; - [value(0)] uint16 num_service_keys; - uint16 num_old_keys; - uint16 num_older_keys; - package_PrimaryKerberosString salt; - uint32 default_iteration_count; - package_PrimaryKerberosKey4 keys[num_keys]; - package_PrimaryKerberosKey4 service_keys[num_service_keys]; - package_PrimaryKerberosKey4 old_keys[num_old_keys]; - package_PrimaryKerberosKey4 older_keys[num_older_keys]; - } package_PrimaryKerberosCtr4; - - typedef [nodiscriminant] union { - [case(3)] package_PrimaryKerberosCtr3 ctr3; - [case(4)] package_PrimaryKerberosCtr4 ctr4; - } package_PrimaryKerberosCtr; - - typedef [public] struct { - uint16 version; - [value(0)] uint16 flags; - [switch_is(version)] package_PrimaryKerberosCtr ctr; - } package_PrimaryKerberosBlob; - - void decode_PrimaryKerberos( - [in] package_PrimaryKerberosBlob blob - ); - - typedef [public] struct { - [flag(STR_NOTERM|NDR_REMAINING)] string cleartext; - } package_PrimaryCLEARTEXTBlob; - - void decode_PrimaryCLEARTEXT( - [in] package_PrimaryCLEARTEXTBlob blob - ); - - typedef [flag(NDR_PAHEX)] struct { - uint8 hash[16]; - } package_PrimaryWDigestHash; - - typedef [public] struct { - [value(0x31)] uint16 unknown1; - [value(0x01)] uint8 unknown2; - uint8 num_hashes; - [value(0)] uint32 unknown3; - [value(0)] udlong uuknown4; - package_PrimaryWDigestHash hashes[num_hashes]; - } package_PrimaryWDigestBlob; - - void decode_PrimaryWDigest( - [in] package_PrimaryWDigestBlob blob - ); - - typedef struct { - NTTIME time1; - uint32 unknown1; - /* - * the secret value is encoded as UTF16 if it's a string - * but krb5 trusts have random bytes here, so converting to UTF16 - * mayfail... - * - * TODO: We should try handle the case of a random buffer in all places - * we deal with cleartext passwords from windows - * - * so we don't use this: - * - * uint32 value_len; - * [charset(UTF16)] uint8 value[value_len]; - */ - DATA_BLOB value; - [flag(NDR_ALIGN4)] DATA_BLOB _pad; - } trustAuthInOutSecret1; - - typedef struct { - [relative] trustAuthInOutSecret1 *value1; - [relative] trustAuthInOutSecret1 *value2; - } trustAuthInOutCtr1; - - typedef struct { - NTTIME time1; - uint32 unknown1; - DATA_BLOB value; - NTTIME time2; - uint32 unknown2; - uint32 unknown3; - uint32 unknown4; - [flag(NDR_ALIGN4)] DATA_BLOB _pad; - } trustAuthInOutSecret2V1; - - typedef struct { - NTTIME time1; - uint32 unknown1; - DATA_BLOB value; - NTTIME time2; - uint32 unknown2; - uint32 unknown3; - [flag(NDR_ALIGN4)] DATA_BLOB _pad; - } trustAuthInOutSecret2V2; - - typedef struct { - [relative] trustAuthInOutSecret2V1 *value1; - [relative] trustAuthInOutSecret2V2 *value2; - } trustAuthInOutCtr2; - - typedef [nodiscriminant] union { - [case(1)] trustAuthInOutCtr1 ctr1; - [case(2)] trustAuthInOutCtr2 ctr2; - } trustAuthInOutCtr; - - typedef [public] struct { - uint32 version; - [switch_is(version)] trustAuthInOutCtr ctr; - } trustAuthInOutBlob; - - void decode_trustAuthInOut( - [in] trustAuthInOutBlob blob - ); - - typedef [public] struct { - uint32 marker; - DATA_BLOB data; - } DsCompressedChunk; - - typedef [public] struct { - DsCompressedChunk chunks[5]; - } DsCompressedBlob; - - void decode_DsCompressed( - [in] DsCompressedBlob blob - ); -} diff --git a/source3/librpc/ndr/ndr_drsuapi.c b/source3/librpc/ndr/ndr_drsuapi.c deleted file mode 100644 index 8bc44dcc36..0000000000 --- a/source3/librpc/ndr/ndr_drsuapi.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - routines for printing some linked list structs in DRSUAPI - - Copyright (C) Stefan (metze) Metzmacher 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 - 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" -#include "librpc/gen_ndr/ndr_drsuapi.h" -#include "librpc/gen_ndr/ndr_misc.h" -#include "../lib/util/asn1.h" -#include "librpc/ndr/ndr_compression.h" - -void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name, - const struct drsuapi_DsReplicaObjectListItem *r) -{ - ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItem"); - ndr->depth++; - ndr_print_ptr(ndr, "next_object", r->next_object); - ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object); - ndr->depth--; - if (r->next_object) { - ndr_print_drsuapi_DsReplicaObjectListItem(ndr, "next_object", r->next_object); - } -} - -void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaObjectListItemEx *r) -{ - ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItemEx"); - ndr->depth++; - ndr_print_ptr(ndr, "next_object", r->next_object); - ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object); - ndr_print_uint32(ndr, "is_nc_prefix", r->is_nc_prefix); - ndr_print_ptr(ndr, "parent_object_guid", r->parent_object_guid); - ndr->depth++; - if (r->parent_object_guid) { - ndr_print_GUID(ndr, "parent_object_guid", r->parent_object_guid); - } - ndr->depth--; - ndr_print_ptr(ndr, "meta_data_ctr", r->meta_data_ctr); - ndr->depth++; - if (r->meta_data_ctr) { - ndr_print_drsuapi_DsReplicaMetaDataCtr(ndr, "meta_data_ctr", r->meta_data_ctr); - } - ndr->depth--; - ndr->depth--; - if (r->next_object) { - ndr_print_drsuapi_DsReplicaObjectListItemEx(ndr, "next_object", r->next_object); - } -} - -#define _OID_PUSH_CHECK(call) do { \ - bool _status; \ - _status = call; \ - if (_status != true) { \ - return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "OID Conversion Error: %s\n", __location__); \ - } \ -} while (0) - -#define _OID_PULL_CHECK(call) do { \ - bool _status; \ - _status = call; \ - if (_status != true) { \ - return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "OID Conversion Error: %s\n", __location__); \ - } \ -} while (0) - -enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsReplicaOID *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_drsuapi_DsReplicaOID_oid(r->oid, 0))); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->oid)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->oid) { - DATA_BLOB blob; - - if (StrnCaseCmp("ff", r->oid, 2) == 0) { - blob = strhex_to_data_blob(NULL, r->oid); - if (!blob.data) { - return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, - "HEX String Conversion Error: %s\n", - __location__); - } - } else { - _OID_PUSH_CHECK(ber_write_OID_String(&blob, r->oid)); - } - talloc_steal(ndr, blob.data); - - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, blob.data, blob.length)); - } - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_drsuapi_DsReplicaOID(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsReplicaOID *r) -{ - uint32_t _ptr_oid; - TALLOC_CTX *_mem_save_oid_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__ndr_size)); - if (r->__ndr_size < 0 || r->__ndr_size > 10000) { - return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); - } - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_oid)); - if (_ptr_oid) { - NDR_PULL_ALLOC(ndr, r->oid); - } else { - r->oid = NULL; - } - } - if (ndr_flags & NDR_BUFFERS) { - if (r->oid) { - DATA_BLOB _oid_array; - const char *_oid; - - _mem_save_oid_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, ndr, 0); - NDR_CHECK(ndr_pull_array_size(ndr, &r->oid)); - _oid_array.length = ndr_get_array_size(ndr, &r->oid); - NDR_PULL_ALLOC_N(ndr, _oid_array.data, _oid_array.length); - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, _oid_array.data, _oid_array.length)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_oid_0, 0); - - if (_oid_array.length && _oid_array.data[0] == 0xFF) { - _oid = data_blob_hex_string(ndr, &_oid_array); - NDR_ERR_HAVE_NO_MEMORY(_oid); - } else { - _OID_PULL_CHECK(ber_read_OID_String(ndr, _oid_array, &_oid)); - } - data_blob_free(&_oid_array); - talloc_steal(r->oid, _oid); - r->oid = _oid; - } - if (r->oid) { - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->oid, r->__ndr_size)); - } - } - return NDR_ERR_SUCCESS; -} - -size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags) -{ - DATA_BLOB _blob; - size_t ret = 0; - - if (!oid) return 0; - - if (StrnCaseCmp("ff", oid, 2) == 0) { - _blob = strhex_to_data_blob(NULL, oid); - if (_blob.data) { - ret = _blob.length; - } - } else { - if (ber_write_OID_String(&_blob, oid)) { - ret = _blob.length; - } - } - data_blob_free(&_blob); - return ret; -} - -enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr1 *r) -{ - if (ndr_flags & NDR_SCALARS) { - uint32_t decompressed_length = 0; - uint32_t compressed_length = 0; - if (r->ts) { - { - struct ndr_push *_ndr_ts; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); - { - struct ndr_push *_ndr_ts_compressed; - NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1)); - NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); - decompressed_length = _ndr_ts_compressed->offset; - NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1)); - } - compressed_length = _ndr_ts->offset; - talloc_free(_ndr_ts); - } - } - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->ts) { - { - struct ndr_push *_ndr_ts; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); - { - struct ndr_push *_ndr_ts_compressed; - NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1)); - NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); - NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1)); - } - NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1)); - } - } - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr6 *r) -{ - if (ndr_flags & NDR_SCALARS) { - uint32_t decompressed_length = 0; - uint32_t compressed_length = 0; - if (r->ts) { - { - struct ndr_push *_ndr_ts; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); - { - struct ndr_push *_ndr_ts_compressed; - NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1)); - NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); - decompressed_length = _ndr_ts_compressed->offset; - NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1)); - } - compressed_length = _ndr_ts->offset; - talloc_free(_ndr_ts); - } - } - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->ts) { - { - struct ndr_push *_ndr_ts; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); - { - struct ndr_push *_ndr_ts_compressed; - NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1)); - NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); - NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1)); - } - NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1)); - } - } - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr1 *r) -{ - if (ndr_flags & NDR_SCALARS) { - uint32_t decompressed_length = 0; - uint32_t compressed_length = 0; - if (r->ts) { - { - struct ndr_push *_ndr_ts; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); - { - struct ndr_push *_ndr_ts_compressed; - NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); - NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); - decompressed_length = _ndr_ts_compressed->offset; - NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); - } - compressed_length = _ndr_ts->offset; - talloc_free(_ndr_ts); - } - } - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->ts) { - { - struct ndr_push *_ndr_ts; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); - { - struct ndr_push *_ndr_ts_compressed; - NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); - NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); - NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); - } - NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1)); - } - } - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr6 *r) -{ - if (ndr_flags & NDR_SCALARS) { - uint32_t decompressed_length = 0; - uint32_t compressed_length = 0; - if (r->ts) { - { - struct ndr_push *_ndr_ts; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); - { - struct ndr_push *_ndr_ts_compressed; - NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); - NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); - decompressed_length = _ndr_ts_compressed->offset; - NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); - } - compressed_length = _ndr_ts->offset; - talloc_free(_ndr_ts); - } - } - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->ts) { - { - struct ndr_push *_ndr_ts; - NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1)); - { - struct ndr_push *_ndr_ts_compressed; - NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); - NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts)); - NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1)); - } - NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1)); - } - } - } - return NDR_ERR_SUCCESS; -} diff --git a/source3/librpc/ndr/ndr_drsuapi.h b/source3/librpc/ndr/ndr_drsuapi.h deleted file mode 100644 index c663eadd7a..0000000000 --- a/source3/librpc/ndr/ndr_drsuapi.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - routines for printing some linked list structs in DRSUAPI - - Copyright (C) Stefan (metze) Metzmacher 2005-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/>. -*/ - -#ifndef _LIBRPC_NDR_NDR_DRSUAPI_H -#define _LIBRPC_NDR_NDR_DRSUAPI_H - -void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name, - const struct drsuapi_DsReplicaObjectListItem *r); - -void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name, - const struct drsuapi_DsReplicaObjectListItemEx *r); - -enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsReplicaOID *r); -enum ndr_err_code ndr_pull_drsuapi_DsReplicaOID(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsReplicaOID *r); -size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags); - -#endif /* _LIBRPC_NDR_NDR_DRSUAPI_H */ diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c index 2f336f14e6..f0595695d2 100644 --- a/source3/libsmb/trusts_util.c +++ b/source3/libsmb/trusts_util.c @@ -33,13 +33,12 @@ NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *m { unsigned char new_trust_passwd_hash[16]; char *new_trust_passwd; - char *str; NTSTATUS nt_status; /* Create a random machine account password */ - str = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH); + new_trust_passwd = generate_random_str(mem_ctx, DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH); - if ((new_trust_passwd = talloc_strdup(mem_ctx, str)) == NULL) { + if (new_trust_passwd == NULL) { DEBUG(0, ("talloc_strdup failed\n")); return NT_STATUS_NO_MEMORY; } diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index c0e62eac19..1826fa88ed 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -280,7 +280,7 @@ static bool upgrade_to_version_3(void) DEBUG(0,("upgrade_to_version_3: upgrading print tdb's to version 3\n")); for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr; - newkey = tdb_nextkey(tdb_drivers, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { + newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) { dbuf = tdb_fetch(tdb_drivers, kbuf); @@ -807,7 +807,7 @@ int get_ntforms(nt_forms_struct **list) for (kbuf = tdb_firstkey(tdb_forms); kbuf.dptr; - newkey = tdb_nextkey(tdb_forms, kbuf), safe_free(kbuf.dptr), kbuf=newkey) + newkey = tdb_nextkey(tdb_forms, kbuf), free(kbuf.dptr), kbuf=newkey) { if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0) continue; @@ -1024,7 +1024,7 @@ int get_ntdrivers(fstring **list, const char *architecture, uint32 version) for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr; - newkey = tdb_nextkey(tdb_drivers, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { + newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) { if (strncmp((const char *)kbuf.dptr, key, strlen(key)) != 0) continue; @@ -3123,8 +3123,7 @@ static void map_single_multi_sz_into_ctr(REGVAL_CTR *ctr, const char *val_name, regval_ctr_delvalue(ctr, val_name); regval_ctr_addvalue(ctr, val_name, REG_MULTI_SZ, (char *) conv_strs, str_size); - safe_free(conv_strs); - + SAFE_FREE(conv_strs); } /**************************************************************************** diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c index b9e5ad56ad..a6bf52a0a4 100644 --- a/source3/printing/pcap.c +++ b/source3/printing/pcap.c @@ -179,7 +179,7 @@ void pcap_cache_reload(void) goto done; } - for (; (pcap_line = fgets_slash(NULL, 1024, pcap_file)) != NULL; safe_free(pcap_line)) { + for (; (pcap_line = fgets_slash(NULL, 1024, pcap_file)) != NULL; free(pcap_line)) { char name[MAXPRINTERLEN+1]; char comment[62]; char *p, *q; diff --git a/source3/printing/print_aix.c b/source3/printing/print_aix.c index 57590cc39e..523be77f35 100644 --- a/source3/printing/print_aix.c +++ b/source3/printing/print_aix.c @@ -49,7 +49,7 @@ bool aix_cache_reload(void) iEtat = 0; /* scan qconfig file for searching <printername>: */ - for (;(line = fgets_slash(NULL, 1024, pfile)); safe_free(line)) { + for (;(line = fgets_slash(NULL, 1024, pfile)); free(line)) { if (*line == '*' || *line == 0) continue; @@ -65,7 +65,7 @@ bool aix_cache_reload(void) if (strcmp(p, "bsh") != 0) { name = talloc_strdup(ctx, p); if (!name) { - safe_free(line); + SAFE_FREE(line); x_fclose(pfile); TALLOC_FREE(ctx); return false; @@ -85,7 +85,7 @@ bool aix_cache_reload(void) /* probably a good printer ??? */ iEtat = 0; if (!pcap_cache_add(name, NULL)) { - safe_free(line); + SAFE_FREE(line); x_fclose(pfile); TALLOC_FREE(ctx); return false; @@ -100,7 +100,7 @@ bool aix_cache_reload(void) /* it's a good virtual printer */ iEtat = 0; if (!pcap_cache_add(name, NULL)) { - safe_free(line); + SAFE_FREE(line); x_fclose(pfile); TALLOC_FREE(ctx); return false; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 9ccfaa7bcb..b7763cb1cf 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -747,7 +747,12 @@ void reply_tcon_and_X(struct smb_request *req) SSVAL(req->outbuf, smb_vwv2, SMB_SUPPORT_SEARCH_BITS| (lp_csc_policy(SNUM(conn)) << 2)); - init_dfsroot(conn, req->inbuf, req->outbuf); + if (lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) { + DEBUG(2,("Serving %s as a Dfs root\n", + lp_servicename(SNUM(conn)) )); + SSVAL(req->outbuf, smb_vwv2, + SMB_SHARE_IN_DFS | SVAL(req->outbuf, smb_vwv2)); + } } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index f64ba8c05f..4e81263ee4 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -888,7 +888,7 @@ bool reload_services(bool test) enum server_exit_reason { SERVER_EXIT_NORMAL, SERVER_EXIT_ABNORMAL }; static void exit_server_common(enum server_exit_reason how, - const char *const reason) NORETURN_ATTRIBUTE; + const char *const reason) _NORETURN_; static void exit_server_common(enum server_exit_reason how, const char *const reason) diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 8e8dd7e767..5a2d535b30 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -480,7 +480,7 @@ static int ads_user_add(struct net_context *c, int argc, const char **argv) asprintf(&upn, "%s@%s", argv[0], ads->config.realm); status = ads_krb5_set_password(ads->auth.kdc_server, upn, argv[1], ads->auth.time_offset); - safe_free(upn); + SAFE_FREE(upn); if (ADS_ERR_OK(status)) { d_printf("User %s added\n", argv[0]); rc = 0; @@ -534,7 +534,7 @@ static int ads_user_info(struct net_context *c, int argc, const char **argv) asprintf(&searchstring, "(sAMAccountName=%s)", escaped_user); rc = ads_search(ads, &res, searchstring, attrs); - safe_free(searchstring); + SAFE_FREE(searchstring); if (!ADS_ERR_OK(rc)) { d_fprintf(stderr, "ads_search: %s\n", ads_errstr(rc)); diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index 5bc38f979f..2fe464a000 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -330,12 +330,8 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv) /* Create a random machine account password */ - { - char *str; - str = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH); - clear_trust_password = SMB_STRDUP(str); - E_md4hash(clear_trust_password, md4_trust_password); - } + clear_trust_password = generate_random_str(talloc_tos(), DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH); + E_md4hash(clear_trust_password, md4_trust_password); /* Set password on machine account */ @@ -468,7 +464,7 @@ done: cli_shutdown(cli); - SAFE_FREE(clear_trust_password); + TALLOC_FREE(clear_trust_password); return retval; } diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c index f4b305d4ab..ddd18a7b9f 100644 --- a/source3/utils/net_rpc_printer.c +++ b/source3/utils/net_rpc_printer.c @@ -2482,7 +2482,7 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c, TALLOC_FREE( reg_ctr ); } - safe_free(keylist); + SAFE_FREE(keylist); /* close printer handles here */ if (got_hnd_src) { diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c index c04b628b1b..45da3f1e88 100644 --- a/source3/utils/nmblookup.c +++ b/source3/utils/nmblookup.c @@ -219,7 +219,7 @@ static bool query_one(const char *lookup, unsigned int lookup_type) } } - safe_free(ip_list); + free(ip_list); return (ip_list != NULL); } diff --git a/source4/Makefile b/source4/Makefile index 7dae4729b7..26cab668c8 100644 --- a/source4/Makefile +++ b/source4/Makefile @@ -301,8 +301,8 @@ data.mk: config.status $(MK_FILES) testcov-html:: include $(pidldir)/config.mk -selftestdir := $(srcdir)/selftest -include $(selftestdir)/config.mk +selftestdir := $(srcdir)/../selftest +include $(srcdir)/selftest/config.mk showflags:: @echo ' pwd = '`/bin/pwd` diff --git a/source4/dsdb/repl/drepl_out_helpers.c b/source4/dsdb/repl/drepl_out_helpers.c index 800645014d..c292c6db74 100644 --- a/source4/dsdb/repl/drepl_out_helpers.c +++ b/source4/dsdb/repl/drepl_out_helpers.c @@ -246,40 +246,42 @@ static void dreplsrv_op_pull_source_get_changes_send(struct dreplsrv_op_pull_sou r = talloc(st, struct drsuapi_DsGetNCChanges); if (composite_nomem(r, c)) return; - r->in.level = talloc(r, int32_t); - if (composite_nomem(r->in.level, c)) return; - r->out.level = talloc(r, int32_t); - if (composite_nomem(r->out.level, c)) return; + r->out.level_out = talloc(r, int32_t); + if (composite_nomem(r->out.level_out, c)) return; + r->in.req = talloc(r, union drsuapi_DsGetNCChangesRequest); + if (composite_nomem(r->in.req, c)) return; + r->out.ctr = talloc(r, union drsuapi_DsGetNCChangesCtr); + if (composite_nomem(r->out.ctr, c)) return; r->in.bind_handle = &drsuapi->bind_handle; if (drsuapi->remote_info28.supported_extensions & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) { - *r->in.level = 8; - r->in.req.req8.destination_dsa_guid = service->ntds_guid; - r->in.req.req8.source_dsa_invocation_id = rf1->source_dsa_invocation_id; - r->in.req.req8.naming_context = &partition->nc; - r->in.req.req8.highwatermark = rf1->highwatermark; - r->in.req.req8.uptodateness_vector = NULL;/*&partition->uptodatevector_ex;*/ - r->in.req.req8.replica_flags = rf1->replica_flags; - r->in.req.req8.max_object_count = 133; - r->in.req.req8.max_ndr_size = 1336811; - r->in.req.req8.extended_op = DRSUAPI_EXOP_NONE; - r->in.req.req8.fsmo_info = 0; - r->in.req.req8.partial_attribute_set = NULL; - r->in.req.req8.partial_attribute_set_ex = NULL; - r->in.req.req8.mapping_ctr.num_mappings = 0; - r->in.req.req8.mapping_ctr.mappings = NULL; + r->in.level = 8; + r->in.req->req8.destination_dsa_guid = service->ntds_guid; + r->in.req->req8.source_dsa_invocation_id= rf1->source_dsa_invocation_id; + r->in.req->req8.naming_context = &partition->nc; + r->in.req->req8.highwatermark = rf1->highwatermark; + r->in.req->req8.uptodateness_vector = NULL;/*&partition->uptodatevector_ex;*/ + r->in.req->req8.replica_flags = rf1->replica_flags; + r->in.req->req8.max_object_count = 133; + r->in.req->req8.max_ndr_size = 1336811; + r->in.req->req8.extended_op = DRSUAPI_EXOP_NONE; + r->in.req->req8.fsmo_info = 0; + r->in.req->req8.partial_attribute_set = NULL; + r->in.req->req8.partial_attribute_set_ex= NULL; + r->in.req->req8.mapping_ctr.num_mappings= 0; + r->in.req->req8.mapping_ctr.mappings = NULL; } else { - *r->in.level = 5; - r->in.req.req5.destination_dsa_guid = service->ntds_guid; - r->in.req.req5.source_dsa_invocation_id = rf1->source_dsa_invocation_id; - r->in.req.req5.naming_context = &partition->nc; - r->in.req.req5.highwatermark = rf1->highwatermark; - r->in.req.req5.uptodateness_vector = NULL;/*&partition->uptodatevector_ex;*/ - r->in.req.req5.replica_flags = rf1->replica_flags; - r->in.req.req5.max_object_count = 133; - r->in.req.req5.max_ndr_size = 1336770; - r->in.req.req5.extended_op = DRSUAPI_EXOP_NONE; - r->in.req.req5.fsmo_info = 0; + r->in.level = 5; + r->in.req->req5.destination_dsa_guid = service->ntds_guid; + r->in.req->req5.source_dsa_invocation_id= rf1->source_dsa_invocation_id; + r->in.req->req5.naming_context = &partition->nc; + r->in.req->req5.highwatermark = rf1->highwatermark; + r->in.req->req5.uptodateness_vector = NULL;/*&partition->uptodatevector_ex;*/ + r->in.req->req5.replica_flags = rf1->replica_flags; + r->in.req->req5.max_object_count = 133; + r->in.req->req5.max_ndr_size = 1336770; + r->in.req->req5.extended_op = DRSUAPI_EXOP_NONE; + r->in.req->req5.fsmo_info = 0; } req = dcerpc_drsuapi_DsGetNCChanges_send(drsuapi->pipe, r, r); @@ -311,28 +313,28 @@ static void dreplsrv_op_pull_source_get_changes_recv(struct rpc_request *req) return; } - if (*r->out.level == 1) { + if (*r->out.level_out == 1) { ctr_level = 1; - ctr1 = &r->out.ctr.ctr1; - } else if (*r->out.level == 2 && - r->out.ctr.ctr2.mszip1.ts) { + ctr1 = &r->out.ctr->ctr1; + } else if (*r->out.level_out == 2 && + r->out.ctr->ctr2.mszip1.ts) { ctr_level = 1; - ctr1 = &r->out.ctr.ctr2.mszip1.ts->ctr1; - } else if (*r->out.level == 6) { + ctr1 = &r->out.ctr->ctr2.mszip1.ts->ctr1; + } else if (*r->out.level_out == 6) { ctr_level = 6; - ctr6 = &r->out.ctr.ctr6; - } else if (*r->out.level == 7 && - r->out.ctr.ctr7.level == 6 && - r->out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP && - r->out.ctr.ctr7.ctr.mszip6.ts) { + ctr6 = &r->out.ctr->ctr6; + } else if (*r->out.level_out == 7 && + r->out.ctr->ctr7.level == 6 && + r->out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP && + r->out.ctr->ctr7.ctr.mszip6.ts) { ctr_level = 6; - ctr6 = &r->out.ctr.ctr7.ctr.mszip6.ts->ctr6; - } else if (*r->out.level == 7 && - r->out.ctr.ctr7.level == 6 && - r->out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS && - r->out.ctr.ctr7.ctr.xpress6.ts) { + ctr6 = &r->out.ctr->ctr7.ctr.mszip6.ts->ctr6; + } else if (*r->out.level_out == 7 && + r->out.ctr->ctr7.level == 6 && + r->out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS && + r->out.ctr->ctr7.ctr.xpress6.ts) { ctr_level = 6; - ctr6 = &r->out.ctr.ctr7.ctr.xpress6.ts->ctr6; + ctr6 = &r->out.ctr->ctr7.ctr.xpress6.ts->ctr6; } else { composite_error(c, werror_to_ntstatus(WERR_BAD_NET_RESP)); return; diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c index 88a8887056..a0602d9281 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c @@ -424,7 +424,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) valstr = str; } else { DATA_BLOB binary; - binary = strhex_to_data_blob(str); + binary = strhex_to_data_blob(NULL, str); if (!binary.data) { ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; @@ -471,7 +471,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) valstr = str; } else { DATA_BLOB binary; - binary = strhex_to_data_blob(str); + binary = strhex_to_data_blob(NULL, str); if (!binary.data) { ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index c4451d1355..5ed7f1fbad 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -482,12 +482,11 @@ static int setup_primary_kerberos(struct setup_password_fields_io *io, if (old_scp) { DATA_BLOB blob; - blob = strhex_to_data_blob(old_scp->data); + blob = strhex_to_data_blob(io->ac, old_scp->data); if (!blob.data) { ldb_oom(io->ac->module->ldb); return LDB_ERR_OPERATIONS_ERROR; } - talloc_steal(io->ac, blob.data); /* TODO: use ndr_pull_struct_blob_all(), when the ndr layer handles it correct with relative pointers */ ndr_err = ndr_pull_struct_blob(&blob, io->ac, lp_iconv_convenience(ldb_get_opaque(io->ac->module->ldb, "loadparm")), &_old_pkb, @@ -596,12 +595,11 @@ static int setup_primary_kerberos_newer(struct setup_password_fields_io *io, if (old_scp) { DATA_BLOB blob; - blob = strhex_to_data_blob(old_scp->data); + blob = strhex_to_data_blob(io->ac, old_scp->data); if (!blob.data) { ldb_oom(io->ac->module->ldb); return LDB_ERR_OPERATIONS_ERROR; } - talloc_steal(io->ac, blob.data); /* TODO: use ndr_pull_struct_blob_all(), when the ndr layer handles it correct with relative pointers */ ndr_err = ndr_pull_struct_blob(&blob, io->ac, diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 93697a3df0..69d4c2ce80 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -199,9 +199,8 @@ WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema, return ntstatus_to_werror(nt_status); } - *schemaInfo = strhex_to_data_blob(schema->schema_info); + *schemaInfo = strhex_to_data_blob(mem_ctx, schema->schema_info); W_ERROR_HAVE_NO_MEMORY(schemaInfo->data); - talloc_steal(mem_ctx, schemaInfo->data); return WERR_OK; } @@ -819,12 +818,11 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, } info_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "schemaInfo"); if (!info_val) { - info_val_default = strhex_to_data_blob("FF0000000000000000000000000000000000000000"); + info_val_default = strhex_to_data_blob(mem_ctx, "FF0000000000000000000000000000000000000000"); if (!info_val_default.data) { dsdb_oom(error_string, mem_ctx); return LDB_ERR_OPERATIONS_ERROR; } - talloc_steal(mem_ctx, info_val_default.data); info_val = &info_val_default; } diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index f8de82e56a..d0aae4e221 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -328,11 +328,10 @@ WERROR dsdb_attach_schema_from_ldif_file(struct ldb_context *ldb, const char *pf info_val = ldb_msg_find_ldb_val(msg, "schemaInfo"); if (!info_val) { - info_val_default = strhex_to_data_blob("FF0000000000000000000000000000000000000000"); + info_val_default = strhex_to_data_blob(mem_ctx, "FF0000000000000000000000000000000000000000"); if (!info_val_default.data) { goto nomem; } - talloc_steal(mem_ctx, info_val_default.data); info_val = &info_val_default; } diff --git a/source4/kdc/hdb-samba4.c b/source4/kdc/hdb-samba4.c index 3a1379bee4..b6a48e79d0 100644 --- a/source4/kdc/hdb-samba4.c +++ b/source4/kdc/hdb-samba4.c @@ -277,12 +277,11 @@ static krb5_error_code LDB_message2entry_keys(krb5_context context, if (scpk) { DATA_BLOB blob; - blob = strhex_to_data_blob(scpk->data); + blob = strhex_to_data_blob(mem_ctx, scpk->data); if (!blob.data) { ret = ENOMEM; goto out; } - talloc_steal(mem_ctx, blob.data); /* we cannot use ndr_pull_struct_blob_all() here, as w2k and w2k3 add padding bytes */ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, iconv_convenience, &_pkb, diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c index 68efd56a86..b3b6e49ea5 100644 --- a/source4/lib/registry/util.c +++ b/source4/lib/registry/util.c @@ -140,8 +140,7 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, break; case REG_BINARY: - *data = strhex_to_data_blob(data_str); - talloc_steal(mem_ctx, data->data); + *data = strhex_to_data_blob(mem_ctx, data_str); break; default: diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c index d39c61551b..d174fbfc28 100644 --- a/source4/libcli/raw/rawfile.c +++ b/source4/libcli/raw/rawfile.c @@ -30,6 +30,50 @@ if (!req) return NULL; \ } while (0) +/** + Return a string representing a CIFS attribute for a file. +**/ +_PUBLIC_ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib) +{ + int i, len; + const struct { + char c; + uint16_t attr; + } attr_strs[] = { + {'V', FILE_ATTRIBUTE_VOLUME}, + {'D', FILE_ATTRIBUTE_DIRECTORY}, + {'A', FILE_ATTRIBUTE_ARCHIVE}, + {'H', FILE_ATTRIBUTE_HIDDEN}, + {'S', FILE_ATTRIBUTE_SYSTEM}, + {'N', FILE_ATTRIBUTE_NORMAL}, + {'R', FILE_ATTRIBUTE_READONLY}, + {'d', FILE_ATTRIBUTE_DEVICE}, + {'t', FILE_ATTRIBUTE_TEMPORARY}, + {'s', FILE_ATTRIBUTE_SPARSE}, + {'r', FILE_ATTRIBUTE_REPARSE_POINT}, + {'c', FILE_ATTRIBUTE_COMPRESSED}, + {'o', FILE_ATTRIBUTE_OFFLINE}, + {'n', FILE_ATTRIBUTE_NONINDEXED}, + {'e', FILE_ATTRIBUTE_ENCRYPTED} + }; + char *ret; + + ret = talloc_array(mem_ctx, char, ARRAY_SIZE(attr_strs)+1); + if (!ret) { + return NULL; + } + + for (len=i=0; i<ARRAY_SIZE(attr_strs); i++) { + if (attrib & attr_strs[i].attr) { + ret[len++] = attr_strs[i].c; + } + } + + ret[len] = 0; + + return ret; +} + /**************************************************************************** Rename a file - async interface ****************************************************************************/ diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index 4cbebbf6d0..6e7924248c 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -2173,11 +2173,15 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) /* setup request structure */ r->in.bind_handle = &s->drsuapi1.bind_handle; r->in.level = 2; - r->in.req.req2.first_object.next_object = NULL; - r->in.req.req2.first_object.object.identifier = identifier; - r->in.req.req2.first_object.object.flags = 0x00000000; - r->in.req.req2.first_object.object.attribute_ctr.num_attributes = num_attrs; - r->in.req.req2.first_object.object.attribute_ctr.attributes = attrs; + r->in.req = talloc(s, union drsuapi_DsAddEntryRequest); + r->in.req->req2.first_object.next_object = NULL; + r->in.req->req2.first_object.object.identifier = identifier; + r->in.req->req2.first_object.object.flags = 0x00000000; + r->in.req->req2.first_object.object.attribute_ctr.num_attributes= num_attrs; + r->in.req->req2.first_object.object.attribute_ctr.attributes = attrs; + + r->out.level_out = talloc(s, int32_t); + r->out.ctr = talloc(s, union drsuapi_DsAddEntryCtr); req = dcerpc_drsuapi_DsAddEntry_send(s->drsuapi1.pipe, r, r); composite_continue_rpc(c, req, becomeDC_drsuapi1_add_entry_recv, s); @@ -2212,37 +2216,37 @@ static void becomeDC_drsuapi1_add_entry_recv(struct rpc_request *req) return; } - if (r->out.level == 3) { - if (r->out.ctr.ctr3.count != 1) { + if (*r->out.level_out == 3) { + if (r->out.ctr->ctr3.count != 1) { WERROR status; - if (r->out.ctr.ctr3.level != 1) { + if (r->out.ctr->ctr3.level != 1) { composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } - if (!r->out.ctr.ctr3.error) { + if (!r->out.ctr->ctr3.error) { composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } - status = r->out.ctr.ctr3.error->info1.status; + status = r->out.ctr->ctr3.error->info1.status; - if (!r->out.ctr.ctr3.error->info1.info) { + if (!r->out.ctr->ctr3.error->info1.info) { composite_error(c, werror_to_ntstatus(status)); return; } /* see if we can get a more detailed error */ - switch (r->out.ctr.ctr3.error->info1.level) { + switch (r->out.ctr->ctr3.error->info1.level) { case 1: - status = r->out.ctr.ctr3.error->info1.info->error1.status; + status = r->out.ctr->ctr3.error->info1.info->error1.status; break; case 4: case 5: case 6: case 7: - status = r->out.ctr.ctr3.error->info1.info->errorX.status; + status = r->out.ctr->ctr3.error->info1.info->errorX.status; break; } @@ -2250,14 +2254,14 @@ static void becomeDC_drsuapi1_add_entry_recv(struct rpc_request *req) return; } - s->dest_dsa.ntds_guid = r->out.ctr.ctr3.objects[0].guid; - } else if (r->out.level == 2) { - if (r->out.ctr.ctr2.count != 1) { - composite_error(c, werror_to_ntstatus(r->out.ctr.ctr2.error.status)); + s->dest_dsa.ntds_guid = r->out.ctr->ctr3.objects[0].guid; + } else if (*r->out.level_out == 2) { + if (r->out.ctr->ctr2.count != 1) { + composite_error(c, werror_to_ntstatus(r->out.ctr->ctr2.error.status)); return; } - s->dest_dsa.ntds_guid = r->out.ctr.ctr2.objects[0].guid; + s->dest_dsa.ntds_guid = r->out.ctr->ctr2.objects[0].guid; } else { composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE); return; @@ -2392,40 +2396,42 @@ static void becomeDC_drsuapi_pull_partition_send(struct libnet_BecomeDC_state *s r = talloc(s, struct drsuapi_DsGetNCChanges); if (composite_nomem(r, c)) return; - r->in.level = talloc(r, int32_t); - if (composite_nomem(r->in.level, c)) return; - r->out.level = talloc(r, int32_t); - if (composite_nomem(r->out.level, c)) return; + r->out.level_out = talloc(r, int32_t); + if (composite_nomem(r->out.level_out, c)) return; + r->in.req = talloc(r, union drsuapi_DsGetNCChangesRequest); + if (composite_nomem(r->in.req, c)) return; + r->out.ctr = talloc(r, union drsuapi_DsGetNCChangesCtr); + if (composite_nomem(r->out.ctr, c)) return; r->in.bind_handle = &drsuapi_h->bind_handle; if (drsuapi_h->remote_info28.supported_extensions & DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8) { - *r->in.level = 8; - r->in.req.req8.destination_dsa_guid = partition->destination_dsa_guid; - r->in.req.req8.source_dsa_invocation_id = partition->source_dsa_invocation_id; - r->in.req.req8.naming_context = &partition->nc; - r->in.req.req8.highwatermark = partition->highwatermark; - r->in.req.req8.uptodateness_vector = NULL; - r->in.req.req8.replica_flags = partition->replica_flags; - r->in.req.req8.max_object_count = 133; - r->in.req.req8.max_ndr_size = 1336811; - r->in.req.req8.extended_op = DRSUAPI_EXOP_NONE; - r->in.req.req8.fsmo_info = 0; - r->in.req.req8.partial_attribute_set = NULL; - r->in.req.req8.partial_attribute_set_ex = NULL; - r->in.req.req8.mapping_ctr.num_mappings = 0; - r->in.req.req8.mapping_ctr.mappings = NULL; + r->in.level = 8; + r->in.req->req8.destination_dsa_guid = partition->destination_dsa_guid; + r->in.req->req8.source_dsa_invocation_id= partition->source_dsa_invocation_id; + r->in.req->req8.naming_context = &partition->nc; + r->in.req->req8.highwatermark = partition->highwatermark; + r->in.req->req8.uptodateness_vector = NULL; + r->in.req->req8.replica_flags = partition->replica_flags; + r->in.req->req8.max_object_count = 133; + r->in.req->req8.max_ndr_size = 1336811; + r->in.req->req8.extended_op = DRSUAPI_EXOP_NONE; + r->in.req->req8.fsmo_info = 0; + r->in.req->req8.partial_attribute_set = NULL; + r->in.req->req8.partial_attribute_set_ex= NULL; + r->in.req->req8.mapping_ctr.num_mappings= 0; + r->in.req->req8.mapping_ctr.mappings = NULL; } else { - *r->in.level = 5; - r->in.req.req5.destination_dsa_guid = partition->destination_dsa_guid; - r->in.req.req5.source_dsa_invocation_id = partition->source_dsa_invocation_id; - r->in.req.req5.naming_context = &partition->nc; - r->in.req.req5.highwatermark = partition->highwatermark; - r->in.req.req5.uptodateness_vector = NULL; - r->in.req.req5.replica_flags = partition->replica_flags; - r->in.req.req5.max_object_count = 133; - r->in.req.req5.max_ndr_size = 1336770; - r->in.req.req5.extended_op = DRSUAPI_EXOP_NONE; - r->in.req.req5.fsmo_info = 0; + r->in.level = 5; + r->in.req->req5.destination_dsa_guid = partition->destination_dsa_guid; + r->in.req->req5.source_dsa_invocation_id= partition->source_dsa_invocation_id; + r->in.req->req5.naming_context = &partition->nc; + r->in.req->req5.highwatermark = partition->highwatermark; + r->in.req->req5.uptodateness_vector = NULL; + r->in.req->req5.replica_flags = partition->replica_flags; + r->in.req->req5.max_object_count = 133; + r->in.req->req5.max_ndr_size = 1336770; + r->in.req->req5.extended_op = DRSUAPI_EXOP_NONE; + r->in.req->req5.fsmo_info = 0; } /* @@ -2457,28 +2463,28 @@ static WERROR becomeDC_drsuapi_pull_partition_recv(struct libnet_BecomeDC_state return r->out.result; } - if (*r->out.level == 1) { + if (*r->out.level_out == 1) { ctr_level = 1; - ctr1 = &r->out.ctr.ctr1; - } else if (*r->out.level == 2 && - r->out.ctr.ctr2.mszip1.ts) { + ctr1 = &r->out.ctr->ctr1; + } else if (*r->out.level_out == 2 && + r->out.ctr->ctr2.mszip1.ts) { ctr_level = 1; - ctr1 = &r->out.ctr.ctr2.mszip1.ts->ctr1; - } else if (*r->out.level == 6) { + ctr1 = &r->out.ctr->ctr2.mszip1.ts->ctr1; + } else if (*r->out.level_out == 6) { ctr_level = 6; - ctr6 = &r->out.ctr.ctr6; - } else if (*r->out.level == 7 && - r->out.ctr.ctr7.level == 6 && - r->out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP && - r->out.ctr.ctr7.ctr.mszip6.ts) { + ctr6 = &r->out.ctr->ctr6; + } else if (*r->out.level_out == 7 && + r->out.ctr->ctr7.level == 6 && + r->out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP && + r->out.ctr->ctr7.ctr.mszip6.ts) { ctr_level = 6; - ctr6 = &r->out.ctr.ctr7.ctr.mszip6.ts->ctr6; - } else if (*r->out.level == 7 && - r->out.ctr.ctr7.level == 6 && - r->out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS && - r->out.ctr.ctr7.ctr.xpress6.ts) { + ctr6 = &r->out.ctr->ctr7.ctr.mszip6.ts->ctr6; + } else if (*r->out.level_out == 7 && + r->out.ctr->ctr7.level == 6 && + r->out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS && + r->out.ctr->ctr7.ctr.xpress6.ts) { ctr_level = 6; - ctr6 = &r->out.ctr.ctr7.ctr.xpress6.ts->ctr6; + ctr6 = &r->out.ctr->ctr7.ctr.xpress6.ts->ctr6; } else { return WERR_BAD_NET_RESP; } diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index f4de9031ec..0ed5e8ae26 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -162,13 +162,19 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J ZERO_STRUCT(r_crack_names); r_crack_names.in.bind_handle = &drsuapi_bind_handle; r_crack_names.in.level = 1; - r_crack_names.in.req.req1.codepage = 1252; /* western european */ - r_crack_names.in.req.req1.language = 0x00000407; /* german */ - r_crack_names.in.req.req1.count = 1; - r_crack_names.in.req.req1.names = names; - r_crack_names.in.req.req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; - r_crack_names.in.req.req1.format_offered= DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY; - r_crack_names.in.req.req1.format_desired= DRSUAPI_DS_NAME_FORMAT_FQDN_1779; + r_crack_names.in.req = talloc(r, union drsuapi_DsNameRequest); + if (!r_crack_names.in.req) { + r->out.error_string = NULL; + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } + r_crack_names.in.req->req1.codepage = 1252; /* western european */ + r_crack_names.in.req->req1.language = 0x00000407; /* german */ + r_crack_names.in.req->req1.count = 1; + r_crack_names.in.req->req1.names = names; + r_crack_names.in.req->req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; + r_crack_names.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY; + r_crack_names.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; names[0].str = dom_sid_string(tmp_ctx, r->out.account_sid); if (!names[0].str) { r->out.error_string = NULL; @@ -176,6 +182,14 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J return NT_STATUS_NO_MEMORY; } + r_crack_names.out.ctr = talloc(r, union drsuapi_DsNameCtr); + r_crack_names.out.level_out = talloc(r, int32_t); + if (!r_crack_names.out.ctr || !r_crack_names.out.level_out) { + r->out.error_string = NULL; + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } + status = dcerpc_drsuapi_DsCrackNames(drsuapi_pipe, tmp_ctx, &r_crack_names); if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { @@ -201,24 +215,24 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J "DsCrackNames failed - %s", win_errstr(r_crack_names.out.result)); talloc_free(tmp_ctx); return NT_STATUS_UNSUCCESSFUL; - } else if (r_crack_names.out.level != 1 - || !r_crack_names.out.ctr.ctr1 - || r_crack_names.out.ctr.ctr1->count != 1) { + } else if (*r_crack_names.out.level_out != 1 + || !r_crack_names.out.ctr->ctr1 + || r_crack_names.out.ctr->ctr1->count != 1) { r->out.error_string = talloc_asprintf(r, "DsCrackNames failed"); talloc_free(tmp_ctx); return NT_STATUS_INVALID_PARAMETER; - } else if (r_crack_names.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { - r->out.error_string = talloc_asprintf(r, "DsCrackNames failed: %d", r_crack_names.out.ctr.ctr1->array[0].status); + } else if (r_crack_names.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + r->out.error_string = talloc_asprintf(r, "DsCrackNames failed: %d", r_crack_names.out.ctr->ctr1->array[0].status); talloc_free(tmp_ctx); return NT_STATUS_UNSUCCESSFUL; - } else if (r_crack_names.out.ctr.ctr1->array[0].result_name == NULL) { + } else if (r_crack_names.out.ctr->ctr1->array[0].result_name == NULL) { r->out.error_string = talloc_asprintf(r, "DsCrackNames failed: no result name"); talloc_free(tmp_ctx); return NT_STATUS_INVALID_PARAMETER; } /* Store the DN of our machine account. */ - account_dn_str = r_crack_names.out.ctr.ctr1->array[0].result_name; + account_dn_str = r_crack_names.out.ctr->ctr1->array[0].result_name; /* Now we know the user's DN, open with LDAP, read and modify a few things */ @@ -328,8 +342,8 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J } /* DsCrackNames to find out the DN of the domain. */ - r_crack_names.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; - r_crack_names.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; + r_crack_names.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; + r_crack_names.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; names[0].str = talloc_asprintf(tmp_ctx, "%s\\", r->out.domain_name); if (!names[0].str) { r->out.error_string = NULL; @@ -362,11 +376,11 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J "DsCrackNames failed - %s", win_errstr(r_crack_names.out.result)); talloc_free(tmp_ctx); return NT_STATUS_UNSUCCESSFUL; - } else if (r_crack_names.out.level != 1 - || !r_crack_names.out.ctr.ctr1 - || r_crack_names.out.ctr.ctr1->count != 1 - || !r_crack_names.out.ctr.ctr1->array[0].result_name - || r_crack_names.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + } else if (*r_crack_names.out.level_out != 1 + || !r_crack_names.out.ctr->ctr1 + || r_crack_names.out.ctr->ctr1->count != 1 + || !r_crack_names.out.ctr->ctr1->array[0].result_name + || r_crack_names.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { r->out.error_string = talloc_asprintf(r, "DsCrackNames failed"); talloc_free(tmp_ctx); return NT_STATUS_UNSUCCESSFUL; @@ -377,8 +391,8 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J talloc_steal(r, account_dn_str); /* Store the domain DN. */ - r->out.domain_dn_str = r_crack_names.out.ctr.ctr1->array[0].result_name; - talloc_steal(r, r_crack_names.out.ctr.ctr1->array[0].result_name); + r->out.domain_dn_str = r_crack_names.out.ctr->ctr1->array[0].result_name; + talloc_steal(r, r_crack_names.out.ctr->ctr1->array[0].result_name); /* Store the KVNO of the account, critical for some kerberos * operations */ diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c index 2ee3c641b2..79c6dc0fc1 100644 --- a/source4/libnet/libnet_unbecome_dc.c +++ b/source4/libnet/libnet_unbecome_dc.c @@ -639,9 +639,13 @@ static void unbecomeDC_drsuapi_remove_ds_server_send(struct libnet_UnbecomeDC_st r->in.bind_handle = &s->drsuapi.bind_handle; r->in.level = 1; - r->in.req.req1.server_dn= s->dest_dsa.server_dn_str; - r->in.req.req1.domain_dn= s->domain.dn_str; - r->in.req.req1.commit = true; + r->in.req = talloc(s, union drsuapi_DsRemoveDSServerRequest); + r->in.req->req1.server_dn = s->dest_dsa.server_dn_str; + r->in.req->req1.domain_dn = s->domain.dn_str; + r->in.req->req1.commit = true; + + r->out.level_out = talloc(s, int32_t); + r->out.res = talloc(s, union drsuapi_DsRemoveDSServerResult); req = dcerpc_drsuapi_DsRemoveDSServer_send(s->drsuapi.pipe, s, r); composite_continue_rpc(c, req, unbecomeDC_drsuapi_remove_ds_server_recv, s); @@ -662,7 +666,7 @@ static void unbecomeDC_drsuapi_remove_ds_server_recv(struct rpc_request *req) return; } - if (r->out.level != 1) { + if (*r->out.level_out != 1) { composite_error(c, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index a4eaae4367..819b79f91f 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -139,12 +139,12 @@ NDR_FRSAPI_OBJ_FILES = $(gen_ndrsrcdir)/ndr_frsapi.o [SUBSYSTEM::NDR_DRSUAPI] PUBLIC_DEPENDENCIES = LIBNDR NDR_COMPRESSION NDR_SECURITY NDR_SAMR ASN1_UTIL -NDR_DRSUAPI_OBJ_FILES = $(gen_ndrsrcdir)/ndr_drsuapi.o $(ndrsrcdir)/ndr_drsuapi.o +NDR_DRSUAPI_OBJ_FILES = $(gen_ndrsrcdir)/ndr_drsuapi.o ../librpc/ndr/ndr_drsuapi.o [SUBSYSTEM::NDR_DRSBLOBS] PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_DRSUAPI -NDR_DRSBLOBS_OBJ_FILES = $(gen_ndrsrcdir)/ndr_drsblobs.o $(ndrsrcdir)/ndr_drsblobs.o +NDR_DRSBLOBS_OBJ_FILES = $(gen_ndrsrcdir)/ndr_drsblobs.o ../librpc/ndr/ndr_drsblobs.o [SUBSYSTEM::NDR_SASL_HELPERS] PUBLIC_DEPENDENCIES = LIBNDR diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl deleted file mode 100644 index f89d9e1f39..0000000000 --- a/source4/librpc/idl/drsuapi.idl +++ /dev/null @@ -1,1597 +0,0 @@ -#include "idl_types.h" - -import "security.idl", "misc.idl", "samr.idl"; - -[ - uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"), - version(4.0), - endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"), - authservice("ldap"), - helpstring("Active Directory Replication"), - helper("librpc/ndr/ndr_drsuapi.h"), - pointer_default(unique) -] -interface drsuapi -{ - typedef bitmap samr_GroupAttrs samr_GroupAttrs; - - /*****************/ - /* Function 0x00 */ - typedef [bitmap32bit] bitmap { - DRSUAPI_SUPPORTED_EXTENSION_BASE = 0x00000001, - DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION = 0x00000002, - DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI = 0x00000004, - DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2 = 0x00000008, - DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS = 0x00000010, - DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1 = 0x00000020, - DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION = 0x00000040, - DRSUAPI_SUPPORTED_EXTENSION_00000080 = 0x00000080, - DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE = 0x00000100, - DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2 = 0x00000200, - DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION = 0x00000400, - DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2 = 0x00000800, - DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD= 0x00001000, - DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND = 0x00002000, - DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO = 0x00004000, - DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION = 0x00008000, - DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01 = 0x00010000, - DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP = 0x00020000, - DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY = 0x00040000, - DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3 = 0x00080000, - DRSUAPI_SUPPORTED_EXTENSION_00100000 = 0x00100000, - DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2 = 0x00200000, - DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6 = 0x00400000, - DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS = 0x00800000, - DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8 = 0x01000000, - DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5 = 0x02000000, - DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6 = 0x04000000, - /* - * the following 3 have the same value - * repadmin.exe /bind says that - */ - DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3 = 0x08000000, - DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7 = 0x08000000, - DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT = 0x08000000, - DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS = 0x10000000, - DRSUAPI_SUPPORTED_EXTENSION_20000000 = 0x20000000, - DRSUAPI_SUPPORTED_EXTENSION_40000000 = 0x40000000, - DRSUAPI_SUPPORTED_EXTENSION_80000000 = 0x80000000 - } drsuapi_SupportedExtensions; - - typedef [bitmap32bit] bitmap { - DRSUAPI_SUPPORTED_EXTENSION_ADAM = 0x00000001, - DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2 = 0x00000002 - } drsuapi_SupportedExtensionsExt; - - /* this is used by w2k */ - typedef struct { - drsuapi_SupportedExtensions supported_extensions; - GUID site_guid; - uint32 pid; - } drsuapi_DsBindInfo24; - - /* this is used by w2k3 */ - typedef struct { - drsuapi_SupportedExtensions supported_extensions; - GUID site_guid; - uint32 pid; - uint32 repl_epoch; - } drsuapi_DsBindInfo28; - - /* this is used by w2k8 */ - typedef struct { - drsuapi_SupportedExtensions supported_extensions; - GUID site_guid; - uint32 pid; - uint32 repl_epoch; - drsuapi_SupportedExtensionsExt supported_extensions_ext; - GUID config_dn_guid; - } drsuapi_DsBindInfo48; - - typedef struct { - [flag(NDR_REMAINING)] DATA_BLOB info; - } drsuapi_DsBindInfoFallBack; - - typedef [nodiscriminant] union { - [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24; - [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28; - [case(48)][subcontext(4)] drsuapi_DsBindInfo48 info48; - [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack; - } drsuapi_DsBindInfo; - - /* the drsuapi_DsBindInfoCtr was this before - * typedef [flag(NDR_PAHEX)] struct { - * [range(1,10000)] uint32 length; - * [size_is(length)] uint8 data[]; - * } drsuapi_DsBindInfo; - * - * but we don't want the caller to manually decode this blob, - * so we're doing it here - */ - - typedef struct { - [range(1,10000)] uint32 length; - [switch_is(length)] drsuapi_DsBindInfo info; - } drsuapi_DsBindInfoCtr; - - /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work - * - * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04 - */ - const char *DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d"; - /* - * this magic guid are needed to fetch the whole tree with drsuapi_DsGetNCChanges() - * as administrator and this values are also used in the destination_dsa_guid field - * of drsuapi_DsGetNCChangesReq5/8 and the source_dsa_guid is zero. - */ - const char *DRSUAPI_DS_BIND_GUID_W2K = "6abec3d1-3054-41c8-a362-5a0c5b7d5d71"; - const char *DRSUAPI_DS_BIND_GUID_W2K3 = "6afab99c-6e26-464a-975f-f58f105218bc"; - - [public] WERROR drsuapi_DsBind( - [in,unique] GUID *bind_guid, - [in,out,unique] drsuapi_DsBindInfoCtr *bind_info, - [out] policy_handle *bind_handle - ); - - /*****************/ - /* Function 0x01 */ - WERROR drsuapi_DsUnbind( - [in,out] policy_handle *bind_handle - ); - - /*****************/ - /* Function 0x02 */ - typedef [public,gensize] struct { - [value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->flags)-4)] uint32 __ndr_size; - [value(ndr_size_dom_sid28(&sid, ndr->flags))] uint32 __ndr_size_sid; - GUID guid; - dom_sid28 sid; - [value(strlen_m(dn))] uint32 __ndr_size_dn; - [charset(UTF16),size_is(__ndr_size_dn+1)] uint16 dn[]; - } drsuapi_DsReplicaObjectIdentifier; - - typedef [public] bitmap { - DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION = 0x00000001, - DRSUAPI_DS_REPLICA_SYNC_WRITEABLE = 0x00000002, - DRSUAPI_DS_REPLICA_SYNC_PERIODIC = 0x00000004, - DRSUAPI_DS_REPLICA_SYNC_INTERSITE_MESSAGING = 0x00000008, - DRSUAPI_DS_REPLICA_SYNC_ALL_SOURCES = 0x00000010, - DRSUAPI_DS_REPLICA_SYNC_FULL = 0x00000020, - DRSUAPI_DS_REPLICA_SYNC_URGENT = 0x00000040, - DRSUAPI_DS_REPLICA_SYNC_NO_DISCARD = 0x00000080, - DRSUAPI_DS_REPLICA_SYNC_FORCE = 0x00000100, - DRSUAPI_DS_REPLICA_SYNC_ADD_REFERENCE = 0x00000200, - DRSUAPI_DS_REPLICA_SYNC_NEVER_COMPLETED = 0x00000400, - DRSUAPI_DS_REPLICA_SYNC_TWO_WAY = 0x00000800, - DRSUAPI_DS_REPLICA_SYNC_NEVER_NOTIFY = 0x00001000, - DRSUAPI_DS_REPLICA_SYNC_INITIAL = 0x00002000, - DRSUAPI_DS_REPLICA_SYNC_USE_COMPRESSION = 0x00004000, - DRSUAPI_DS_REPLICA_SYNC_ABANDONED = 0x00008000, - DRSUAPI_DS_REPLICA_SYNC_INITIAL_IN_PROGRESS = 0x00010000, - DRSUAPI_DS_REPLICA_SYNC_PARTIAL_ATTRIBUTE_SET = 0x00020000, - DRSUAPI_DS_REPLICA_SYNC_REQUEUE = 0x00040000, - DRSUAPI_DS_REPLICA_SYNC_NOTIFICATION = 0x00080000, - DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_REPLICA = 0x00100000, - DRSUAPI_DS_REPLICA_SYNC_CRITICAL = 0x00200000, - DRSUAPI_DS_REPLICA_SYNC_FULL_IN_PROGRESS = 0x00400000, - DRSUAPI_DS_REPLICA_SYNC_PREEMPTED = 0x00800000 - } drsuapi_DsReplicaSyncOptions; - - typedef struct { - drsuapi_DsReplicaObjectIdentifier *naming_context; - GUID source_dsa_guid; - astring *other_info; /* I assume this is related to the repsFromTo1OtherInfo dns_name */ - drsuapi_DsReplicaSyncOptions options; - } drsuapi_DsReplicaSyncRequest1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsReplicaSyncRequest1 req1; - } drsuapi_DsReplicaSyncRequest; - - WERROR drsuapi_DsReplicaSync( - [in] policy_handle *bind_handle, - [in] int32 level, - [in,switch_is(level)] drsuapi_DsReplicaSyncRequest req - ); - - /*****************/ - /* Function 0x03 */ - typedef [public] struct { - hyper tmp_highest_usn; /* updated after each object update */ - hyper reserved_usn; - hyper highest_usn; /* updated after a full replication cycle */ - } drsuapi_DsReplicaHighWaterMark; - - typedef [public] struct { - GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ - hyper highest_usn; /* updated after a full replication cycle */ - } drsuapi_DsReplicaCursor; - - typedef struct { - [value(1)] uint32 version; - [value(0)] uint32 reserved1; - [range(0,0x100000)] uint32 count; - [value(0)] uint32 reserved2; - [size_is(count)] drsuapi_DsReplicaCursor cursors[]; - } drsuapi_DsReplicaCursorCtrEx; - - typedef [public] bitmap { - /* the _WRITEABLE flag indicates a replication with all attributes - * - * --metze - */ - DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE = 0x00000010, - DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP = 0x00000020, - DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS = 0x00000040, - DRSUAPI_DS_REPLICA_NEIGHBOUR_USE_ASYNC_INTERSIDE_TRANSPORT = 0x00000080, - DRSUAPI_DS_REPLICA_NEIGHBOUR_TWO_WAY_SYNC = 0x00000200, - DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS = 0x00000800, - DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS = 0x00001000, /* was 0x00010000, */ - DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_NEXT_PACKET = 0x00002000, /* was 0x00020000, */ - DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED = 0x00200000, - DRSUAPI_DS_REPLICA_NEIGHBOUR_PREEMPTED = 0x01000000, - DRSUAPI_DS_REPLICA_NEIGHBOUR_IGNORE_CHANGE_NOTIFICATIONS = 0x04000000, - DRSUAPI_DS_REPLICA_NEIGHBOUR_DISABLE_SCHEDULED_SYNC = 0x08000000, - /* - * the following NOTE applies to DsGetNCChangesRequest5: - * - the data is only compressed when 10 or more objects are replicated - * - but there could also be a size limit of 35 KBytes or something like that - * - the reply is DsGetNCChangesCtr2 - * - maybe the same applies to DsGetNCChangesRequest8... - * - * --metze - */ - DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES = 0x10000000, - DRSUAPI_DS_REPLICA_NEIGHBOUR_NO_CHANGE_NOTIFICATIONS = 0x20000000, - DRSUAPI_DS_REPLICA_NEIGHBOUR_PARTIAL_ATTRIBUTE_SET = 0x40000000 - } drsuapi_DsReplicaNeighbourFlags; - - typedef [flag(NDR_PAHEX),v1_enum] enum { - DRSUAPI_EXOP_NONE = 0x00000000, - DRSUAPI_EXOP_FSMO_REQ_ROLE = 0x00000001, - DRSUAPI_EXOP_FSMO_RID_ALLOC = 0x00000002, - DRSUAPI_EXOP_FSMO_RID_REQ_ROLE = 0x00000003, - DRSUAPI_EXOP_FSMO_REQ_PDC = 0x00000004, - DRSUAPI_EXOP_FSMO_ABANDON_ROLE = 0x00000005, - DRSUAPI_EXOP_REPL_OBJ = 0x00000006, - DRSUAPI_EXOP_REPL_SECRET = 0x00000007 - } drsuapi_DsExtendedOperation; - - typedef [flag(NDR_PAHEX),v1_enum] enum { - DRSUAPI_EXOP_ERR_NONE = 0x00000000, - DRSUAPI_EXOP_ERR_SUCCESS = 0x00000001, - DRSUAPI_EXOP_ERR_UNKNOWN_OP = 0x00000002, - DRSUAPI_EXOP_ERR_FSMO_NOT_OWNER = 0x00000003, - DRSUAPI_EXOP_ERR_UPDATE_ERR = 0x00000004, - DRSUAPI_EXOP_ERR_EXCEPTION = 0x00000005, - DRSUAPI_EXOP_ERR_UNKNOWN_CALLER = 0x00000006, - DRSUAPI_EXOP_ERR_RID_ALLOC = 0x00000007, - DRSUAPI_EXOP_ERR_FSMO_OWNER_DELETED = 0x00000008, - DRSUAPI_EXOP_ERR_FMSO_PENDING_OP = 0x00000009, - DRSUAPI_EXOP_ERR_MISMATCH = 0x0000000A, - DRSUAPI_EXOP_ERR_COULDNT_CONTACT = 0x0000000B, - DRSUAPI_EXOP_ERR_FSMO_REFUSING_ROLES = 0x0000000C, - DRSUAPI_EXOP_ERR_DIR_ERROR = 0x0000000D, - DRSUAPI_EXOP_ERR_FSMO_MISSING_SETTINGS = 0x0000000E, - DRSUAPI_EXOP_ERR_ACCESS_DENIED = 0x0000000F, - DRSUAPI_EXOP_ERR_PARAM_ERROR = 0x00000010 - } drsuapi_DsExtendedError; - - typedef struct { - GUID destination_dsa_guid; - GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ - [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; - drsuapi_DsReplicaHighWaterMark highwatermark; - drsuapi_DsReplicaCursorCtrEx *uptodateness_vector; - drsuapi_DsReplicaNeighbourFlags replica_flags; - uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */ - uint32 max_ndr_size; /* w2k3 seems to ignore this */ - drsuapi_DsExtendedOperation extended_op; - hyper fsmo_info; - } drsuapi_DsGetNCChangesRequest5; - - /* - * In DRSUAPI all attributes with syntax 2.5.5.2 - * are identified by uint32 values - * - * the following table shows the mapping used between the two representations - * e.g. - objectClass 'nTDSDSA' has governsID: 1.2.840.113556.1.5.7000.47 - * and a UINT32-ID of '0x0017002F'. - * - so the OID 1.2.840.113556.1.5.7000.47 is splitted into a - * OID-prefix: 1.2.840.113556.1.5.7000 - * and a value: 47 => 0x2F - * - the mapping table gives a UINT32-prefix: 0x00170000 - * - and the UINT32-ID is 0x0017002F = 0x00170000 | 0x2F - * - * This prefix mapping table is replied in the drsuapi_DsReplicaOIDMapping_Ctr - * array. The following are the default mappings of w2k3 - * - * OID-prefix => UINT32-Id prefix - * - * 2.5.4.* => 0x00000000 (standard attributes RFC2256 core.schema) - * 2.5.6.* => 0x00010000 (standard object classes RFC2256 core.schema) - * 1.2.840.113556.1.2.* => 0x00020000 - * 1.2.840.113556.1.3.* => 0x00030000 - * 2.5.5.* => 0x00080000 (attributeSyntax OID's) - * 1.2.840.113556.1.4.* => 0x00090000 - * 1.2.840.113556.1.5.* => 0x000A0000 - * 2.16.840.1.113730.3.* => 0x00140000 - * 0.9.2342.19200300.100.1.* => 0x00150000 - * 2.16.840.1.113730.3.1.* => 0x00160000 - * 1.2.840.113556.1.5.7000.* => 0x00170000 - * 2.5.21.* => 0x00180000 (attrs for SubSchema) - * 2.5.18.* => 0x00190000 (createTimeStamp,modifyTimeStamp, SubSchema) - * 2.5.20.* => 0x001A0000 - * 1.3.6.1.4.1.1466.101.119.* => 0x001B0000 (dynamicObject, entryTTL) - * 2.16.840.1.113730.3.2.* => 0x001C0000 - * 1.3.6.1.4.1.250.1.* => 0x001D0000 - * 1.2.840.113549.1.9.* => 0x001E0000 (unstructuredAddress,unstructuredName) - * 0.9.2342.19200300.100.4.* => 0x001F0000 - * - * Here's a list of used 'attributeSyntax' OID's - * - * 2.5.5.1 => Object(DS-DN) string - * struct drsuapi_DsObjectIdentifier3 - * - * 2.5.5.2 => OID-string - * => all values are represented as uint32 values in drsuapi - * => governsID, attributeID and attributeSyntax returned as OID-Strings in LDAP - * => mayContain, mustContain and all other attributes with 2.5.5.2 syntax - * are returned as attribute names - * - * 2.5.5.4 => String(Teletex) case-insensitive string with teletex charset - * - * 2.5.5.5 => String(IA5) case-sensitive string - * - * 2.5.5.6 => String(Numeric) - * => eg. internationalISDNNumber - * - * 2.5.5.7 => Object(DN-Binary) B:<byte count>:<bytes>:<object DN> - * => e.g. wellKnownObjects - * - * 2.5.5.8 => BOOL - * - * 2.5.5.9 => int32 - * - * 2.5.5.10 => DATA_BLOB - * => struct GUID - * - * 2.5.5.11 => LDAP timestring - * => NTTIME_1sec - * - * 2.5.5.12 => String(Unicode) case-insensitive string - * => 'standard strings' - * - * 2.5.5.13 => Object(Presentation-Address) string - * => used in objectClass applicationEntity - * - * 2.5.5.14 => Object(DN-String) S:<char count>:<string>:<object DN> - * => not used - * - * 2.5.5.15 => ntSecurityDescriptor - * - * 2.5.5.16 => int64 - * - * 2.5.5.17 => dom_sid - */ - typedef [nopush,nopull] struct { - [range(0,10000),value(ndr_size_drsuapi_DsReplicaOID_oid(oid, 0))] uint32 __ndr_size; - [size_is(__ndr_size),charset(DOS)] uint8 *oid; /* it's encoded with asn1_write_OID_String() */ - } drsuapi_DsReplicaOID; - - typedef struct { - uint32 id_prefix; - drsuapi_DsReplicaOID oid; - } drsuapi_DsReplicaOIDMapping; - - typedef [public] struct { - [range(0,0x100000)] uint32 num_mappings; - [size_is(num_mappings)] drsuapi_DsReplicaOIDMapping *mappings; - } drsuapi_DsReplicaOIDMapping_Ctr; - - typedef [flag(NDR_PAHEX),v1_enum] enum { - DRSUAPI_OBJECTCLASS_top = 0x00010000, - DRSUAPI_OBJECTCLASS_classSchema = 0x0003000d, - DRSUAPI_OBJECTCLASS_attributeSchema = 0x0003000e - } drsuapi_DsObjectClassId; - - typedef [flag(NDR_PAHEX),v1_enum,public] enum { - DRSUAPI_ATTRIBUTE_objectClass = 0x00000000, - DRSUAPI_ATTRIBUTE_description = 0x0000000d, - DRSUAPI_ATTRIBUTE_member = 0x0000001f, - DRSUAPI_ATTRIBUTE_instanceType = 0x00020001, - DRSUAPI_ATTRIBUTE_whenCreated = 0x00020002, - DRSUAPI_ATTRIBUTE_hasMasterNCs = 0x0002000e, - DRSUAPI_ATTRIBUTE_governsID = 0x00020016, - DRSUAPI_ATTRIBUTE_attributeID = 0x0002001e, - DRSUAPI_ATTRIBUTE_attributeSyntax = 0x00020020, - DRSUAPI_ATTRIBUTE_isSingleValued = 0x00020021, - DRSUAPI_ATTRIBUTE_rangeLower = 0x00020022, - DRSUAPI_ATTRIBUTE_rangeUpper = 0x00020023, - DRSUAPI_ATTRIBUTE_dMDLocation = 0x00020024, - DRSUAPI_ATTRIBUTE_objectVersion = 0x0002004c, - DRSUAPI_ATTRIBUTE_invocationId = 0x00020073, - DRSUAPI_ATTRIBUTE_showInAdvancedViewOnly = 0x000200a9, - DRSUAPI_ATTRIBUTE_adminDisplayName = 0x000200c2, - DRSUAPI_ATTRIBUTE_adminDescription = 0x000200e2, - DRSUAPI_ATTRIBUTE_oMSyntax = 0x000200e7, - DRSUAPI_ATTRIBUTE_ntSecurityDescriptor = 0x00020119, - DRSUAPI_ATTRIBUTE_searchFlags = 0x0002014e, - DRSUAPI_ATTRIBUTE_lDAPDisplayName = 0x000201cc, - DRSUAPI_ATTRIBUTE_name = 0x00090001, - DRSUAPI_ATTRIBUTE_userAccountControl = 0x00090008, - DRSUAPI_ATTRIBUTE_currentValue = 0x0009001b, - DRSUAPI_ATTRIBUTE_homeDirectory = 0x0009002c, - DRSUAPI_ATTRIBUTE_homeDrive = 0x0009002d, - DRSUAPI_ATTRIBUTE_scriptPath = 0x0009003e, - DRSUAPI_ATTRIBUTE_profilePath = 0x0009008b, - DRSUAPI_ATTRIBUTE_objectSid = 0x00090092, - DRSUAPI_ATTRIBUTE_schemaIDGUID = 0x00090094, - DRSUAPI_ATTRIBUTE_dBCSPwd = 0x00090037,/* lmPwdHash */ - DRSUAPI_ATTRIBUTE_logonHours = 0x00090040, - DRSUAPI_ATTRIBUTE_userWorkstations = 0x00090056, - DRSUAPI_ATTRIBUTE_unicodePwd = 0x0009005a,/* ntPwdHash */ - DRSUAPI_ATTRIBUTE_ntPwdHistory = 0x0009005e, - DRSUAPI_ATTRIBUTE_priorValue = 0x00090064, - DRSUAPI_ATTRIBUTE_supplementalCredentials = 0x0009007d, - DRSUAPI_ATTRIBUTE_trustAuthIncoming = 0x00090081, - DRSUAPI_ATTRIBUTE_trustAuthOutgoing = 0x00090087, - DRSUAPI_ATTRIBUTE_lmPwdHistory = 0x000900a0, - DRSUAPI_ATTRIBUTE_sAMAccountName = 0x000900dd, - DRSUAPI_ATTRIBUTE_sAMAccountType = 0x0009012e, - DRSUAPI_ATTRIBUTE_fSMORoleOwner = 0x00090171, - DRSUAPI_ATTRIBUTE_systemFlags = 0x00090177, - DRSUAPI_ATTRIBUTE_serverReference = 0x00090203, - DRSUAPI_ATTRIBUTE_serverReferenceBL = 0x00090204, - DRSUAPI_ATTRIBUTE_initialAuthIncoming = 0x0009021b, - DRSUAPI_ATTRIBUTE_initialAuthOutgoing = 0x0009021c, - DRSUAPI_ATTRIBUTE_wellKnownObjects = 0x0009026a, - DRSUAPI_ATTRIBUTE_dNSHostName = 0x0009026b, - DRSUAPI_ATTRIBUTE_isMemberOfPartialAttributeSet = 0x0009027f, - DRSUAPI_ATTRIBUTE_userPrincipalName = 0x00090290, - DRSUAPI_ATTRIBUTE_groupType = 0x000902ee, - DRSUAPI_ATTRIBUTE_servicePrincipalName = 0x00090303, - DRSUAPI_ATTRIBUTE_objectCategory = 0x0009030e, - DRSUAPI_ATTRIBUTE_gPLink = 0x0009037b, - DRSUAPI_ATTRIBUTE_msDS_Behavior_Version = 0x000905b3, - DRSUAPI_ATTRIBUTE_msDS_KeyVersionNumber = 0x000906f6, - DRSUAPI_ATTRIBUTE_msDS_HasDomainNCs = 0x0009071c, - DRSUAPI_ATTRIBUTE_msDS_hasMasterNCs = 0x0009072c - } drsuapi_DsAttributeId; - - typedef struct { - [value(1)] uint32 version; - [value(0)] uint32 reserved1; - [range(1,0x100000)] uint32 num_attids; - [size_is(num_attids)] drsuapi_DsAttributeId attids[]; - } drsuapi_DsPartialAttributeSet; - - typedef struct { - GUID destination_dsa_guid; - GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ - [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; - drsuapi_DsReplicaHighWaterMark highwatermark; - drsuapi_DsReplicaCursorCtrEx *uptodateness_vector; - drsuapi_DsReplicaNeighbourFlags replica_flags; - uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */ - uint32 max_ndr_size; /* w2k3 seems to ignore this */ - drsuapi_DsExtendedOperation extended_op; - hyper fsmo_info; - drsuapi_DsPartialAttributeSet *partial_attribute_set; - drsuapi_DsPartialAttributeSet *partial_attribute_set_ex; - drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; - } drsuapi_DsGetNCChangesRequest8; - - typedef [switch_type(int32)] union { - [case(5)] drsuapi_DsGetNCChangesRequest5 req5; - [case(8)] drsuapi_DsGetNCChangesRequest8 req8; - } drsuapi_DsGetNCChangesRequest; - - typedef [public] struct { - GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ - hyper highest_usn; /* updated after a full replication cycle */ - NTTIME last_sync_success; - } drsuapi_DsReplicaCursor2; - - typedef struct { - [value(2)] uint32 version; - [value(0)] uint32 reserved1; - [range(0,0x100000)] uint32 count; - [value(0)] uint32 reserved2; - [size_is(count)] drsuapi_DsReplicaCursor2 cursors[]; - } drsuapi_DsReplicaCursor2CtrEx; - - /* Generic DATA_BLOB values */ - typedef struct { - [range(0,10485760),value(ndr_size_DATA_BLOB(0,blob,0))] uint32 __ndr_size; - DATA_BLOB *blob; - } drsuapi_DsAttributeValue; - - typedef struct { - [range(0,10485760)] uint32 num_values; - [size_is(num_values)] drsuapi_DsAttributeValue *values; - } drsuapi_DsAttributeValueCtr; - - /* DN String values */ - typedef [public,gensize] struct { - [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags))] uint32 __ndr_size; - [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid; - GUID guid; - dom_sid28 sid; - [value(strlen_m(dn))] uint32 __ndr_size_dn; - [charset(UTF16)] uint16 dn[__ndr_size_dn+1]; - } drsuapi_DsReplicaObjectIdentifier3; - - typedef [public,gensize] struct { - [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary(r, ndr->flags))] uint32 __ndr_size; - [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid; - GUID guid; - dom_sid28 sid; - [value(strlen_m(dn))] uint32 __ndr_size_dn; - [charset(UTF16)] uint16 dn[__ndr_size_dn+1]; - [value(binary.length + 4)] uint32 __ndr_size_binary; - [flag(NDR_REMAINING)] DATA_BLOB binary; - } drsuapi_DsReplicaObjectIdentifier3Binary; - - typedef [public] struct { - drsuapi_DsAttributeId attid; - drsuapi_DsAttributeValueCtr value_ctr; - } drsuapi_DsReplicaAttribute; - - typedef struct { - [range(0,1048576)] uint32 num_attributes; - [size_is(num_attributes)] drsuapi_DsReplicaAttribute *attributes; - } drsuapi_DsReplicaAttributeCtr; - - typedef [public] bitmap { - DRSUAPI_DS_REPLICA_OBJECT_FROM_MASTER = 0x00000001, - DRSUAPI_DS_REPLICA_OBJECT_DYNAMIC = 0x00000002, - DRSUAPI_DS_REPLICA_OBJECT_REMOTE_MODIFY = 0x00010000 - } drsuapi_DsReplicaObjectFlags; - - typedef [public] struct { - drsuapi_DsReplicaObjectIdentifier *identifier; - drsuapi_DsReplicaObjectFlags flags; - drsuapi_DsReplicaAttributeCtr attribute_ctr; - } drsuapi_DsReplicaObject; - - typedef struct { - uint32 version; - NTTIME_1sec originating_change_time; - GUID originating_invocation_id; - hyper originating_usn; - } drsuapi_DsReplicaMetaData; - - typedef [public] struct { - [range(0,1048576)] uint32 count; - [size_is(count)] drsuapi_DsReplicaMetaData meta_data[]; - } drsuapi_DsReplicaMetaDataCtr; - - typedef [public,noprint] struct { - drsuapi_DsReplicaObjectListItemEx *next_object; - drsuapi_DsReplicaObject object; - boolean32 is_nc_prefix; - GUID *parent_object_guid; - drsuapi_DsReplicaMetaDataCtr *meta_data_ctr; - } drsuapi_DsReplicaObjectListItemEx; - - typedef [public,gensize] struct { - GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */ - GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ - drsuapi_DsReplicaObjectIdentifier *naming_context; - drsuapi_DsReplicaHighWaterMark old_highwatermark; - drsuapi_DsReplicaHighWaterMark new_highwatermark; - drsuapi_DsReplicaCursorCtrEx *uptodateness_vector; - drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; - drsuapi_DsExtendedError extended_ret; /* w2k sends the nc_object_count value here */ - uint32 object_count; - /* this +55 is sometimes +56, so I don't know where this comes from... --metze */ - [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->flags)+55)] uint32 __ndr_size; - drsuapi_DsReplicaObjectListItemEx *first_object; - boolean32 more_data; - } drsuapi_DsGetNCChangesCtr1; - - /* - * if the DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE flag - * isn't there it means the value is deleted - */ - typedef [public] bitmap { - DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE = 0x00000001 - } drsuapi_DsLinkedAttributeFlags; - - typedef [public] struct { - drsuapi_DsReplicaObjectIdentifier *identifier; - drsuapi_DsAttributeId attid; - drsuapi_DsAttributeValue value; - drsuapi_DsLinkedAttributeFlags flags; - NTTIME_1sec originating_add_time; - drsuapi_DsReplicaMetaData meta_data; - } drsuapi_DsReplicaLinkedAttribute; - - typedef [public,gensize] struct { - GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */ - GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ - drsuapi_DsReplicaObjectIdentifier *naming_context; - drsuapi_DsReplicaHighWaterMark old_highwatermark; - drsuapi_DsReplicaHighWaterMark new_highwatermark; - drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector; - drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; - drsuapi_DsExtendedError extended_ret; - uint32 object_count; - /* this +55 is sometimes +56, so I don't know where this comes from... --metze */ - [value(ndr_size_drsuapi_DsGetNCChangesCtr6(r,ndr->flags)+55)] uint32 __ndr_size; - drsuapi_DsReplicaObjectListItemEx *first_object; - boolean32 more_data; - uint32 nc_object_count; /* estimated amount of objects in the whole NC */ - uint32 nc_linked_attributes_count; /* estimated amount of linked values in the whole NC */ - [range(0,1048576)] uint32 linked_attributes_count; - [size_is(linked_attributes_count)] drsuapi_DsReplicaLinkedAttribute *linked_attributes; - WERROR drs_error; - } drsuapi_DsGetNCChangesCtr6; - - typedef [public] struct { - [subcontext(0xFFFFFC01)] drsuapi_DsGetNCChangesCtr1 ctr1; - } drsuapi_DsGetNCChangesCtr1TS; - - typedef [public] struct { - [subcontext(0xFFFFFC01)] drsuapi_DsGetNCChangesCtr6 ctr6; - } drsuapi_DsGetNCChangesCtr6TS; - - typedef [nopush] struct { - uint32 decompressed_length; - uint32 compressed_length; - [subcontext(4),subcontext_size(compressed_length), - compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)] - drsuapi_DsGetNCChangesCtr1TS *ts; - } drsuapi_DsGetNCChangesMSZIPCtr1; - - typedef [nopush] struct { - uint32 decompressed_length; - uint32 compressed_length; - [subcontext(4),subcontext_size(compressed_length), - compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)] - drsuapi_DsGetNCChangesCtr6TS *ts; - } drsuapi_DsGetNCChangesMSZIPCtr6; - - typedef [nopush] struct { - uint32 decompressed_length; - uint32 compressed_length; - [subcontext(4),subcontext_size(compressed_length), - compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)] - drsuapi_DsGetNCChangesCtr1TS *ts; - } drsuapi_DsGetNCChangesXPRESSCtr1; - - typedef [nopush] struct { - uint32 decompressed_length; - uint32 compressed_length; - [subcontext(4),subcontext_size(compressed_length), - compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)] - drsuapi_DsGetNCChangesCtr6TS *ts; - } drsuapi_DsGetNCChangesXPRESSCtr6; - - typedef [enum16bit] enum { - DRSUAPI_COMPRESSION_TYPE_MSZIP = 2, - DRSUAPI_COMPRESSION_TYPE_XPRESS = 3 - } drsuapi_DsGetNCChangesCompressionType; - - typedef [nodiscriminant,flag(NDR_PAHEX)] union { - [case(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr1 mszip1; - [case(6|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr6 mszip6; - [case(1|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr1 xpress1; - [case(6|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr6 xpress6; - } drsuapi_DsGetNCChangesCompressedCtr; - - typedef struct { - drsuapi_DsGetNCChangesMSZIPCtr1 mszip1; - } drsuapi_DsGetNCChangesCtr2; - - typedef struct { - [range(0,6)] int32 level; - [range(2,3)] drsuapi_DsGetNCChangesCompressionType type; - [switch_is(level | (type<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr; - } drsuapi_DsGetNCChangesCtr7; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsGetNCChangesCtr1 ctr1; - [case(2)] drsuapi_DsGetNCChangesCtr2 ctr2; - [case(6)] drsuapi_DsGetNCChangesCtr6 ctr6; - [case(7)] drsuapi_DsGetNCChangesCtr7 ctr7; - } drsuapi_DsGetNCChangesCtr; - - WERROR drsuapi_DsGetNCChanges( - [in] policy_handle *bind_handle, - [in,out,ref] int32 *level, - [in,switch_is(*level)] drsuapi_DsGetNCChangesRequest req, - [out,switch_is(*level)] drsuapi_DsGetNCChangesCtr ctr - ); - - /*****************/ - /* Function 0x04 */ - typedef bitmap { - DRSUAPI_DS_REPLICA_UPDATE_ASYNCHRONOUS_OPERATION = 0x00000001, - DRSUAPI_DS_REPLICA_UPDATE_WRITEABLE = 0x00000002, - DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE = 0x00000004, - DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE = 0x00000008, - DRSUAPI_DS_REPLICA_UPDATE_0x00000010 = 0x00000010 - } drsuapi_DsReplicaUpdateRefsOptions; - - typedef struct { - [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; - [ref,charset(DOS),string] uint8 *dest_dsa_dns_name; - GUID dest_dsa_guid; - drsuapi_DsReplicaUpdateRefsOptions options; - } drsuapi_DsReplicaUpdateRefsRequest1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1; - } drsuapi_DsReplicaUpdateRefsRequest; - - WERROR drsuapi_DsReplicaUpdateRefs( - [in] policy_handle *bind_handle, - [in] int32 level, - [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req - ); - - /*****************/ - /* Function 0x05 */ - typedef bitmap { - DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION = 0x00000001, - DRSUAPI_DS_REPLICA_ADD_WRITEABLE = 0x00000002 - /* TODO ... */ - } drsuapi_DsReplicaAddOptions; - - [todo] WERROR DRSUAPI_REPLICA_ADD(); - - /*****************/ - /* Function 0x06 */ - typedef bitmap { - DRSUAPI_DS_REPLICA_DELETE_ASYNCHRONOUS_OPERATION = 0x00000001, - DRSUAPI_DS_REPLICA_DELETE_WRITEABLE = 0x00000002 - /* TODO ... */ - } drsuapi_DsReplicaDeleteOptions; - - [todo] WERROR DRSUAPI_REPLICA_DEL(); - - /*****************/ - /* Function 0x07 */ - typedef bitmap { - DRSUAPI_DS_REPLICA_MODIFY_ASYNCHRONOUS_OPERATION = 0x00000001, - DRSUAPI_DS_REPLICA_MODIFY_WRITEABLE = 0x00000002 - } drsuapi_DsReplicaModifyOptions; - - [todo] WERROR DRSUAPI_REPLICA_MODIFY(); - - /*****************/ - /* Function 0x08 */ - [todo] WERROR DRSUAPI_VERIFY_NAMES(); - - /*****************/ - /* Function 0x09 */ - - /* how are type 4 and 7 different from 2 and 3 ? */ - typedef [v1_enum] enum { - DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_AND_DOMAIN_GROUPS = 1, - DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS = 2, - DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS = 3, - DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS2 = 4, - DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_GROUPS = 5, - DRSUAPI_DS_MEMBERSHIP_TYPE_GROUPMEMBERS = 6, - DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS2 = 7 - } drsuapi_DsMembershipType; - - typedef struct { - NTSTATUS status; - [range(0,10000)] uint32 num_memberships; - [range(0,10000)] uint32 num_sids; - [size_is(num_memberships)] drsuapi_DsReplicaObjectIdentifier **info_array; - [size_is(num_memberships)] samr_GroupAttrs *group_attrs; - [size_is(num_sids)] dom_sid28 **sids; - } drsuapi_DsGetMembershipsCtr1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1; - } drsuapi_DsGetMembershipsCtr; - - const int DRSUAPI_DS_MEMBERSHIP_FLAG_GROUP_ATTR = 0x1; - - typedef struct { - [range(1,10000)] uint32 count; - [size_is(count)] drsuapi_DsReplicaObjectIdentifier **info_array; - uint32 flags; - drsuapi_DsMembershipType type; - drsuapi_DsReplicaObjectIdentifier *domain; - } drsuapi_DsGetMembershipsRequest1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsGetMembershipsRequest1 req1; - } drsuapi_DsGetMembershipsRequest; - - [todo] WERROR drsuapi_DsGetMemberships( - [in] policy_handle *bind_handle, - [in] int32 level, - [in,ref] [switch_is(level)] drsuapi_DsGetMembershipsRequest *req, - [out,ref] int32 *level_out, - [out,ref] [switch_is(*level_out)] drsuapi_DsGetMembershipsCtr *ctr - ); - - /*****************/ - /* Function 0x0a */ - [todo] WERROR DRSUAPI_INTER_DOMAIN_MOVE(); - - /*****************/ - /* Function 0x0b */ - typedef struct { - uint32 unknown1; - uint32 unknown2; - [range(0,0x00A00000)] uint32 length; - [size_is(length)] uint8 *data; - } drsuapi_DsGetNT4ChangeLogRequest1; - - typedef [switch_type(uint32)] union { - [case(1)] drsuapi_DsGetNT4ChangeLogRequest1 req1; - } drsuapi_DsGetNT4ChangeLogRequest; - - typedef struct { - [range(0,0x00A00000)] uint32 length1; - [range(0,0x00A00000)] uint32 length2; - hyper unknown1; - NTTIME time2; - hyper unknown3; - NTTIME time4; - hyper unknown5; - NTTIME time6; - NTSTATUS status; - [size_is(length1)] uint8 *data1; - [size_is(length2)] uint8 *data2; - } drsuapi_DsGetNT4ChangeLogInfo1; - - typedef [switch_type(uint32)] union { - [case(1)] drsuapi_DsGetNT4ChangeLogInfo1 info1; - } drsuapi_DsGetNT4ChangeLogInfo; - - [todo] WERROR drsuapi_DsGetNT4ChangeLog( - [in] policy_handle *bind_handle, - [in] uint32 level, - [in,ref] [switch_is(level)] drsuapi_DsGetNT4ChangeLogRequest *req, - [out,ref] uint32 *level_out, - [out,ref] [switch_is(*level_out)] drsuapi_DsGetNT4ChangeLogInfo *info - ); - - /*****************/ - /* Function 0x0c */ - typedef [v1_enum] enum { - DRSUAPI_DS_NAME_STATUS_OK = 0, - DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR = 1, - DRSUAPI_DS_NAME_STATUS_NOT_FOUND = 2, - DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE = 3, - DRSUAPI_DS_NAME_STATUS_NO_MAPPING = 4, - DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY = 5, - DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING = 6, - DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL = 7 - } drsuapi_DsNameStatus; - - typedef [v1_enum] enum { - DRSUAPI_DS_NAME_FLAG_NO_FLAGS = 0x0, - DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY = 0x1, - DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC = 0x2, - DRSUAPI_DS_NAME_FLAG_GCVERIFY = 0x4, - DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL = 0x8 - } drsuapi_DsNameFlags; - - typedef [v1_enum] enum { - DRSUAPI_DS_NAME_FORMAT_UNKNOWN = 0, - DRSUAPI_DS_NAME_FORMAT_FQDN_1779 = 1, - DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT = 2, - DRSUAPI_DS_NAME_FORMAT_DISPLAY = 3, - DRSUAPI_DS_NAME_FORMAT_GUID = 6, - DRSUAPI_DS_NAME_FORMAT_CANONICAL = 7, - DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL = 8, - DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX = 9, - DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL = 10, - DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY = 11, - DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN = 12 - } drsuapi_DsNameFormat; - - typedef struct { - [string,charset(UTF16)] uint16 *str; - } drsuapi_DsNameString; - - typedef struct { - uint32 codepage; /* 0x000004e4 - 1252 is german codepage*/ - uint32 language; /* 0x00000407 - german language ID*/ - drsuapi_DsNameFlags format_flags; - drsuapi_DsNameFormat format_offered; - drsuapi_DsNameFormat format_desired; - [range(1,10000)] uint32 count; - [size_is(count)] drsuapi_DsNameString *names; - } drsuapi_DsNameRequest1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsNameRequest1 req1; - } drsuapi_DsNameRequest; - - typedef struct { - drsuapi_DsNameStatus status; - [charset(UTF16),string] uint16 *dns_domain_name; - [charset(UTF16),string] uint16 *result_name; - } drsuapi_DsNameInfo1; - - typedef struct { - uint32 count; - [size_is(count)] drsuapi_DsNameInfo1 *array; - } drsuapi_DsNameCtr1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsNameCtr1 *ctr1; - } drsuapi_DsNameCtr; - - WERROR drsuapi_DsCrackNames( - [in] policy_handle *bind_handle, - [in, out] int32 level, - [in,switch_is(level)] drsuapi_DsNameRequest req, - [out,switch_is(level)] drsuapi_DsNameCtr ctr - ); - - /*****************/ - /* Function 0x0d */ - typedef [v1_enum] enum { - DRSUAPI_DS_SPN_OPERATION_ADD = 0, - DRSUAPI_DS_SPN_OPERATION_REPLACE= 1, - DRSUAPI_DS_SPN_OPERATION_DELETE = 2 - } drsuapi_DsSpnOperation; - - typedef struct { - drsuapi_DsSpnOperation operation; - uint32 unknown1; - [charset(UTF16),string] uint16 *object_dn; - [range(0,10000)] uint32 count; - [size_is(count)] drsuapi_DsNameString *spn_names; - } drsuapi_DsWriteAccountSpnRequest1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1; - } drsuapi_DsWriteAccountSpnRequest; - - typedef struct { - WERROR status; - } drsuapi_DsWriteAccountSpnResult1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsWriteAccountSpnResult1 res1; - } drsuapi_DsWriteAccountSpnResult; - - WERROR drsuapi_DsWriteAccountSpn( - [in] policy_handle *bind_handle, - [in,out] int32 level, - [in,switch_is(level)] drsuapi_DsWriteAccountSpnRequest req, - [out,switch_is(level)] drsuapi_DsWriteAccountSpnResult res - ); - - /*****************/ - /* Function 0x0e */ - typedef struct { - [charset(UTF16),string] uint16 *server_dn; - [charset(UTF16),string] uint16 *domain_dn; - boolean32 commit; - } drsuapi_DsRemoveDSServerRequest1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsRemoveDSServerRequest1 req1; - } drsuapi_DsRemoveDSServerRequest; - - typedef struct { - boolean32 last_dc_in_domain; - } drsuapi_DsRemoveDSServerResult1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsRemoveDSServerResult1 res1; - } drsuapi_DsRemoveDSServerResult; - - WERROR drsuapi_DsRemoveDSServer( - [in] policy_handle *bind_handle, - [in,out] int32 level, - [in,switch_is(level)] drsuapi_DsRemoveDSServerRequest req, - [out,switch_is(level)] drsuapi_DsRemoveDSServerResult res - ); - - /*****************/ - /* Function 0x0f */ - [todo] WERROR DRSUAPI_REMOVE_DS_DOMAIN(); - - /*****************/ - /* Function 0x10 */ - typedef struct { - [charset(UTF16),string] uint16 *domain_name; /* netbios or dns */ - int32 level; /* specifies the switch level for the request */ - } drsuapi_DsGetDCInfoRequest1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsGetDCInfoRequest1 req1; - } drsuapi_DsGetDCInfoRequest; - - typedef struct { - [charset(UTF16),string] uint16 *netbios_name; - [charset(UTF16),string] uint16 *dns_name; - [charset(UTF16),string] uint16 *site_name; - [charset(UTF16),string] uint16 *computer_dn; - [charset(UTF16),string] uint16 *server_dn; - uint32 is_pdc; - uint32 is_enabled; - } drsuapi_DsGetDCInfo1; - - typedef struct { - [range(0,10000)] uint32 count; - [size_is(count)] drsuapi_DsGetDCInfo1 *array; - } drsuapi_DsGetDCInfoCtr1; - - typedef struct { - [charset(UTF16),string] uint16 *netbios_name; - [charset(UTF16),string] uint16 *dns_name; - [charset(UTF16),string] uint16 *site_name; - [charset(UTF16),string] uint16 *site_dn; - [charset(UTF16),string] uint16 *computer_dn; - [charset(UTF16),string] uint16 *server_dn; - [charset(UTF16),string] uint16 *ntds_dn; - uint32 is_pdc; - uint32 is_enabled; - uint32 is_gc; - GUID site_guid; - GUID computer_guid; - GUID server_guid; - GUID ntds_guid; - } drsuapi_DsGetDCInfo2; - - typedef struct { - [range(0,10000)] uint32 count; - [size_is(count)] drsuapi_DsGetDCInfo2 *array; - } drsuapi_DsGetDCInfoCtr2; - - typedef struct { - [charset(UTF16),string] uint16 *netbios_name; - [charset(UTF16),string] uint16 *dns_name; - [charset(UTF16),string] uint16 *site_name; - [charset(UTF16),string] uint16 *site_dn; - [charset(UTF16),string] uint16 *computer_dn; - [charset(UTF16),string] uint16 *server_dn; - [charset(UTF16),string] uint16 *ntds_dn; - uint32 is_pdc; - uint32 is_enabled; - uint32 is_gc; - uint32 is_rodc; - GUID site_guid; - GUID computer_guid; - GUID server_guid; - GUID ntds_guid; - } drsuapi_DsGetDCInfo3; - - typedef struct { - [range(0,10000)] uint32 count; - [size_is(count)] drsuapi_DsGetDCInfo3 *array; - } drsuapi_DsGetDCInfoCtr3; - - /* - * this represents an active connection to the - * Directory System Agent (DSA) - * this can be via LDAP or DRSUAPI - */ - typedef struct { - [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address; - uint32 unknown2; - uint32 connection_time; /* in seconds */ - uint32 unknown4; - uint32 unknown5; - uint32 unknown6; - /* - * client_account can be the following: - * "W2K3\Administrator" - * "Administrator@W2K3" - * "cn=Administrator,cn=Users,DC=w2k3,DC=vmnet1,DC=vm,DC=base" - * "" - * or NULL - */ - [charset(UTF16),string] uint16 *client_account; - } drsuapi_DsGetDCConnection01; - - typedef struct { - [range(0,10000)] uint32 count; - [size_is(count)] drsuapi_DsGetDCConnection01 *array; - } drsuapi_DsGetDCConnectionCtr01; - - typedef [v1_enum] enum { - DRSUAPI_DC_INFO_CTR_1 = 1, - DRSUAPI_DC_INFO_CTR_2 = 2, - DRSUAPI_DC_INFO_CTR_3 = 3, - DRSUAPI_DC_CONNECTION_CTR_01 = -1 - } drsuapi_DsGetDCInfoCtrLevels; - - typedef [switch_type(int32)] union { - [case(DRSUAPI_DC_INFO_CTR_1)] drsuapi_DsGetDCInfoCtr1 ctr1; - [case(DRSUAPI_DC_INFO_CTR_2)] drsuapi_DsGetDCInfoCtr2 ctr2; - [case(DRSUAPI_DC_INFO_CTR_3)] drsuapi_DsGetDCInfoCtr3 ctr3; - [case(DRSUAPI_DC_CONNECTION_CTR_01)] drsuapi_DsGetDCConnectionCtr01 ctr01; - } drsuapi_DsGetDCInfoCtr; - - WERROR drsuapi_DsGetDomainControllerInfo( - [in] policy_handle *bind_handle, - [in] int32 level, - [in,switch_is(level)] drsuapi_DsGetDCInfoRequest req, - [out] int32 level_out, - [out,switch_is(level_out)] drsuapi_DsGetDCInfoCtr ctr - ); - - /*****************/ - /* Function 0x11 */ - typedef [public,noprint] struct { - drsuapi_DsReplicaObjectListItem *next_object; - drsuapi_DsReplicaObject object; - } drsuapi_DsReplicaObjectListItem; - - /* - * The DsAddEntry() call which creates a nTDSDSA object, - * also adds a servicePrincipalName in the following form - * to the computer account of the new domain controller - * referenced by the "serverReferenece" attribute. - * - * E3514235-4B06-11D1-AB04-00C04FC2DCD2/<new-ntdsdsa-object-guid-as-string>/<domain-dns-name> - * - * also note that the "serverReference" isn't added to the new object! - */ - const char *DRSUAPI_NTDSDSA_KRB5_SERVICE_GUID = "E3514235-4B06-11D1-AB04-00C04FC2DCD2"; - - /* - * please note the the current idl - * for DsAddEntry does only parse - * what I saw between 2 w2k3 boxes - * in my dssync experiments I got some other replies - * so all I want to say is that this is very incomplete yet... - * --metze - */ - typedef struct { - drsuapi_DsReplicaObjectListItem first_object; - } drsuapi_DsAddEntryRequest2; - - typedef [switch_type(int32)] union { - [case(2)] drsuapi_DsAddEntryRequest2 req2; - } drsuapi_DsAddEntryRequest; - - typedef struct { - uint32 unknown1; - WERROR status; - uint32 unknown2; - uint16 unknown3; - } drsuapi_DsAddEntryErrorInfoX; - - typedef struct { - [range(0,10485760)] uint32 size; - [size_is(size)] uint8 *data; - } drsuapi_DsAddEntryExtraErrorBuffer; - - typedef struct { - drsuapi_DsAddEntryErrorInfoX error; - drsuapi_DsAttributeId attid; - uint32 unknown2; - drsuapi_DsAddEntryExtraErrorBuffer buffer; - } drsuapi_DsAddEntryExtraError1; - - typedef /*[noprint]*/ struct { - drsuapi_DsAddEntryErrorListItem1 *next; - drsuapi_DsAddEntryExtraError1 error; - } drsuapi_DsAddEntryErrorListItem1; - - typedef struct { - drsuapi_DsReplicaObjectIdentifier *id; - WERROR status; - drsuapi_DsAddEntryErrorListItem1 first; - } drsuapi_DsAddEntryErrorInfo1; - - typedef [switch_type(uint32)] union { - [case(1)] drsuapi_DsAddEntryErrorInfo1 error1; -/* [case(2)] drsuapi_DsAddEntryErrorInfo2 error2; - [case(3)] drsuapi_DsAddEntryErrorInfo3 error3; -*/ [case(4)] drsuapi_DsAddEntryErrorInfoX errorX; - [case(5)] drsuapi_DsAddEntryErrorInfoX errorX; - [case(6)] drsuapi_DsAddEntryErrorInfoX errorX; - [case(7)] drsuapi_DsAddEntryErrorInfoX errorX; - } drsuapi_DsAddEntryErrorInfo; - - typedef struct { - WERROR status; - uint32 level; - [switch_is(level)] drsuapi_DsAddEntryErrorInfo *info; - } drsuapi_DsAddEntryError1; - - typedef [switch_type(uint32)] union { - [case(1)] drsuapi_DsAddEntryError1 info1; - } drsuapi_DsAddEntryError; - - typedef struct { - GUID guid; - dom_sid28 sid; - } drsuapi_DsReplicaObjectIdentifier2; - - typedef struct { - drsuapi_DsReplicaObjectIdentifier *id; - uint32 unknown1; - drsuapi_DsAddEntryErrorInfoX error; - [range(0,10000)] uint32 count; - [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects; - } drsuapi_DsAddEntryCtr2; - - typedef struct { - drsuapi_DsReplicaObjectIdentifier *id; - uint32 level; - [switch_is(level)] drsuapi_DsAddEntryError *error; - [range(0,10000)] uint32 count; - [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects; - } drsuapi_DsAddEntryCtr3; - - typedef [switch_type(int32)] union { - [case(2)] drsuapi_DsAddEntryCtr2 ctr2; - [case(3)] drsuapi_DsAddEntryCtr3 ctr3; - } drsuapi_DsAddEntryCtr; - - [public] WERROR drsuapi_DsAddEntry( - [in] policy_handle *bind_handle, - [in,out] int32 level, - [in,switch_is(level)] drsuapi_DsAddEntryRequest req, - [out,switch_is(level)] drsuapi_DsAddEntryCtr ctr - ); - - /*****************/ - /* Function 0x12 */ - [todo] WERROR DRSUAPI_EXECUTE_KCC(); - - /*****************/ - /* Function 0x13 */ - typedef [v1_enum] enum { - DRSUAPI_DS_REPLICA_GET_INFO = 1, - DRSUAPI_DS_REPLICA_GET_INFO2 = 2 - } drsuapi_DsReplicaGetInfoLevel; - - typedef [v1_enum] enum { - DRSUAPI_DS_REPLICA_INFO_NEIGHBORS = 0, - DRSUAPI_DS_REPLICA_INFO_CURSORS = 1, - DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA = 2, - DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES = 3, - DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES = 4, - DRSUAPI_DS_REPLICA_INFO_PENDING_OPS = 5, - DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA = 6, - DRSUAPI_DS_REPLICA_INFO_CURSORS2 = 7, - DRSUAPI_DS_REPLICA_INFO_CURSORS3 = 8, - DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2 = 9, - DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2 = 10, - DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02 = -2, - DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04 = -4, - DRSUAPI_DS_REPLICA_INFO_CURSORS05 = -5, - DRSUAPI_DS_REPLICA_INFO_06 = -6 - } drsuapi_DsReplicaInfoType; - - typedef struct { - drsuapi_DsReplicaInfoType info_type; - [charset(UTF16),string] uint16 *object_dn; - GUID guid1; - } drsuapi_DsReplicaGetInfoRequest1; - - typedef struct { - drsuapi_DsReplicaInfoType info_type; - [charset(UTF16),string] uint16 *object_dn; - GUID guid1; - uint32 unknown1; - [charset(UTF16),string] uint16 *string1; - [charset(UTF16),string] uint16 *string2; - uint32 unknown2; - } drsuapi_DsReplicaGetInfoRequest2; - - typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union { - [case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1; - [case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2; - } drsuapi_DsReplicaGetInfoRequest; - - typedef struct { - [charset(UTF16),string] uint16 *naming_context_dn; - [charset(UTF16),string] uint16 *source_dsa_obj_dn; - [charset(UTF16),string] uint16 *source_dsa_address; - [charset(UTF16),string] uint16 *transport_obj_dn; - drsuapi_DsReplicaNeighbourFlags replica_flags; - uint32 reserved; - GUID naming_context_obj_guid; - GUID source_dsa_obj_guid; - GUID source_dsa_invocation_id; - GUID transport_obj_guid; - hyper tmp_highest_usn; - hyper highest_usn; - NTTIME last_success; - NTTIME last_attempt; - WERROR result_last_attempt; - uint32 consecutive_sync_failures; - } drsuapi_DsReplicaNeighbour; - - typedef struct { - uint32 count; - uint32 reserved; - [size_is(count)] drsuapi_DsReplicaNeighbour array[]; - } drsuapi_DsReplicaNeighbourCtr; - - typedef struct { - uint32 count; - uint32 reserved; - [size_is(count)] drsuapi_DsReplicaCursor array[]; - } drsuapi_DsReplicaCursorCtr; - - typedef struct { - [charset(UTF16),string] uint16 *attribute_name; - uint32 version; - NTTIME originating_change_time; - GUID originating_invocation_id; - hyper originating_usn; - hyper local_usn; - } drsuapi_DsReplicaObjMetaData; - - typedef struct { - uint32 count; - uint32 reserved; - [size_is(count)] drsuapi_DsReplicaObjMetaData array[]; - } drsuapi_DsReplicaObjMetaDataCtr; - - typedef struct { - [charset(UTF16),string] uint16 *dsa_obj_dn; - GUID dsa_obj_guid; - NTTIME first_failure; - uint32 num_failures; - WERROR last_result; - } drsuapi_DsReplicaKccDsaFailure; - - typedef struct { - uint32 count; - uint32 reserved; - [size_is(count)] drsuapi_DsReplicaKccDsaFailure array[]; - } drsuapi_DsReplicaKccDsaFailuresCtr; - - typedef enum { - DRSUAPI_DS_REPLICA_OP_TYPE_SYNC = 0, - DRSUAPI_DS_REPLICA_OP_TYPE_ADD = 1, - DRSUAPI_DS_REPLICA_OP_TYPE_DELETE = 2, - DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY = 3, - DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS = 4 - } drsuapi_DsReplicaOpType; - - typedef [switch_type(drsuapi_DsReplicaOpType)] union { - [case(DRSUAPI_DS_REPLICA_OP_TYPE_SYNC)] drsuapi_DsReplicaSyncOptions sync; - [case(DRSUAPI_DS_REPLICA_OP_TYPE_ADD)] drsuapi_DsReplicaAddOptions add; - [case(DRSUAPI_DS_REPLICA_OP_TYPE_DELETE)] drsuapi_DsReplicaDeleteOptions op_delete; - [case(DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY)] drsuapi_DsReplicaModifyOptions modify; - [case(DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS)] drsuapi_DsReplicaUpdateRefsOptions update_refs; - [default] uint32 unknown; - } drsuapi_DsRplicaOpOptions; - - typedef struct { - NTTIME operation_start; - uint32 serial_num; /* unique till reboot */ - uint32 priority; - drsuapi_DsReplicaOpType operation_type; - [switch_is(operation_type)] drsuapi_DsRplicaOpOptions options; - [charset(UTF16),string] uint16 *nc_dn; - [charset(UTF16),string] uint16 *remote_dsa_obj_dn; - [charset(UTF16),string] uint16 *remote_dsa_address; - GUID nc_obj_guid; - GUID remote_dsa_obj_guid; - } drsuapi_DsReplicaOp; - - typedef struct { - NTTIME time; - uint32 count; - [size_is(count)] drsuapi_DsReplicaOp array[]; - } drsuapi_DsReplicaOpCtr; - - typedef struct { - [charset(UTF16),string] uint16 *attribute_name; - [charset(UTF16),string] uint16 *object_dn; - [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary; - DATA_BLOB *binary; - NTTIME deleted; - NTTIME created; - uint32 version; - NTTIME originating_change_time; - GUID originating_invocation_id; - hyper originating_usn; - hyper local_usn; - } drsuapi_DsReplicaAttrValMetaData; - - typedef struct { - uint32 count; - int32 enumeration_context; - [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[]; - } drsuapi_DsReplicaAttrValMetaDataCtr; - - typedef struct { - uint32 count; - int32 enumeration_context; - [size_is(count)] drsuapi_DsReplicaCursor2 array[]; - } drsuapi_DsReplicaCursor2Ctr; - - typedef struct { - GUID source_dsa_invocation_id; - hyper highest_usn; - NTTIME last_sync_success; - [charset(UTF16),string] uint16 *source_dsa_obj_dn; - } drsuapi_DsReplicaCursor3; - - typedef struct { - uint32 count; - int32 enumeration_context; - [size_is(count)] drsuapi_DsReplicaCursor3 array[]; - } drsuapi_DsReplicaCursor3Ctr; - - typedef struct { - [charset(UTF16),string] uint16 *attribute_name; - uint32 version; - NTTIME originating_change_time; - GUID originating_invocation_id; - hyper originating_usn; - hyper local_usn; - [charset(UTF16),string] uint16 *originating_dsa_dn; - } drsuapi_DsReplicaObjMetaData2; - - typedef struct { - uint32 count; - int32 enumeration_context; - [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[]; - } drsuapi_DsReplicaObjMetaData2Ctr; - - typedef struct { - [charset(UTF16),string] uint16 *attribute_name; - [charset(UTF16),string] uint16 *object_dn; - [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary; - DATA_BLOB *binary; - NTTIME deleted; - NTTIME created; - uint32 version; - NTTIME originating_change_time; - GUID originating_invocation_id; - hyper originating_usn; - hyper local_usn; - [charset(UTF16),string] uint16 *originating_dsa_dn; - } drsuapi_DsReplicaAttrValMetaData2; - - typedef struct { - uint32 count; - int32 enumeration_context; - [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[]; - } drsuapi_DsReplicaAttrValMetaData2Ctr; - - typedef struct { - hyper u1; /* session number? */ - uint32 u2; - uint32 u3; - GUID bind_guid; - NTTIME_1sec bind_time; - [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address; - uint32 u5; /* this is the same value the client used as pid in the DsBindInfoX struct */ - } drsuapi_DsReplicaConnection04; - - typedef struct { - [range(0,10000)] uint32 count; - uint32 reserved; - [size_is(count)] drsuapi_DsReplicaConnection04 array[]; - } drsuapi_DsReplicaConnection04Ctr; - - typedef struct { - [charset(UTF16),string] uint16 *str1; - uint32 u1; - uint32 u2; - uint32 u3; - uint32 u4; - uint32 u5; - hyper u6; - uint32 u7; - } drsuapi_DsReplica06; - - typedef struct { - [range(0,256)] uint32 count; - uint32 reserved; - [size_is(count)] drsuapi_DsReplica06 array[]; - } drsuapi_DsReplica06Ctr; - - typedef [switch_type(drsuapi_DsReplicaInfoType)] union { - [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours; - [case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCursorCtr *cursors; - [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata; - [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures; - [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures; - [case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops; - [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata; - [case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCursor2Ctr *cursors2; - [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCursor3Ctr *cursors3; - [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2; - [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2; - [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02; - [case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04; - [case(DRSUAPI_DS_REPLICA_INFO_CURSORS05)] drsuapi_DsReplicaCursorCtrEx *cursors05; - [case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06; - } drsuapi_DsReplicaInfo; - - WERROR drsuapi_DsReplicaGetInfo( - [in] policy_handle *bind_handle, - [in] drsuapi_DsReplicaGetInfoLevel level, - [in,ref,switch_is(level)] drsuapi_DsReplicaGetInfoRequest *req, - [out,ref] drsuapi_DsReplicaInfoType *info_type, - [out,ref,switch_is(*info_type)] drsuapi_DsReplicaInfo *info - ); - - /*****************/ - /* Function 0x14 */ - [todo] WERROR DRSUAPI_ADD_SID_HISTORY(); - - /*****************/ - /* Function 0x15 */ - - typedef struct { - [range(0,10000)] uint32 num_entries; - [size_is(num_entries)] drsuapi_DsGetMembershipsCtr1 **ctrl_array; - } drsuapi_DsGetMemberships2Ctr1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1; - } drsuapi_DsGetMemberships2Ctr; - - typedef struct { - [range(1,10000)] uint32 num_req; - [size_is(num_req)] drsuapi_DsGetMembershipsRequest1 **req_array; - } drsuapi_DsGetMemberships2Request1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_DsGetMemberships2Request1 req1; - } drsuapi_DsGetMemberships2Request; - - WERROR drsuapi_DsGetMemberships2( - [in] policy_handle *bind_handle, - [in] int32 level, - [in,ref] [switch_is(level)] drsuapi_DsGetMemberships2Request *req, - [out,ref] int32 *level_out, - [out,ref] [switch_is(*level_out)] drsuapi_DsGetMemberships2Ctr *ctr - ); - - /*****************/ - /* Function 0x16 */ - [todo] WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS(); - - /*****************/ - /* Function 0x17 */ - [todo] WERROR DRSUAPI_GET_OBJECT_EXISTENCE(); - - /*****************/ - /* Function 0x18 */ - typedef struct { - WERROR error_code; - uint32 site_cost; - } drsuapi_DsSiteCostInfo; - - typedef struct { - [range(0,10000)] uint32 num_info; - [size_is(num_info)] drsuapi_DsSiteCostInfo *info; - uint32 unknown; - } drsuapi_QuerySitesByCostCtr1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_QuerySitesByCostCtr1 ctr1; - } drsuapi_QuerySitesByCostCtr; - - typedef struct { - [charset(UTF16),string] uint16 *site_from; - [range(1,10000)] uint32 num_req; - [size_is(num_req)] [charset(UTF16),string] uint16 **site_to; - uint32 flags; - } drsuapi_QuerySitesByCostRequest1; - - typedef [switch_type(int32)] union { - [case(1)] drsuapi_QuerySitesByCostRequest1 req1; - } drsuapi_QuerySitesByCostRequest; - - WERROR drsuapi_QuerySitesByCost( - [in] policy_handle *bind_handle, - [in] int32 level, - [in,ref] [switch_is(level)] drsuapi_QuerySitesByCostRequest *req, - [out,ref] int32 *level_out, - [out,ref] [switch_is(*level_out)] drsuapi_QuerySitesByCostCtr *ctr - ); -} diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c index d555ba27bf..a84f24a3e8 100644 --- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c +++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c @@ -337,12 +337,14 @@ WERROR dcesrv_drsuapi_DsCrackNames(struct dcesrv_call_state *dce_call, TALLOC_CT struct drsuapi_bind_state *b_state; struct dcesrv_handle *h; - r->out.level = r->in.level; - ZERO_STRUCT(r->out.ctr); + *r->out.level_out = r->in.level; DCESRV_PULL_HANDLE_WERR(h, r->in.bind_handle, DRSUAPI_BIND_HANDLE); b_state = h->data; + r->out.ctr = talloc_zero(mem_ctx, union drsuapi_DsNameCtr); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr); + switch (r->in.level) { case 1: { struct drsuapi_DsNameCtr1 *ctr1; @@ -353,16 +355,16 @@ WERROR dcesrv_drsuapi_DsCrackNames(struct dcesrv_call_state *dce_call, TALLOC_CT ctr1 = talloc(mem_ctx, struct drsuapi_DsNameCtr1); W_ERROR_HAVE_NO_MEMORY(ctr1); - count = r->in.req.req1.count; + count = r->in.req->req1.count; names = talloc_array(mem_ctx, struct drsuapi_DsNameInfo1, count); W_ERROR_HAVE_NO_MEMORY(names); for (i=0; i < count; i++) { status = DsCrackNameOneName(b_state->sam_ctx, mem_ctx, - r->in.req.req1.format_flags, - r->in.req.req1.format_offered, - r->in.req.req1.format_desired, - r->in.req.req1.names[i].str, + r->in.req->req1.format_flags, + r->in.req->req1.format_offered, + r->in.req->req1.format_desired, + r->in.req->req1.names[i].str, &names[i]); if (!W_ERROR_IS_OK(status)) { return status; @@ -371,7 +373,7 @@ WERROR dcesrv_drsuapi_DsCrackNames(struct dcesrv_call_state *dce_call, TALLOC_CT ctr1->count = count; ctr1->array = names; - r->out.ctr.ctr1 = ctr1; + r->out.ctr->ctr1 = ctr1; return WERR_OK; } @@ -389,17 +391,20 @@ static WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_cal struct drsuapi_bind_state *b_state; struct dcesrv_handle *h; - r->out.level = r->in.level; + *r->out.level_out = r->in.level; DCESRV_PULL_HANDLE_WERR(h, r->in.bind_handle, DRSUAPI_BIND_HANDLE); b_state = h->data; + r->out.res = talloc(mem_ctx, union drsuapi_DsWriteAccountSpnResult); + W_ERROR_HAVE_NO_MEMORY(r->out.res); + switch (r->in.level) { case 1: { struct drsuapi_DsWriteAccountSpnRequest1 *req; struct ldb_message *msg; int count, i, ret; - req = &r->in.req.req1; + req = &r->in.req->req1; count = req->count; msg = ldb_msg_new(mem_ctx); @@ -409,7 +414,7 @@ static WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_cal msg->dn = ldb_dn_new(msg, b_state->sam_ctx, req->object_dn); if ( ! ldb_dn_validate(msg->dn)) { - r->out.res.res1.status = WERR_OK; + r->out.res->res1.status = WERR_OK; return WERR_OK; } @@ -440,9 +445,9 @@ static WERROR dcesrv_drsuapi_DsWriteAccountSpn(struct dcesrv_call_state *dce_cal DEBUG(0,("Failed to modify SPNs on %s: %s\n", ldb_dn_get_linearized(msg->dn), ldb_errstring(b_state->sam_ctx))); - r->out.res.res1.status = WERR_ACCESS_DENIED; + r->out.res->res1.status = WERR_ACCESS_DENIED; } else { - r->out.res.res1.status = WERR_OK; + r->out.res->res1.status = WERR_OK; } return WERR_OK; @@ -519,14 +524,16 @@ static WERROR dcesrv_drsuapi_DsGetDomainControllerInfo_1(struct drsuapi_bind_sta int ret, i; - r->out.level_out = r->in.req.req1.level; + *r->out.level_out = r->in.req->req1.level; + r->out.ctr = talloc(mem_ctx, union drsuapi_DsGetDCInfoCtr); + W_ERROR_HAVE_NO_MEMORY(r->out.ctr); sites_dn = samdb_sites_dn(b_state->sam_ctx, mem_ctx); if (!sites_dn) { return WERR_DS_OBJ_NOT_FOUND; } - switch (r->out.level_out) { + switch (*r->out.level_out) { case -1: /* this level is not like the others */ return WERR_UNKNOWN_LEVEL; @@ -549,9 +556,9 @@ static WERROR dcesrv_drsuapi_DsGetDomainControllerInfo_1(struct drsuapi_bind_sta return WERR_GENERAL_FAILURE; } - switch (r->out.level_out) { + switch (*r->out.level_out) { case 1: - ctr1 = &r->out.ctr.ctr1; + ctr1 = &r->out.ctr->ctr1; ctr1->count = res->count; ctr1->array = talloc_zero_array(mem_ctx, struct drsuapi_DsGetDCInfo1, @@ -614,7 +621,7 @@ static WERROR dcesrv_drsuapi_DsGetDomainControllerInfo_1(struct drsuapi_bind_sta } break; case 2: - ctr2 = &r->out.ctr.ctr2; + ctr2 = &r->out.ctr->ctr2; ctr2->count = res->count; ctr2->array = talloc_zero_array(mem_ctx, struct drsuapi_DsGetDCInfo2, diff --git a/source4/selftest/config.mk b/source4/selftest/config.mk index 58db087105..74c177d8e8 100644 --- a/source4/selftest/config.mk +++ b/source4/selftest/config.mk @@ -2,12 +2,12 @@ TEST_FORMAT = plain SELFTEST = $(LD_LIBPATH_OVERRIDE) $(PERL) $(selftestdir)/selftest.pl --prefix=${selftest_prefix} \ --builddir=$(builddir) --srcdir=$(srcdir) \ - --expected-failures=$(srcdir)/samba4-knownfail \ + --expected-failures=$(srcdir)/selftest/knownfail \ --format=$(TEST_FORMAT) \ - --exclude=$(srcdir)/samba4-skip --testlist="./selftest/samba4_tests.sh|" \ + --exclude=$(srcdir)/selftest/skip --testlist="./selftest/tests.sh|" \ $(TEST_OPTIONS) -SELFTEST_NOSLOW_OPTS = --exclude=$(srcdir)/samba4-slow +SELFTEST_NOSLOW_OPTS = --exclude=$(srcdir)/selftest/slow SELFTEST_QUICK_OPTS = $(SELFTEST_NOSLOW_OPTS) --quick slowtest:: everything diff --git a/source4/samba4-knownfail b/source4/selftest/knownfail index f99db4fb1b..f99db4fb1b 100644 --- a/source4/samba4-knownfail +++ b/source4/selftest/knownfail diff --git a/source4/samba4-quick b/source4/selftest/quick index 7bea619f18..7bea619f18 100644 --- a/source4/samba4-quick +++ b/source4/selftest/quick diff --git a/source4/samba4-skip b/source4/selftest/skip index e3e2d2d525..e3e2d2d525 100644 --- a/source4/samba4-skip +++ b/source4/selftest/skip diff --git a/source4/samba4-slow b/source4/selftest/slow index d414368de8..d414368de8 100644 --- a/source4/samba4-slow +++ b/source4/selftest/slow diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/tests.sh index 9fc71a104f..fa799f51ff 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/tests.sh @@ -23,8 +23,6 @@ then PERL=perl fi -incdir=`dirname $0` - plantest() { name=$1 env=$2 @@ -56,9 +54,9 @@ plansmbtorturetest() { plantest "$modname" "$env" $cmdline } -$incdir/../bin/smbtorture -V +bin/smbtorture -V -samba4srcdir=$incdir/.. +samba4srcdir=. samba4bindir=$samba4srcdir/bin smb4torture="$samba4bindir/smbtorture $TORTURE_OPTIONS" @@ -263,7 +261,7 @@ fi # the API. These mainly test that the various command-line options of commands # work correctly. -bbdir=$incdir/../../testprogs/blackbox +bbdir=../testprogs/blackbox plantest "blackbox.ndrdump" none $samba4srcdir/librpc/tests/test_ndrdump.sh plantest "blackbox.net" dc $samba4srcdir/utils/tests/test_net.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c index 739a048d29..1e8b339997 100644 --- a/source4/torture/auth/ntlmssp.c +++ b/source4/torture/auth/ntlmssp.c @@ -48,7 +48,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; - gensec_ntlmssp_state->session_key = strhex_to_data_blob("0102030405060708090a0b0c0d0e0f00"); + gensec_ntlmssp_state->session_key = strhex_to_data_blob(tctx, "0102030405060708090a0b0c0d0e0f00"); dump_data_pw("NTLMSSP session key: \n", gensec_ntlmssp_state->session_key.data, gensec_ntlmssp_state->session_key.length); @@ -59,11 +59,11 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) ntlmssp_sign_init(gensec_ntlmssp_state), "Failed to sign_init"); - data = strhex_to_data_blob("6a43494653"); + data = strhex_to_data_blob(tctx, "6a43494653"); gensec_ntlmssp_sign_packet(gensec_security, gensec_security, data.data, data.length, data.data, data.length, &sig); - expected_sig = strhex_to_data_blob("01000000e37f97f2544f4d7e00000000"); + expected_sig = strhex_to_data_blob(tctx, "01000000e37f97f2544f4d7e00000000"); dump_data_pw("NTLMSSP calc sig: ", sig.data, sig.length); dump_data_pw("NTLMSSP expected sig: ", expected_sig.data, expected_sig.length); @@ -103,7 +103,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; - gensec_ntlmssp_state->session_key = strhex_to_data_blob("0102030405e538b0"); + gensec_ntlmssp_state->session_key = strhex_to_data_blob(tctx, "0102030405e538b0"); dump_data_pw("NTLMSSP session key: \n", gensec_ntlmssp_state->session_key.data, gensec_ntlmssp_state->session_key.length); @@ -114,11 +114,11 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) ntlmssp_sign_init(gensec_ntlmssp_state), "Failed to sign_init"); - data = strhex_to_data_blob("6a43494653"); + data = strhex_to_data_blob(tctx, "6a43494653"); gensec_ntlmssp_sign_packet(gensec_security, gensec_security, data.data, data.length, data.data, data.length, &sig); - expected_sig = strhex_to_data_blob("0100000078010900397420fe0e5a0f89"); + expected_sig = strhex_to_data_blob(tctx, "0100000078010900397420fe0e5a0f89"); dump_data_pw("NTLMSSP calc sig: ", sig.data, sig.length); dump_data_pw("NTLMSSP expected sig: ", expected_sig.data, expected_sig.length); diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c index 8d4d43b2a0..70bd070009 100644 --- a/source4/torture/ndr/ndr.c +++ b/source4/torture/ndr/ndr.c @@ -96,7 +96,7 @@ static bool test_check_string_terminator(struct torture_context *tctx) TALLOC_CTX *mem_ctx = tctx; /* Simple test */ - blob = strhex_to_data_blob("0000"); + blob = strhex_to_data_blob(tctx, "0000"); ndr = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(tctx->lp_ctx)); @@ -115,7 +115,7 @@ static bool test_check_string_terminator(struct torture_context *tctx) talloc_free(ndr); - blob = strhex_to_data_blob("11220000"); + blob = strhex_to_data_blob(tctx, "11220000"); ndr = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(tctx->lp_ctx)); torture_assert_ndr_success(tctx, diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c index 0b4ce02a00..da6ce2b5f5 100644 --- a/source4/torture/rpc/drsuapi.c +++ b/source4/torture/rpc/drsuapi.c @@ -62,6 +62,8 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture { NTSTATUS status; struct drsuapi_DsGetDomainControllerInfo r; + union drsuapi_DsGetDCInfoCtr ctr; + int32_t level_out = 0; bool found = false; int i, j, k; @@ -91,16 +93,21 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture for (i=0; i < ARRAY_SIZE(levels); i++) { for (j=0; j < ARRAY_SIZE(names); j++) { + union drsuapi_DsGetDCInfoRequest req; level = levels[i]; r.in.bind_handle = &priv->bind_handle; r.in.level = 1; + r.in.req = &req; - r.in.req.req1.domain_name = names[j].name; - r.in.req.req1.level = level; + r.in.req->req1.domain_name = names[j].name; + r.in.req->req1.level = level; + + r.out.ctr = &ctr; + r.out.level_out = &level_out; torture_comment(torture, "testing DsGetDomainControllerInfo level %d on domainname '%s'\n", - r.in.req.req1.level, r.in.req.req1.domain_name); + r.in.req->req1.level, r.in.req->req1.domain_name); status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &r); torture_assert_ntstatus_ok(torture, status, @@ -115,13 +122,13 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture } torture_assert_int_equal(torture, - r.in.req.req1.level, r.out.level_out, + r.in.req->req1.level, *r.out.level_out, "dcerpc_drsuapi_DsGetDomainControllerInfo level"); switch (level) { case 1: - for (k=0; k < r.out.ctr.ctr1.count; k++) { - if (strcasecmp_m(r.out.ctr.ctr1.array[k].netbios_name, + for (k=0; k < r.out.ctr->ctr1.count; k++) { + if (strcasecmp_m(r.out.ctr->ctr1.array[k].netbios_name, torture_join_netbios_name(priv->join)) == 0) { found = true; break; @@ -129,11 +136,11 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture } break; case 2: - for (k=0; k < r.out.ctr.ctr2.count; k++) { - if (strcasecmp_m(r.out.ctr.ctr2.array[k].netbios_name, + for (k=0; k < r.out.ctr->ctr2.count; k++) { + if (strcasecmp_m(r.out.ctr->ctr2.array[k].netbios_name, torture_join_netbios_name(priv->join)) == 0) { found = true; - priv->dcinfo = r.out.ctr.ctr2.array[k]; + priv->dcinfo = r.out.ctr->ctr2.array[k]; break; } } @@ -146,12 +153,15 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture r.in.bind_handle = &priv->bind_handle; r.in.level = 1; - - r.in.req.req1.domain_name = "__UNKNOWN_DOMAIN__"; /* This is clearly ignored for this level */ - r.in.req.req1.level = -1; + + r.out.ctr = &ctr; + r.out.level_out = &level_out; + + r.in.req->req1.domain_name = "__UNKNOWN_DOMAIN__"; /* This is clearly ignored for this level */ + r.in.req->req1.level = -1; printf("testing DsGetDomainControllerInfo level %d on domainname '%s'\n", - r.in.req.req1.level, r.in.req.req1.domain_name); + r.in.req->req1.level, r.in.req->req1.domain_name); status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &r); @@ -164,8 +174,8 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture const char *dc_account = talloc_asprintf(torture, "%s\\%s$", torture_join_dom_netbios_name(priv->join), priv->dcinfo.netbios_name); - for (k=0; k < r.out.ctr.ctr01.count; k++) { - if (strcasecmp_m(r.out.ctr.ctr01.array[k].client_account, + for (k=0; k < r.out.ctr->ctr01.count; k++) { + if (strcasecmp_m(r.out.ctr->ctr01.array[k].client_account, dc_account)) { found = true; break; @@ -184,22 +194,29 @@ static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct drsuapi_DsWriteAccountSpn r; + union drsuapi_DsWriteAccountSpnRequest req; struct drsuapi_DsNameString names[2]; + union drsuapi_DsWriteAccountSpnResult res; + int32_t level_out; bool ret = true; r.in.bind_handle = &priv->bind_handle; r.in.level = 1; + r.in.req = &req; printf("testing DsWriteAccountSpn\n"); - r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_ADD; - r.in.req.req1.unknown1 = 0; - r.in.req.req1.object_dn = priv->dcinfo.computer_dn; - r.in.req.req1.count = 2; - r.in.req.req1.spn_names = names; + r.in.req->req1.operation = DRSUAPI_DS_SPN_OPERATION_ADD; + r.in.req->req1.unknown1 = 0; + r.in.req->req1.object_dn = priv->dcinfo.computer_dn; + r.in.req->req1.count = 2; + r.in.req->req1.spn_names = names; names[0].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.netbios_name); names[1].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.dns_name); + r.out.res = &res; + r.out.level_out = &level_out; + status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { const char *errstr = nt_errstr(status); @@ -213,8 +230,8 @@ static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = false; } - r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE; - r.in.req.req1.unknown1 = 0; + r.in.req->req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE; + r.in.req->req1.unknown1 = 0; status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -508,6 +525,8 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t bool ret = true; int i; struct drsuapi_DsGetNCChanges r; + union drsuapi_DsGetNCChangesRequest req; + union drsuapi_DsGetNCChangesCtr ctr; struct drsuapi_DsReplicaObjectIdentifier nc; struct GUID null_guid; struct dom_sid null_sid; @@ -536,30 +555,32 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t array[i].level); r.in.bind_handle = &priv->bind_handle; - r.in.level = &array[i].level; - r.out.level = &level_out; + r.in.level = array[i].level; + r.out.level_out = &level_out; + r.out.ctr = &ctr; - switch (*r.in.level) { + switch (r.in.level) { case 5: nc.guid = null_guid; nc.sid = null_sid; nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:""; - r.in.req.req5.destination_dsa_guid = GUID_random(); - r.in.req.req5.source_dsa_invocation_id = null_guid; - r.in.req.req5.naming_context = &nc; - r.in.req.req5.highwatermark.tmp_highest_usn = 0; - r.in.req.req5.highwatermark.reserved_usn = 0; - r.in.req.req5.highwatermark.highest_usn = 0; - r.in.req.req5.uptodateness_vector = NULL; - r.in.req.req5.replica_flags = 0; + r.in.req = &req; + r.in.req->req5.destination_dsa_guid = GUID_random(); + r.in.req->req5.source_dsa_invocation_id = null_guid; + r.in.req->req5.naming_context = &nc; + r.in.req->req5.highwatermark.tmp_highest_usn = 0; + r.in.req->req5.highwatermark.reserved_usn = 0; + r.in.req->req5.highwatermark.highest_usn = 0; + r.in.req->req5.uptodateness_vector = NULL; + r.in.req->req5.replica_flags = 0; if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi","compression", false)) { - r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; + r.in.req->req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } - r.in.req.req5.max_object_count = 0; - r.in.req.req5.max_ndr_size = 0; - r.in.req.req5.extended_op = DRSUAPI_EXOP_NONE; - r.in.req.req5.fsmo_info = 0; + r.in.req->req5.max_object_count = 0; + r.in.req->req5.max_ndr_size = 0; + r.in.req->req5.extended_op = DRSUAPI_EXOP_NONE; + r.in.req->req5.fsmo_info = 0; break; case 8: @@ -567,33 +588,34 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t nc.sid = null_sid; nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:""; - r.in.req.req8.destination_dsa_guid = GUID_random(); - r.in.req.req8.source_dsa_invocation_id = null_guid; - r.in.req.req8.naming_context = &nc; - r.in.req.req8.highwatermark.tmp_highest_usn = 0; - r.in.req.req8.highwatermark.reserved_usn = 0; - r.in.req.req8.highwatermark.highest_usn = 0; - r.in.req.req8.uptodateness_vector = NULL; - r.in.req.req8.replica_flags = 0; + r.in.req = &req; + r.in.req->req8.destination_dsa_guid = GUID_random(); + r.in.req->req8.source_dsa_invocation_id = null_guid; + r.in.req->req8.naming_context = &nc; + r.in.req->req8.highwatermark.tmp_highest_usn = 0; + r.in.req->req8.highwatermark.reserved_usn = 0; + r.in.req->req8.highwatermark.highest_usn = 0; + r.in.req->req8.uptodateness_vector = NULL; + r.in.req->req8.replica_flags = 0; if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi", "compression", false)) { - r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; + r.in.req->req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi", "neighbour_writeable", true)) { - r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE; + r.in.req->req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE; } - r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP + r.in.req->req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS | DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS | DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED ; - r.in.req.req8.max_object_count = 402; - r.in.req.req8.max_ndr_size = 402116; - r.in.req.req8.extended_op = DRSUAPI_EXOP_NONE; - r.in.req.req8.fsmo_info = 0; - r.in.req.req8.partial_attribute_set = NULL; - r.in.req.req8.partial_attribute_set_ex = NULL; - r.in.req.req8.mapping_ctr.num_mappings = 0; - r.in.req.req8.mapping_ctr.mappings = NULL; + r.in.req->req8.max_object_count = 402; + r.in.req->req8.max_ndr_size = 402116; + r.in.req->req8.extended_op = DRSUAPI_EXOP_NONE; + r.in.req->req8.fsmo_info = 0; + r.in.req->req8.partial_attribute_set = NULL; + r.in.req->req8.partial_attribute_set_ex = NULL; + r.in.req->req8.mapping_ctr.num_mappings = 0; + r.in.req->req8.mapping_ctr.mappings = NULL; break; } diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c index a9a614953d..dabd4125c7 100644 --- a/source4/torture/rpc/drsuapi_cracknames.c +++ b/source4/torture/rpc/drsuapi_cracknames.c @@ -38,6 +38,10 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; bool ret = true; struct drsuapi_DsCrackNames r; + union drsuapi_DsNameRequest req; + int32_t level_out; + union drsuapi_DsNameCtr ctr; + enum drsuapi_DsNameFormat formats[] = { DRSUAPI_DS_NAME_FORMAT_UNKNOWN, DRSUAPI_DS_NAME_FORMAT_FQDN_1779, @@ -60,17 +64,21 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ZERO_STRUCT(r); r.in.bind_handle = &priv->bind_handle; r.in.level = 1; - r.in.req.req1.codepage = 1252; /* german */ - r.in.req.req1.language = 0x00000407; /* german */ - r.in.req.req1.count = 1; - r.in.req.req1.names = names; - r.in.req.req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; + r.in.req = &req; + r.in.req->req1.codepage = 1252; /* german */ + r.in.req->req1.language = 0x00000407; /* german */ + r.in.req->req1.count = 1; + r.in.req->req1.names = names; + r.in.req->req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; + + r.out.level_out = &level_out; + r.out.ctr = &ctr; n_matrix[0][0] = dn; for (i = 0; i < ARRAY_SIZE(formats); i++) { - r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; - r.in.req.req1.format_desired = formats[i]; + r.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; + r.in.req->req1.format_desired = formats[i]; names[0].str = dn; status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -79,13 +87,13 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("testing DsCrackNames (matrix prep) with name '%s' from format: %d desired format:%d ", - names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired); + names[0].str, r.in.req->req1.format_offered, r.in.req->req1.format_desired); printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("testing DsCrackNames (matrix prep) with name '%s' from format: %d desired format:%d ", - names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired); + names[0].str, r.in.req->req1.format_offered, r.in.req->req1.format_desired); printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); ret = false; @@ -96,33 +104,33 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } switch (formats[i]) { case DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL: - if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE) { + if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE) { printf(__location__ ": Unexpected error (%d): This name lookup should fail\n", - r.out.ctr.ctr1->array[0].status); + r.out.ctr->ctr1->array[0].status); return false; } printf ("(expected) error\n"); break; case DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL: - if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NO_MAPPING) { + if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NO_MAPPING) { printf(__location__ ": Unexpected error (%d): This name lookup should fail\n", - r.out.ctr.ctr1->array[0].status); + r.out.ctr->ctr1->array[0].status); return false; } printf ("(expected) error\n"); break; case DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN: case DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY: - if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR) { + if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR) { printf(__location__ ": Unexpected error (%d): This name lookup should fail\n", - r.out.ctr.ctr1->array[0].status); + r.out.ctr->ctr1->array[0].status); return false; } printf ("(expected) error\n"); break; default: - if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { - printf("Error: %d\n", r.out.ctr.ctr1->array[0].status); + if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + printf("Error: %d\n", r.out.ctr->ctr1->array[0].status); return false; } } @@ -139,15 +147,15 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, n_from[i] = NULL; break; default: - n_from[i] = r.out.ctr.ctr1->array[0].result_name; + n_from[i] = r.out.ctr->ctr1->array[0].result_name; printf("%s\n", n_from[i]); } } for (i = 0; i < ARRAY_SIZE(formats); i++) { for (j = 0; j < ARRAY_SIZE(formats); j++) { - r.in.req.req1.format_offered = formats[i]; - r.in.req.req1.format_desired = formats[j]; + r.in.req->req1.format_offered = formats[i]; + r.in.req->req1.format_desired = formats[j]; if (!n_from[i]) { n_matrix[i][j] = NULL; continue; @@ -160,11 +168,11 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("testing DsCrackNames (matrix) with name '%s' from format: %d desired format:%d failed - %s", - names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired, errstr); + names[0].str, r.in.req->req1.format_offered, r.in.req->req1.format_desired, errstr); ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("testing DsCrackNames (matrix) with name '%s' from format: %d desired format:%d failed - %s", - names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired, + names[0].str, r.in.req->req1.format_offered, r.in.req->req1.format_desired, win_errstr(r.out.result)); ret = false; } @@ -172,8 +180,8 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!ret) { return ret; } - if (r.out.ctr.ctr1->array[0].status == DRSUAPI_DS_NAME_STATUS_OK) { - n_matrix[i][j] = r.out.ctr.ctr1->array[0].result_name; + if (r.out.ctr->ctr1->array[0].status == DRSUAPI_DS_NAME_STATUS_OK) { + n_matrix[i][j] = r.out.ctr->ctr1->array[0].result_name; } else { n_matrix[i][j] = NULL; } @@ -211,6 +219,9 @@ bool test_DsCrackNames(struct torture_context *tctx, { NTSTATUS status; struct drsuapi_DsCrackNames r; + union drsuapi_DsNameRequest req; + int32_t level_out; + union drsuapi_DsNameCtr ctr; struct drsuapi_DsNameString names[1]; bool ret = true; const char *dns_domain; @@ -233,21 +244,25 @@ bool test_DsCrackNames(struct torture_context *tctx, ZERO_STRUCT(r); r.in.bind_handle = &priv->bind_handle; r.in.level = 1; - r.in.req.req1.codepage = 1252; /* german */ - r.in.req.req1.language = 0x00000407; /* german */ - r.in.req.req1.count = 1; - r.in.req.req1.names = names; - r.in.req.req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; + r.in.req = &req; + r.in.req->req1.codepage = 1252; /* german */ + r.in.req->req1.language = 0x00000407; /* german */ + r.in.req->req1.count = 1; + r.in.req->req1.names = names; + r.in.req->req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; + + r.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY; + r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; - r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY; - r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; + r.out.level_out = &level_out; + r.out.ctr = &ctr; dom_sid = dom_sid_string(mem_ctx, torture_join_sid(priv->join)); names[0].str = dom_sid; printf("testing DsCrackNames with name '%s' desired format:%d\n", - names[0].str, r.in.req.req1.format_desired); + names[0].str, r.in.req->req1.format_desired); status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -260,8 +275,8 @@ bool test_DsCrackNames(struct torture_context *tctx, } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); ret = false; - } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { - printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); + } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status); ret = false; } @@ -269,13 +284,13 @@ bool test_DsCrackNames(struct torture_context *tctx, return ret; } - dns_domain = r.out.ctr.ctr1->array[0].dns_domain_name; - nt4_domain = r.out.ctr.ctr1->array[0].result_name; + dns_domain = r.out.ctr->ctr1->array[0].dns_domain_name; + nt4_domain = r.out.ctr->ctr1->array[0].result_name; - r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_GUID; + r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_GUID; printf("testing DsCrackNames with name '%s' desired format:%d\n", - names[0].str, r.in.req.req1.format_desired); + names[0].str, r.in.req->req1.format_desired); status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -288,8 +303,8 @@ bool test_DsCrackNames(struct torture_context *tctx, } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); ret = false; - } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { - printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); + } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status); ret = false; } @@ -297,14 +312,14 @@ bool test_DsCrackNames(struct torture_context *tctx, return ret; } - priv->domain_dns_name = r.out.ctr.ctr1->array[0].dns_domain_name; - priv->domain_guid_str = r.out.ctr.ctr1->array[0].result_name; + priv->domain_dns_name = r.out.ctr->ctr1->array[0].dns_domain_name; + priv->domain_guid_str = r.out.ctr->ctr1->array[0].result_name; GUID_from_string(priv->domain_guid_str, &priv->domain_guid); - r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; + r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; printf("testing DsCrackNames with name '%s' desired format:%d\n", - names[0].str, r.in.req.req1.format_desired); + names[0].str, r.in.req->req1.format_desired); status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -317,8 +332,8 @@ bool test_DsCrackNames(struct torture_context *tctx, } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); ret = false; - } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { - printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); + } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status); ret = false; } @@ -328,7 +343,7 @@ bool test_DsCrackNames(struct torture_context *tctx, ldb = ldb_init(mem_ctx, tctx->ev); - realm_dn_str = r.out.ctr.ctr1->array[0].result_name; + realm_dn_str = r.out.ctr->ctr1->array[0].result_name; realm_dn = ldb_dn_new(mem_ctx, ldb, realm_dn_str); realm_canonical = ldb_dn_canonical_string(mem_ctx, realm_dn); @@ -350,12 +365,12 @@ bool test_DsCrackNames(struct torture_context *tctx, return false; }; - r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; - r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; + r.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; + r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; names[0].str = nt4_domain; printf("testing DsCrackNames with name '%s' desired format:%d\n", - names[0].str, r.in.req.req1.format_desired); + names[0].str, r.in.req->req1.format_desired); status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -368,8 +383,8 @@ bool test_DsCrackNames(struct torture_context *tctx, } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); ret = false; - } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { - printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); + } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status); ret = false; } @@ -377,14 +392,14 @@ bool test_DsCrackNames(struct torture_context *tctx, return ret; } - priv->domain_obj_dn = r.out.ctr.ctr1->array[0].result_name; + priv->domain_obj_dn = r.out.ctr->ctr1->array[0].result_name; - r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; - r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; + r.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; + r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; names[0].str = talloc_asprintf(mem_ctx, "%s%s$", nt4_domain, test_dc); printf("testing DsCrackNames with name '%s' desired format:%d\n", - names[0].str, r.in.req.req1.format_desired); + names[0].str, r.in.req->req1.format_desired); status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -397,8 +412,8 @@ bool test_DsCrackNames(struct torture_context *tctx, } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); ret = false; - } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { - printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); + } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status); ret = false; } @@ -406,14 +421,14 @@ bool test_DsCrackNames(struct torture_context *tctx, return ret; } - FQDN_1779_name = r.out.ctr.ctr1->array[0].result_name; + FQDN_1779_name = r.out.ctr->ctr1->array[0].result_name; - r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_GUID; - r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; + r.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_GUID; + r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; names[0].str = priv->domain_guid_str; printf("testing DsCrackNames with name '%s' desired format:%d\n", - names[0].str, r.in.req.req1.format_desired); + names[0].str, r.in.req->req1.format_desired); status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -426,8 +441,8 @@ bool test_DsCrackNames(struct torture_context *tctx, } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); ret = false; - } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { - printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); + } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { + printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status); ret = false; } @@ -435,8 +450,8 @@ bool test_DsCrackNames(struct torture_context *tctx, return ret; } - if (strcmp(priv->domain_dns_name, r.out.ctr.ctr1->array[0].dns_domain_name) != 0) { - printf("DsCrackNames failed to return same DNS name - expected %s got %s\n", priv->domain_dns_name, r.out.ctr.ctr1->array[0].dns_domain_name); + if (strcmp(priv->domain_dns_name, r.out.ctr->ctr1->array[0].dns_domain_name) != 0) { + printf("DsCrackNames failed to return same DNS name - expected %s got %s\n", priv->domain_dns_name, r.out.ctr->ctr1->array[0].dns_domain_name); return false; } @@ -920,17 +935,17 @@ bool test_DsCrackNames(struct torture_context *tctx, for (i=0; i < ARRAY_SIZE(crack); i++) { const char *comment; - r.in.req.req1.format_flags = crack[i].flags; - r.in.req.req1.format_offered = crack[i].format_offered; - r.in.req.req1.format_desired = crack[i].format_desired; + r.in.req->req1.format_flags = crack[i].flags; + r.in.req->req1.format_offered = crack[i].format_offered; + r.in.req->req1.format_desired = crack[i].format_desired; names[0].str = crack[i].str; if (crack[i].comment) { comment = talloc_asprintf(mem_ctx, "'%s' with name '%s' desired format:%d\n", - crack[i].comment, names[0].str, r.in.req.req1.format_desired); + crack[i].comment, names[0].str, r.in.req->req1.format_desired); } else { comment = talloc_asprintf(mem_ctx, "'%s' desired format:%d\n", - names[0].str, r.in.req.req1.format_desired); + names[0].str, r.in.req->req1.format_desired); } if (crack[i].skip) { printf("skipping: %s", comment); @@ -947,11 +962,11 @@ bool test_DsCrackNames(struct torture_context *tctx, } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); ret = false; - } else if (r.out.ctr.ctr1->array[0].status != crack[i].status) { + } else if (r.out.ctr->ctr1->array[0].status != crack[i].status) { if (crack[i].alternate_status) { - if (r.out.ctr.ctr1->array[0].status != crack[i].alternate_status) { + if (r.out.ctr->ctr1->array[0].status != crack[i].alternate_status) { printf("DsCrackNames unexpected status %d, wanted %d or %d on: %s\n", - r.out.ctr.ctr1->array[0].status, + r.out.ctr->ctr1->array[0].status, crack[i].status, crack[i].alternate_status, comment); @@ -959,30 +974,30 @@ bool test_DsCrackNames(struct torture_context *tctx, } } else { printf("DsCrackNames unexpected status %d, wanted %d on: %s\n", - r.out.ctr.ctr1->array[0].status, + r.out.ctr->ctr1->array[0].status, crack[i].status, comment); ret = false; } } else if (crack[i].expected_str - && (strcmp(r.out.ctr.ctr1->array[0].result_name, + && (strcmp(r.out.ctr->ctr1->array[0].result_name, crack[i].expected_str) != 0)) { - if (strcasecmp(r.out.ctr.ctr1->array[0].result_name, + if (strcasecmp(r.out.ctr->ctr1->array[0].result_name, crack[i].expected_str) != 0) { printf("DsCrackNames failed - got %s, expected %s on %s\n", - r.out.ctr.ctr1->array[0].result_name, + r.out.ctr->ctr1->array[0].result_name, crack[i].expected_str, comment); ret = false; } else { printf("(warning) DsCrackNames returned different case - got %s, expected %s on %s\n", - r.out.ctr.ctr1->array[0].result_name, + r.out.ctr->ctr1->array[0].result_name, crack[i].expected_str, comment); } } else if (crack[i].expected_dns - && (strcmp(r.out.ctr.ctr1->array[0].dns_domain_name, + && (strcmp(r.out.ctr->ctr1->array[0].dns_domain_name, crack[i].expected_dns) != 0)) { printf("DsCrackNames failed - got DNS name %s, expected %s on %s\n", - r.out.ctr.ctr1->array[0].result_name, + r.out.ctr->ctr1->array[0].result_name, crack[i].expected_str, comment); ret = false; } diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index 2070485a19..bee2658816 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -265,6 +265,9 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx) { NTSTATUS status; struct drsuapi_DsCrackNames r; + union drsuapi_DsNameRequest req; + union drsuapi_DsNameCtr ctr; + int32_t level_out = 0; struct drsuapi_DsNameString names[1]; bool ret = true; struct cldap_socket *cldap; @@ -274,15 +277,19 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx) r.in.bind_handle = &ctx->admin.drsuapi.bind_handle; r.in.level = 1; - r.in.req.req1.codepage = 1252; /* western european */ - r.in.req.req1.language = 0x00000407; /* german */ - r.in.req.req1.count = 1; - r.in.req.req1.names = names; - r.in.req.req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; - r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; - r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; + r.in.req = &req; + r.in.req->req1.codepage = 1252; /* western european */ + r.in.req->req1.language = 0x00000407; /* german */ + r.in.req->req1.count = 1; + r.in.req->req1.names = names; + r.in.req->req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; + r.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; + r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; names[0].str = talloc_asprintf(ctx, "%s\\", lp_workgroup(tctx->lp_ctx)); + r.out.level_out = &level_out; + r.out.ctr = &ctr; + status = dcerpc_drsuapi_DsCrackNames(ctx->admin.drsuapi.pipe, ctx, &r); if (!NT_STATUS_IS_OK(status)) { const char *errstr = nt_errstr(status); @@ -296,7 +303,7 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx) return false; } - ctx->domain_dn = r.out.ctr.ctr1->array[0].result_name; + ctx->domain_dn = r.out.ctr->ctr1->array[0].result_name; ZERO_STRUCT(search); search.in.dest_address = ctx->drsuapi_binding->host; @@ -592,6 +599,7 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx) uint64_t highest_usn = 0; const char *partition = NULL; struct drsuapi_DsGetNCChanges r; + union drsuapi_DsGetNCChangesRequest req; struct drsuapi_DsReplicaObjectIdentifier nc; struct drsuapi_DsGetNCChangesCtr1 *ctr1 = NULL; struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL; @@ -642,37 +650,38 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx) array[i].level); r.in.bind_handle = &ctx->new_dc.drsuapi.bind_handle; - r.in.level = &array[i].level; + r.in.level = array[i].level; - switch (*r.in.level) { + switch (r.in.level) { case 5: nc.guid = null_guid; nc.sid = null_sid; nc.dn = partition; - r.in.req.req5.destination_dsa_guid = ctx->new_dc.invocation_id; - r.in.req.req5.source_dsa_invocation_id = null_guid; - r.in.req.req5.naming_context = &nc; - r.in.req.req5.highwatermark.tmp_highest_usn = highest_usn; - r.in.req.req5.highwatermark.reserved_usn = 0; - r.in.req.req5.highwatermark.highest_usn = highest_usn; - r.in.req.req5.uptodateness_vector = NULL; - r.in.req.req5.replica_flags = 0; + r.in.req = &req; + r.in.req->req5.destination_dsa_guid = ctx->new_dc.invocation_id; + r.in.req->req5.source_dsa_invocation_id = null_guid; + r.in.req->req5.naming_context = &nc; + r.in.req->req5.highwatermark.tmp_highest_usn = highest_usn; + r.in.req->req5.highwatermark.reserved_usn = 0; + r.in.req->req5.highwatermark.highest_usn = highest_usn; + r.in.req->req5.uptodateness_vector = NULL; + r.in.req->req5.replica_flags = 0; if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "compression", false)) { - r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; + r.in.req->req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "neighbour_writeable", true)) { - r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE; + r.in.req->req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE; } - r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP + r.in.req->req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS | DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS | DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED ; - r.in.req.req5.max_object_count = 133; - r.in.req.req5.max_ndr_size = 1336770; - r.in.req.req5.extended_op = DRSUAPI_EXOP_NONE; - r.in.req.req5.fsmo_info = 0; + r.in.req->req5.max_object_count = 133; + r.in.req->req5.max_ndr_size = 1336770; + r.in.req->req5.extended_op = DRSUAPI_EXOP_NONE; + r.in.req->req5.fsmo_info = 0; break; case 8: @@ -680,35 +689,36 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx) nc.sid = null_sid; nc.dn = partition; /* nc.dn can be set to any other ad partition */ - - r.in.req.req8.destination_dsa_guid = ctx->new_dc.invocation_id; - r.in.req.req8.source_dsa_invocation_id = null_guid; - r.in.req.req8.naming_context = &nc; - r.in.req.req8.highwatermark.tmp_highest_usn = highest_usn; - r.in.req.req8.highwatermark.reserved_usn = 0; - r.in.req.req8.highwatermark.highest_usn = highest_usn; - r.in.req.req8.uptodateness_vector = NULL; - r.in.req.req8.replica_flags = 0; + + r.in.req = &req; + r.in.req->req8.destination_dsa_guid = ctx->new_dc.invocation_id; + r.in.req->req8.source_dsa_invocation_id = null_guid; + r.in.req->req8.naming_context = &nc; + r.in.req->req8.highwatermark.tmp_highest_usn = highest_usn; + r.in.req->req8.highwatermark.reserved_usn = 0; + r.in.req->req8.highwatermark.highest_usn = highest_usn; + r.in.req->req8.uptodateness_vector = NULL; + r.in.req->req8.replica_flags = 0; if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "compression", false)) { - r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; + r.in.req->req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "neighbour_writeable", true)) { - r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE; + r.in.req->req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE; } - r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP + r.in.req->req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS | DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS | DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED ; - r.in.req.req8.max_object_count = 402; - r.in.req.req8.max_ndr_size = 402116; + r.in.req->req8.max_object_count = 402; + r.in.req->req8.max_ndr_size = 402116; - r.in.req.req8.extended_op = DRSUAPI_EXOP_NONE; - r.in.req.req8.fsmo_info = 0; - r.in.req.req8.partial_attribute_set = NULL; - r.in.req.req8.partial_attribute_set_ex = NULL; - r.in.req.req8.mapping_ctr.num_mappings = 0; - r.in.req.req8.mapping_ctr.mappings = NULL; + r.in.req->req8.extended_op = DRSUAPI_EXOP_NONE; + r.in.req->req8.fsmo_info = 0; + r.in.req->req8.partial_attribute_set = NULL; + r.in.req->req8.partial_attribute_set_ex = NULL; + r.in.req->req8.mapping_ctr.num_mappings = 0; + r.in.req->req8.mapping_ctr.mappings = NULL; break; } @@ -716,19 +726,23 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx) printf("Dumping AD partition: %s\n", nc.dn); for (y=0; ;y++) { int32_t _level = 0; + union drsuapi_DsGetNCChangesCtr ctr; + ZERO_STRUCT(r.out); - r.out.level = &_level; - if (*r.in.level == 5) { + r.out.level_out = &_level; + r.out.ctr = &ctr; + + if (r.in.level == 5) { DEBUG(0,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, - (long long)r.in.req.req5.highwatermark.tmp_highest_usn, - (long long)r.in.req.req5.highwatermark.highest_usn)); + (long long)r.in.req->req5.highwatermark.tmp_highest_usn, + (long long)r.in.req->req5.highwatermark.highest_usn)); } - if (*r.in.level == 8) { + if (r.in.level == 8) { DEBUG(0,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y, - (long long)r.in.req.req8.highwatermark.tmp_highest_usn, - (long long)r.in.req.req8.highwatermark.highest_usn)); + (long long)r.in.req->req8.highwatermark.tmp_highest_usn, + (long long)r.in.req->req8.highwatermark.highest_usn)); } status = dcerpc_drsuapi_DsGetNCChanges(ctx->new_dc.drsuapi.pipe, ctx, &r); @@ -744,13 +758,13 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx) ret = false; } - if (ret == true && *r.out.level == 1) { + if (ret == true && *r.out.level_out == 1) { out_level = 1; - ctr1 = &r.out.ctr.ctr1; - } else if (ret == true && *r.out.level == 2 && - r.out.ctr.ctr2.mszip1.ts) { + ctr1 = &r.out.ctr->ctr1; + } else if (ret == true && *r.out.level_out == 2 && + r.out.ctr->ctr2.mszip1.ts) { out_level = 1; - ctr1 = &r.out.ctr.ctr2.mszip1.ts->ctr1; + ctr1 = &r.out.ctr->ctr2.mszip1.ts->ctr1; } if (out_level == 1) { @@ -761,26 +775,26 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx) test_analyse_objects(tctx, ctx, &gensec_skey, ctr1->first_object); if (ctr1->more_data) { - r.in.req.req5.highwatermark = ctr1->new_highwatermark; + r.in.req->req5.highwatermark = ctr1->new_highwatermark; continue; } } - if (ret == true && *r.out.level == 6) { + if (ret == true && *r.out.level_out == 6) { out_level = 6; - ctr6 = &r.out.ctr.ctr6; - } else if (ret == true && *r.out.level == 7 - && r.out.ctr.ctr7.level == 6 - && r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP - && r.out.ctr.ctr7.ctr.mszip6.ts) { + ctr6 = &r.out.ctr->ctr6; + } else if (ret == true && *r.out.level_out == 7 + && r.out.ctr->ctr7.level == 6 + && r.out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP + && r.out.ctr->ctr7.ctr.mszip6.ts) { out_level = 6; - ctr6 = &r.out.ctr.ctr7.ctr.mszip6.ts->ctr6; - } else if (ret == true && *r.out.level == 7 - && r.out.ctr.ctr7.level == 6 - && r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS - && r.out.ctr.ctr7.ctr.xpress6.ts) { + ctr6 = &r.out.ctr->ctr7.ctr.mszip6.ts->ctr6; + } else if (ret == true && *r.out.level_out == 7 + && r.out.ctr->ctr7.level == 6 + && r.out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS + && r.out.ctr->ctr7.ctr.xpress6.ts) { out_level = 6; - ctr6 = &r.out.ctr.ctr7.ctr.xpress6.ts->ctr6; + ctr6 = &r.out.ctr->ctr7.ctr.xpress6.ts->ctr6; } if (out_level == 6) { @@ -791,7 +805,7 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx) test_analyse_objects(tctx, ctx, &gensec_skey, ctr6->first_object); if (ctr6->more_data) { - r.in.req.req8.highwatermark = ctr6->new_highwatermark; + r.in.req->req8.highwatermark = ctr6->new_highwatermark; continue; } } diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 6a6302837e..1ec87c6b42 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -869,7 +869,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod } if (strequal(request, "LANMAN-Challenge")) { - challenge = strhex_to_data_blob(parameter); + challenge = strhex_to_data_blob(NULL, parameter); if (challenge.length != 8) { mux_printf(mux_id, "Error: hex decode of %s failed! (got %d bytes, expected 8)\n.\n", parameter, @@ -877,7 +877,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod challenge = data_blob(NULL, 0); } } else if (strequal(request, "NT-Response")) { - nt_response = strhex_to_data_blob(parameter); + nt_response = strhex_to_data_blob(NULL, parameter); if (nt_response.length < 24) { mux_printf(mux_id, "Error: hex decode of %s failed! (only got %d bytes, needed at least 24)\n.\n", parameter, @@ -885,7 +885,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod nt_response = data_blob(NULL, 0); } } else if (strequal(request, "LANMAN-Response")) { - lm_response = strhex_to_data_blob(parameter); + lm_response = strhex_to_data_blob(NULL, parameter); if (lm_response.length != 24) { mux_printf(mux_id, "Error: hex decode of %s failed! (got %d bytes, expected 24)\n.\n", parameter, |