1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

return results on prs_xxxxx() and all xxx_io_xxx() routines.

the whole task is not complete, yet.  xxx_io_xxx() routines that
_call_ xxx_io_xxx() routines not done.

prs_xxxx() covered by macros.  considering doing xxx_io_xxxx in the same way.
(This used to be commit 3b583f7be5)
This commit is contained in:
Luke Leighton 1999-10-15 18:46:22 +00:00
parent 415f84112e
commit 896ecb48ca
16 changed files with 3328 additions and 1868 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,43 @@
#ifndef _RPC_MISC_H /* _RPC_MISC_H */
#define _RPC_MISC_H
/*
* macros to wrap prs_xxxx routines.
*/
#define prs_uint8(name, ps, depth, data8) \
if (!_prs_uint8(name, ps, depth, data8)) return False
#define prs_uint16(name, ps, depth, data16) \
if (!_prs_uint16(name, ps, depth, data16)) return False
#define prs_hash1(ps, offset, sess_key) \
if (!_prs_hash1(ps, offset, sess_key)) return False
#define prs_uint32(name, ps, depth, data32) \
if (!_prs_uint32(name, ps, depth, data32)) return False
#define prs_uint8s(charmode, name, ps, depth, data8s, len) \
if (!_prs_uint8s(charmode, name, ps, depth, data8s, len)) return False
#define prs_uint16s(charmode, name, ps, depth, data16s, len) \
if (!_prs_uint16s(charmode, name, ps, depth, data16s, len)) return False
#define prs_uint32s(charmode, name, ps, depth, data32s, len) \
if (!_prs_uint32s(charmode, name, ps, depth, data32s, len)) return False
#define prs_buffer2(charmode, name, ps, depth, str) \
if (!_prs_buffer2(charmode, name, ps, depth, str)) return False
#define prs_string2(charmode, name, ps, depth, str) \
if (!_prs_string2(charmode, name, ps, depth, str)) return False
#define prs_unistr2(charmode, name, ps, depth, str) \
if (!_prs_unistr2(charmode, name, ps, depth, str)) return False
#define prs_unistr3(charmode, name, str, ps, depth) \
if (!_prs_unistr3(charmode, name, str, ps, depth)) return False
#define prs_unistr(name, ps, depth, str) \
if (!_prs_unistr(name, ps, depth, str)) return False
#define prs_string(name, ps, depth, str, len, max_buf_size) \
if (!_prs_string(name, ps, depth, str, len, max_buf_size)) return False
#define prs_uint16_pre(name, ps, depth, data16, offset) \
if (!_prs_uint16_pre(name, ps, depth, data16, offset)) return False
#define prs_uint16_post(name, ps, depth, data16, ptr_uint16, data_size) \
if (!_prs_uint16_post(name, ps, depth, data16, ptr_uint16, data_size)) return False
#define prs_uint32_pre(name, ps, depth, data32, offset) \
if (!_prs_uint32_pre(name, ps, depth, data32, offset)) return False
#define prs_uint32_post(name, ps, depth, data32, ptr_uint32, data_size) \
if (!_prs_uint32_post(name, ps, depth, data32, ptr_uint32, data_size)) return False
#include "rpc_dce.h"

View File

@ -28,7 +28,7 @@ extern int DEBUGLEVEL;
/*******************************************************************
make_at_q_add_job
********************************************************************/
void make_at_q_add_job(AT_Q_ADD_JOB *q_a, char *server,
BOOL make_at_q_add_job(AT_Q_ADD_JOB *q_a, char *server,
AT_JOB_INFO *info, char *command)
{
DEBUG(5,("make_at_q_add_job\n"));
@ -36,14 +36,16 @@ void make_at_q_add_job(AT_Q_ADD_JOB *q_a, char *server,
make_buf_unistr2(&(q_a->uni_srv_name), &(q_a->ptr_srv_name), server);
memcpy(&(q_a->info), info, sizeof(q_a->info));
make_unistr2(&(q_a->command), command, strlen(command)+1);
return True;
}
/*******************************************************************
reads or writes a AT_JOB_INFO structure.
********************************************************************/
void at_io_job_info(char *desc, AT_JOB_INFO *info, prs_struct *ps, int depth)
BOOL at_io_job_info(char *desc, AT_JOB_INFO *info, prs_struct *ps, int depth)
{
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "at_io_job_info");
depth++;
@ -57,14 +59,16 @@ void at_io_job_info(char *desc, AT_JOB_INFO *info, prs_struct *ps, int depth)
prs_align(ps);
prs_uint32("ptr_command", ps, depth, &(info->ptr_command));
return True;
}
/*******************************************************************
reads or writes a AT_Q_ADD_JOB structure.
********************************************************************/
void at_io_q_add_job(char *desc, AT_Q_ADD_JOB *q_a, prs_struct *ps, int depth)
BOOL at_io_q_add_job(char *desc, AT_Q_ADD_JOB *q_a, prs_struct *ps, int depth)
{
if (q_a == NULL) return;
if (q_a == NULL) return False;
prs_debug(ps, depth, desc, "at_q_add_job");
depth++;
@ -74,14 +78,16 @@ void at_io_q_add_job(char *desc, AT_Q_ADD_JOB *q_a, prs_struct *ps, int depth)
smb_io_unistr2("", &(q_a->uni_srv_name), q_a->ptr_srv_name, ps, depth);
at_io_job_info("", &(q_a->info), ps, depth);
smb_io_unistr2("", &(q_a->command), q_a->info.ptr_command, ps, depth);
return True;
}
/*******************************************************************
reads or writes a AT_R_ADD_JOB structure.
********************************************************************/
void at_io_r_add_job(char *desc, AT_R_ADD_JOB *r_a, prs_struct *ps, int depth)
BOOL at_io_r_add_job(char *desc, AT_R_ADD_JOB *r_a, prs_struct *ps, int depth)
{
if (r_a == NULL) return;
if (r_a == NULL) return False;
prs_debug(ps, depth, desc, "at_r_add_job");
depth++;
@ -89,12 +95,14 @@ void at_io_r_add_job(char *desc, AT_R_ADD_JOB *r_a, prs_struct *ps, int depth)
prs_align(ps);
prs_uint32("jobid", ps, depth, &(r_a->jobid));
prs_uint32("status", ps, depth, &(r_a->status));
return True;
}
/*******************************************************************
make_at_q_del_job
********************************************************************/
void make_at_q_del_job(AT_Q_DEL_JOB *q_a, char *server, uint32 min_jobid,
BOOL make_at_q_del_job(AT_Q_DEL_JOB *q_a, char *server, uint32 min_jobid,
uint32 max_jobid)
{
DEBUG(5,("make_at_q_del_job\n"));
@ -102,14 +110,16 @@ void make_at_q_del_job(AT_Q_DEL_JOB *q_a, char *server, uint32 min_jobid,
make_buf_unistr2(&(q_a->uni_srv_name), &(q_a->ptr_srv_name), server);
q_a->min_jobid = min_jobid;
q_a->max_jobid = max_jobid;
return True;
}
/*******************************************************************
reads or writes a AT_Q_DEL_JOB structure.
********************************************************************/
void at_io_q_del_job(char *desc, AT_Q_DEL_JOB *q_d, prs_struct *ps, int depth)
BOOL at_io_q_del_job(char *desc, AT_Q_DEL_JOB *q_d, prs_struct *ps, int depth)
{
if (q_d == NULL) return;
if (q_d == NULL) return False;
prs_debug(ps, depth, desc, "at_q_del_job");
depth++;
@ -121,26 +131,30 @@ void at_io_q_del_job(char *desc, AT_Q_DEL_JOB *q_d, prs_struct *ps, int depth)
prs_align(ps);
prs_uint32("min_jobid", ps, depth, &(q_d->min_jobid));
prs_uint32("max_jobid", ps, depth, &(q_d->max_jobid));
return True;
}
/*******************************************************************
reads or writes a AT_R_DEL_JOB structure.
********************************************************************/
void at_io_r_del_job(char *desc, AT_R_DEL_JOB *r_d, prs_struct *ps, int depth)
BOOL at_io_r_del_job(char *desc, AT_R_DEL_JOB *r_d, prs_struct *ps, int depth)
{
if (r_d == NULL) return;
if (r_d == NULL) return False;
prs_debug(ps, depth, desc, "at_r_del_job");
depth++;
prs_align(ps);
prs_uint32("status", ps, depth, &(r_d->status));
return True;
}
/*******************************************************************
make_at_q_enum_jobs
********************************************************************/
void make_at_q_enum_jobs(AT_Q_ENUM_JOBS *q_e, char *server)
BOOL make_at_q_enum_jobs(AT_Q_ENUM_JOBS *q_e, char *server)
{
DEBUG(5,("make_at_q_enum_jobs\n"));
@ -150,14 +164,16 @@ void make_at_q_enum_jobs(AT_Q_ENUM_JOBS *q_e, char *server)
q_e->max_len = 0xffff;
q_e->ptr_resume = 1;
q_e->hnd_resume = 0;
return True;
}
/*******************************************************************
reads or writes a AT_Q_ENUM_JOBS structure.
********************************************************************/
void at_io_q_enum_jobs(char *desc, AT_Q_ENUM_JOBS *q_e, prs_struct *ps, int depth)
BOOL at_io_q_enum_jobs(char *desc, AT_Q_ENUM_JOBS *q_e, prs_struct *ps, int depth)
{
if (q_e == NULL) return;
if (q_e == NULL) return False;
prs_debug(ps, depth, desc, "at_q_enum_jobs");
depth++;
@ -172,14 +188,16 @@ void at_io_q_enum_jobs(char *desc, AT_Q_ENUM_JOBS *q_e, prs_struct *ps, int dept
prs_uint32("ptr_resume", ps, depth, &(q_e->ptr_resume));
prs_uint32("hnd_resume", ps, depth, &(q_e->hnd_resume));
return True;
}
/*******************************************************************
reads or writes a AT_R_ENUM_JOBS structure.
********************************************************************/
void at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int depth)
BOOL at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int depth)
{
if (r_e == NULL) return;
if (r_e == NULL) return False;
prs_debug(ps, depth, desc, "at_r_enum_jobs");
depth++;
@ -196,7 +214,7 @@ void at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int dept
if (r_e->num_entries2 != r_e->num_entries)
{
/* RPC fault */
return;
return False;
}
SMB_ASSERT_ARRAY(r_e->info, r_e->num_entries2);
@ -222,25 +240,29 @@ void at_io_r_enum_jobs(char *desc, AT_R_ENUM_JOBS *r_e, prs_struct *ps, int dept
prs_uint32("hnd_resume" , ps, depth, &(r_e->hnd_resume ));
prs_uint32("status", ps, depth, &(r_e->status));
return True;
}
/*******************************************************************
make_at_q_query_job
********************************************************************/
void make_at_q_query_job(AT_Q_QUERY_JOB *q_q, char *server, uint32 jobid)
BOOL make_at_q_query_job(AT_Q_QUERY_JOB *q_q, char *server, uint32 jobid)
{
DEBUG(5,("make_at_q_query_job\n"));
make_buf_unistr2(&(q_q->uni_srv_name), &(q_q->ptr_srv_name), server);
q_q->jobid = jobid;
return True;
}
/*******************************************************************
reads or writes a AT_Q_QUERY_JOB structure.
********************************************************************/
void at_io_q_query_job(char *desc, AT_Q_QUERY_JOB *q_q, prs_struct *ps, int depth)
BOOL at_io_q_query_job(char *desc, AT_Q_QUERY_JOB *q_q, prs_struct *ps, int depth)
{
if (q_q == NULL) return;
if (q_q == NULL) return False;
prs_debug(ps, depth, desc, "at_q_query_job");
depth++;
@ -250,14 +272,16 @@ void at_io_q_query_job(char *desc, AT_Q_QUERY_JOB *q_q, prs_struct *ps, int dept
smb_io_unistr2("", &(q_q->uni_srv_name), q_q->ptr_srv_name, ps, depth);
prs_align(ps);
prs_uint32("jobid", ps, depth, &(q_q->jobid));
return True;
}
/*******************************************************************
reads or writes a AT_R_QUERY_JOB structure.
********************************************************************/
void at_io_r_query_job(char *desc, AT_R_QUERY_JOB *r_q, prs_struct *ps, int depth)
BOOL at_io_r_query_job(char *desc, AT_R_QUERY_JOB *r_q, prs_struct *ps, int depth)
{
if (r_q == NULL) return;
if (r_q == NULL) return False;
prs_debug(ps, depth, desc, "at_r_query_job");
depth++;
@ -272,4 +296,6 @@ void at_io_r_query_job(char *desc, AT_R_QUERY_JOB *r_q, prs_struct *ps, int dept
prs_align(ps);
prs_uint32("status", ps, depth, &(r_q->status));
return True;
}

View File

@ -2,8 +2,8 @@
* Unix SMB/Netbios implementation.
* Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1998,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1998,
* Copyright (C) Andrew Tridgell 1992-1999,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
* Copyright (C) Jean François Micouleau 1998-1999.
*
* This program is free software; you can redistribute it and/or modify
@ -27,7 +27,7 @@ extern int DEBUGLEVEL;
/*******************************************************************
********************************************************************/
void make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal, char *unk)
BOOL make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal, char *unk)
{
int len_journal = journal != NULL ? strlen(journal) : 0;
int len_unk = unk != NULL ? strlen(unk) : 0;
@ -44,11 +44,13 @@ void make_eventlog_q_open(EVENTLOG_Q_OPEN *q_u, char *journal, char *unk)
q_u->unk6=0x01;
q_u->unk7=0x01;
return True;
}
/*******************************************************************
********************************************************************/
void eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int depth)
BOOL eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "eventlog_io_q_open");
depth++;
@ -72,11 +74,13 @@ void eventlog_io_q_open(char *desc, EVENTLOG_Q_OPEN *q_u, prs_struct *ps, int de
prs_uint32("unk6", ps, depth, &(q_u->unk6));
prs_uint32("unk7", ps, depth, &(q_u->unk7));
return True;
}
/*******************************************************************
********************************************************************/
void eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int depth)
BOOL eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "eventlog_io_r_open");
depth++;
@ -84,29 +88,35 @@ void eventlog_io_r_open(char *desc, EVENTLOG_R_OPEN *r_u, prs_struct *ps, int de
prs_align(ps);
smb_io_pol_hnd("", &(r_u->pol), ps, depth);
prs_uint32("status", ps, depth, &(r_u->status));
return True;
}
/*******************************************************************
********************************************************************/
void make_eventlog_q_close(EVENTLOG_Q_CLOSE *q_u, POLICY_HND *pol)
BOOL make_eventlog_q_close(EVENTLOG_Q_CLOSE *q_u, POLICY_HND *pol)
{
memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data));
return True;
}
/*******************************************************************
********************************************************************/
void eventlog_io_q_close(char *desc, EVENTLOG_Q_CLOSE *q_u, prs_struct *ps, int depth)
BOOL eventlog_io_q_close(char *desc, EVENTLOG_Q_CLOSE *q_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "eventlog_io_q_close");
depth++;
prs_align(ps);
smb_io_pol_hnd("", &(q_u->pol), ps, depth);
return True;
}
/*******************************************************************
********************************************************************/
void eventlog_io_r_close(char *desc, EVENTLOG_R_CLOSE *r_u, prs_struct *ps, int depth)
BOOL eventlog_io_r_close(char *desc, EVENTLOG_R_CLOSE *r_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "eventlog_io_r_close");
depth++;
@ -114,19 +124,23 @@ void eventlog_io_r_close(char *desc, EVENTLOG_R_CLOSE *r_u, prs_struct *ps, int
prs_align(ps);
smb_io_pol_hnd("", &(r_u->pol), ps, depth);
prs_uint32("status", ps, depth, &(r_u->status));
return True;
}
/*******************************************************************
********************************************************************/
void make_eventlog_q_numofeventlogrec(EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, POLICY_HND *pol)
BOOL make_eventlog_q_numofeventlogrec(EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, POLICY_HND *pol)
{
memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data));
return True;
}
/*******************************************************************
********************************************************************/
void eventlog_io_q_numofeventlogrec(char *desc,EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, prs_struct *ps, int depth)
BOOL eventlog_io_q_numofeventlogrec(char *desc,EVENTLOG_Q_NUMOFEVENTLOGREC *q_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "eventlog_io_q_numofeventlogrec");
depth++;
@ -134,11 +148,13 @@ void eventlog_io_q_numofeventlogrec(char *desc,EVENTLOG_Q_NUMOFEVENTLOGREC *q_u
prs_align(ps);
smb_io_pol_hnd("", &(q_u->pol), ps, depth);
return True;
}
/*******************************************************************
********************************************************************/
void eventlog_io_r_numofeventlogrec(char *desc, EVENTLOG_R_NUMOFEVENTLOGREC *r_u, prs_struct *ps, int depth)
BOOL eventlog_io_r_numofeventlogrec(char *desc, EVENTLOG_R_NUMOFEVENTLOGREC *r_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "eventlog_io_r_numofeventlogrec");
depth++;
@ -146,22 +162,26 @@ void eventlog_io_r_numofeventlogrec(char *desc, EVENTLOG_R_NUMOFEVENTLOGREC *r_u
prs_align(ps);
prs_uint32("number", ps, depth, &(r_u->number));
prs_uint32("status", ps, depth, &(r_u->status));
return True;
}
/*******************************************************************
********************************************************************/
void make_eventlog_q_readeventlog(EVENTLOG_Q_READEVENTLOG *q_u, POLICY_HND *pol,
BOOL make_eventlog_q_readeventlog(EVENTLOG_Q_READEVENTLOG *q_u, POLICY_HND *pol,
uint32 flags, uint32 offset, uint32 number_of_bytes)
{
memcpy(&(q_u->pol.data), pol->data, sizeof(q_u->pol.data));
q_u->flags=flags;
q_u->offset=offset;
q_u->number_of_bytes=number_of_bytes;
return True;
}
/*******************************************************************
********************************************************************/
void eventlog_io_q_readeventlog(char *desc, EVENTLOG_Q_READEVENTLOG *q_u, prs_struct *ps, int depth)
BOOL eventlog_io_q_readeventlog(char *desc, EVENTLOG_Q_READEVENTLOG *q_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "eventlog_io_q_readeventlog");
depth++;
@ -171,11 +191,13 @@ void eventlog_io_q_readeventlog(char *desc, EVENTLOG_Q_READEVENTLOG *q_u, prs_st
prs_uint32("flags", ps, depth, &(q_u->flags));
prs_uint32("offset", ps, depth, &(q_u->offset));
prs_uint32("number_of_bytes", ps, depth, &(q_u->number_of_bytes));
return True;
}
/*******************************************************************
********************************************************************/
static void eventlog_io_eventlog(char *desc, EVENTLOGRECORD *ev, prs_struct *ps, int depth)
static BOOL eventlog_io_eventlog(char *desc, EVENTLOGRECORD *ev, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "eventlog_io_eventlog");
depth++;
@ -213,11 +235,13 @@ static void eventlog_io_eventlog(char *desc, EVENTLOGRECORD *ev, prs_struct *ps,
smb_io_unistr("", &(ev->data), ps, depth);
prs_uint32("size2", ps, depth, &(ev->size2));
return True;
}
/*******************************************************************
********************************************************************/
void eventlog_io_r_readeventlog(char *desc, EVENTLOG_R_READEVENTLOG *r_u, prs_struct *ps, int depth)
BOOL eventlog_io_r_readeventlog(char *desc, EVENTLOG_R_READEVENTLOG *r_u, prs_struct *ps, int depth)
{
prs_debug(ps, depth, desc, "eventlog_io_r_readeventlog");
depth++;
@ -231,5 +255,7 @@ void eventlog_io_r_readeventlog(char *desc, EVENTLOG_R_READEVENTLOG *r_u, prs_st
prs_uint32("sent_size", ps, depth, &(r_u->sent_size));
prs_uint32("real_size", ps, depth, &(r_u->real_size));
prs_uint32("status", ps, depth, &(r_u->status));
return True;
}

View File

@ -2,9 +2,9 @@
* Unix SMB/Netbios implementation.
* Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
* Copyright (C) Andrew Tridgell 1992-1999,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
* Copyright (C) Paul Ashton 1997-1999.
*
* 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
@ -29,7 +29,7 @@ extern int DEBUGLEVEL;
/*******************************************************************
creates a LSA_TRANS_NAME structure.
********************************************************************/
void make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
BOOL make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
uint32 sid_name_use, char *name, uint32 idx)
{
int len_name = strlen(name);
@ -38,14 +38,16 @@ void make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
make_uni_hdr(&(trn->hdr_name), len_name);
make_unistr2(uni_name, name, len_name);
trn->domain_idx = idx;
return True;
}
/*******************************************************************
reads or writes a LSA_TRANS_NAME structure.
********************************************************************/
static void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth)
static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth)
{
if (trn == NULL) return;
if (trn == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_trans_name");
depth++;
@ -55,19 +57,21 @@ static void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, i
prs_uint32("sid_name_use", ps, depth, &(trn->sid_name_use));
smb_io_unihdr ("hdr_name", &(trn->hdr_name), ps, depth);
prs_uint32("domain_idx ", ps, depth, &(trn->domain_idx ));
return True;
}
/*******************************************************************
reads or writes a DOM_R_REF structure.
********************************************************************/
static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth)
static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth)
{
int i, s, n;
prs_debug(ps, depth, desc, "smb_io_dom_r_ref");
depth++;
if (r_r == NULL) return;
if (r_r == NULL) return False;
prs_align(ps);
@ -112,16 +116,18 @@ static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int de
}
}
}
return True;
}
/*******************************************************************
makes an LSA_SEC_QOS structure.
********************************************************************/
void make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff,
BOOL make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff,
uint32 unknown)
{
if (qos == NULL) return;
if (qos == NULL) return False;
DEBUG(5,("make_lsa_sec_qos\n"));
@ -130,16 +136,18 @@ void make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff,
qos->sec_ctxt_mode = ctxt;
qos->effective_only = eff;
qos->unknown = unknown;
return True;
}
/*******************************************************************
reads or writes an LSA_SEC_QOS structure.
********************************************************************/
static void lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth)
static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth)
{
int start;
if (qos == NULL) return;
if (qos == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_obj_qos");
depth++;
@ -162,15 +170,17 @@ static void lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int de
DEBUG(3,("lsa_io_sec_qos: length %x does not match size %x\n",
qos->len, ps->offset - start));
}
return True;
}
/*******************************************************************
makes an LSA_OBJ_ATTR structure.
********************************************************************/
void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos)
BOOL make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos)
{
if (attr == NULL) return;
if (attr == NULL) return False;
DEBUG(5,("make_lsa_obj_attr\n"));
@ -190,16 +200,18 @@ void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos)
attr->ptr_sec_qos = 0;
attr->sec_qos = NULL;
}
return True;
}
/*******************************************************************
reads or writes an LSA_OBJ_ATTR structure.
********************************************************************/
static void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth)
static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth)
{
int start;
if (attr == NULL) return;
if (attr == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_obj_attr");
depth++;
@ -228,18 +240,20 @@ static void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int
{
lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth);
}
return True;
}
/*******************************************************************
makes an LSA_Q_OPEN_POL structure.
********************************************************************/
void make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name,
BOOL make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name,
uint32 attributes,
uint32 desired_access,
LSA_SEC_QOS *qos)
{
if (r_q == NULL) return;
if (r_q == NULL) return False;
DEBUG(5,("make_open_pol: attr:%d da:%d\n", attributes, desired_access));
@ -252,14 +266,16 @@ void make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name,
r_q->system_name = system_name;
make_lsa_obj_attr(&(r_q->attr ), attributes, qos);
return True;
}
/*******************************************************************
reads or writes an LSA_Q_OPEN_POL structure.
********************************************************************/
void lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth)
BOOL lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth)
{
if (r_q == NULL) return;
if (r_q == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_q_open_pol");
depth++;
@ -274,14 +290,16 @@ void lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int dep
{
prs_uint32("des_access", ps, depth, &(r_q->des_access));
}
return True;
}
/*******************************************************************
reads or writes an LSA_R_OPEN_POL structure.
********************************************************************/
void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth)
BOOL lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth)
{
if (r_p == NULL) return;
if (r_p == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_r_open_pol");
depth++;
@ -289,17 +307,19 @@ void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int dep
smb_io_pol_hnd("", &(r_p->pol), ps, depth);
prs_uint32("status", ps, depth, &(r_p->status));
return True;
}
/*******************************************************************
makes an LSA_Q_OPEN_POL2 structure.
********************************************************************/
void make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name,
BOOL make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name,
uint32 attributes,
uint32 desired_access,
LSA_SEC_QOS *qos)
{
if (r_q == NULL) return;
if (r_q == NULL) return False;
DEBUG(5,("make_open_pol2: attr:%d da:%d\n", attributes, desired_access));
@ -312,14 +332,16 @@ void make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name,
make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name));
make_lsa_obj_attr(&(r_q->attr ), attributes, qos);
return True;
}
/*******************************************************************
reads or writes an LSA_Q_OPEN_POL2 structure.
********************************************************************/
void lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth)
BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth)
{
if (r_q == NULL) return;
if (r_q == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_q_open_pol2");
depth++;
@ -333,14 +355,16 @@ void lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int d
{
prs_uint32("des_access", ps, depth, &(r_q->des_access));
}
return True;
}
/*******************************************************************
reads or writes an LSA_R_OPEN_POL2 structure.
********************************************************************/
void lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth)
BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth)
{
if (r_p == NULL) return;
if (r_p == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_r_open_pol2");
depth++;
@ -348,28 +372,34 @@ void lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int d
smb_io_pol_hnd("", &(r_p->pol), ps, depth);
prs_uint32("status", ps, depth, &(r_p->status));
return True;
return True;
}
/*******************************************************************
makes an LSA_Q_QUERY_INFO structure.
********************************************************************/
void make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class)
BOOL make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class)
{
if (q_q == NULL || hnd == NULL) return;
if (q_q == NULL || hnd == NULL) return False;
DEBUG(5,("make_q_query\n"));
memcpy(&(q_q->pol), hnd, sizeof(q_q->pol));
q_q->info_class = info_class;
return True;
}
/*******************************************************************
reads or writes an LSA_Q_QUERY_INFO structure.
********************************************************************/
void lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth)
BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth)
{
if (q_q == NULL) return;
if (q_q == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_q_query");
depth++;
@ -377,17 +407,19 @@ void lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int dept
smb_io_pol_hnd("", &(q_q->pol), ps, depth);
prs_uint16("info_class", ps, depth, &(q_q->info_class));
return True;
}
/*******************************************************************
makes an LSA_Q_OPEN_SECRET structure.
********************************************************************/
void make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd,
BOOL make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd,
char *secret_name, uint32 desired_access)
{
int len = strlen(secret_name);
if (q_o == NULL) return;
if (q_o == NULL) return False;
DEBUG(5,("make_q_open_secret"));
@ -397,14 +429,16 @@ void make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd,
make_unistr2(&(q_o->uni_secret), secret_name, len);
q_o->des_access = desired_access;
return True;
}
/*******************************************************************
reads or writes an LSA_Q_OPEN_SECRET structure.
********************************************************************/
void lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, int depth)
BOOL lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, int depth)
{
if (q_o == NULL) return;
if (q_o == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_q_open_secret");
depth++;
@ -417,14 +451,16 @@ void lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, in
prs_align(ps);
prs_uint32("des_access", ps, depth, &(q_o->des_access));
return True;
}
/*******************************************************************
reads or writes an LSA_R_OPEN_SECRET structure.
********************************************************************/
void lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, int depth)
BOOL lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, int depth)
{
if (r_o == NULL) return;
if (r_o == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_r_open_secret");
depth++;
@ -432,14 +468,16 @@ void lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, in
smb_io_pol_hnd("", &(r_o->pol), ps, depth);
prs_uint32("status", ps, depth, &(r_o->status));
return True;
}
/*******************************************************************
reads or writes an LSA_SECRET_VALUE structure.
********************************************************************/
void lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, int depth)
BOOL lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, int depth)
{
if (value == NULL) return;
if (value == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_secret_value");
depth++;
@ -453,14 +491,16 @@ void lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, in
smb_io_string2("secret" , &(value->enc_secret),
value->hdr_secret.buffer, ps, depth);
}
return True;
}
/*******************************************************************
reads or writes an LSA_SECRET_INFO structure.
********************************************************************/
void lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int depth)
BOOL lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int depth)
{
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_secret_info");
depth++;
@ -484,14 +524,16 @@ void lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int d
smb_io_time("last_update", &(info->last_update), ps, depth);
}
return True;
}
/*******************************************************************
makes an LSA_Q_QUERY_SECRET structure.
********************************************************************/
void make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol)
BOOL make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol)
{
if (q_q == NULL) return;
if (q_q == NULL) return False;
DEBUG(5,("make_q_query_secret\n"));
@ -507,14 +549,16 @@ void make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol)
/* Don't care about old info */
q_q->oldinfo.ptr_value = 0;
q_q->oldinfo.ptr_update = 0;
return True;
}
/*******************************************************************
reads or writes an LSA_Q_QUERY_SECRET structure.
********************************************************************/
void lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, int depth)
BOOL lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, int depth)
{
if (q_q == NULL) return;
if (q_q == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_q_query_secret");
depth++;
@ -523,14 +567,16 @@ void lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps,
lsa_io_secret_info("", &(q_q->info ), ps, depth);
lsa_io_secret_info("", &(q_q->oldinfo), ps, depth);
return True;
}
/*******************************************************************
reads or writes an LSA_Q_QUERY_SECRET structure.
********************************************************************/
void lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, int depth)
BOOL lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, int depth)
{
if (r_q == NULL) return;
if (r_q == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_r_query_secret");
depth++;
@ -540,14 +586,16 @@ void lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps,
prs_align(ps);
prs_uint32("status", ps, depth, &(r_q->status));
return True;
}
/*******************************************************************
reads or writes an LSA_Q_ENUM_TRUST_DOM structure.
********************************************************************/
void lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth)
BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth)
{
if (q_e == NULL) return;
if (q_e == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom");
depth++;
@ -557,16 +605,18 @@ void lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct
prs_uint32("enum_context ", ps, depth, &(q_e->enum_context ));
prs_uint32("preferred_len", ps, depth, &(q_e->preferred_len));
return True;
}
/*******************************************************************
makes an LSA_R_ENUM_TRUST_DOM structure.
********************************************************************/
void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e,
BOOL make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e,
uint32 enum_context, char *domain_name, DOM_SID *domain_sid,
uint32 status)
{
if (r_e == NULL) return;
if (r_e == NULL) return False;
DEBUG(5,("make_r_enum_trust_dom\n"));
@ -591,14 +641,16 @@ void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e,
}
r_e->status = status;
return True;
}
/*******************************************************************
reads or writes an LSA_R_ENUM_TRUST_DOM structure.
********************************************************************/
void lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth)
BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth)
{
if (r_e == NULL) return;
if (r_e == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom");
depth++;
@ -616,14 +668,16 @@ void lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct
}
prs_uint32("status", ps, depth, &(r_e->status));
return True;
}
/*******************************************************************
reads or writes an LSA_Q_QUERY_INFO structure.
********************************************************************/
void lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth)
BOOL lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth)
{
if (r_q == NULL) return;
if (r_q == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_r_query");
depth++;
@ -655,15 +709,17 @@ void lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int dept
}
prs_uint32("status", ps, depth, &(r_q->status));
return True;
}
/*******************************************************************
makes a LSA_SID_ENUM structure.
********************************************************************/
void make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids)
BOOL make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids)
{
int i, i2;
if (sen == NULL || sids == NULL) return;
if (sen == NULL || sids == NULL) return False;
DEBUG(5,("make_lsa_sid_enum\n"));
@ -686,17 +742,19 @@ void make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids)
sen->ptr_sid[i] = 0;
}
}
return True;
}
/*******************************************************************
reads or writes a LSA_SID_ENUM structure.
********************************************************************/
static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen,
static BOOL lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen,
prs_struct *ps, int depth)
{
int i;
if (sen == NULL) return;
if (sen == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_sid_enum");
depth++;
@ -724,17 +782,19 @@ static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen,
slprintf(temp, sizeof(temp) - 1, "sid[%d]", i);
smb_io_dom_sid2(temp, &(sen->sid[i]), ps, depth); /* domain SIDs to be looked up. */
}
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn,
static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn,
prs_struct *ps, int depth)
{
int i;
if (trn == NULL) return;
if (trn == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_trans_names");
depth++;
@ -766,16 +826,18 @@ static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn,
prs_align(ps);
}
}
return True;
}
/*******************************************************************
makes a structure.
********************************************************************/
void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd,
BOOL make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd,
int num_sids, DOM_SID **sids,
uint16 level)
{
if (q_l == NULL) return;
if (q_l == NULL) return False;
DEBUG(5,("make_q_lookup_sids\n"));
@ -786,14 +848,16 @@ void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd,
q_l->names.num_entries = 0;
q_l->level.value = level;
return True;
}
/*******************************************************************
reads or writes a LSA_Q_LOOKUP_SIDS structure.
********************************************************************/
void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth)
BOOL lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth)
{
if (q_s == NULL) return;
if (q_s == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids");
depth++;
@ -806,14 +870,16 @@ void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, in
smb_io_lookup_level("switch ", &(q_s->level ), ps, depth); /* lookup level */
prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count));
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth)
BOOL lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth)
{
if (r_s == NULL) return;
if (r_s == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids");
depth++;
@ -832,16 +898,18 @@ void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, i
prs_uint32("mapped_count", ps, depth, &(r_s->mapped_count));
prs_uint32("status ", ps, depth, &(r_s->status));
return True;
}
/*******************************************************************
makes a structure.
********************************************************************/
void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd,
BOOL make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd,
int num_names, const char **names)
{
int i;
if (q_l == NULL) return;
if (q_l == NULL) return False;
DEBUG(5,("make_q_lookup_names\n"));
@ -864,16 +932,18 @@ void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd,
q_l->ptr_trans_sids = 0;
q_l->lookup_level = 1;
q_l->mapped_count = 0;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth)
BOOL lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth)
{
int i;
if (q_r == NULL) return;
if (q_r == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_q_lookup_names");
depth++;
@ -902,16 +972,18 @@ void lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps,
prs_uint32("ptr_trans_sids ", ps, depth, &(q_r->ptr_trans_sids));
prs_uint32("lookup_level ", ps, depth, &(q_r->lookup_level ));
prs_uint32("mapped_count ", ps, depth, &(q_r->mapped_count ));
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth)
BOOL lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth)
{
int i;
if (r_r == NULL) return;
if (r_r == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_r_lookup_names");
depth++;
@ -934,7 +1006,7 @@ void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps,
if (r_r->num_entries2 != r_r->num_entries)
{
/* RPC fault */
return;
return False;
}
for (i = 0; i < r_r->num_entries2; i++)
@ -946,40 +1018,46 @@ void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps,
prs_uint32("mapped_count", ps, depth, &(r_r->mapped_count));
prs_uint32("status ", ps, depth, &(r_r->status));
return True;
}
/*******************************************************************
makes an LSA_Q_CLOSE structure.
********************************************************************/
void make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd)
BOOL make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd)
{
if (q_c == NULL || hnd == NULL) return;
if (q_c == NULL || hnd == NULL) return False;
DEBUG(5,("make_lsa_q_close\n"));
memcpy(&(q_c->pol), hnd, sizeof(q_c->pol));
return True;
}
/*******************************************************************
reads or writes an LSA_Q_CLOSE structure.
********************************************************************/
void lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth)
BOOL lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth)
{
if (q_c == NULL) return;
if (q_c == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_q_close");
depth++;
smb_io_pol_hnd("", &(q_c->pol), ps, depth);
return True;
}
/*******************************************************************
reads or writes an LSA_R_CLOSE structure.
********************************************************************/
void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth)
BOOL lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth)
{
if (r_c == NULL) return;
if (r_c == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_r_close");
depth++;
@ -987,5 +1065,7 @@ void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth)
smb_io_pol_hnd("", &(r_c->pol), ps, depth);
prs_uint32("status", ps, depth, &(r_c->status));
return True;
}

File diff suppressed because it is too large Load Diff

View File

@ -29,9 +29,9 @@ extern int DEBUGLEVEL;
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth)
static BOOL net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth)
{
if (neg == NULL) return;
if (neg == NULL) return False;
prs_debug(ps, depth, desc, "net_io_neg_flags");
depth++;
@ -39,12 +39,14 @@ static void net_io_neg_flags(char *desc, NEG_FLAGS *neg, prs_struct *ps, int de
prs_align(ps);
prs_uint32("neg_flags", ps, depth, &(neg->neg_flags));
return True;
}
/*******************************************************************
creates a NETLOGON_INFO_3 structure.
********************************************************************/
static void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts)
static BOOL make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts)
{
info->flags = flags;
info->logon_attempts = logon_attempts;
@ -53,14 +55,16 @@ static void make_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_att
info->reserved_3 = 0x0;
info->reserved_4 = 0x0;
info->reserved_5 = 0x0;
return True;
}
/*******************************************************************
reads or writes a NETLOGON_INFO_3 structure.
********************************************************************/
static void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth)
static BOOL net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth)
{
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "net_io_netinfo_3");
depth++;
@ -74,24 +78,28 @@ static void net_io_netinfo_3(char *desc, NETLOGON_INFO_3 *info, prs_struct *ps,
prs_uint32("reserved_3 ", ps, depth, &(info->reserved_3 ));
prs_uint32("reserved_4 ", ps, depth, &(info->reserved_4 ));
prs_uint32("reserved_5 ", ps, depth, &(info->reserved_5 ));
return True;
}
/*******************************************************************
creates a NETLOGON_INFO_1 structure.
********************************************************************/
static void make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status)
static BOOL make_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status)
{
info->flags = flags;
info->pdc_status = pdc_status;
return True;
}
/*******************************************************************
reads or writes a NETLOGON_INFO_1 structure.
********************************************************************/
static void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth)
static BOOL net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth)
{
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "net_io_netinfo_1");
depth++;
@ -100,12 +108,14 @@ static void net_io_netinfo_1(char *desc, NETLOGON_INFO_1 *info, prs_struct *ps,
prs_uint32("flags ", ps, depth, &(info->flags ));
prs_uint32("pdc_status", ps, depth, &(info->pdc_status));
return True;
}
/*******************************************************************
creates a NETLOGON_INFO_2 structure.
********************************************************************/
static void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status,
static BOOL make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status,
uint32 tc_status, char *trusted_dc_name)
{
int len_dc_name = strlen(trusted_dc_name);
@ -122,14 +132,16 @@ static void make_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_statu
{
make_unistr2(&(info->uni_trusted_dc_name), "", 1);
}
return True;
}
/*******************************************************************
reads or writes a NETLOGON_INFO_2 structure.
********************************************************************/
static void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth)
static BOOL net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth)
{
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "net_io_netinfo_2");
depth++;
@ -147,14 +159,16 @@ static void net_io_netinfo_2(char *desc, NETLOGON_INFO_2 *info, prs_struct *ps,
}
prs_align(ps);
return True;
}
/*******************************************************************
reads or writes an NET_Q_LOGON_CTRL2 structure.
********************************************************************/
void net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth)
BOOL net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth)
{
if (q_l == NULL) return;
if (q_l == NULL) return False;
prs_debug(ps, depth, desc, "net_io_q_logon_ctrl2");
depth++;
@ -170,16 +184,18 @@ void net_io_q_logon_ctrl2(char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, i
prs_uint32("function_code", ps, depth, &(q_l->function_code));
prs_uint32("query_level ", ps, depth, &(q_l->query_level ));
prs_uint32("switch_value ", ps, depth, &(q_l->switch_value ));
return True;
}
/*******************************************************************
makes an NET_R_LOGON_CTRL2 structure.
********************************************************************/
void make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level,
BOOL make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level,
uint32 flags, uint32 pdc_status, uint32 logon_attempts,
uint32 tc_status, char *trusted_domain_name)
{
if (r_l == NULL) return;
if (r_l == NULL) return False;
DEBUG(5,("make_r_logon_ctrl2\n"));
@ -224,14 +240,16 @@ void make_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level,
break;
}
}
return True;
}
/*******************************************************************
reads or writes an NET_R_LOGON_CTRL2 structure.
********************************************************************/
void net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth)
BOOL net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth)
{
if (r_l == NULL) return;
if (r_l == NULL) return False;
prs_debug(ps, depth, desc, "net_io_r_logon_ctrl2");
depth++;
@ -268,17 +286,19 @@ void net_io_r_logon_ctrl2(char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, i
}
prs_uint32("status ", ps, depth, &(r_l->status ));
return True;
}
/*******************************************************************
makes an NET_R_TRUST_DOM_LIST structure.
********************************************************************/
void make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t,
BOOL make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t,
uint32 num_doms, char *dom_name)
{
int i = 0;
if (r_t == NULL) return;
if (r_t == NULL) return False;
DEBUG(5,("make_r_trust_dom\n"));
@ -300,15 +320,17 @@ void make_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t,
}
r_t->status = 0;
return True;
}
/*******************************************************************
reads or writes an NET_R_TRUST_DOM_LIST structure.
********************************************************************/
void net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth)
BOOL net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth)
{
int i;
if (r_t == NULL) return;
if (r_t == NULL) return False;
prs_debug(ps, depth, desc, "net_io_r_trust_dom");
depth++;
@ -320,15 +342,17 @@ void net_io_r_trust_dom(char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps,
}
prs_uint32("status", ps, depth, &(r_t->status));
return True;
}
/*******************************************************************
reads or writes an NET_Q_TRUST_DOM_LIST structure.
********************************************************************/
void net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth)
BOOL net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth)
{
if (q_l == NULL) return;
if (q_l == NULL) return False;
prs_debug(ps, depth, desc, "net_io_q_trust_dom");
depth++;
@ -339,16 +363,18 @@ void net_io_q_trust_dom(char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps,
prs_align(ps);
prs_uint32("function_code", ps, depth, &(q_l->function_code));
return True;
}
/*******************************************************************
makes an NET_Q_REQ_CHAL structure.
********************************************************************/
void make_q_req_chal(NET_Q_REQ_CHAL *q_c,
BOOL make_q_req_chal(NET_Q_REQ_CHAL *q_c,
char *logon_srv, char *logon_clnt,
DOM_CHAL *clnt_chal)
{
if (q_c == NULL) return;
if (q_c == NULL) return False;
DEBUG(5,("make_q_req_chal: %d\n", __LINE__));
@ -360,15 +386,17 @@ void make_q_req_chal(NET_Q_REQ_CHAL *q_c,
memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data));
DEBUG(5,("make_q_req_chal: %d\n", __LINE__));
return True;
}
/*******************************************************************
reads or writes an NET_Q_REQ_CHAL structure.
********************************************************************/
void net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth)
BOOL net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth)
{
int old_align;
if (q_c == NULL) return;
if (q_c == NULL) return False;
prs_debug(ps, depth, desc, "net_io_q_req_chal");
depth++;
@ -385,14 +413,16 @@ void net_io_q_req_chal(char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int dep
/* client challenge is _not_ aligned after the unicode strings */
smb_io_chal("", &(q_c->clnt_chal), ps, depth); /* client challenge */
ps->align = old_align;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth)
BOOL net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth)
{
if (r_c == NULL) return;
if (r_c == NULL) return False;
prs_debug(ps, depth, desc, "net_io_r_req_chal");
depth++;
@ -402,18 +432,20 @@ void net_io_r_req_chal(char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int dep
smb_io_chal("", &(r_c->srv_chal), ps, depth); /* server challenge */
prs_uint32("status", ps, depth, &(r_c->status));
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void make_q_auth_2(NET_Q_AUTH_2 *q_a,
BOOL make_q_auth_2(NET_Q_AUTH_2 *q_a,
const char *logon_srv, const char *acct_name,
uint16 sec_chan, const char *comp_name,
DOM_CHAL *clnt_chal, uint32 clnt_flgs)
{
if (q_a == NULL) return;
if (q_a == NULL) return False;
DEBUG(5,("make_q_auth_2: %d\n", __LINE__));
@ -422,15 +454,17 @@ void make_q_auth_2(NET_Q_AUTH_2 *q_a,
q_a->clnt_flgs.neg_flags = clnt_flgs;
DEBUG(5,("make_q_auth_2: %d\n", __LINE__));
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth)
BOOL net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth)
{
int old_align;
if (q_a == NULL) return;
if (q_a == NULL) return False;
prs_debug(ps, depth, desc, "net_io_q_auth_2");
depth++;
@ -444,14 +478,16 @@ void net_io_q_auth_2(char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth)
smb_io_chal ("", &(q_a->clnt_chal), ps, depth); /* client-calculated credentials */
ps->align = old_align;
net_io_neg_flags("", &(q_a->clnt_flgs), ps, depth);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth)
BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth)
{
if (r_a == NULL) return;
if (r_a == NULL) return False;
prs_debug(ps, depth, desc, "net_io_r_auth_2");
depth++;
@ -462,30 +498,34 @@ void net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth)
net_io_neg_flags("", &(r_a->srv_flgs), ps, depth);
prs_uint32("status", ps, depth, &(r_a->status));
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name,
BOOL make_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name,
uint16 sec_chan, char *comp_name, DOM_CRED *cred, char nt_cypher[16])
{
if (q_s == NULL || cred == NULL) return;
if (q_s == NULL || cred == NULL) return False;
DEBUG(5,("make_q_srv_pwset\n"));
make_clnt_info(&(q_s->clnt_id), logon_srv, acct_name, sec_chan, comp_name, cred);
memcpy(q_s->pwd, nt_cypher, sizeof(q_s->pwd));
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth)
BOOL net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth)
{
if (q_s == NULL) return;
if (q_s == NULL) return False;
prs_debug(ps, depth, desc, "net_io_q_srv_pwset");
depth++;
@ -494,14 +534,16 @@ void net_io_q_srv_pwset(char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int d
smb_io_clnt_info("", &(q_s->clnt_id), ps, depth); /* client identification/authentication info */
prs_uint8s (False, "pwd", ps, depth, q_s->pwd, 16); /* new password - undocumented */
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth)
BOOL net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth)
{
if (r_s == NULL) return;
if (r_s == NULL) return False;
prs_debug(ps, depth, desc, "net_io_r_srv_pwset");
depth++;
@ -511,6 +553,8 @@ void net_io_r_srv_pwset(char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int d
smb_io_cred("", &(r_s->srv_cred), ps, depth); /* server challenge */
prs_uint32("status", ps, depth, &(r_s->status));
return True;
}
@ -537,12 +581,14 @@ static int make_dom_sid2s(char *sids_str, DOM_SID2 *sids, int max_sids)
}
return count;
return True;
}
/*******************************************************************
makes a NET_ID_INFO_1 structure.
********************************************************************/
void make_id_info1(NET_ID_INFO_1 *id, char *domain_name,
BOOL make_id_info1(NET_ID_INFO_1 *id, char *domain_name,
uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high,
char *user_name, char *wksta_name,
char sess_key[16],
@ -555,7 +601,7 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name,
unsigned char lm_owf[16];
unsigned char nt_owf[16];
if (id == NULL) return;
if (id == NULL) return False;
DEBUG(5,("make_id_info1: %d\n", __LINE__));
@ -607,14 +653,16 @@ void make_id_info1(NET_ID_INFO_1 *id, char *domain_name,
make_unistr2(&(id->uni_domain_name), domain_name, len_domain_name);
make_unistr2(&(id->uni_user_name ), user_name , len_user_name );
make_unistr2(&(id->uni_wksta_name ), wksta_name , len_wksta_name );
return True;
}
/*******************************************************************
reads or writes an NET_ID_INFO_1 structure.
********************************************************************/
static void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth)
static BOOL net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth)
{
if (id == NULL) return;
if (id == NULL) return False;
prs_debug(ps, depth, desc, "net_io_id_info1");
depth++;
@ -640,6 +688,8 @@ static void net_io_id_info1(char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int
smb_io_unistr2("unistr2", &(id->uni_user_name ), id->hdr_user_name.buffer, ps, depth);
smb_io_unistr2("unistr2", &(id->uni_wksta_name ), id->hdr_wksta_name.buffer, ps, depth);
}
return True;
}
/*******************************************************************
@ -657,7 +707,7 @@ checking for a logon as it doesn't export the password
hashes to anyone who has compromised the secure channel. JRA.
********************************************************************/
void make_id_info2(NET_ID_INFO_2 *id, char *domain_name,
BOOL make_id_info2(NET_ID_INFO_2 *id, char *domain_name,
uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high,
char *user_name, char *wksta_name,
unsigned char lm_challenge[8],
@ -672,7 +722,7 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name,
unsigned char lm_owf[24];
unsigned char nt_owf[24];
if (id == NULL) return;
if (id == NULL) return False;
DEBUG(5,("make_id_info2: %d\n", __LINE__));
@ -710,14 +760,16 @@ void make_id_info2(NET_ID_INFO_2 *id, char *domain_name,
make_string2(&(id->nt_chal_resp ), (char *)nt_chal_resp , nt_chal_resp_len);
make_string2(&(id->lm_chal_resp ), (char *)lm_chal_resp , lm_chal_resp_len);
return True;
}
/*******************************************************************
reads or writes an NET_ID_INFO_2 structure.
********************************************************************/
static void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth)
static BOOL net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth)
{
if (id == NULL) return;
if (id == NULL) return False;
prs_debug(ps, depth, desc, "net_io_id_info2");
depth++;
@ -747,18 +799,20 @@ static void net_io_id_info2(char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int
smb_io_string2("nt_chal_resp" , &(id->nt_chal_resp) , id->hdr_nt_chal_resp.buffer, ps, depth);
smb_io_string2("lm_chal_resp" , &(id->lm_chal_resp) , id->hdr_lm_chal_resp.buffer, ps, depth);
}
return True;
}
/*******************************************************************
makes a DOM_SAM_INFO structure.
********************************************************************/
void make_sam_info(DOM_SAM_INFO *sam,
BOOL make_sam_info(DOM_SAM_INFO *sam,
char *logon_srv, char *comp_name, DOM_CRED *clnt_cred,
DOM_CRED *rtn_cred, uint16 logon_level,
NET_ID_INFO_CTR *ctr, uint16 validation_level)
{
if (sam == NULL) return;
if (sam == NULL) return False;
DEBUG(5,("make_sam_info: %d\n", __LINE__));
@ -777,14 +831,16 @@ void make_sam_info(DOM_SAM_INFO *sam,
sam->logon_level = logon_level;
sam->ctr = ctr;
sam->validation_level = validation_level;
return True;
}
/*******************************************************************
reads or writes a DOM_SAM_INFO structure.
********************************************************************/
static void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth)
static BOOL net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps, int depth)
{
if (ctr == NULL) return;
if (ctr == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_sam_info");
depth++;
@ -812,14 +868,16 @@ static void net_io_id_info_ctr(char *desc, NET_ID_INFO_CTR *ctr, prs_struct *ps
break;
}
}
return True;
}
/*******************************************************************
reads or writes a DOM_SAM_INFO structure.
********************************************************************/
static void smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth)
static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth)
{
if (sam == NULL) return;
if (sam == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_sam_info");
depth++;
@ -839,12 +897,14 @@ static void smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int
}
prs_uint16("validation_level", ps, depth, &(sam->validation_level));
return True;
}
/*************************************************************************
make_net_user_info3
*************************************************************************/
void make_net_user_info3(NET_USER_INFO_3 *usr,
BOOL make_net_user_info3(NET_USER_INFO_3 *usr,
NTTIME *logon_time,
NTTIME *logoff_time,
@ -959,17 +1019,19 @@ void make_net_user_info3(NET_USER_INFO_3 *usr,
make_dom_sid2(&(usr->dom_sid), dom_sid);
/* "other" sids are set up above */
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth)
static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, int depth)
{
int i;
if (usr == NULL) return;
if (usr == NULL) return False;
prs_debug(ps, depth, desc, "lsa_io_lsa_user_info");
depth++;
@ -1041,14 +1103,16 @@ static void net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps,
smb_io_dom_sid2("", &(usr->other_sids[i]), ps, depth); /* other domain SIDs */
}
}
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth)
BOOL net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth)
{
if (q_l == NULL) return;
if (q_l == NULL) return False;
prs_debug(ps, depth, desc, "net_io_q_sam_logon");
depth++;
@ -1056,14 +1120,16 @@ void net_io_q_sam_logon(char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int d
prs_align(ps);
smb_io_sam_info("", &(q_l->sam_id), ps, depth); /* domain SID */
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth)
BOOL net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth)
{
if (r_l == NULL) return;
if (r_l == NULL) return False;
prs_debug(ps, depth, desc, "net_io_r_sam_logon");
depth++;
@ -1084,14 +1150,16 @@ void net_io_r_sam_logon(char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int d
prs_uint32("status ", ps, depth, &(r_l->status));
prs_align(ps);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth)
BOOL net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth)
{
if (q_l == NULL) return;
if (q_l == NULL) return False;
prs_debug(ps, depth, desc, "net_io_q_sam_logoff");
depth++;
@ -1099,14 +1167,16 @@ void net_io_q_sam_logoff(char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int
prs_align(ps);
smb_io_sam_info("", &(q_l->sam_id), ps, depth); /* domain SID */
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth)
BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth)
{
if (r_l == NULL) return;
if (r_l == NULL) return False;
prs_debug(ps, depth, desc, "net_io_r_sam_logoff");
depth++;
@ -1117,15 +1187,17 @@ void net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int
smb_io_cred("", &(r_l->srv_creds), ps, depth); /* server credentials. server time stamp appears to be ignored. */
prs_uint32("status ", ps, depth, &(r_l->status));
return True;
}
/*******************************************************************
makes a NET_Q_SAM_SYNC structure.
********************************************************************/
void make_q_sam_sync(NET_Q_SAM_SYNC *q_s, char *srv_name, char *cli_name,
BOOL make_q_sam_sync(NET_Q_SAM_SYNC *q_s, char *srv_name, char *cli_name,
DOM_CRED *cli_creds, uint32 database_id)
{
if (q_s == NULL) return;
if (q_s == NULL) return False;
DEBUG(5,("make_q_sam_sync\n"));
@ -1139,14 +1211,16 @@ void make_q_sam_sync(NET_Q_SAM_SYNC *q_s, char *srv_name, char *cli_name,
q_s->restart_state = 0;
q_s->sync_context = 0;
q_s->max_size = 0xffff;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int depth)
BOOL net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int depth)
{
if (q_s == NULL) return;
if (q_s == NULL) return False;
prs_debug(ps, depth, desc, "net_io_q_sam_sync");
depth++;
@ -1162,14 +1236,16 @@ void net_io_q_sam_sync(char *desc, NET_Q_SAM_SYNC *q_s, prs_struct *ps, int dept
prs_uint32("sync_context ", ps, depth, &(q_s->sync_context ));
prs_uint32("max_size", ps, depth, &(q_s->max_size));
return True;
}
/*******************************************************************
makes a SAM_DELTA_HDR structure.
********************************************************************/
void make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid)
BOOL make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid)
{
if (delta == NULL) return;
if (delta == NULL) return False;
DEBUG(5,("make_sam_delta_hdr\n"));
@ -1178,14 +1254,16 @@ void make_sam_delta_hdr(SAM_DELTA_HDR *delta, uint16 type, uint32 rid)
delta->type3 = type;
delta->ptr_delta = 1;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR *delta, prs_struct *ps, int depth)
static BOOL net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR *delta, prs_struct *ps, int depth)
{
if (delta == NULL) return;
if (delta == NULL) return False;
prs_debug(ps, depth, desc, "net_io_sam_delta_hdr");
depth++;
@ -1196,14 +1274,16 @@ static void net_io_sam_delta_hdr(char *desc, SAM_DELTA_HDR *delta, prs_struct *p
prs_uint32("type3", ps, depth, &(delta->type3 ));
prs_uint32("ptr_delta", ps, depth, &(delta->ptr_delta ));
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO *info, prs_struct *ps, int depth)
static BOOL net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO *info, prs_struct *ps, int depth)
{
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "net_io_sam_domain_info");
depth++;
@ -1232,14 +1312,16 @@ static void net_io_sam_domain_info(char *desc, SAM_DOMAIN_INFO *info, prs_struct
info->hdr_sec_desc.buffer, ps, depth);
smb_io_unistr2("buf_unknown" , &(info->buf_unknown ),
info->hdr_unknown .buffer, ps, depth);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_sam_group_info(char *desc, SAM_GROUP_INFO *info, prs_struct *ps, int depth)
static BOOL net_io_sam_group_info(char *desc, SAM_GROUP_INFO *info, prs_struct *ps, int depth)
{
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "net_io_sam_group_info");
depth++;
@ -1256,12 +1338,14 @@ static void net_io_sam_group_info(char *desc, SAM_GROUP_INFO *info, prs_struct *
info->hdr_grp_desc.buffer, ps, depth);
smb_io_buffer4("buf_sec_desc", &(info->buf_sec_desc),
info->hdr_sec_desc.buffer, ps, depth);
return True;
}
/*******************************************************************
makes a SAM_ACCOUNT_INFO structure.
********************************************************************/
void make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name,
BOOL make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name,
char *full_name, uint32 user_rid, uint32 group_rid,
char *home_dir, char *dir_drive, char *logon_script,
char *acct_desc, uint32 acb_info, char *profile)
@ -1320,15 +1404,17 @@ void make_sam_account_info(SAM_ACCOUNT_INFO *info, char *user_name,
make_unistr2(&(info->uni_logon_script), logon_script, len_logon_script+1);
make_unistr2(&(info->uni_acct_desc), acct_desc, len_acct_desc+1);
make_unistr2(&(info->uni_profile ), profile , len_profile +1);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_sam_passwd_info(char *desc, SAM_PWD *pwd,
static BOOL net_io_sam_passwd_info(char *desc, SAM_PWD *pwd,
prs_struct *ps, int depth)
{
if (pwd == NULL) return;
if (pwd == NULL) return False;
prs_debug(ps, depth, desc, "net_io_sam_passwd_info");
depth++;
@ -1343,18 +1429,20 @@ static void net_io_sam_passwd_info(char *desc, SAM_PWD *pwd,
smb_io_unihdr("", &(pwd->hdr_empty_lm), ps, depth);
smb_io_unihdr("", &(pwd->hdr_empty_nt), ps, depth);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_sam_account_info(char *desc, uint8 sess_key[16],
static BOOL net_io_sam_account_info(char *desc, uint8 sess_key[16],
SAM_ACCOUNT_INFO *info, prs_struct *ps, int depth)
{
BUFHDR2 hdr_priv_data;
int i;
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "net_io_sam_account_info");
depth++;
@ -1470,17 +1558,19 @@ static void net_io_sam_account_info(char *desc, uint8 sess_key[16],
smb_io_unistr2("uni_profile" , &(info->uni_profile ),
info->hdr_profile.buffer, ps, depth);
prs_align(ps);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_struct *ps, int depth)
static BOOL net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_struct *ps, int depth)
{
int i;
fstring tmp;
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "net_io_sam_group_mem_info");
depth++;
@ -1497,7 +1587,7 @@ static void net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_
if (info->num_members2 != info->num_members)
{
/* RPC fault */
return;
return False;
}
SMB_ASSERT_ARRAY(info->rids, info->num_members2);
@ -1516,7 +1606,7 @@ static void net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_
if (info->num_members3 != info->num_members)
{
/* RPC fault */
return;
return False;
}
SMB_ASSERT_ARRAY(info->attribs, info->num_members3);
@ -1528,14 +1618,16 @@ static void net_io_sam_group_mem_info(char *desc, SAM_GROUP_MEM_INFO *info, prs_
prs_uint32(tmp, ps, depth, &(info->attribs[i]));
}
}
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO *info, prs_struct *ps, int depth)
static BOOL net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO *info, prs_struct *ps, int depth)
{
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "net_io_sam_alias_info");
depth++;
@ -1552,17 +1644,19 @@ static void net_io_sam_alias_info(char *desc, SAM_ALIAS_INFO *info, prs_struct *
info->hdr_sec_desc.buffer, ps, depth);
smb_io_unistr2("uni_als_desc", &(info->uni_als_desc),
info->hdr_als_name.buffer, ps, depth);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_struct *ps, int depth)
static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_struct *ps, int depth)
{
int i;
fstring tmp;
if (info == NULL) return;
if (info == NULL) return False;
prs_debug(ps, depth, desc, "net_io_sam_alias_mem_info");
depth++;
@ -1578,7 +1672,7 @@ static void net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_
if (info->num_sids != info->num_members)
{
/* RPC fault */
return;
return False;
}
SMB_ASSERT_ARRAY(info->ptr_sids, info->num_sids);
@ -1602,16 +1696,18 @@ static void net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO *info, prs_
}
}
}
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void net_io_sam_delta_ctr(char *desc, uint8 sess_key[16],
static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16],
SAM_DELTA_CTR *delta, uint16 type,
prs_struct *ps, int depth)
{
if (delta == NULL) return;
if (delta == NULL) return False;
prs_debug(ps, depth, desc, "net_io_sam_delta_ctr");
depth++;
@ -1661,17 +1757,19 @@ static void net_io_sam_delta_ctr(char *desc, uint8 sess_key[16],
break;
}
}
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void net_io_r_sam_sync(char *desc, uint8 sess_key[16],
BOOL net_io_r_sam_sync(char *desc, uint8 sess_key[16],
NET_R_SAM_SYNC *r_s, prs_struct *ps, int depth)
{
int i;
if (r_s == NULL) return;
if (r_s == NULL) return False;
prs_debug(ps, depth, desc, "net_io_r_sam_sync");
depth++;
@ -1690,7 +1788,7 @@ void net_io_r_sam_sync(char *desc, uint8 sess_key[16],
if (r_s->num_deltas2 != r_s->num_deltas)
{
/* RPC fault */
return;
return False;
}
for (i = 0; i < r_s->num_deltas2; i++)
@ -1709,4 +1807,6 @@ void net_io_r_sam_sync(char *desc, uint8 sess_key[16],
prs_align(ps);
prs_uint32("status", ps, depth, &(r_s->status));
return True;
}

View File

@ -2,8 +2,8 @@
Unix SMB/Netbios implementation.
Version 1.9.
Samba memory buffer functions
Copyright (C) Andrew Tridgell 1992-1997
Copyright (C) Luke Kenneth Casson Leighton 1996-1997
Copyright (C) Andrew Tridgell 1992-1999
Copyright (C) Luke Kenneth Casson Leighton 1996-1999
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
@ -103,7 +103,7 @@ BOOL prs_grow(prs_struct *ps)
/*******************************************************************
stream a uint8
********************************************************************/
BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8)
BOOL _prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8)
{
char *q = mem_data(&(ps->data), ps->offset);
if (q == NULL) return False;
@ -117,7 +117,7 @@ BOOL prs_uint8(char *name, prs_struct *ps, int depth, uint8 *data8)
/*******************************************************************
stream a uint16
********************************************************************/
BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16)
BOOL _prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16)
{
char *q = mem_data(&(ps->data), ps->offset);
if (q == NULL) return False;
@ -131,7 +131,7 @@ BOOL prs_uint16(char *name, prs_struct *ps, int depth, uint16 *data16)
/*******************************************************************
hash a stream.
********************************************************************/
BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16])
BOOL _prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16])
{
char *q = mem_data(&(ps->data), offset);
if (q == NULL) return False;
@ -152,7 +152,7 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, uint8 sess_key[16])
/*******************************************************************
stream a uint32
********************************************************************/
BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32)
BOOL _prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32)
{
char *q = mem_data(&(ps->data), ps->offset);
if (q == NULL) return False;
@ -167,7 +167,7 @@ BOOL prs_uint32(char *name, prs_struct *ps, int depth, uint32 *data32)
/******************************************************************
stream an array of uint8s. length is number of uint8s
********************************************************************/
BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len)
BOOL _prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *data8s, int len)
{
char *q = mem_data(&(ps->data), ps->offset);
int end_offset = ps->offset + len * sizeof(uint8);
@ -184,7 +184,7 @@ BOOL prs_uint8s(BOOL charmode, char *name, prs_struct *ps, int depth, uint8 *dat
/******************************************************************
stream an array of uint16s. length is number of uint16s
********************************************************************/
BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len)
BOOL _prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *data16s, int len)
{
char *q = mem_data(&(ps->data), ps->offset);
int end_offset = ps->offset + len * sizeof(uint16);
@ -201,7 +201,7 @@ BOOL prs_uint16s(BOOL charmode, char *name, prs_struct *ps, int depth, uint16 *d
/******************************************************************
stream an array of uint32s. length is number of uint32s
********************************************************************/
BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len)
BOOL _prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *data32s, int len)
{
char *q = mem_data(&(ps->data), ps->offset);
int end_offset = ps->offset + len * sizeof(uint32);
@ -219,7 +219,7 @@ BOOL prs_uint32s(BOOL charmode, char *name, prs_struct *ps, int depth, uint32 *d
stream a "not" unicode string, length/buffer specified separately,
in byte chars
********************************************************************/
BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str)
BOOL _prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *str)
{
char *q = mem_data(&(ps->data), ps->offset);
int end_offset = ps->offset + str->buf_len;
@ -237,7 +237,7 @@ BOOL prs_buffer2(BOOL charmode, char *name, prs_struct *ps, int depth, BUFFER2 *
stream a string, length/buffer specified separately,
in uint8 chars.
********************************************************************/
BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str)
BOOL _prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *str)
{
char *q = mem_data(&(ps->data), ps->offset);
int end_offset = ps->offset + str->str_str_len * sizeof(uint8);
@ -255,7 +255,7 @@ BOOL prs_string2(BOOL charmode, char *name, prs_struct *ps, int depth, STRING2 *
stream a unicode string, length/buffer specified separately,
in uint16 chars.
********************************************************************/
BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str)
BOOL _prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *str)
{
char *q = mem_data(&(ps->data), ps->offset);
int end_offset = ps->offset + str->uni_str_len * sizeof(uint16);
@ -273,7 +273,7 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *
stream a unicode string, length/buffer specified separately,
in uint16 chars.
********************************************************************/
BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth)
BOOL _prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int depth)
{
char *q = mem_data(&(ps->data), ps->offset);
int end_offset = ps->offset + str->uni_str_len * sizeof(uint16);
@ -290,7 +290,7 @@ BOOL prs_unistr3(BOOL charmode, char *name, UNISTR3 *str, prs_struct *ps, int de
/*******************************************************************
stream a unicode null-terminated string
********************************************************************/
BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
BOOL _prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
{
int i = -1;
uint8 *start = (uint8*)mem_data(&(ps->data), ps->offset);
@ -322,7 +322,7 @@ BOOL prs_unistr(char *name, prs_struct *ps, int depth, UNISTR *str)
(up to max size of pstring - 1024 chars).
********************************************************************/
BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size)
BOOL _prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, uint16 max_buf_size)
{
uint8 *start = (uint8*)mem_data(&(ps->data), ps->offset);
int i = -1; /* start off at zero after 1st i++ */
@ -358,13 +358,13 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui
prs_uint16 wrapper. call this and it sets up a pointer to where the
uint16 should be stored, or gets the size if reading
********************************************************************/
BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset)
BOOL _prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset)
{
(*offset) = ps->offset;
if (ps->io)
{
/* reading. */
return prs_uint16(name, ps, depth, data16);
return _prs_uint16(name, ps, depth, data16);
}
else
{
@ -377,7 +377,7 @@ BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint3
prs_uint16 wrapper. call this and it retrospectively stores the size.
does nothing on reading, as that is already handled by ...._pre()
********************************************************************/
BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16,
BOOL _prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16,
uint32 ptr_uint16, uint32 start_offset)
{
if (!ps->io)
@ -401,13 +401,13 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16,
prs_uint32 wrapper. call this and it sets up a pointer to where the
uint32 should be stored, or gets the size if reading
********************************************************************/
BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset)
BOOL _prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset)
{
(*offset) = ps->offset;
if (ps->io)
{
/* reading. */
return prs_uint32(name, ps, depth, data32);
return _prs_uint32(name, ps, depth, data32);
}
else
{
@ -420,7 +420,7 @@ BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint3
prs_uint32 wrapper. call this and it retrospectively stores the size.
does nothing on reading, as that is already handled by ...._pre()
********************************************************************/
BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32,
BOOL _prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32,
uint32 ptr_uint32, uint32 data_size)
{
if (!ps->io)

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,9 @@
* Unix SMB/Netbios implementation.
* Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
* Copyright (C) Andrew Tridgell 1992-1999,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
* Copyright (C) Paul Ashton 1997-1999.
*
* 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
@ -181,10 +181,10 @@ struct pipe_id_info pipe_names [] =
/*******************************************************************
creates an RPC_HDR structure.
********************************************************************/
void make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags,
BOOL make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags,
uint32 call_id, int data_len, int auth_len)
{
if (hdr == NULL) return;
if (hdr == NULL) return False;
hdr->major = 5; /* RPC version 5 */
hdr->minor = 0; /* minor version 0 */
@ -194,14 +194,16 @@ void make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags,
hdr->frag_len = data_len; /* fragment length, fill in later */
hdr->auth_len = auth_len; /* authentication length */
hdr->call_id = call_id; /* call identifier - match incoming RPC */
return True;
}
/*******************************************************************
reads or writes an RPC_HDR structure.
********************************************************************/
void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth)
BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth)
{
if (rpc == NULL) return;
if (rpc == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_hdr");
depth++;
@ -214,14 +216,16 @@ void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth)
prs_uint16("frag_len ", ps, depth, &(rpc->frag_len));
prs_uint16("auth_len ", ps, depth, &(rpc->auth_len));
prs_uint32("call_id ", ps, depth, &(rpc->call_id));
return True;
}
/*******************************************************************
reads or writes an RPC_IFACE structure.
********************************************************************/
static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth)
static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth)
{
if (ifc == NULL) return;
if (ifc == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_iface");
depth++;
@ -230,6 +234,8 @@ static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int de
prs_uint8s (False, "data ", ps, depth, ifc->data, sizeof(ifc->data));
prs_uint32 ( "version", ps, depth, &(ifc->version));
return True;
}
/*******************************************************************
@ -237,9 +243,9 @@ creates an RPC_ADDR_STR structure.
The name can be null (RPC Alter-Context)
********************************************************************/
static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name)
static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, char *name)
{
if (str == NULL ) return;
if (str == NULL ) return False;
if (name == NULL)
{
str->len = 1;
@ -250,14 +256,16 @@ static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name)
str->len = strlen(name) + 1;
fstrcpy(str->str, name);
}
return True;
}
/*******************************************************************
reads or writes an RPC_ADDR_STR structure.
********************************************************************/
static void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth)
static BOOL smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth)
{
if (str == NULL) return;
if (str == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_addr_str");
depth++;
@ -265,26 +273,30 @@ static void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps,
prs_uint16 ( "len", ps, depth, &(str->len));
prs_uint8s (True, "str", ps, depth, (uchar*)str->str, str->len);
return True;
}
/*******************************************************************
creates an RPC_HDR_BBA structure.
********************************************************************/
static void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid)
static BOOL make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid)
{
if (bba == NULL) return;
if (bba == NULL) return False;
bba->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */
bba->max_rsize = max_rsize; /* max receive fragment size (0x1630) */
bba->assoc_gid = assoc_gid; /* associated group id (0x0) */
return True;
}
/*******************************************************************
reads or writes an RPC_HDR_BBA structure.
********************************************************************/
static void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth)
static BOOL smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth)
{
if (rpc == NULL) return;
if (rpc == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_hdr_bba");
depth++;
@ -292,17 +304,19 @@ static void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, in
prs_uint16("max_tsize", ps, depth, &(rpc->max_tsize));
prs_uint16("max_rsize", ps, depth, &(rpc->max_rsize));
prs_uint32("assoc_gid", ps, depth, &(rpc->assoc_gid));
return True;
}
/*******************************************************************
creates an RPC_HDR_RB structure.
********************************************************************/
void make_rpc_hdr_rb(RPC_HDR_RB *rpc,
BOOL make_rpc_hdr_rb(RPC_HDR_RB *rpc,
uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
uint32 num_elements, uint16 context_id, uint8 num_syntaxes,
RPC_IFACE *abstract, RPC_IFACE *transfer)
{
if (rpc == NULL) return;
if (rpc == NULL) return False;
make_rpc_hdr_bba(&(rpc->bba), max_tsize, max_rsize, assoc_gid);
@ -315,14 +329,16 @@ void make_rpc_hdr_rb(RPC_HDR_RB *rpc,
/* num and vers. of interface to use for replies */
memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer));
return True;
}
/*******************************************************************
reads or writes an RPC_HDR_RB structure.
********************************************************************/
void smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth)
BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth)
{
if (rpc == NULL) return;
if (rpc == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rb");
depth++;
@ -335,6 +351,8 @@ void smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth)
smb_io_rpc_iface("", &(rpc->abstract), ps, depth);
smb_io_rpc_iface("", &(rpc->transfer), ps, depth);
return True;
}
/*******************************************************************
@ -343,14 +361,16 @@ creates an RPC_RESULTS structure.
lkclXXXX only one reason at the moment!
********************************************************************/
static void make_rpc_results(RPC_RESULTS *res,
static BOOL make_rpc_results(RPC_RESULTS *res,
uint8 num_results, uint16 result, uint16 reason)
{
if (res == NULL) return;
if (res == NULL) return False;
res->num_results = num_results; /* the number of results (0x01) */
res->result = result ; /* result (0x00 = accept) */
res->reason = reason ; /* reason (0x00 = no reason specified) */
return True;
}
/*******************************************************************
@ -359,9 +379,9 @@ reads or writes an RPC_RESULTS structure.
lkclXXXX only one reason at the moment!
********************************************************************/
static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth)
static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth)
{
if (res == NULL) return;
if (res == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_results");
depth++;
@ -374,6 +394,8 @@ static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, in
prs_uint16("result ", ps, depth, &(res->result ));
prs_uint16("reason ", ps, depth, &(res->reason ));
return True;
}
/*******************************************************************
@ -383,13 +405,13 @@ lkclXXXX only one reason at the moment!
jfm: nope two ! The pipe_addr can be NULL !
********************************************************************/
void make_rpc_hdr_ba(RPC_HDR_BA *rpc,
BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc,
uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
char *pipe_addr,
uint8 num_results, uint16 result, uint16 reason,
RPC_IFACE *transfer)
{
if (rpc == NULL || transfer == NULL) return;
if (rpc == NULL || transfer == NULL) return False;
make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid);
make_rpc_addr_str(&(rpc->addr), pipe_addr);
@ -397,14 +419,16 @@ void make_rpc_hdr_ba(RPC_HDR_BA *rpc,
/* the transfer syntax from the request */
memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer));
return True;
}
/*******************************************************************
reads or writes an RPC_HDR_BA structure.
********************************************************************/
void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth)
BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth)
{
if (rpc == NULL) return;
if (rpc == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_hdr_ba");
depth++;
@ -413,26 +437,30 @@ void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth)
smb_io_rpc_addr_str("", &(rpc->addr) , ps, depth);
smb_io_rpc_results ("", &(rpc->res) , ps, depth);
smb_io_rpc_iface ("", &(rpc->transfer), ps, depth);
return True;
}
/*******************************************************************
creates an RPC_HDR_REQ structure.
********************************************************************/
void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum)
BOOL make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum)
{
if (hdr == NULL) return;
if (hdr == NULL) return False;
hdr->alloc_hint = alloc_hint; /* allocation hint */
hdr->context_id = 0; /* presentation context identifier */
hdr->opnum = opnum; /* opnum */
return True;
}
/*******************************************************************
reads or writes an RPC_HDR_REQ structure.
********************************************************************/
void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth)
BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth)
{
if (rpc == NULL) return;
if (rpc == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_hdr_req");
depth++;
@ -440,14 +468,16 @@ void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth
prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint));
prs_uint16("context_id", ps, depth, &(rpc->context_id));
prs_uint16("opnum ", ps, depth, &(rpc->opnum));
return True;
}
/*******************************************************************
reads or writes an RPC_HDR_RESP structure.
********************************************************************/
void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth)
BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth)
{
if (rpc == NULL) return;
if (rpc == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_hdr_resp");
depth++;
@ -456,17 +486,19 @@ void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dep
prs_uint16("context_id", ps, depth, &(rpc->context_id));
prs_uint8 ("cancel_ct ", ps, depth, &(rpc->cancel_count));
prs_uint8 ("reserved ", ps, depth, &(rpc->reserved));
return True;
}
/*******************************************************************
creates an RPC_HDR_AUTHA structure.
********************************************************************/
void make_rpc_hdr_autha(RPC_HDR_AUTHA *rai,
BOOL make_rpc_hdr_autha(RPC_HDR_AUTHA *rai,
uint16 max_tsize, uint16 max_rsize,
uint8 auth_type, uint8 auth_level,
uint8 stub_type_len)
{
if (rai == NULL) return;
if (rai == NULL) return False;
rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */
rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */
@ -477,14 +509,16 @@ void make_rpc_hdr_autha(RPC_HDR_AUTHA *rai,
rai->padding = 0; /* padding 0x00 */
rai->unknown = 0x0014a0c0; /* non-zero pointer to something */
return True;
}
/*******************************************************************
reads or writes an RPC_HDR_AUTHA structure.
********************************************************************/
void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth)
BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth)
{
if (rai == NULL) return;
if (rai == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha");
depth++;
@ -498,6 +532,8 @@ void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int de
prs_uint8 ("padding ", ps, depth, &(rai->padding ));
prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */
return True;
}
/*******************************************************************
@ -507,17 +543,19 @@ BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai)
{
return ((rai->auth_type == 0x0a || rai->auth_type == 0x44) &&
rai->auth_level == 0x06);
return True;
}
/*******************************************************************
creates an RPC_HDR_AUTH structure.
********************************************************************/
void make_rpc_hdr_auth(RPC_HDR_AUTH *rai,
BOOL make_rpc_hdr_auth(RPC_HDR_AUTH *rai,
uint8 auth_type, uint8 auth_level,
uint8 stub_type_len,
uint32 ptr)
{
if (rai == NULL) return;
if (rai == NULL) return False;
rai->auth_type = auth_type; /* nt lm ssp 0x0a */
rai->auth_level = auth_level; /* 0x06 */
@ -525,14 +563,16 @@ void make_rpc_hdr_auth(RPC_HDR_AUTH *rai,
rai->padding = 0; /* padding 0x00 */
rai->unknown = ptr; /* non-zero pointer to something */
return True;
}
/*******************************************************************
reads or writes an RPC_HDR_AUTH structure.
********************************************************************/
void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth)
BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth)
{
if (rai == NULL) return;
if (rai == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth");
depth++;
@ -543,6 +583,8 @@ void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept
prs_uint8 ("padding ", ps, depth, &(rai->padding ));
prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */
return True;
}
/*******************************************************************
@ -552,45 +594,51 @@ BOOL rpc_auth_ntlmssp_verifier_chk(RPC_AUTH_NTLMSSP_VERIFIER *rav,
char *signature, uint32 msg_type)
{
return (strequal(rav->signature, signature) && rav->msg_type == msg_type);
return True;
}
/*******************************************************************
creates an RPC_AUTH_NTLMSSP_VERIFIER structure.
********************************************************************/
void make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav,
BOOL make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav,
char *signature, uint32 msg_type)
{
if (rav == NULL) return;
if (rav == NULL) return False;
fstrcpy(rav->signature, signature); /* "NTLMSSP" */
rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */
return True;
}
/*******************************************************************
reads or writes an RPC_AUTH_NTLMSSP_VERIFIER structure.
********************************************************************/
void smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth)
BOOL smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth)
{
if (rav == NULL) return;
if (rav == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier");
depth++;
prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */
prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */
return True;
}
/*******************************************************************
creates an RPC_AUTH_NTLMSSP_NEG structure.
********************************************************************/
void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg,
BOOL make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg,
uint32 neg_flgs,
fstring myname, fstring domain)
{
int len_myname = strlen(myname);
int len_domain = strlen(domain);
if (neg == NULL) return;
if (neg == NULL) return False;
neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */
@ -599,6 +647,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg,
fstrcpy(neg->myname, myname);
fstrcpy(neg->domain, domain);
return True;
}
/*******************************************************************
@ -607,9 +657,9 @@ reads or writes an RPC_AUTH_NTLMSSP_NEG structure.
*** lkclXXXX HACK ALERT! ***
********************************************************************/
void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth)
BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth)
{
if (neg == NULL) return;
if (neg == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_neg");
depth++;
@ -648,16 +698,18 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru
prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname )));
prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain )));
}
return True;
}
/*******************************************************************
creates an RPC_AUTH_NTLMSSP_CHAL structure.
********************************************************************/
void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl,
BOOL make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl,
uint32 neg_flags,
uint8 challenge[8])
{
if (chl == NULL) return;
if (chl == NULL) return False;
chl->unknown_1 = 0x0;
chl->unknown_2 = 0x00000028;
@ -665,14 +717,16 @@ void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl,
memcpy(chl->challenge, challenge, sizeof(chl->challenge));
bzero (chl->reserved , sizeof(chl->reserved));
return True;
}
/*******************************************************************
reads or writes an RPC_AUTH_NTLMSSP_CHAL structure.
********************************************************************/
void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth)
BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth)
{
if (chl == NULL) return;
if (chl == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chal");
depth++;
@ -683,6 +737,8 @@ void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st
prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge));
prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved ));
return True;
}
/*******************************************************************
@ -692,7 +748,7 @@ creates an RPC_AUTH_NTLMSSP_RESP structure.
*** lkclXXXX the actual offset is at the start of the auth verifier ***
********************************************************************/
void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp,
BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp,
uchar lm_resp[24],
uchar *nt_resp, size_t nt_len,
char *domain, char *user, char *wks,
@ -706,7 +762,7 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp,
DEBUG(5,("make_rpc_auth_ntlmssp_resp\n"));
if (rsp == NULL) return;
if (rsp == NULL) return False;
#ifdef DEBUG_PASSWORD
DEBUG(100,("lm_resp\n"));
@ -782,6 +838,8 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp,
fstrcpy(rsp->wks , wks );
}
rsp->sess_key[0] = 0;
return True;
}
/*******************************************************************
@ -791,9 +849,9 @@ reads or writes an RPC_AUTH_NTLMSSP_RESP structure.
*** lkclXXXX the actual offset is at the start of the auth verifier ***
********************************************************************/
void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth)
BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth)
{
if (rsp == NULL) return;
if (rsp == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp");
depth++;
@ -865,6 +923,8 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st
prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )));
prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)));
}
return True;
}
/*******************************************************************
@ -888,28 +948,32 @@ BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_nu
return False;
}
return True;
return True;
}
/*******************************************************************
creates an RPC_AUTH_NTLMSSP_CHK structure.
********************************************************************/
void make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk,
BOOL make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk,
uint32 ver, uint32 crc32, uint32 seq_num)
{
if (chk == NULL) return;
if (chk == NULL) return False;
chk->ver = ver ;
chk->reserved = 0x0;
chk->crc32 = crc32 ;
chk->seq_num = seq_num ;
return True;
}
/*******************************************************************
reads or writes an RPC_AUTH_NTLMSSP_CHK structure.
********************************************************************/
void smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth)
BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth)
{
if (chk == NULL) return;
if (chk == NULL) return False;
prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chk");
depth++;
@ -918,5 +982,7 @@ void smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_stru
prs_uint32("reserved", ps, depth, &(chk->reserved));
prs_uint32("crc32 ", ps, depth, &(chk->crc32 ));
prs_uint32("seq_num ", ps, depth, &(chk->seq_num ));
return True;
}

File diff suppressed because it is too large Load Diff

View File

@ -2,10 +2,10 @@
* Unix SMB/Netbios implementation.
* Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1998,
* Copyright (C) Jeremy R. Allison 1995-1998
* Copyright (C) Luke Kenneth Casson Leighton 1996-1998,
* Copyright (C) Paul Ashton 1997-1998.
* Copyright (C) Andrew Tridgell 1992-1999,
* Copyright (C) Jeremy R. Allison 1995-1999
* Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
* Copyright (C) Paul Ashton 1997-1999.
*
* 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
@ -31,17 +31,19 @@ extern int DEBUGLEVEL;
/*******************************************************************
makes a structure.
********************************************************************/
void make_sec_access(SEC_ACCESS *t, uint32 mask)
BOOL make_sec_access(SEC_ACCESS *t, uint32 mask)
{
t->mask = mask;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth)
{
if (t == NULL) return;
BOOL sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth)
{
if (t == NULL) return False;
prs_debug(ps, depth, desc, "sec_io_access");
depth++;
@ -49,13 +51,15 @@ void sec_io_access(char *desc, SEC_ACCESS *t, prs_struct *ps, int depth)
prs_align(ps);
prs_uint32("mask", ps, depth, &(t->mask));
return True;
}
/*******************************************************************
makes a structure.
********************************************************************/
void make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag)
BOOL make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 flag)
{
t->type = type;
t->flags = flag;
@ -63,16 +67,18 @@ void make_sec_ace(SEC_ACE *t, DOM_SID *sid, uint8 type, SEC_ACCESS mask, uint8 f
t->info = mask;
sid_copy(&t->sid, sid);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth)
BOOL sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth)
{
uint32 old_offset;
uint32 offset_ace_size;
if (t == NULL) return;
if (t == NULL) return False;
prs_debug(ps, depth, desc, "sec_io_ace");
depth++;
@ -90,12 +96,14 @@ void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth)
smb_io_dom_sid("sid ", &t->sid , ps, depth);
prs_uint16_post("size ", ps, depth, &t->size, offset_ace_size, old_offset);
return True;
}
/*******************************************************************
makes a structure.
********************************************************************/
void make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace)
BOOL make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace)
{
int i;
t->revision = revision;
@ -107,6 +115,8 @@ void make_sec_acl(SEC_ACL *t, uint16 revision, int num_aces, SEC_ACE *ace)
{
t->size += ace[i].size;
}
return True;
}
/*******************************************************************
@ -126,13 +136,13 @@ reads or writes a structure.
first of the xx_io_xx functions that allocates its data structures
for you as it reads them.
********************************************************************/
void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth)
BOOL sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth)
{
int i;
uint32 old_offset;
uint32 offset_acl_size;
if (t == NULL) return;
if (t == NULL) return False;
prs_debug(ps, depth, desc, "sec_io_acl");
depth++;
@ -156,7 +166,7 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth)
{
DEBUG(0,("INVALID ACL\n"));
ps->offset = 0xfffffffe;
return;
return False;
}
for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++)
@ -169,6 +179,8 @@ void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth)
prs_align(ps);
prs_uint16_post("size ", ps, depth, &t->size , offset_acl_size, old_offset);
return True;
}
@ -253,7 +265,8 @@ void free_sec_desc(SEC_DESC *t)
if (t->sacl != NULL)
{
free_sec_acl(t->dacl);
}
}
if (t->owner_sid != NULL)
{
@ -261,7 +274,7 @@ void free_sec_desc(SEC_DESC *t)
}
if (t->grp_sid != NULL)
{
{
free(t->grp_sid);
}
}
@ -270,7 +283,7 @@ void free_sec_desc(SEC_DESC *t)
/*******************************************************************
reads or writes a structure.
********************************************************************/
static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
static BOOL sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
{
#if 0
uint32 off_owner_sid;
@ -281,7 +294,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
uint32 old_offset;
uint32 max_offset = 0; /* after we're done, move offset to end */
if (t == NULL) return;
if (t == NULL) return False;
prs_debug(ps, depth, desc, "sec_io_desc");
depth++;
@ -317,13 +330,13 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
/* reading */
t->dacl = malloc(sizeof(*t->dacl));
ZERO_STRUCTP(t->dacl);
}
}
if (t->dacl == NULL)
{
DEBUG(0,("INVALID DACL\n"));
ps->offset = 0xfffffffe;
return;
return False;
}
sec_io_acl ("dacl" , t->dacl , ps, depth);
@ -355,7 +368,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
{
DEBUG(0,("INVALID SACL\n"));
ps->offset = 0xfffffffe;
return;
return False;
}
sec_io_acl ("sacl" , t->sacl , ps, depth);
@ -390,7 +403,7 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
{
DEBUG(0,("INVALID OWNER SID\n"));
ps->offset = 0xfffffffe;
return;
return False;
}
smb_io_dom_sid("owner_sid ", t->owner_sid , ps, depth);
@ -407,20 +420,21 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
if (ps->io)
{
ps->offset = old_offset + t->off_grp_sid;
}
}
if (ps->io)
{
{
/* reading */
t->grp_sid = malloc(sizeof(*t->grp_sid));
ZERO_STRUCTP(t->grp_sid);
}
if (t->grp_sid == NULL)
{
{
DEBUG(0,("INVALID GROUP SID\n"));
ps->offset = 0xfffffffe;
return;
}
return False;
}
smb_io_dom_sid("grp_sid", t->grp_sid, ps, depth);
prs_align(ps);
@ -429,13 +443,15 @@ static void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
max_offset = MAX(max_offset, ps->offset);
ps->offset = max_offset;
return True;
}
/*******************************************************************
creates a SEC_DESC_BUF structure.
********************************************************************/
void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data)
{
BOOL make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data)
{
ZERO_STRUCTP(buf);
/* max buffer size (allocated size) */
@ -443,6 +459,8 @@ void make_sec_desc_buf(SEC_DESC_BUF *buf, int len, SEC_DESC *data)
buf->undoc = 0;
buf->len = data != NULL ? len : 0;
buf->sec = data;
return True;
}
/*******************************************************************
@ -461,14 +479,14 @@ void free_sec_desc_buf(SEC_DESC_BUF *buf)
/*******************************************************************
reads or writes a SEC_DESC_BUF structure.
********************************************************************/
void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth)
BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth)
{
uint32 off_len;
uint32 off_max_len;
uint32 old_offset;
uint32 size;
if (sec == NULL) return;
if (sec == NULL) return False;
prs_debug(ps, depth, desc, "sec_io_desc_buf");
depth++;
@ -491,7 +509,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth)
{
DEBUG(0,("INVALID SEC_DESC\n"));
ps->offset = 0xfffffffe;
return;
return False;
}
}
@ -504,5 +522,7 @@ void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth)
size = ps->offset - old_offset;
prs_uint32_post("max_len", ps, depth, &(sec->max_len), off_max_len, size == 0 ? sec->max_len : size);
prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , size);
return True;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,9 @@
* Unix SMB/Netbios implementation.
* Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
* Copyright (C) Andrew Tridgell 1992-1999,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
* Copyright (C) Paul Ashton 1997-1999.
*
* 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,7 +30,7 @@ extern int DEBUGLEVEL;
/*******************************************************************
make_svc_q_open_sc_man
********************************************************************/
void make_svc_q_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u,
BOOL make_svc_q_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u,
char *server, char *database,
uint32 des_access)
{
@ -40,14 +40,16 @@ void make_svc_q_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u,
make_buf_unistr2(&(q_u->uni_db_name ), &(q_u->ptr_db_name), database);
q_u->des_access = des_access;
return True;
}
/*******************************************************************
reads or writes a SVC_Q_OPEN_SC_MAN structure.
********************************************************************/
void svc_io_q_open_sc_man(char *desc, SVC_Q_OPEN_SC_MAN *q_u, prs_struct *ps, int depth)
BOOL svc_io_q_open_sc_man(char *desc, SVC_Q_OPEN_SC_MAN *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
if (q_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_q_open_sc_man");
depth++;
@ -64,26 +66,30 @@ void svc_io_q_open_sc_man(char *desc, SVC_Q_OPEN_SC_MAN *q_u, prs_struct *ps, in
prs_uint32("des_access", ps, depth, &(q_u->des_access));
prs_align(ps);
return True;
}
/*******************************************************************
make_svc_r_open_sc_man
********************************************************************/
void make_svc_r_open_sc_man(SVC_R_OPEN_SC_MAN *r_u, POLICY_HND *hnd,
BOOL make_svc_r_open_sc_man(SVC_R_OPEN_SC_MAN *r_u, POLICY_HND *hnd,
uint32 status)
{
DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__));
memcpy(&(r_u->pol), hnd, sizeof(r_u->pol));
r_u->status = status;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, int depth)
BOOL svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
if (r_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_r_open_sc_man");
depth++;
@ -93,12 +99,14 @@ void svc_io_r_open_sc_man(char *desc, SVC_R_OPEN_SC_MAN *r_u, prs_struct *ps, i
smb_io_pol_hnd("", &(r_u->pol), ps, depth);
prs_uint32("status ", ps, depth, &(r_u->status));
return True;
}
/*******************************************************************
make_svc_q_open_service
********************************************************************/
void make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u,
BOOL make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u,
POLICY_HND *hnd,
char *server,
uint32 des_access)
@ -109,14 +117,16 @@ void make_svc_q_open_service(SVC_Q_OPEN_SERVICE *q_u,
make_unistr2(&(q_u->uni_svc_name), server, strlen(server)+1);
q_u->des_access = des_access;
return True;
}
/*******************************************************************
reads or writes a SVC_Q_OPEN_SERVICE structure.
********************************************************************/
void svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth)
BOOL svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
if (q_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_q_open_service");
depth++;
@ -131,26 +141,30 @@ void svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps,
prs_uint32("des_access", ps, depth, &(q_u->des_access));
prs_align(ps);
return True;
}
/*******************************************************************
make_svc_r_open_service
********************************************************************/
void make_svc_r_open_service(SVC_R_OPEN_SERVICE *r_u, POLICY_HND *hnd,
BOOL make_svc_r_open_service(SVC_R_OPEN_SERVICE *r_u, POLICY_HND *hnd,
uint32 status)
{
DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__));
memcpy(&(r_u->pol), hnd, sizeof(r_u->pol));
r_u->status = status;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth)
BOOL svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
if (r_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_r_open_service");
depth++;
@ -160,14 +174,16 @@ void svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps,
smb_io_pol_hnd("", &(r_u->pol), ps, depth);
prs_uint32("status ", ps, depth, &(r_u->status));
return True;
}
/*******************************************************************
reads or writes a SVC_Q_START_SERVICE structure.
********************************************************************/
void svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps, int depth)
BOOL svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps, int depth)
{
if (q_s == NULL) return;
if (q_s == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_q_start_service");
depth++;
@ -195,25 +211,29 @@ void svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps
smb_io_unistr2("", &(q_s->argv[i]), 1, ps, depth);
}
}
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_r_start_service(char *desc, SVC_R_START_SERVICE *r_s, prs_struct *ps, int depth)
BOOL svc_io_r_start_service(char *desc, SVC_R_START_SERVICE *r_s, prs_struct *ps, int depth)
{
if (r_s == NULL) return;
if (r_s == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_r_start_service");
depth++;
prs_uint32("status", ps, depth, &(r_s->status));
return True;
}
/*******************************************************************
make_svc_query_svc_cfg
********************************************************************/
void make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u,
BOOL make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u,
uint32 service_type, uint32 start_type,
uint32 error_control,
char* bin_path_name, char* load_order_grp,
@ -232,14 +252,16 @@ void make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u,
make_buf_unistr2(&(q_u->uni_dependencies ), &(q_u->ptr_dependencies ), dependencies );
make_buf_unistr2(&(q_u->uni_service_start_name), &(q_u->ptr_service_start_name), service_start_name);
make_buf_unistr2(&(q_u->uni_display_name ), &(q_u->ptr_display_name ), disp_name );
return True;
}
/*******************************************************************
reads or writes a QUERY_SERVICE_CONFIG structure.
********************************************************************/
void svc_io_query_svc_cfg(char *desc, QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth)
BOOL svc_io_query_svc_cfg(char *desc, QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
if (q_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_query_svc_cfg");
depth++;
@ -266,16 +288,18 @@ void svc_io_query_svc_cfg(char *desc, QUERY_SERVICE_CONFIG *q_u, prs_struct *ps,
prs_align(ps);
smb_io_unistr2("uni_display_name ", &(q_u->uni_display_name ), q_u->ptr_display_name , ps, depth);
prs_align(ps);
return True;
}
/*******************************************************************
makes an SVC_Q_ENUM_SVCS_STATUS structure.
********************************************************************/
void make_svc_q_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_c, POLICY_HND *hnd,
BOOL make_svc_q_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_c, POLICY_HND *hnd,
uint32 service_type, uint32 service_state,
uint32 buf_size, uint32 resume_hnd )
{
if (q_c == NULL || hnd == NULL) return;
if (q_c == NULL || hnd == NULL) return False;
DEBUG(5,("make_svc_q_enum_svcs_status\n"));
@ -284,14 +308,16 @@ void make_svc_q_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_c, POLICY_HND *hnd,
q_c->service_state = service_state;
q_c->buf_size = buf_size;
make_enum_hnd(&q_c->resume_hnd, resume_hnd);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_q_enum_svcs_status(char *desc, SVC_Q_ENUM_SVCS_STATUS *q_u, prs_struct *ps, int depth)
BOOL svc_io_q_enum_svcs_status(char *desc, SVC_Q_ENUM_SVCS_STATUS *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
if (q_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_q_enum_svcs_status");
depth++;
@ -305,17 +331,19 @@ void svc_io_q_enum_svcs_status(char *desc, SVC_Q_ENUM_SVCS_STATUS *q_u, prs_str
prs_uint32("service_state", ps, depth, &(q_u->service_state));
prs_uint32("buf_size ", ps, depth, &(q_u->buf_size ));
smb_io_enum_hnd("resume_hnd", &(q_u->resume_hnd), ps, depth);
return True;
}
/*******************************************************************
makes an SVC_R_ENUM_SVCS_STATUS structure.
********************************************************************/
void make_svc_r_enum_svcs_status(SVC_R_ENUM_SVCS_STATUS *r_c,
BOOL make_svc_r_enum_svcs_status(SVC_R_ENUM_SVCS_STATUS *r_c,
ENUM_SRVC_STATUS *svcs, uint32 more_buf_size,
uint32 num_svcs, uint32 resume_hnd,
uint32 dos_status)
{
if (r_c == NULL) return;
if (r_c == NULL) return False;
DEBUG(5,("make_svc_r_enum_svcs_status\n"));
@ -324,6 +352,8 @@ void make_svc_r_enum_svcs_status(SVC_R_ENUM_SVCS_STATUS *r_c,
r_c->num_svcs = num_svcs;
make_enum_hnd(&r_c->resume_hnd, resume_hnd);
r_c->dos_status = dos_status;
return True;
}
/*******************************************************************
@ -334,10 +364,10 @@ not COMMUNICATE and get some CONSISTENCY TO THEIR DATA STRUCTURES!
ARGH!
********************************************************************/
void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_struct *ps, int depth)
BOOL svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_struct *ps, int depth)
{
int i;
if (svc == NULL) return;
if (svc == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_r_enum_svcs_status");
depth++;
@ -380,7 +410,7 @@ void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru
{
DEBUG(0,("svc_io_r_enum_svcs_status: Realloc failed\n"));
ps->offset = 0x7fffffff;
return;
return False;
}
bzero(svc->svcs, svc->num_svcs * sizeof(ENUM_SRVC_STATUS));
@ -426,7 +456,7 @@ void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru
if (svc->svcs == NULL)
{
return;
return False;
}
for (i = 0; i < svc->num_svcs; i++)
@ -482,14 +512,16 @@ void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_stru
smb_io_enum_hnd("resume_hnd", &(svc->resume_hnd), ps, depth);
prs_uint32("dos_status", ps, depth, &(svc->dos_status));
}
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth)
BOOL svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth)
{
if (svc == NULL) return;
if (svc == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_svc_status");
depth++;
@ -503,28 +535,32 @@ void svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth)
prs_uint32("svc_specific_exit_code", ps, depth, &(svc->svc_specific_exit_code));
prs_uint32("check_point", ps, depth, &(svc->check_point));
prs_uint32("wait_hint", ps, depth, &(svc->wait_hint));
return True;
}
/*******************************************************************
makes an SVC_Q_QUERY_SVC_CONFIG structure.
********************************************************************/
void make_svc_q_query_svc_config(SVC_Q_QUERY_SVC_CONFIG *q_c, POLICY_HND *hnd,
BOOL make_svc_q_query_svc_config(SVC_Q_QUERY_SVC_CONFIG *q_c, POLICY_HND *hnd,
uint32 buf_size)
{
if (q_c == NULL || hnd == NULL) return;
if (q_c == NULL || hnd == NULL) return False;
DEBUG(5,("make_svc_q_query_svc_config\n"));
memcpy(&(q_c->pol), hnd, sizeof(q_c->pol));
q_c->buf_size = buf_size;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_struct *ps, int depth)
BOOL svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
if (q_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_q_query_svc_config");
depth++;
@ -534,29 +570,33 @@ void svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_str
smb_io_pol_hnd("", &(q_u->pol), ps, depth);
prs_align(ps);
prs_uint32("buf_size", ps, depth, &(q_u->buf_size));
return True;
}
/*******************************************************************
makes an SVC_R_QUERY_SVC_CONFIG structure.
********************************************************************/
void make_svc_r_query_svc_config(SVC_R_QUERY_SVC_CONFIG *r_c,
BOOL make_svc_r_query_svc_config(SVC_R_QUERY_SVC_CONFIG *r_c,
QUERY_SERVICE_CONFIG *cfg,
uint32 buf_size)
{
if (r_c == NULL) return;
if (r_c == NULL) return False;
DEBUG(5,("make_svc_r_query_svc_config\n"));
r_c->cfg = cfg;
r_c->buf_size = buf_size;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_struct *ps, int depth)
BOOL svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
if (r_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_r_query_svc_config");
depth++;
@ -566,14 +606,16 @@ void svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_str
svc_io_query_svc_cfg("cfg", r_u->cfg, ps, depth);
prs_uint32("buf_size", ps, depth, &(r_u->buf_size));
prs_uint32("status ", ps, depth, &(r_u->status ));
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_q_query_disp_name(char *desc, SVC_Q_QUERY_DISP_NAME *q_u, prs_struct *ps, int depth)
BOOL svc_io_q_query_disp_name(char *desc, SVC_Q_QUERY_DISP_NAME *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
if (q_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_q_query_disp_name");
depth++;
@ -587,17 +629,19 @@ void svc_io_q_query_disp_name(char *desc, SVC_Q_QUERY_DISP_NAME *q_u, prs_struct
prs_align(ps);
prs_uint32("buf_size", ps, depth, &(q_u->buf_size));
return True;
}
/*******************************************************************
makes an SVC_R_QUERY_DISP_NAME structure.
********************************************************************/
void make_svc_r_query_disp_name(SVC_R_QUERY_DISP_NAME *r_d,
BOOL make_svc_r_query_disp_name(SVC_R_QUERY_DISP_NAME *r_d,
char *disp_name, uint32 status)
{
uint32 len = strlen(disp_name);
if (r_d == NULL) return;
if (r_d == NULL) return False;
DEBUG(5,("make_svc_r_query_disp_name\n"));
@ -605,14 +649,16 @@ void make_svc_r_query_disp_name(SVC_R_QUERY_DISP_NAME *r_d,
r_d->buf_size = len;
r_d->status = status;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_r_query_disp_name(char *desc, SVC_R_QUERY_DISP_NAME *r_u, prs_struct *ps, int depth)
BOOL svc_io_r_query_disp_name(char *desc, SVC_R_QUERY_DISP_NAME *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
if (r_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_r_query_disp_name");
depth++;
@ -624,26 +670,30 @@ void svc_io_r_query_disp_name(char *desc, SVC_R_QUERY_DISP_NAME *r_u, prs_struct
prs_uint32("buf_size", ps, depth, &(r_u->buf_size));
prs_uint32("status ", ps, depth, &(r_u->status ));
return True;
}
/*******************************************************************
makes an SVC_Q_CLOSE structure.
********************************************************************/
void make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd)
BOOL make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd)
{
if (q_c == NULL || hnd == NULL) return;
if (q_c == NULL || hnd == NULL) return False;
DEBUG(5,("make_svc_q_close\n"));
memcpy(&(q_c->pol), hnd, sizeof(q_c->pol));
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth)
BOOL svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
if (q_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_q_close");
depth++;
@ -652,14 +702,16 @@ void svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth)
smb_io_pol_hnd("", &(q_u->pol), ps, depth);
prs_align(ps);
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth)
BOOL svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
if (r_u == NULL) return False;
prs_debug(ps, depth, desc, "svc_io_r_close");
depth++;
@ -670,5 +722,7 @@ void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth)
prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
return True;
}

View File

@ -3,9 +3,9 @@
* Unix SMB/Netbios implementation.
* Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
* Copyright (C) Andrew Tridgell 1992-1999,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1999,
* Copyright (C) Paul Ashton 1997-1999.
*
* 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,7 +30,7 @@ extern int DEBUGLEVEL;
/*******************************************************************
make_wks_q_query_info
********************************************************************/
void make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u,
BOOL make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u,
char *server, uint16 switch_value)
{
DEBUG(5,("make_wks_q_query_info\n"));
@ -38,14 +38,16 @@ void make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u,
make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server);
q_u->switch_value = switch_value;
return True;
}
/*******************************************************************
reads or writes a WKS_Q_QUERY_INFO structure.
********************************************************************/
void wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth)
BOOL wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return;
if (q_u == NULL) return False;
prs_debug(ps, depth, desc, "wks_io_q_query_info");
depth++;
@ -58,12 +60,14 @@ void wks_io_q_query_info(char *desc, WKS_Q_QUERY_INFO *q_u, prs_struct *ps, int
prs_uint16("switch_value", ps, depth, &(q_u->switch_value));
prs_align(ps);
return True;
}
/*******************************************************************
wks_info_100
********************************************************************/
void make_wks_info_100(WKS_INFO_100 *inf,
BOOL make_wks_info_100(WKS_INFO_100 *inf,
uint32 platform_id, uint32 ver_major, uint32 ver_minor,
char *my_name, char *domain_name)
{
@ -75,14 +79,16 @@ void make_wks_info_100(WKS_INFO_100 *inf,
make_buf_unistr2(&(inf->uni_compname), &(inf->ptr_compname), my_name );
make_buf_unistr2(&(inf->uni_lan_grp ), &(inf->ptr_lan_grp ), domain_name);
return True;
}
/*******************************************************************
reads or writes a WKS_INFO_100 structure.
********************************************************************/
static void wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth)
static BOOL wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, int depth)
{
if (inf == NULL) return;
if (inf == NULL) return False;
prs_debug(ps, depth, desc, "wks_io_wks_info_100");
depth++;
@ -100,6 +106,8 @@ static void wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, i
smb_io_unistr2("", &(inf->uni_lan_grp ), inf->ptr_lan_grp , ps, depth);
prs_align(ps);
return True;
}
/*******************************************************************
@ -108,7 +116,7 @@ static void wks_io_wks_info_100(char *desc, WKS_INFO_100 *inf, prs_struct *ps, i
only supports info level 100 at the moment.
********************************************************************/
void make_wks_r_query_info(WKS_R_QUERY_INFO *r_u,
BOOL make_wks_r_query_info(WKS_R_QUERY_INFO *r_u,
uint32 switch_value, WKS_INFO_100 *wks100,
int status)
{
@ -120,14 +128,16 @@ void make_wks_r_query_info(WKS_R_QUERY_INFO *r_u,
r_u->wks100 = wks100;
r_u->status = status;
return True;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
void wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth)
BOOL wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL) return;
if (r_u == NULL) return False;
prs_debug(ps, depth, desc, "wks_io_r_query_info");
depth++;
@ -141,5 +151,7 @@ void wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int
wks_io_wks_info_100("inf", r_u->wks100, ps, depth);
prs_uint32("status ", ps, depth, &(r_u->status));
return True;
}