mirror of
https://github.com/samba-team/samba.git
synced 2025-03-12 20:58:37 +03:00
Remove more redundant lsa parsing functions.
Guenther (This used to be commit 99dd28da84c270f46535bd2ffa6bfef96d2e2eed)
This commit is contained in:
parent
f326cd2be5
commit
351377a90e
@ -1059,121 +1059,6 @@ typedef struct {
|
||||
NTSTATUS status;
|
||||
} LSA_R_SET_SECRET;
|
||||
|
||||
/* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO - LSA query trusted domain info */
|
||||
typedef struct lsa_query_trusted_domain_info
|
||||
{
|
||||
POLICY_HND pol; /* policy handle */
|
||||
uint16 info_class; /* info class */
|
||||
|
||||
} LSA_Q_QUERY_TRUSTED_DOMAIN_INFO;
|
||||
|
||||
typedef struct trusted_domain_info_name {
|
||||
LSA_STRING netbios_name;
|
||||
} TRUSTED_DOMAIN_INFO_NAME;
|
||||
|
||||
typedef struct trusted_domain_info_posix_offset {
|
||||
uint32 posix_offset;
|
||||
} TRUSTED_DOMAIN_INFO_POSIX_OFFSET;
|
||||
|
||||
typedef struct lsa_data_buf {
|
||||
uint32 size;
|
||||
uint32 offset;
|
||||
uint32 length;
|
||||
uint8 *data;
|
||||
} LSA_DATA_BUF;
|
||||
|
||||
typedef struct lsa_data_buf_hdr {
|
||||
uint32 length;
|
||||
uint32 size;
|
||||
uint32 data_ptr;
|
||||
} LSA_DATA_BUF_HDR;
|
||||
|
||||
typedef struct lsa_data_buf2 {
|
||||
uint32 size;
|
||||
uint8 *data;
|
||||
} LSA_DATA_BUF2;
|
||||
|
||||
typedef struct trusted_domain_info_password {
|
||||
uint32 ptr_password;
|
||||
uint32 ptr_old_password;
|
||||
LSA_DATA_BUF_HDR password_hdr;
|
||||
LSA_DATA_BUF_HDR old_password_hdr;
|
||||
LSA_DATA_BUF password;
|
||||
LSA_DATA_BUF old_password;
|
||||
} TRUSTED_DOMAIN_INFO_PASSWORD;
|
||||
|
||||
typedef struct trusted_domain_info_basic {
|
||||
LSA_STRING netbios_name;
|
||||
DOM_SID2 sid;
|
||||
} TRUSTED_DOMAIN_INFO_BASIC;
|
||||
|
||||
typedef struct trusted_domain_info_ex {
|
||||
LSA_STRING domain_name;
|
||||
LSA_STRING netbios_name;
|
||||
DOM_SID2 sid;
|
||||
uint32 trust_direction;
|
||||
uint32 trust_type;
|
||||
uint32 trust_attributes;
|
||||
} TRUSTED_DOMAIN_INFO_EX;
|
||||
|
||||
typedef struct trust_domain_info_buffer {
|
||||
NTTIME last_update_time;
|
||||
uint32 secret_type;
|
||||
LSA_DATA_BUF2 data;
|
||||
} LSA_TRUSTED_DOMAIN_INFO_BUFFER;
|
||||
|
||||
typedef struct trusted_domain_info_auth_info {
|
||||
uint32 incoming_count;
|
||||
LSA_TRUSTED_DOMAIN_INFO_BUFFER incoming_current_auth_info;
|
||||
LSA_TRUSTED_DOMAIN_INFO_BUFFER incoming_previous_auth_info;
|
||||
uint32 outgoing_count;
|
||||
LSA_TRUSTED_DOMAIN_INFO_BUFFER outgoing_current_auth_info;
|
||||
LSA_TRUSTED_DOMAIN_INFO_BUFFER outgoing_previous_auth_info;
|
||||
} TRUSTED_DOMAIN_INFO_AUTH_INFO;
|
||||
|
||||
typedef struct trusted_domain_info_full_info {
|
||||
TRUSTED_DOMAIN_INFO_EX info_ex;
|
||||
TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset;
|
||||
TRUSTED_DOMAIN_INFO_AUTH_INFO auth_info;
|
||||
} TRUSTED_DOMAIN_INFO_FULL_INFO;
|
||||
|
||||
typedef struct trusted_domain_info_11 {
|
||||
TRUSTED_DOMAIN_INFO_EX info_ex;
|
||||
LSA_DATA_BUF2 data1;
|
||||
} TRUSTED_DOMAIN_INFO_11;
|
||||
|
||||
typedef struct trusted_domain_info_all {
|
||||
TRUSTED_DOMAIN_INFO_EX info_ex;
|
||||
LSA_DATA_BUF2 data1;
|
||||
TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset;
|
||||
TRUSTED_DOMAIN_INFO_AUTH_INFO auth_info;
|
||||
} TRUSTED_DOMAIN_INFO_ALL;
|
||||
|
||||
/* LSA_TRUSTED_DOMAIN_INFO */
|
||||
typedef union lsa_trusted_domain_info
|
||||
{
|
||||
uint16 info_class;
|
||||
TRUSTED_DOMAIN_INFO_NAME name;
|
||||
/* deprecated - gd
|
||||
TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO controllers; */
|
||||
TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset;
|
||||
TRUSTED_DOMAIN_INFO_PASSWORD password;
|
||||
TRUSTED_DOMAIN_INFO_BASIC basic;
|
||||
TRUSTED_DOMAIN_INFO_EX info_ex;
|
||||
TRUSTED_DOMAIN_INFO_AUTH_INFO auth_info;
|
||||
TRUSTED_DOMAIN_INFO_FULL_INFO full_info;
|
||||
TRUSTED_DOMAIN_INFO_11 info11;
|
||||
TRUSTED_DOMAIN_INFO_ALL info_all;
|
||||
|
||||
} LSA_TRUSTED_DOMAIN_INFO;
|
||||
|
||||
/* LSA_R_QUERY_TRUSTED_DOMAIN_INFO - LSA query trusted domain info */
|
||||
typedef struct r_lsa_query_trusted_domain_info
|
||||
{
|
||||
LSA_TRUSTED_DOMAIN_INFO *info;
|
||||
NTSTATUS status;
|
||||
} LSA_R_QUERY_TRUSTED_DOMAIN_INFO;
|
||||
|
||||
typedef struct dom_info_kerberos {
|
||||
uint32 enforce_restrictions;
|
||||
NTTIME service_tkt_lifetime;
|
||||
|
@ -3636,263 +3636,6 @@ bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_stru
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure.
|
||||
********************************************************************/
|
||||
|
||||
void init_q_query_trusted_domain_info(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q,
|
||||
POLICY_HND *hnd, uint16 info_class)
|
||||
{
|
||||
DEBUG(5, ("init_q_query_trusted_domain_info\n"));
|
||||
|
||||
q->pol = *hnd;
|
||||
q->info_class = info_class;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure.
|
||||
********************************************************************/
|
||||
|
||||
bool lsa_io_q_query_trusted_domain_info(const char *desc,
|
||||
LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q_q,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_uint16("info_class", ps, depth, &q_q->info_class))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static bool smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
prs_debug(ps, depth, desc, "smb_io_lsa_data_buf_hdr");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("length", ps, depth, &buf_hdr->length))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("size", ps, depth, &buf_hdr->size))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("data_ptr", ps, depth, &buf_hdr->data_ptr))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static bool smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf,
|
||||
prs_struct *ps, int depth, int length, int size)
|
||||
{
|
||||
prs_debug(ps, depth, desc, "smb_io_lsa_data_buf");
|
||||
depth++;
|
||||
|
||||
if ( UNMARSHALLING(ps) && length ) {
|
||||
if ( !(buf->data = PRS_ALLOC_MEM( ps, uint8, length )) )
|
||||
return False;
|
||||
}
|
||||
|
||||
if (!prs_uint32("size", ps, depth, &buf->size))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("offset", ps, depth, &buf->offset))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("length", ps, depth, &buf->length))
|
||||
return False;
|
||||
|
||||
if(!prs_uint8s(False, "data", ps, depth, buf->data, length))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static bool lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME *name,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (!smb_io_lsa_string("netbios_name", &name->netbios_name, ps, depth))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static bool lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_OFFSET *posix,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(!prs_uint32("posix_offset", ps, depth, &posix->posix_offset))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static bool lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWORD *password,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("ptr_password", ps, depth, &password->ptr_password))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("ptr_old_password", ps, depth, &password->ptr_old_password))
|
||||
return False;
|
||||
|
||||
if (&password->ptr_password) {
|
||||
|
||||
if (!smb_io_lsa_data_buf_hdr("password_hdr", &password->password_hdr, ps, depth))
|
||||
return False;
|
||||
|
||||
if (!smb_io_lsa_data_buf("password", &password->password, ps, depth,
|
||||
password->password_hdr.length, password->password_hdr.size))
|
||||
return False;
|
||||
}
|
||||
|
||||
if (&password->ptr_old_password) {
|
||||
|
||||
if (!smb_io_lsa_data_buf_hdr("old_password_hdr", &password->old_password_hdr, ps, depth))
|
||||
return False;
|
||||
|
||||
if (!smb_io_lsa_data_buf("old_password", &password->old_password, ps, depth,
|
||||
password->old_password_hdr.length, password->old_password_hdr.size))
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static bool lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *info_ex,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
uint32 dom_sid_ptr;
|
||||
|
||||
if (!smb_io_unihdr("domain_name_hdr", &info_ex->domain_name.hdr, ps, depth))
|
||||
return False;
|
||||
|
||||
if (!smb_io_unihdr("netbios_name_hdr", &info_ex->netbios_name.hdr, ps, depth))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("dom_sid_ptr", ps, depth, &dom_sid_ptr))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("trust_direction", ps, depth, &info_ex->trust_direction))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("trust_type", ps, depth, &info_ex->trust_type))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("trust_attributes", ps, depth, &info_ex->trust_attributes))
|
||||
return False;
|
||||
|
||||
if (!smb_io_unistr2("domain_name_unistring", &info_ex->domain_name.unistring, info_ex->domain_name.hdr.buffer, ps, depth))
|
||||
return False;
|
||||
|
||||
if (!smb_io_unistr2("netbios_name_unistring", &info_ex->netbios_name.unistring, info_ex->netbios_name.hdr.buffer, ps, depth))
|
||||
return False;
|
||||
|
||||
if (!smb_io_dom_sid2("sid", &info_ex->sid, ps, depth))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static bool lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info)
|
||||
{
|
||||
prs_debug(ps, depth, desc, "lsa_io_trustdom_query");
|
||||
depth++;
|
||||
|
||||
if(!prs_uint16("info_class", ps, depth, &info->info_class))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
switch (info->info_class) {
|
||||
case 1:
|
||||
if(!lsa_io_trustdom_query_1("name", &info->name, ps, depth))
|
||||
return False;
|
||||
break;
|
||||
case 3:
|
||||
if(!lsa_io_trustdom_query_3("posix_offset", &info->posix_offset, ps, depth))
|
||||
return False;
|
||||
break;
|
||||
case 4:
|
||||
if(!lsa_io_trustdom_query_4("password", &info->password, ps, depth))
|
||||
return False;
|
||||
break;
|
||||
case 6:
|
||||
if(!lsa_io_trustdom_query_6("info_ex", &info->info_ex, ps, depth))
|
||||
return False;
|
||||
break;
|
||||
default:
|
||||
DEBUG(0,("unsupported info-level: %d\n", info->info_class));
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Reads or writes an LSA_R_QUERY_TRUSTED_DOMAIN_INFO structure.
|
||||
********************************************************************/
|
||||
|
||||
bool lsa_io_r_query_trusted_domain_info(const char *desc,
|
||||
LSA_R_QUERY_TRUSTED_DOMAIN_INFO *r_q,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (r_q == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "lsa_io_r_query_trusted_domain_info");
|
||||
depth++;
|
||||
|
||||
if (!prs_pointer("trustdom", ps, depth, (void*)&r_q->info,
|
||||
sizeof(LSA_TRUSTED_DOMAIN_INFO),
|
||||
(PRS_POINTER_CAST)lsa_io_trustdom_query) )
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_ntstatus("status", ps, depth, &r_q->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Inits an LSA_Q_QUERY_DOM_INFO_POLICY structure.
|
||||
********************************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user