"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "librpc/ndr/ndr_dns.c" between
samba-4.12.3.tar.gz and samba-4.12.5.tar.gz

About: Samba is the standard Windows interoperability suite of programs for Linux and Unix providing secure, stable and fast file and print services for all clients using the SMB/CIFS protocol. 4.12 series.

ndr_dns.c  (samba-4.12.3):ndr_dns.c  (samba-4.12.5)
skipping to change at line 36 skipping to change at line 36
/* /*
see rfc1002 for the detailed format of compressed names see rfc1002 for the detailed format of compressed names
*/ */
#include "includes.h" #include "includes.h"
#include "librpc/gen_ndr/ndr_dns.h" #include "librpc/gen_ndr/ndr_dns.h"
#include "librpc/gen_ndr/ndr_misc.h" #include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_dnsp.h" #include "librpc/gen_ndr/ndr_dnsp.h"
#include "system/locale.h" #include "system/locale.h"
#include "lib/util/util_net.h" #include "lib/util/util_net.h"
#include "ndr_dns_utils.h"
/* don't allow an unlimited number of name components */ /* don't allow an unlimited number of name components */
#define MAX_COMPONENTS 128 #define MAX_COMPONENTS 128
/** /**
print a dns string print a dns string
*/ */
_PUBLIC_ void ndr_print_dns_string(struct ndr_print *ndr, _PUBLIC_ void ndr_print_dns_string(struct ndr_print *ndr,
const char *name, const char *name,
const char *s) const char *s)
skipping to change at line 162 skipping to change at line 163
return NDR_ERR_SUCCESS; return NDR_ERR_SUCCESS;
} }
/** /**
push a dns string to the wire push a dns string to the wire
*/ */
_PUBLIC_ enum ndr_err_code ndr_push_dns_string(struct ndr_push *ndr, _PUBLIC_ enum ndr_err_code ndr_push_dns_string(struct ndr_push *ndr,
int ndr_flags, int ndr_flags,
const char *s) const char *s)
{ {
if (!(ndr_flags & NDR_SCALARS)) { return ndr_push_dns_string_list(ndr,
return NDR_ERR_SUCCESS; &ndr->dns_string_list,
} ndr_flags,
s,
while (s && *s) { false);
enum ndr_err_code ndr_err;
char *compname;
size_t complen;
uint32_t offset;
if (!(ndr->flags & LIBNDR_FLAG_NO_COMPRESSION)) {
/* see if we have pushed the remaining string already,
* if so we use a label pointer to this string
*/
ndr_err = ndr_token_retrieve_cmp_fn(&ndr->dns_string_list
, s,
&offset,
(comparison_fn_t)strc
mp,
false);
if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
uint8_t b[2];
if (offset > 0x3FFF) {
return ndr_push_error(ndr, NDR_ERR_STRING
,
"offset for dns str
ing " \
"label pointer " \
"%u[%08X] > 0x00003
FFF",
offset, offset);
}
b[0] = 0xC0 | (offset>>8);
b[1] = (offset & 0xFF);
return ndr_push_bytes(ndr, b, 2);
}
}
complen = strcspn(s, ".");
/* we need to make sure the length fits into 6 bytes */
if (complen > 0x3F) {
return ndr_push_error(ndr, NDR_ERR_STRING,
"component length %u[%08X] > " \
"0x0000003F",
(unsigned)complen,
(unsigned)complen);
}
compname = talloc_asprintf(ndr, "%c%*.*s",
(unsigned char)complen,
(unsigned char)complen,
(unsigned char)complen, s);
NDR_ERR_HAVE_NO_MEMORY(compname);
/* remember the current component + the rest of the string
* so it can be reused later
*/
if (!(ndr->flags & LIBNDR_FLAG_NO_COMPRESSION)) {
NDR_CHECK(ndr_token_store(ndr, &ndr->dns_string_list, s,
ndr->offset));
}
/* push just this component into the blob */
NDR_CHECK(ndr_push_bytes(ndr, (const uint8_t *)compname,
complen+1));
talloc_free(compname);
s += complen;
if (*s == '.') s++;
}
/* if we reach the end of the string and have pushed the last component
* without using a label pointer, we need to terminate the string
*/
return ndr_push_bytes(ndr, (const uint8_t *)"", 1);
} }
_PUBLIC_ enum ndr_err_code ndr_pull_dns_txt_record(struct ndr_pull *ndr, int ndr _flags, struct dns_txt_record *r) _PUBLIC_ enum ndr_err_code ndr_pull_dns_txt_record(struct ndr_pull *ndr, int ndr _flags, struct dns_txt_record *r)
{ {
NDR_PULL_CHECK_FLAGS(ndr, ndr_flags); NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
if (ndr_flags & NDR_SCALARS) { if (ndr_flags & NDR_SCALARS) {
enum ndr_err_code ndr_err; enum ndr_err_code ndr_err;
uint32_t data_size = ndr->data_size; uint32_t data_size = ndr->data_size;
uint32_t record_size = 0; uint32_t record_size = 0;
ndr_err = ndr_token_retrieve(&ndr->array_size_list, r, ndr_err = ndr_token_retrieve(&ndr->array_size_list, r,
 End of changes. 2 change blocks. 
79 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)