mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
r6014: rather large change set....
pulling back all recent rpc changes from trunk into 3.0. I've tested a compile and so don't think I've missed any files. But if so, just mail me and I'll clean backup in a couple of hours. Changes include \winreg, \eventlog, \svcctl, and general parse_misc.c updates. I am planning on bracketing the event code with an #ifdef ENABLE_EVENTLOG until I finish merging Marcin's changes (very soon).
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
51beba71d4
commit
4e0ac63c36
457
source/rpc_parse/parse_eventlog.c
Normal file
457
source/rpc_parse/parse_eventlog.c
Normal file
@ -0,0 +1,457 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* RPC Pipe client / server routines
|
||||
* Copyright (C) Marcin Krzysztof Porwit 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_RPC_PARSE
|
||||
|
||||
/*
|
||||
* called from eventlog_q_open_eventlog (srv_eventlog.c)
|
||||
*/
|
||||
|
||||
BOOL eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(q_u == NULL)
|
||||
return False;
|
||||
|
||||
/* Data format seems to be:
|
||||
UNKNOWN structure
|
||||
uint32 unknown
|
||||
uint16 unknown
|
||||
uint16 unknown
|
||||
Eventlog name
|
||||
uint16 eventlog name length
|
||||
uint16 eventlog name size
|
||||
Character Array
|
||||
uint32 unknown
|
||||
uint32 max count
|
||||
uint32 offset
|
||||
uint32 actual count
|
||||
UNISTR2 log file name
|
||||
Server Name
|
||||
uint16 server name length
|
||||
uint16 server name size
|
||||
Character Array
|
||||
UNISTR2 server name
|
||||
*/
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_q_open_eventlog");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
/* Munch unknown bits */
|
||||
|
||||
if(!prs_uint32("", ps, depth, &q_u->unknown1))
|
||||
return False;
|
||||
if(!prs_uint16("", ps, depth, &q_u->unknown2))
|
||||
return False;
|
||||
if(!prs_uint16("", ps, depth, &q_u->unknown3))
|
||||
return False;
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
/* Get name of log source */
|
||||
|
||||
if(!prs_uint16("sourcename_length", ps, depth, &q_u->sourcename_length))
|
||||
return False;
|
||||
if(!prs_uint16("sourcename_size", ps, depth, &q_u->sourcename_size))
|
||||
return False;
|
||||
if(!prs_uint32("sourcename_ptr", ps, depth, &q_u->sourcename_ptr))
|
||||
return False;
|
||||
if(!smb_io_unistr2("", &q_u->sourcename, q_u->sourcename_ptr, ps, depth))
|
||||
return False;
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
/* Get server name */
|
||||
|
||||
if(!prs_uint32("servername_ptr", ps, depth, &q_u->servername_ptr))
|
||||
return False;
|
||||
if(!smb_io_unistr2("", &q_u->servername, q_u->servername_ptr, ps, depth))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_r_open_eventlog");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!(smb_io_pol_hnd("log handle", &(r_u->handle), ps, depth)))
|
||||
return False;
|
||||
|
||||
if(!(prs_werror("status code", ps, depth, &(r_u->status))))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL eventlog_io_q_get_num_records(const char *desc, EVENTLOG_Q_GET_NUM_RECORDS *q_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_q_get_num_records");
|
||||
depth++;
|
||||
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
|
||||
if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth)))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL eventlog_io_r_get_num_records(const char *desc, EVENTLOG_R_GET_NUM_RECORDS *r_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_r_get_num_records");
|
||||
depth++;
|
||||
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
|
||||
if(!(prs_uint32("num records", ps, depth, &(r_u->num_records))))
|
||||
return False;
|
||||
|
||||
if(!(prs_werror("status code", ps, depth, &(r_u->status))))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL eventlog_io_q_get_oldest_entry(const char *desc, EVENTLOG_Q_GET_OLDEST_ENTRY *q_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_q_get_oldest_entry");
|
||||
depth++;
|
||||
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
|
||||
if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth)))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL eventlog_io_r_get_oldest_entry(const char *desc, EVENTLOG_R_GET_OLDEST_ENTRY *r_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_r_get_oldest_entry");
|
||||
depth++;
|
||||
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
|
||||
if(!(prs_uint32("oldest entry", ps, depth, &(r_u->oldest_entry))))
|
||||
return False;
|
||||
|
||||
if(!(prs_werror("status code", ps, depth, &(r_u->status))))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL eventlog_io_q_close_eventlog(const char *desc, EVENTLOG_Q_CLOSE_EVENTLOG *q_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_q_close_eventlog");
|
||||
depth++;
|
||||
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
|
||||
if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth)))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL eventlog_io_r_close_eventlog(const char *desc, EVENTLOG_R_CLOSE_EVENTLOG *r_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_r_close_eventlog");
|
||||
depth++;
|
||||
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
|
||||
if(!(smb_io_pol_hnd("log handle", &(r_u->handle), ps, depth)))
|
||||
return False;
|
||||
|
||||
if(!(prs_werror("status code", ps, depth, &(r_u->status))))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL eventlog_io_q_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_q_read_eventlog");
|
||||
depth++;
|
||||
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
|
||||
if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth)))
|
||||
return False;
|
||||
|
||||
if(!(prs_uint32("read flags", ps, depth, &(q_u->flags))))
|
||||
return False;
|
||||
|
||||
if(!(prs_uint32("read offset", ps, depth, &(q_u->offset))))
|
||||
return False;
|
||||
|
||||
if(!(prs_uint32("read buf size", ps, depth, &(q_u->max_read_size))))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
/* Structure of response seems to be:
|
||||
DWORD num_bytes_in_resp -- MUST be the same as q_u->max_read_size
|
||||
for i=0..n
|
||||
EVENTLOGRECORD record
|
||||
DWORD sent_size -- sum of EVENTLOGRECORD lengths if records returned, 0 otherwise
|
||||
DWORD real_size -- 0 if records returned, otherwise length of next record to be returned
|
||||
WERROR status */
|
||||
BOOL eventlog_io_r_read_eventlog(const char *desc,
|
||||
EVENTLOG_Q_READ_EVENTLOG *q_u,
|
||||
EVENTLOG_R_READ_EVENTLOG *r_u,
|
||||
prs_struct *ps,
|
||||
int depth)
|
||||
{
|
||||
Eventlog_entry *entry;
|
||||
uint32 record_written = 0;
|
||||
uint32 record_total = 0;
|
||||
|
||||
if(r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_r_read_eventlog");
|
||||
depth++;
|
||||
|
||||
/* First, see if we've read more logs than we can output */
|
||||
|
||||
if(r_u->num_bytes_in_resp > q_u->max_read_size) {
|
||||
entry = r_u->entry;
|
||||
|
||||
/* remove the size of the last entry from the list */
|
||||
|
||||
while(entry->next != NULL)
|
||||
entry = entry->next;
|
||||
|
||||
r_u->num_bytes_in_resp -= entry->record.length;
|
||||
|
||||
/* do not output the last log entry */
|
||||
|
||||
r_u->num_records--;
|
||||
}
|
||||
|
||||
entry = r_u->entry;
|
||||
record_total = r_u->num_records;
|
||||
|
||||
if(r_u->num_bytes_in_resp != 0)
|
||||
r_u->sent_size = r_u->num_bytes_in_resp;
|
||||
else
|
||||
r_u->real_size = entry->record.length;
|
||||
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
if(!(prs_uint32("bytes in resp", ps, depth, &(q_u->max_read_size))))
|
||||
return False;
|
||||
|
||||
while(entry != NULL && record_written < record_total)
|
||||
{
|
||||
DEBUG(10, ("eventlog_io_r_read_eventlog: writing record [%d] out of [%d].\n", record_written, record_total));
|
||||
|
||||
/* Encode the actual eventlog record record */
|
||||
|
||||
if(!(prs_uint32("length", ps, depth, &(entry->record.length))))
|
||||
return False;
|
||||
if(!(prs_uint32("reserved", ps, depth, &(entry->record.reserved1))))
|
||||
return False;
|
||||
if(!(prs_uint32("record number", ps, depth, &(entry->record.record_number))))
|
||||
return False;
|
||||
if(!(prs_uint32("time generated", ps, depth, &(entry->record.time_generated))))
|
||||
return False;
|
||||
if(!(prs_uint32("time written", ps, depth, &(entry->record.time_written))))
|
||||
return False;
|
||||
if(!(prs_uint32("event id", ps, depth, &(entry->record.event_id))))
|
||||
return False;
|
||||
if(!(prs_uint16("event type", ps, depth, &(entry->record.event_type))))
|
||||
return False;
|
||||
if(!(prs_uint16("num strings", ps, depth, &(entry->record.num_strings))))
|
||||
return False;
|
||||
if(!(prs_uint16("event category", ps, depth, &(entry->record.event_category))))
|
||||
return False;
|
||||
if(!(prs_uint16("reserved2", ps, depth, &(entry->record.reserved2))))
|
||||
return False;
|
||||
if(!(prs_uint32("closing record", ps, depth, &(entry->record.closing_record_number))))
|
||||
return False;
|
||||
if(!(prs_uint32("string offset", ps, depth, &(entry->record.string_offset))))
|
||||
return False;
|
||||
if(!(prs_uint32("user sid length", ps, depth, &(entry->record.user_sid_length))))
|
||||
return False;
|
||||
if(!(prs_uint32("user sid offset", ps, depth, &(entry->record.user_sid_offset))))
|
||||
return False;
|
||||
if(!(prs_uint32("data length", ps, depth, &(entry->record.data_length))))
|
||||
return False;
|
||||
if(!(prs_uint32("data offset", ps, depth, &(entry->record.data_offset))))
|
||||
return False;
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
|
||||
/* Now encoding data */
|
||||
|
||||
if(!(prs_uint8s(False, "buffer", ps, depth, entry->data,
|
||||
entry->record.length - sizeof(Eventlog_record) - sizeof(entry->record.length))))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
|
||||
if(!(prs_align(ps)))
|
||||
return False;
|
||||
if(!(prs_uint32("length 2", ps, depth, &(entry->record.length))))
|
||||
return False;
|
||||
|
||||
entry = entry->next;
|
||||
record_written++;
|
||||
|
||||
} /* end of encoding EVENTLOGRECORD */
|
||||
|
||||
/* Now pad with whitespace until the end of the response buffer */
|
||||
|
||||
r_u->end_of_entries_padding = (uint8 *)calloc(q_u->max_read_size - r_u->num_bytes_in_resp, sizeof(uint8));
|
||||
|
||||
if(!(prs_uint8s(False, "end of entries padding", ps,
|
||||
depth, r_u->end_of_entries_padding,
|
||||
(q_u->max_read_size - r_u->num_bytes_in_resp))))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
|
||||
free(r_u->end_of_entries_padding);
|
||||
|
||||
/* We had better be DWORD aligned here */
|
||||
|
||||
if(!(prs_uint32("sent size", ps, depth, &(r_u->sent_size))))
|
||||
return False;
|
||||
if(!(prs_uint32("real size", ps, depth, &(r_u->real_size))))
|
||||
return False;
|
||||
if(!(prs_werror("status code", ps, depth, &(r_u->status))))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/* The windows client seems to be doing something funny with the file name
|
||||
A call like
|
||||
ClearEventLog(handle, "backup_file")
|
||||
on the client side will result in the backup file name looking like this on the
|
||||
server side:
|
||||
\??\${CWD of client}\backup_file
|
||||
If an absolute path gets specified, such as
|
||||
ClearEventLog(handle, "C:\\temp\\backup_file")
|
||||
then it is still mangled by the client into this:
|
||||
\??\C:\temp\backup_file
|
||||
when it is on the wire.
|
||||
I'm not sure where the \?? is coming from, or why the ${CWD} of the client process
|
||||
would be added in given that the backup file gets written on the server side. */
|
||||
|
||||
BOOL eventlog_io_q_clear_eventlog(const char *desc, EVENTLOG_Q_CLEAR_EVENTLOG *q_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_q_clear_eventlog");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth)))
|
||||
return False;
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
if(!(prs_uint32("unknown1", ps, depth, &q_u->unknown1)))
|
||||
return False;
|
||||
if(!(prs_uint16("backup_file_length", ps, depth, &q_u->backup_file_length)))
|
||||
return False;
|
||||
if(!(prs_uint16("backup_file_size", ps, depth, &q_u->backup_file_size)))
|
||||
return False;
|
||||
if(!prs_uint32("backup_file_ptr", ps, depth, &q_u->backup_file_ptr))
|
||||
return False;
|
||||
if(!smb_io_unistr2("backup file", &q_u->backup_file, q_u->backup_file_ptr, ps, depth))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
|
||||
}
|
||||
|
||||
BOOL eventlog_io_r_clear_eventlog(const char *desc, EVENTLOG_R_CLEAR_EVENTLOG *r_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "eventlog_io_r_clear_eventlog");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
if(!(prs_werror("status code", ps, depth, &(r_u->status))))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
@ -906,7 +906,7 @@ void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l,
|
||||
memcpy(&q_l->pol, hnd, sizeof(q_l->pol));
|
||||
init_lsa_sid_enum(mem_ctx, &q_l->sids, num_sids, sids);
|
||||
|
||||
q_l->level.value = level;
|
||||
q_l->level = level;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
@ -928,7 +928,10 @@ BOOL lsa_io_q_lookup_sids(const char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *
|
||||
return False;
|
||||
if(!lsa_io_trans_names("names ", &q_s->names, ps, depth)) /* translated names */
|
||||
return False;
|
||||
if(!smb_io_lookup_level("switch ", &q_s->level, ps, depth)) /* lookup level */
|
||||
|
||||
if(!prs_uint16("level", ps, depth, &q_s->level)) /* lookup level */
|
||||
return False;
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count))
|
||||
|
@ -131,28 +131,6 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth)
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Reads or writes a LOOKUP_LEVEL structure.
|
||||
********************************************************************/
|
||||
|
||||
BOOL smb_io_lookup_level(const char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth)
|
||||
{
|
||||
if (level == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "smb_io_lookup_level");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
if(!prs_uint16("value", ps, depth, &level->value))
|
||||
return False;
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Gets an enumeration handle from an ENUM_HND structure.
|
||||
********************************************************************/
|
||||
@ -707,10 +685,10 @@ BOOL smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth)
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Inits a BUFFER2 structure.
|
||||
Inits a REGVAL_BUFFER structure.
|
||||
********************************************************************/
|
||||
|
||||
void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len)
|
||||
void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len)
|
||||
{
|
||||
ZERO_STRUCTP(str);
|
||||
|
||||
@ -723,50 +701,39 @@ void init_buffer2(BUFFER2 *str, const uint8 *buf, size_t len)
|
||||
SMB_ASSERT(str->buf_max_len >= str->buf_len);
|
||||
str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->buf_max_len);
|
||||
if (str->buffer == NULL)
|
||||
smb_panic("init_buffer2: talloc fail\n");
|
||||
smb_panic("init_regval_buffer: talloc fail\n");
|
||||
memcpy(str->buffer, buf, str->buf_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Reads or writes a BUFFER2 structure.
|
||||
Reads or writes a REGVAL_BUFFER structure.
|
||||
the uni_max_len member tells you how large the buffer is.
|
||||
the uni_str_len member tells you how much of the buffer is really used.
|
||||
********************************************************************/
|
||||
|
||||
BOOL smb_io_buffer2(const char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth)
|
||||
BOOL smb_io_regval_buffer(const char *desc, prs_struct *ps, int depth, REGVAL_BUFFER *buf2)
|
||||
{
|
||||
if (buf2 == NULL)
|
||||
|
||||
prs_debug(ps, depth, desc, "smb_io_regval_buffer");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("uni_max_len", ps, depth, &buf2->buf_max_len))
|
||||
return False;
|
||||
if(!prs_uint32("offset ", ps, depth, &buf2->offset))
|
||||
return False;
|
||||
if(!prs_uint32("buf_len ", ps, depth, &buf2->buf_len))
|
||||
return False;
|
||||
|
||||
if (buffer) {
|
||||
/* buffer advanced by indicated length of string
|
||||
NOT by searching for null-termination */
|
||||
|
||||
prs_debug(ps, depth, desc, "smb_io_buffer2");
|
||||
depth++;
|
||||
if(!prs_regval_buffer(True, "buffer ", ps, depth, buf2))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("uni_max_len", ps, depth, &buf2->buf_max_len))
|
||||
return False;
|
||||
if(!prs_uint32("offset ", ps, depth, &buf2->offset))
|
||||
return False;
|
||||
if(!prs_uint32("buf_len ", ps, depth, &buf2->buf_len))
|
||||
return False;
|
||||
|
||||
/* buffer advanced by indicated length of string
|
||||
NOT by searching for null-termination */
|
||||
|
||||
if(!prs_buffer2(True, "buffer ", ps, depth, buf2))
|
||||
return False;
|
||||
|
||||
} else {
|
||||
|
||||
prs_debug(ps, depth, desc, "smb_io_buffer2 - NULL");
|
||||
depth++;
|
||||
memset((char *)buf2, '\0', sizeof(*buf2));
|
||||
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
@ -933,6 +900,20 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags)
|
||||
str->uni_max_len++;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Inits a UNISTR4 structure.
|
||||
********************************************************************/
|
||||
|
||||
void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags)
|
||||
{
|
||||
uni4->string = TALLOC_P( get_talloc_ctx(), UNISTR2 );
|
||||
init_unistr2( uni4->string, buf, flags );
|
||||
|
||||
uni4->length = 2 * (uni4->string->uni_str_len);
|
||||
uni4->size = 2 * (uni4->string->uni_max_len);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inits a UNISTR2 structure.
|
||||
* @param ctx talloc context to allocate string on
|
||||
@ -1033,6 +1014,57 @@ void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob)
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
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 = (uint32) *uni2;
|
||||
|
||||
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, (uint32)uni2, ps, depth );
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Reads or writes a UNISTR2 structure.
|
||||
XXXX NOTE: UNISTR2 structures need NOT be null-terminated.
|
||||
@ -1076,10 +1108,29 @@ BOOL smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
now read/write UNISTR4
|
||||
********************************************************************/
|
||||
|
||||
/*
|
||||
BOOL prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4)
|
||||
{
|
||||
|
||||
if ( !prs_uint16("length", ps, depth, &uni4->length ))
|
||||
return False;
|
||||
if ( !prs_uint16("size", ps, depth, &uni4->size ))
|
||||
return False;
|
||||
|
||||
if ( !prs_pointer( desc, ps, depth, (void**)&uni4->string, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
initialise a UNISTR_ARRAY from a char**
|
||||
*/
|
||||
********************************************************************/
|
||||
|
||||
BOOL init_unistr2_array(UNISTR2_ARRAY *array,
|
||||
uint32 count, const char **strings)
|
||||
{
|
||||
|
@ -588,6 +588,37 @@ BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8)
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Stream a uint16* (allocate memory if unmarshalling)
|
||||
********************************************************************/
|
||||
|
||||
BOOL prs_pointer( const char *name, prs_struct *ps, int depth,
|
||||
void **data, size_t data_size,
|
||||
BOOL(*prs_fn)(const char*, prs_struct*, int, void*) )
|
||||
{
|
||||
uint32 data_p;
|
||||
|
||||
/* caputure the pointer value to stream */
|
||||
|
||||
data_p = (uint32) *data;
|
||||
|
||||
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 ( !(*data = PRS_ALLOC_MEM_VOID(ps, data_size)) )
|
||||
return False;
|
||||
}
|
||||
|
||||
return prs_fn(name, ps, depth, *data);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Stream a uint16.
|
||||
********************************************************************/
|
||||
@ -598,12 +629,12 @@ BOOL prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16)
|
||||
if (q == NULL)
|
||||
return False;
|
||||
|
||||
if (UNMARSHALLING(ps)) {
|
||||
if (UNMARSHALLING(ps)) {
|
||||
if (ps->bigendian_data)
|
||||
*data16 = RSVAL(q,0);
|
||||
else
|
||||
*data16 = SVAL(q,0);
|
||||
} else {
|
||||
} else {
|
||||
if (ps->bigendian_data)
|
||||
RSSVAL(q,0,*data16);
|
||||
else
|
||||
@ -646,34 +677,6 @@ BOOL prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32)
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Stream a uint32* (allocate memory if unmarshalling)
|
||||
********************************************************************/
|
||||
|
||||
BOOL prs_uint32_p(const char *name, prs_struct *ps, int depth, uint32 **data32)
|
||||
{
|
||||
uint32 data_p;
|
||||
|
||||
/* caputure the pointer value to stream */
|
||||
|
||||
data_p = (uint32) *data32;
|
||||
|
||||
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 ( !(*data32 = PRS_ALLOC_MEM(ps, uint32, 1)) )
|
||||
return False;
|
||||
}
|
||||
|
||||
return prs_uint32(name, ps, depth, *data32);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Stream a NTSTATUS
|
||||
********************************************************************/
|
||||
@ -944,28 +947,28 @@ BOOL prs_buffer5(BOOL charmode, const char *name, prs_struct *ps, int depth, BUF
|
||||
in byte chars. String is in little-endian format.
|
||||
********************************************************************/
|
||||
|
||||
BOOL prs_buffer2(BOOL charmode, const char *name, prs_struct *ps, int depth, BUFFER2 *str)
|
||||
BOOL prs_regval_buffer(BOOL charmode, const char *name, prs_struct *ps, int depth, REGVAL_BUFFER *buf)
|
||||
{
|
||||
char *p;
|
||||
char *q = prs_mem_get(ps, str->buf_len);
|
||||
char *q = prs_mem_get(ps, buf->buf_len);
|
||||
if (q == NULL)
|
||||
return False;
|
||||
|
||||
if (UNMARSHALLING(ps)) {
|
||||
if (str->buf_len > str->buf_max_len) {
|
||||
if (buf->buf_len > buf->buf_max_len) {
|
||||
return False;
|
||||
}
|
||||
if ( str->buf_max_len ) {
|
||||
str->buffer = PRS_ALLOC_MEM(ps, uint16, str->buf_max_len);
|
||||
if ( str->buffer == NULL )
|
||||
if ( buf->buf_max_len ) {
|
||||
buf->buffer = PRS_ALLOC_MEM(ps, uint16, buf->buf_max_len);
|
||||
if ( buf->buffer == NULL )
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
p = (char *)str->buffer;
|
||||
p = (char *)buf->buffer;
|
||||
|
||||
dbg_rw_punival(charmode, name, depth, ps, q, p, str->buf_len/2);
|
||||
ps->data_offset += str->buf_len;
|
||||
dbg_rw_punival(charmode, name, depth, ps, q, p, buf->buf_len/2);
|
||||
ps->data_offset += buf->buf_len;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,7 +36,7 @@ interface/version dce/rpc pipe identification
|
||||
0x8a885d04, 0x1ceb, 0x11c9, \
|
||||
{ 0x9f, 0xe8 }, \
|
||||
{ 0x08, 0x00, \
|
||||
0x2b, 0x10, 0x48, 0x60 } \
|
||||
0x2b, 0x10, 0x48, 0x60 } \
|
||||
}, 0x02 \
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ interface/version dce/rpc pipe identification
|
||||
0x8a885d04, 0x1ceb, 0x11c9, \
|
||||
{ 0x9f, 0xe8 }, \
|
||||
{ 0x08, 0x00, \
|
||||
0x2b, 0x10, 0x48, 0x60 } \
|
||||
0x2b, 0x10, 0x48, 0x60 } \
|
||||
}, 0x02 \
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ interface/version dce/rpc pipe identification
|
||||
0x6bffd098, 0xa112, 0x3610, \
|
||||
{ 0x98, 0x33 }, \
|
||||
{ 0x46, 0xc3, \
|
||||
0xf8, 0x7e, 0x34, 0x5a } \
|
||||
0xf8, 0x7e, 0x34, 0x5a } \
|
||||
}, 0x01 \
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ interface/version dce/rpc pipe identification
|
||||
0x4b324fc8, 0x1670, 0x01d3, \
|
||||
{ 0x12, 0x78 }, \
|
||||
{ 0x5a, 0x47, \
|
||||
0xbf, 0x6e, 0xe1, 0x88 } \
|
||||
0xbf, 0x6e, 0xe1, 0x88 } \
|
||||
}, 0x03 \
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ interface/version dce/rpc pipe identification
|
||||
0x12345778, 0x1234, 0xabcd, \
|
||||
{ 0xef, 0x00 }, \
|
||||
{ 0x01, 0x23, \
|
||||
0x45, 0x67, 0x89, 0xab } \
|
||||
0x45, 0x67, 0x89, 0xab } \
|
||||
}, 0x00 \
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ interface/version dce/rpc pipe identification
|
||||
0x3919286a, 0xb10c, 0x11d0, \
|
||||
{ 0x9b, 0xa8 }, \
|
||||
{ 0x00, 0xc0, \
|
||||
0x4f, 0xd9, 0x2e, 0xf5 } \
|
||||
0x4f, 0xd9, 0x2e, 0xf5 } \
|
||||
}, 0x00 \
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ interface/version dce/rpc pipe identification
|
||||
0x12345778, 0x1234, 0xabcd, \
|
||||
{ 0xef, 0x00 }, \
|
||||
{ 0x01, 0x23, \
|
||||
0x45, 0x67, 0x89, 0xac } \
|
||||
0x45, 0x67, 0x89, 0xac } \
|
||||
}, 0x01 \
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ interface/version dce/rpc pipe identification
|
||||
0x12345678, 0x1234, 0xabcd, \
|
||||
{ 0xef, 0x00 }, \
|
||||
{ 0x01, 0x23, \
|
||||
0x45, 0x67, 0xcf, 0xfb } \
|
||||
0x45, 0x67, 0xcf, 0xfb } \
|
||||
}, 0x01 \
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ interface/version dce/rpc pipe identification
|
||||
0x338cd001, 0x2244, 0x31f1, \
|
||||
{ 0xaa, 0xaa }, \
|
||||
{ 0x90, 0x00, \
|
||||
0x38, 0x00, 0x10, 0x03 } \
|
||||
0x38, 0x00, 0x10, 0x03 } \
|
||||
}, 0x01 \
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ interface/version dce/rpc pipe identification
|
||||
0x12345678, 0x1234, 0xabcd, \
|
||||
{ 0xef, 0x00 }, \
|
||||
{ 0x01, 0x23, \
|
||||
0x45, 0x67, 0x89, 0xab } \
|
||||
0x45, 0x67, 0x89, 0xab } \
|
||||
}, 0x01 \
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ interface/version dce/rpc pipe identification
|
||||
0x0, 0x0, 0x0, \
|
||||
{ 0x00, 0x00 }, \
|
||||
{ 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00 } \
|
||||
0x00, 0x00, 0x00, 0x00 } \
|
||||
}, 0x00 \
|
||||
}
|
||||
|
||||
@ -170,6 +170,27 @@ interface/version dce/rpc pipe identification
|
||||
}, 0x01 \
|
||||
}
|
||||
|
||||
#define SYNT_SVCCTL_V2 \
|
||||
{ \
|
||||
{ \
|
||||
0x367abb81, 0x9844, 0x35f1, \
|
||||
{ 0xad, 0x32 }, \
|
||||
{ 0x98, 0xf0, \
|
||||
0x38, 0x00, 0x10, 0x03 } \
|
||||
}, 0x02 \
|
||||
}
|
||||
|
||||
|
||||
#define SYNT_EVENTLOG_V0 \
|
||||
{ \
|
||||
{ \
|
||||
0x82273fdc, 0xe32a, 0x18c3, \
|
||||
{ 0x3f, 0x78 }, \
|
||||
{ 0x82, 0x79, \
|
||||
0x29, 0xdc, 0x23, 0xea } \
|
||||
}, 0x00 \
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPORTANT!! If you update this structure, make sure to
|
||||
* update the index #defines in smb.h.
|
||||
@ -189,6 +210,8 @@ const struct pipe_id_info pipe_names [] =
|
||||
{ PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 },
|
||||
{ PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 },
|
||||
{ PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 },
|
||||
{ PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 },
|
||||
{ PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 },
|
||||
{ NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 }
|
||||
};
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Unix SMB/CIFS implementation.
|
||||
* RPC Pipe client / server routines
|
||||
* Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
|
||||
* Copyright (C) Gerald (Jerry) Carter 2002-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
|
||||
@ -30,12 +31,11 @@ Inits a structure.
|
||||
void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg,
|
||||
uint32 timeout, BOOL do_reboot, BOOL force)
|
||||
{
|
||||
q_s->ptr_server = 1;
|
||||
q_s->server = 1;
|
||||
q_s->ptr_msg = 1;
|
||||
q_s->server = TALLOC_P( get_talloc_ctx(), uint16 );
|
||||
*q_s->server = 0x1;
|
||||
|
||||
init_unistr2(&q_s->uni_msg, msg, UNI_FLAGS_NONE);
|
||||
init_uni_hdr(&q_s->hdr_msg, &q_s->uni_msg);
|
||||
q_s->message = TALLOC_P( get_talloc_ctx(), UNISTR4 );
|
||||
init_unistr4( q_s->message, msg, UNI_FLAGS_NONE );
|
||||
|
||||
q_s->timeout = timeout;
|
||||
|
||||
@ -43,6 +43,29 @@ void init_shutdown_q_init(SHUTDOWN_Q_INIT *q_s, const char *msg,
|
||||
q_s->force = force ? 1 : 0;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
void init_shutdown_q_init_ex(SHUTDOWN_Q_INIT_EX * q_u_ex, const char *msg,
|
||||
uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason)
|
||||
{
|
||||
SHUTDOWN_Q_INIT q_u;
|
||||
|
||||
ZERO_STRUCT( q_u );
|
||||
|
||||
init_shutdown_q_init( &q_u, msg, timeout, do_reboot, force );
|
||||
|
||||
/* steal memory */
|
||||
|
||||
q_u_ex->server = q_u.server;
|
||||
q_u_ex->message = q_u.message;
|
||||
|
||||
q_u_ex->reboot = q_u.reboot;
|
||||
q_u_ex->force = q_u.force;
|
||||
|
||||
q_u_ex->reason = reason;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
@ -59,30 +82,24 @@ BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps,
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server)))
|
||||
return False;
|
||||
if (!prs_uint16("server", ps, depth, &(q_s->server)))
|
||||
if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
if (!prs_uint32("ptr_msg", ps, depth, &(q_s->ptr_msg)))
|
||||
if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
|
||||
return False;
|
||||
|
||||
if (!smb_io_unihdr("hdr_msg", &(q_s->hdr_msg), ps, depth))
|
||||
return False;
|
||||
if (!smb_io_unistr2("uni_msg", &(q_s->uni_msg), q_s->hdr_msg.buffer, ps, depth))
|
||||
return False;
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("timeout", ps, depth, &(q_s->timeout)))
|
||||
return False;
|
||||
|
||||
if (!prs_uint8("force ", ps, depth, &(q_s->force)))
|
||||
return False;
|
||||
if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot)))
|
||||
return False;
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
@ -101,20 +118,83 @@ BOOL shutdown_io_r_init(const char *desc, SHUTDOWN_R_INIT* r_s, prs_struct *ps,
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_ntstatus("status", ps, depth, &r_s->status))
|
||||
if(!prs_werror("status", ps, depth, &r_s->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a REG_Q_SHUTDOWN_EX structure.
|
||||
********************************************************************/
|
||||
|
||||
BOOL shutdown_io_q_init_ex(const char *desc, SHUTDOWN_Q_INIT_EX * q_s, prs_struct *ps,
|
||||
int depth)
|
||||
{
|
||||
if (q_s == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "shutdown_io_q_init_ex");
|
||||
depth++;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
|
||||
return False;
|
||||
|
||||
if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("timeout", ps, depth, &(q_s->timeout)))
|
||||
return False;
|
||||
|
||||
if (!prs_uint8("force ", ps, depth, &(q_s->force)))
|
||||
return False;
|
||||
if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot)))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
if (!prs_uint32("reason", ps, depth, &(q_s->reason)))
|
||||
return False;
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a REG_R_SHUTDOWN_EX structure.
|
||||
********************************************************************/
|
||||
BOOL shutdown_io_r_init_ex(const char *desc, SHUTDOWN_R_INIT_EX * r_s, prs_struct *ps,
|
||||
int depth)
|
||||
{
|
||||
if (r_s == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "shutdown_io_r_init_ex");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_s->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Inits a structure.
|
||||
********************************************************************/
|
||||
void init_shutdown_q_abort(SHUTDOWN_Q_ABORT *q_s)
|
||||
{
|
||||
|
||||
q_s->ptr_server = 0;
|
||||
|
||||
q_s->server = TALLOC_P( get_talloc_ctx(), uint16 );
|
||||
*q_s->server = 0x1;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
@ -132,11 +212,8 @@ BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s,
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("ptr_server", ps, depth, &(q_s->ptr_server)))
|
||||
if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
|
||||
return False;
|
||||
if (q_s->ptr_server != 0)
|
||||
if (!prs_uint16("server", ps, depth, &(q_s->server)))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
@ -156,7 +233,7 @@ BOOL shutdown_io_r_abort(const char *desc, SHUTDOWN_R_ABORT *r_s,
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_ntstatus("status", ps, depth, &r_s->status))
|
||||
if (!prs_werror("status", ps, depth, &r_s->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
|
@ -550,23 +550,22 @@ static BOOL smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_st
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static BOOL spool_io_user_level_1(const char *desc, SPOOL_USER_1 *q_u, prs_struct *ps, int depth)
|
||||
BOOL spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u )
|
||||
{
|
||||
prs_debug(ps, depth, desc, "");
|
||||
depth++;
|
||||
|
||||
/* reading */
|
||||
if (UNMARSHALLING(ps))
|
||||
ZERO_STRUCTP(q_u);
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("size", ps, depth, &q_u->size))
|
||||
return False;
|
||||
if (!prs_uint32("client_name_ptr", ps, depth, &q_u->client_name_ptr))
|
||||
|
||||
if (!prs_io_unistr2_p("", ps, depth, &q_u->client_name))
|
||||
return False;
|
||||
if (!prs_uint32("user_name_ptr", ps, depth, &q_u->user_name_ptr))
|
||||
if (!prs_io_unistr2_p("", ps, depth, &q_u->user_name))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("build", ps, depth, &q_u->build))
|
||||
return False;
|
||||
if (!prs_uint32("major", ps, depth, &q_u->major))
|
||||
@ -576,11 +575,12 @@ static BOOL spool_io_user_level_1(const char *desc, SPOOL_USER_1 *q_u, prs_struc
|
||||
if (!prs_uint32("processor", ps, depth, &q_u->processor))
|
||||
return False;
|
||||
|
||||
if (!smb_io_unistr2("", &q_u->client_name, q_u->client_name_ptr, ps, depth))
|
||||
if (!prs_io_unistr2("", ps, depth, q_u->client_name))
|
||||
return False;
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
if (!smb_io_unistr2("", &q_u->user_name, q_u->user_name_ptr, ps, depth))
|
||||
|
||||
if (!prs_io_unistr2("", ps, depth, q_u->user_name))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
@ -600,21 +600,20 @@ static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struc
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
/* From looking at many captures in ethereal, it looks like
|
||||
the level and ptr fields should be transposed. -tpot */
|
||||
|
||||
if (!prs_uint32("level", ps, depth, &q_u->level))
|
||||
return False;
|
||||
if (!prs_uint32("ptr", ps, depth, &q_u->ptr))
|
||||
return False;
|
||||
|
||||
switch (q_u->level) {
|
||||
case 1:
|
||||
if (!spool_io_user_level_1("", &q_u->user1, ps, depth))
|
||||
return False;
|
||||
break;
|
||||
default:
|
||||
return False;
|
||||
switch ( q_u->level )
|
||||
{
|
||||
case 1:
|
||||
if ( !prs_pointer( "" , ps, depth, (void**)&q_u->user.user1,
|
||||
sizeof(SPOOL_USER_1), (PRS_POINTER_CAST)spool_io_user_level_1 ))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
@ -899,30 +898,31 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u,
|
||||
const fstring user_name)
|
||||
{
|
||||
DEBUG(5,("make_spoolss_q_open_printer_ex\n"));
|
||||
q_u->printername_ptr = (printername!=NULL)?1:0;
|
||||
init_unistr2(&q_u->printername, printername, UNI_STR_TERMINATE);
|
||||
|
||||
q_u->printername = TALLOC_P( get_talloc_ctx(), UNISTR2 );
|
||||
init_unistr2(q_u->printername, printername, UNI_STR_TERMINATE);
|
||||
|
||||
q_u->printer_default.datatype_ptr = 0;
|
||||
/*
|
||||
q_u->printer_default.datatype_ptr = (datatype!=NULL)?1:0;
|
||||
init_unistr2(&q_u->printer_default.datatype, datatype, UNI_FLAGS_NONE);
|
||||
*/
|
||||
|
||||
q_u->printer_default.devmode_cont.size=0;
|
||||
q_u->printer_default.devmode_cont.devmode_ptr=0;
|
||||
q_u->printer_default.devmode_cont.devmode=NULL;
|
||||
q_u->printer_default.access_required=access_required;
|
||||
q_u->user_switch=1;
|
||||
q_u->user_ctr.level=1;
|
||||
q_u->user_ctr.ptr=1;
|
||||
q_u->user_ctr.user1.size=strlen(clientname)+strlen(user_name)+10;
|
||||
q_u->user_ctr.user1.client_name_ptr = (clientname!=NULL)?1:0;
|
||||
q_u->user_ctr.user1.user_name_ptr = (user_name!=NULL)?1:0;
|
||||
q_u->user_ctr.user1.build=1381;
|
||||
q_u->user_ctr.user1.major=2;
|
||||
q_u->user_ctr.user1.minor=0;
|
||||
q_u->user_ctr.user1.processor=0;
|
||||
init_unistr2(&q_u->user_ctr.user1.client_name, clientname, UNI_STR_TERMINATE);
|
||||
init_unistr2(&q_u->user_ctr.user1.user_name, user_name, UNI_STR_TERMINATE);
|
||||
|
||||
q_u->user_switch = 1;
|
||||
|
||||
q_u->user_ctr.level = 1;
|
||||
q_u->user_ctr.user.user1->size = strlen(clientname) + strlen(user_name) + 10;
|
||||
q_u->user_ctr.user.user1->build = 1381;
|
||||
q_u->user_ctr.user.user1->major = 2;
|
||||
q_u->user_ctr.user.user1->minor = 0;
|
||||
q_u->user_ctr.user.user1->processor = 0;
|
||||
|
||||
q_u->user_ctr.user.user1->client_name = TALLOC_P( get_talloc_ctx(), UNISTR2 );
|
||||
q_u->user_ctr.user.user1->user_name = TALLOC_P( get_talloc_ctx(), UNISTR2 );
|
||||
|
||||
init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE);
|
||||
init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE);
|
||||
|
||||
return True;
|
||||
}
|
||||
@ -931,23 +931,19 @@ BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u,
|
||||
* init a structure.
|
||||
********************************************************************/
|
||||
|
||||
BOOL make_spoolss_q_addprinterex(
|
||||
TALLOC_CTX *mem_ctx,
|
||||
SPOOL_Q_ADDPRINTEREX *q_u,
|
||||
const char *srv_name,
|
||||
const char* clientname,
|
||||
const char* user_name,
|
||||
uint32 level,
|
||||
PRINTER_INFO_CTR *ctr)
|
||||
BOOL make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u,
|
||||
const char *srv_name, const char* clientname, const char* user_name,
|
||||
uint32 level, PRINTER_INFO_CTR *ctr)
|
||||
{
|
||||
DEBUG(5,("make_spoolss_q_addprinterex\n"));
|
||||
|
||||
if (!ctr) return False;
|
||||
if (!ctr)
|
||||
return False;
|
||||
|
||||
ZERO_STRUCTP(q_u);
|
||||
|
||||
q_u->server_name_ptr = (srv_name!=NULL)?1:0;
|
||||
init_unistr2(&q_u->server_name, srv_name, UNI_FLAGS_NONE);
|
||||
q_u->server_name = TALLOC_P( mem_ctx, UNISTR2 );
|
||||
init_unistr2(q_u->server_name, srv_name, UNI_FLAGS_NONE);
|
||||
|
||||
q_u->level = level;
|
||||
|
||||
@ -967,18 +963,20 @@ BOOL make_spoolss_q_addprinterex(
|
||||
|
||||
q_u->user_switch=1;
|
||||
|
||||
q_u->user_ctr.level=1;
|
||||
q_u->user_ctr.ptr=1;
|
||||
q_u->user_ctr.user1.client_name_ptr = (clientname!=NULL)?1:0;
|
||||
q_u->user_ctr.user1.user_name_ptr = (user_name!=NULL)?1:0;
|
||||
q_u->user_ctr.user1.build=1381;
|
||||
q_u->user_ctr.user1.major=2;
|
||||
q_u->user_ctr.user1.minor=0;
|
||||
q_u->user_ctr.user1.processor=0;
|
||||
init_unistr2(&q_u->user_ctr.user1.client_name, clientname, UNI_STR_TERMINATE);
|
||||
init_unistr2(&q_u->user_ctr.user1.user_name, user_name, UNI_STR_TERMINATE);
|
||||
q_u->user_ctr.user1.size=q_u->user_ctr.user1.user_name.uni_str_len +
|
||||
q_u->user_ctr.user1.client_name.uni_str_len + 2;
|
||||
q_u->user_ctr.level = 1;
|
||||
q_u->user_ctr.user.user1->build = 1381;
|
||||
q_u->user_ctr.user.user1->major = 2;
|
||||
q_u->user_ctr.user.user1->minor = 0;
|
||||
q_u->user_ctr.user.user1->processor = 0;
|
||||
|
||||
q_u->user_ctr.user.user1->client_name = TALLOC_P( mem_ctx, UNISTR2 );
|
||||
q_u->user_ctr.user.user1->user_name = TALLOC_P( mem_ctx, UNISTR2 );
|
||||
|
||||
init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE);
|
||||
init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE);
|
||||
|
||||
q_u->user_ctr.user.user1->size = q_u->user_ctr.user.user1->user_name->uni_str_len +
|
||||
q_u->user_ctr.user.user1->client_name->uni_str_len + 2;
|
||||
|
||||
return True;
|
||||
}
|
||||
@ -1102,9 +1100,9 @@ BOOL spoolss_io_q_open_printer(const char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("printername_ptr", ps, depth, &q_u->printername_ptr))
|
||||
if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->printername))
|
||||
return False;
|
||||
if (!smb_io_unistr2("", &q_u->printername, q_u->printername_ptr, ps,depth))
|
||||
if (!prs_io_unistr2("printername", ps, depth, q_u->printername))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
@ -1158,9 +1156,9 @@ BOOL spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("printername_ptr", ps, depth, &q_u->printername_ptr))
|
||||
if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->printername))
|
||||
return False;
|
||||
if (!smb_io_unistr2("", &q_u->printername, q_u->printername_ptr, ps,depth))
|
||||
if (!prs_io_unistr2("printername", ps, depth, q_u->printername))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
@ -4645,9 +4643,10 @@ BOOL spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
if(!prs_uint32("", ps, depth, &q_u->server_name_ptr))
|
||||
|
||||
if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->server_name))
|
||||
return False;
|
||||
if(!smb_io_unistr2("", &q_u->server_name, q_u->server_name_ptr, ps, depth))
|
||||
if (!prs_io_unistr2("servername", ps, depth, q_u->server_name))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
|
665
source/rpc_parse/parse_svcctl.c
Normal file
665
source/rpc_parse/parse_svcctl.c
Normal file
@ -0,0 +1,665 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* RPC Pipe client / server routines
|
||||
* Copyright (C) Gerald (Jerry) Carter 2005.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_RPC_PARSE
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static BOOL svcctl_io_service_status( const char *desc, SERVICE_STATUS *status, prs_struct *ps, int depth )
|
||||
{
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_service_status");
|
||||
depth++;
|
||||
|
||||
if(!prs_uint32("type", ps, depth, &status->type))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("state", ps, depth, &status->state))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("controls_accepted", ps, depth, &status->controls_accepted))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("win32_exit_code", ps, depth, &status->win32_exit_code))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("service_exit_code", ps, depth, &status->service_exit_code))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("check_point", ps, depth, &status->check_point))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("wait_hint", ps, depth, &status->wait_hint))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static BOOL svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, prs_struct *ps, int depth )
|
||||
{
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_service_config");
|
||||
depth++;
|
||||
|
||||
if(!prs_uint32("service_type", ps, depth, &config->service_type))
|
||||
return False;
|
||||
if(!prs_uint32("start_type", ps, depth, &config->start_type))
|
||||
return False;
|
||||
if(!prs_uint32("error_control", ps, depth, &config->error_control))
|
||||
return False;
|
||||
|
||||
if (!prs_io_unistr2_p("", ps, depth, &config->executablepath))
|
||||
return False;
|
||||
if (!prs_io_unistr2_p("", ps, depth, &config->loadordergroup))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("tag_id", ps, depth, &config->tag_id))
|
||||
return False;
|
||||
|
||||
if (!prs_io_unistr2_p("", ps, depth, &config->dependencies))
|
||||
return False;
|
||||
if (!prs_io_unistr2_p("", ps, depth, &config->startname))
|
||||
return False;
|
||||
if (!prs_io_unistr2_p("", ps, depth, &config->displayname))
|
||||
return False;
|
||||
|
||||
if (!prs_io_unistr2("", ps, depth, config->executablepath))
|
||||
return False;
|
||||
if (!prs_io_unistr2("", ps, depth, config->loadordergroup))
|
||||
return False;
|
||||
if (!prs_io_unistr2("", ps, depth, config->dependencies))
|
||||
return False;
|
||||
if (!prs_io_unistr2("", ps, depth, config->startname))
|
||||
return False;
|
||||
if (!prs_io_unistr2("", ps, depth, config->displayname))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth )
|
||||
{
|
||||
prs_struct *ps=&buffer->prs;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_enum_services_status");
|
||||
depth++;
|
||||
|
||||
if ( !smb_io_relstr("servicename", buffer, depth, &enum_status->servicename) )
|
||||
return False;
|
||||
if ( !smb_io_relstr("displayname", buffer, depth, &enum_status->displayname) )
|
||||
return False;
|
||||
|
||||
if ( !svcctl_io_service_status("svc_status", &enum_status->status, ps, depth) )
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status )
|
||||
{
|
||||
uint32 size = 0;
|
||||
|
||||
size += size_of_relative_string( &status->servicename );
|
||||
size += size_of_relative_string( &status->displayname );
|
||||
size += sizeof(SERVICE_STATUS);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_close_service(const char *desc, SVCCTL_Q_CLOSE_SERVICE *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_close_service");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_close_service(const char *desc, SVCCTL_R_CLOSE_SERVICE *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_close_service");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_open_scmanager(const char *desc, SVCCTL_Q_OPEN_SCMANAGER *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_open_scmanager");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("srv_ptr", ps, depth, &q_u->ptr_srv))
|
||||
return False;
|
||||
if(!smb_io_unistr2("servername", &q_u->servername, q_u->ptr_srv, ps, depth))
|
||||
return False;
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("db_ptr", ps, depth, &q_u->ptr_db))
|
||||
return False;
|
||||
if(!smb_io_unistr2("database", &q_u->database, q_u->ptr_db, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_open_scmanager(const char *desc, SVCCTL_R_OPEN_SCMANAGER *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_open_scmanager");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("scm_pol", &r_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_get_display_name(const char *desc, SVCCTL_Q_GET_DISPLAY_NAME *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_get_display_name");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!smb_io_unistr2("servicename", &q_u->servicename, 1, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("display_name_len", ps, depth, &q_u->display_name_len))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL init_svcctl_r_get_display_name( SVCCTL_R_GET_DISPLAY_NAME *r_u, const char *displayname )
|
||||
{
|
||||
r_u->display_name_len = strlen(displayname);
|
||||
init_unistr2( &r_u->displayname, displayname, UNI_STR_TERMINATE );
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_get_display_name(const char *desc, SVCCTL_R_GET_DISPLAY_NAME *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_get_display_name");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
|
||||
if(!smb_io_unistr2("displayname", &r_u->displayname, 1, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("display_name_len", ps, depth, &r_u->display_name_len))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_open_service(const char *desc, SVCCTL_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_open_service");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!smb_io_unistr2("servicename", &q_u->servicename, 1, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_open_service(const char *desc, SVCCTL_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_open_service");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("service_pol", &r_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_query_status(const char *desc, SVCCTL_Q_QUERY_STATUS *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_query_status");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_query_status(const char *desc, SVCCTL_R_QUERY_STATUS *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_query_status");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!svcctl_io_service_status("service_status", &r_u->svc_status, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_enum_services_status");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("type", ps, depth, &q_u->type))
|
||||
return False;
|
||||
if(!prs_uint32("state", ps, depth, &q_u->state))
|
||||
return False;
|
||||
if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
|
||||
return False;
|
||||
|
||||
if(!prs_pointer("resume", ps, depth, (void**)&q_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_STATUS *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_enum_services_status");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("needed", ps, depth, &r_u->needed))
|
||||
return False;
|
||||
if(!prs_uint32("returned", ps, depth, &r_u->returned))
|
||||
return False;
|
||||
|
||||
if(!prs_pointer("resume", ps, depth, (void**)&r_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_start_service(const char *desc, SVCCTL_Q_START_SERVICE *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_start_service");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("parmcount", ps, depth, &q_u->parmcount))
|
||||
return False;
|
||||
|
||||
if(!smb_io_unistr2_array("parameters", &q_u->parameters, ps, depth))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_start_service(const char *desc, SVCCTL_R_START_SERVICE *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_start_service");
|
||||
depth++;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_enum_dependent_services(const char *desc, SVCCTL_Q_ENUM_DEPENDENT_SERVICES *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_enum_dependent_services");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("state", ps, depth, &q_u->state))
|
||||
return False;
|
||||
if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_enum_dependent_services");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("needed", ps, depth, &r_u->needed))
|
||||
return False;
|
||||
if(!prs_uint32("returned", ps, depth, &r_u->returned))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_control_service(const char *desc, SVCCTL_Q_CONTROL_SERVICE *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_control_service");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("control", ps, depth, &q_u->control))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_control_service(const char *desc, SVCCTL_R_CONTROL_SERVICE *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_control_service");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!svcctl_io_service_status("service_status", &r_u->svc_status, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
BOOL svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!svcctl_io_service_config("config", &r_u->config, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("needed", ps, depth, &r_u->needed))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user