summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_misc.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-18 15:09:57 +0100
committerGünther Deschner <gd@samba.org>2009-03-18 22:02:23 +0100
commit7d7b1a8dcc338ea037cc02ef1b2dd9e9f6ce0943 (patch)
treefe4c7144f2d51d1b662a74a7d9595575d82e52c7 /source3/rpc_parse/parse_misc.c
parenta1256594b047061d5fce8b7b4234dc725462392d (diff)
downloadsamba-7d7b1a8dcc338ea037cc02ef1b2dd9e9f6ce0943.tar.gz
samba-7d7b1a8dcc338ea037cc02ef1b2dd9e9f6ce0943.tar.bz2
samba-7d7b1a8dcc338ea037cc02ef1b2dd9e9f6ce0943.zip
s3-rpc_parse: remove some unused parsing code.
Guenther
Diffstat (limited to 'source3/rpc_parse/parse_misc.c')
-rw-r--r--source3/rpc_parse/parse_misc.c338
1 files changed, 0 insertions, 338 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index bddd4212dc..8b4135a1e8 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -59,15 +59,6 @@ bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth)
}
/*******************************************************************
- Reads or writes an NTTIME structure.
-********************************************************************/
-
-bool smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime)
-{
- return smb_io_time( desc, nttime, ps, depth );
-}
-
-/*******************************************************************
********************************************************************/
bool smb_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime)
@@ -195,76 +186,6 @@ void init_unistr(UNISTR *str, const char *buf)
}
/*******************************************************************
-reads or writes a UNISTR structure.
-XXXX NOTE: UNISTR structures NEED to be null-terminated.
-********************************************************************/
-
-bool smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth)
-{
- if (uni == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_unistr");
- depth++;
-
- if(!prs_unistr("unistr", ps, depth, uni))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-creates a UNISTR2 structure: sets up the buffer, too
-********************************************************************/
-
-void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf)
-{
- if (buf != NULL) {
- *ptr = 1;
- init_unistr2(str, buf, UNI_STR_TERMINATE);
- } else {
- *ptr = 0;
- init_unistr2(str, NULL, UNI_FLAGS_NONE);
-
- }
-}
-
-/*******************************************************************
- Copies a UNISTR2 structure.
-********************************************************************/
-
-void copy_unistr2(UNISTR2 *str, const UNISTR2 *from)
-{
- if (from->buffer == NULL) {
- ZERO_STRUCTP(str);
- return;
- }
-
- SMB_ASSERT(from->uni_max_len >= from->uni_str_len);
-
- str->uni_max_len = from->uni_max_len;
- str->offset = from->offset;
- str->uni_str_len = from->uni_str_len;
-
- /* the string buffer is allocated to the maximum size
- (the the length of the source string) to prevent
- reallocation of memory. */
- if (str->buffer == NULL) {
- if (str->uni_max_len) {
- str->buffer = (uint16 *)TALLOC_ZERO_ARRAY(talloc_tos(), uint16, str->uni_max_len);
- if ((str->buffer == NULL)) {
- smb_panic("copy_unistr2: talloc fail");
- return;
- }
- /* copy the string */
- memcpy(str->buffer, from->buffer, str->uni_max_len*sizeof(uint16));
- } else {
- str->buffer = NULL;
- }
- }
-}
-
-/*******************************************************************
Inits a UNISTR2 structure.
********************************************************************/
@@ -319,262 +240,3 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags)
if ( num_chars && ((flags == UNI_MAXLEN_TERMINATE) || (flags == UNI_BROKEN_NON_NULL)) )
str->uni_max_len++;
}
-
-/**
- * Inits a UNISTR2 structure.
- * @param ctx talloc context to allocate string on
- * @param str pointer to string to create
- * @param buf UCS2 null-terminated buffer to init from
-*/
-
-void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf)
-{
- uint32 len = buf ? strlen_w(buf) : 0;
-
- ZERO_STRUCTP(str);
-
- /* set up string lengths. */
- str->uni_max_len = len;
- str->offset = 0;
- str->uni_str_len = len;
-
- if (len + 1) {
- str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, len + 1);
- if (str->buffer == NULL) {
- smb_panic("init_unistr2_w: talloc fail");
- return;
- }
- } else {
- str->buffer = NULL;
- }
-
- /*
- * don't move this test above ! The UNISTR2 must be initialized !!!
- * jfm, 7/7/2001.
- */
- if (buf==NULL)
- return;
-
- /* Yes, this is a strncpy( foo, bar, strlen(bar)) - but as
- long as the buffer above is talloc()ed correctly then this
- is the correct thing to do */
- if (len+1) {
- strncpy_w(str->buffer, buf, len + 1);
- }
-}
-
-/*******************************************************************
- Inits a UNISTR2 structure from a UNISTR
-********************************************************************/
-
-void init_unistr2_from_unistr(TALLOC_CTX *ctx, UNISTR2 *to, const UNISTR *from)
-{
- uint32 i;
-
- /* the destination UNISTR2 should never be NULL.
- if it is it is a programming error */
-
- /* if the source UNISTR is NULL, then zero out
- the destination string and return */
- ZERO_STRUCTP (to);
- if ((from == NULL) || (from->buffer == NULL))
- return;
-
- /* get the length; UNISTR must be NULL terminated */
- i = 0;
- while ((from->buffer)[i]!='\0')
- i++;
- i++; /* one more to catch the terminating NULL */
- /* is this necessary -- jerry? I need to think */
-
- /* set up string lengths; uni_max_len is set to i+1
- because we need to account for the final NULL termination */
- to->uni_max_len = i;
- to->offset = 0;
- to->uni_str_len = i;
-
- /* allocate the space and copy the string buffer */
- if (i) {
- to->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, i);
- if (to->buffer == NULL)
- smb_panic("init_unistr2_from_unistr: talloc fail");
- memcpy(to->buffer, from->buffer, i*sizeof(uint16));
- } else {
- to->buffer = NULL;
- }
- return;
-}
-
-/*******************************************************************
- Inits a UNISTR2 structure from a DATA_BLOB.
- The length of the data_blob must count the bytes of the buffer.
- Copies the blob data.
-********************************************************************/
-
-void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob)
-{
- /* Allocs the unistring */
- init_unistr2(str, NULL, UNI_FLAGS_NONE);
-
- /* Sets the values */
- str->uni_str_len = blob->length / sizeof(uint16);
- str->uni_max_len = str->uni_str_len;
- str->offset = 0;
- if (blob->length) {
- str->buffer = (uint16 *) memdup(blob->data, blob->length);
- } else {
- str->buffer = NULL;
- }
- if ((str->buffer == NULL) && (blob->length > 0)) {
- smb_panic("init_unistr2_from_datablob: malloc fail");
- }
-}
-
-/*******************************************************************
- UNISTR2* are a little different in that the pointer and the UNISTR2
- are not necessarily read/written back to back. So we break it up
- into 2 separate functions.
- See SPOOL_USER_1 in include/rpc_spoolss.h for an example.
-********************************************************************/
-
-bool prs_io_unistr2_p(const char *desc, prs_struct *ps, int depth, UNISTR2 **uni2)
-{
- uint32 data_p;
-
- /* caputure the pointer value to stream */
-
- data_p = *uni2 ? 0xf000baaa : 0;
-
- if ( !prs_uint32("ptr", ps, depth, &data_p ))
- return False;
-
- /* we're done if there is no data */
-
- if ( !data_p )
- return True;
-
- if (UNMARSHALLING(ps)) {
- if ( !(*uni2 = PRS_ALLOC_MEM(ps, UNISTR2, 1)) )
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- now read/write the actual UNISTR2. Memory for the UNISTR2 (but
- not UNISTR2.buffer) has been allocated previously by prs_unistr2_p()
-********************************************************************/
-
-bool prs_io_unistr2(const char *desc, prs_struct *ps, int depth, UNISTR2 *uni2 )
-{
- /* just return true if there is no pointer to deal with.
- the memory must have been previously allocated on unmarshalling
- by prs_unistr2_p() */
-
- if ( !uni2 )
- return True;
-
- /* just pass off to smb_io_unstr2() passing the uni2 address as
- the pointer (like you would expect) */
-
- return smb_io_unistr2( desc, uni2, uni2 ? 1 : 0, ps, depth );
-}
-
-/*******************************************************************
- Reads or writes a UNISTR2 structure.
- XXXX NOTE: UNISTR2 structures need NOT be null-terminated.
- the uni_str_len member tells you how long the string is;
- the uni_max_len member tells you how large the buffer is.
-********************************************************************/
-
-bool smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth)
-{
- if (uni2 == NULL)
- return False;
-
- if (buffer) {
-
- prs_debug(ps, depth, desc, "smb_io_unistr2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("uni_max_len", ps, depth, &uni2->uni_max_len))
- return False;
- if(!prs_uint32("offset ", ps, depth, &uni2->offset))
- return False;
- if(!prs_uint32("uni_str_len", ps, depth, &uni2->uni_str_len))
- return False;
-
- /* buffer advanced by indicated length of string
- NOT by searching for null-termination */
- if(!prs_unistr2(True, "buffer ", ps, depth, uni2))
- return False;
-
- } else {
-
- prs_debug(ps, depth, desc, "smb_io_unistr2 - NULL");
- depth++;
- memset((char *)uni2, '\0', sizeof(*uni2));
-
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an POLICY_HND structure.
-********************************************************************/
-
-bool smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth)
-{
- if (pol == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_pol_hnd");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(UNMARSHALLING(ps))
- ZERO_STRUCTP(pol);
-
- if (!prs_uint32("handle_type", ps, depth, &pol->handle_type))
- return False;
- if (!smb_io_uuid("uuid", (struct GUID*)&pol->uuid, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-return the length of a UNISTR string.
-********************************************************************/
-
-uint32 str_len_uni(UNISTR *source)
-{
- uint32 i=0;
-
- if (!source->buffer)
- return 0;
-
- while (source->buffer[i])
- i++;
-
- return i;
-}
-
-/*******************************************************************
- Verifies policy handle
-********************************************************************/
-
-bool policy_handle_is_valid(const POLICY_HND *hnd)
-{
- POLICY_HND zero_pol;
-
- ZERO_STRUCT(zero_pol);
- return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? false : true );
-}