32 * wrong.
33 *
34 * When available, the relevant ndr reference is passed to the
35 * operation but keep in mind that it may be a null pointer.
36 *
37 * Functions ndo_get_pdu(), ndo_put_pdu(), and ndo_pad_pdu()
38 * must never grow the PDU data. A request for out-of-bounds data is
39 * an error. The swap_bytes flag is 1 if NDR knows that the byte-
40 * order in the PDU is different from the local system.
41 */
42
43 #include <sys/types.h>
44 #include <stdarg.h>
45 #include <ctype.h>
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <strings.h>
49 #include <string.h>
50 #include <assert.h>
51
52 #include <smbsrv/libsmb.h>
53 #include <smbsrv/libmlrpc.h>
54
55 #define NDOBUFSZ 128
56
57 #define NDR_PDU_BLOCK_SIZE (4*1024)
58 #define NDR_PDU_BLOCK_MASK (NDR_PDU_BLOCK_SIZE - 1)
59 #define NDR_PDU_ALIGN(N) \
60 (((N) + NDR_PDU_BLOCK_SIZE) & ~NDR_PDU_BLOCK_MASK)
61 #define NDR_PDU_MAX_SIZE (64*1024*1024)
62
63 static char *ndo_malloc(ndr_stream_t *, unsigned, ndr_ref_t *);
64 static int ndo_free(ndr_stream_t *, char *, ndr_ref_t *);
65 static int ndo_grow_pdu(ndr_stream_t *, unsigned long, ndr_ref_t *);
66 static int ndo_pad_pdu(ndr_stream_t *, unsigned long, unsigned long,
67 ndr_ref_t *);
68 static int ndo_get_pdu(ndr_stream_t *, unsigned long, unsigned long,
69 char *, int, ndr_ref_t *);
70 static int ndo_put_pdu(ndr_stream_t *, unsigned long, unsigned long,
71 char *, int, ndr_ref_t *);
72 static void ndo_tattle(ndr_stream_t *, char *, ndr_ref_t *);
73 static void ndo_tattle_error(ndr_stream_t *, ndr_ref_t *);
|
32 * wrong.
33 *
34 * When available, the relevant ndr reference is passed to the
35 * operation but keep in mind that it may be a null pointer.
36 *
37 * Functions ndo_get_pdu(), ndo_put_pdu(), and ndo_pad_pdu()
38 * must never grow the PDU data. A request for out-of-bounds data is
39 * an error. The swap_bytes flag is 1 if NDR knows that the byte-
40 * order in the PDU is different from the local system.
41 */
42
43 #include <sys/types.h>
44 #include <stdarg.h>
45 #include <ctype.h>
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <strings.h>
49 #include <string.h>
50 #include <assert.h>
51
52 #include <libmlrpc.h>
53
54 #define NDOBUFSZ 128
55
56 #define NDR_PDU_BLOCK_SIZE (4*1024)
57 #define NDR_PDU_BLOCK_MASK (NDR_PDU_BLOCK_SIZE - 1)
58 #define NDR_PDU_ALIGN(N) \
59 (((N) + NDR_PDU_BLOCK_SIZE) & ~NDR_PDU_BLOCK_MASK)
60 #define NDR_PDU_MAX_SIZE (64*1024*1024)
61
62 static char *ndo_malloc(ndr_stream_t *, unsigned, ndr_ref_t *);
63 static int ndo_free(ndr_stream_t *, char *, ndr_ref_t *);
64 static int ndo_grow_pdu(ndr_stream_t *, unsigned long, ndr_ref_t *);
65 static int ndo_pad_pdu(ndr_stream_t *, unsigned long, unsigned long,
66 ndr_ref_t *);
67 static int ndo_get_pdu(ndr_stream_t *, unsigned long, unsigned long,
68 char *, int, ndr_ref_t *);
69 static int ndo_put_pdu(ndr_stream_t *, unsigned long, unsigned long,
70 char *, int, ndr_ref_t *);
71 static void ndo_tattle(ndr_stream_t *, char *, ndr_ref_t *);
72 static void ndo_tattle_error(ndr_stream_t *, ndr_ref_t *);
|