1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

Some code moved back from TNG - updates to LSA stuff. Not yet used but

will be needed soon.
Jeremy.
This commit is contained in:
Jeremy Allison 0001-01-01 00:00:00 +00:00
parent 07dffc4ee9
commit f0aa8f9314
3 changed files with 105 additions and 11 deletions

View File

@ -1548,6 +1548,7 @@ BOOL lp_add_printer(char *pszPrintername, int iDefaultService);
BOOL lp_file_list_changed(void);
void *lp_local_ptr(int snum, void *ptr);
BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue);
void init_locals(void);
BOOL lp_is_default(int snum, struct parm_struct *parm);
struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
BOOL lp_snum_ok(int iService);
@ -2143,7 +2144,7 @@ BOOL dfs_io_dfs_storage_info(char *desc, DFS_INFO_3* info3,
/*The following definitions come from rpc_parse/parse_lsa.c */
void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
uint32 sid_name_use, char *name, uint32 idx);
uint16 sid_name_use, char *name, uint32 idx);
void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff,
uint32 unknown);
void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos);
@ -2159,6 +2160,9 @@ void init_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name,
LSA_SEC_QOS *qos);
BOOL lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth);
BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth);
void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, uint32 sec_info);
BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, prs_struct *ps, int depth);
BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, prs_struct *ps, int depth);
void init_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class);
BOOL lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, 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);
@ -2792,6 +2796,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info);
uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info);
uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info);
uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info);
uint32 spoolss_size_string_array(uint16 *string);
uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info);
uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info);
uint32 spoolss_size_job_info_1(JOB_INFO_1 *info);

View File

@ -130,6 +130,24 @@ typedef struct lsa_r_open_pol2_info
} LSA_R_OPEN_POL2;
/* LSA_Q_QUERY_SEC_OBJ - LSA query security */
typedef struct lsa_query_sec_obj_info
{
POLICY_HND pol; /* policy handle */
uint32 sec_info;
} LSA_Q_QUERY_SEC_OBJ;
/* LSA_R_QUERY_SEC_OBJ - probably an open */
typedef struct r_lsa_query_sec_obj_info
{
uint32 ptr;
SEC_DESC_BUF *buf;
uint32 status; /* return status */
} LSA_R_QUERY_SEC_OBJ;
/* LSA_Q_QUERY_INFO - LSA query info policy */
typedef struct lsa_query_info
{
@ -234,7 +252,7 @@ typedef struct dom_ref_info
/* LSA_TRANS_NAME - translated name */
typedef struct lsa_trans_name_info
{
uint32 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */
uint16 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */
UNIHDR hdr_name;
uint32 domain_idx; /* index into DOM_R_REF array of SIDs */
@ -324,4 +342,3 @@ typedef struct lsa_r_lookup_names
} LSA_R_LOOKUP_NAMES;
#endif /* _RPC_LSA_H */

View File

@ -32,7 +32,7 @@ static BOOL lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct
********************************************************************/
void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
uint32 sid_name_use, char *name, uint32 idx)
uint16 sid_name_use, char *name, uint32 idx)
{
int len_name = strlen(name);
@ -60,8 +60,11 @@ static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, i
if(!prs_align(ps))
return False;
if(!prs_uint32("sid_name_use", ps, depth, &trn->sid_name_use))
if(!prs_uint16("sid_name_use", ps, depth, &trn->sid_name_use))
return False;
if(!prs_align(ps))
return False;
if(!smb_io_unihdr ("hdr_name", &trn->hdr_name, ps, depth))
return False;
if(!prs_uint32("domain_idx ", ps, depth, &trn->domain_idx))
@ -76,7 +79,7 @@ static BOOL lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, i
static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth)
{
int i, s, n;
int i;
prs_debug(ps, depth, desc, "lsa_io_dom_r_ref");
depth++;
@ -97,6 +100,7 @@ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int dep
SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1);
if (r_r->ptr_ref_dom != 0) {
if(!prs_uint32("num_ref_doms_2", ps, depth, &r_r->num_ref_doms_2)) /* 4 - num referenced domains? */
return False;
@ -114,21 +118,21 @@ static BOOL lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int dep
return False;
}
for (i = 0, n = 0, s = 0; i < r_r->num_ref_doms_2; i++) {
for (i = 0; i < r_r->num_ref_doms_2; i++) {
fstring t;
if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0) {
slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i);
if(!smb_io_unistr2(t, &r_r->ref_dom[n].uni_dom_name, True, ps, depth)) /* domain name unicode string */
if(!smb_io_unistr2(t, &r_r->ref_dom[i].uni_dom_name, True, ps, depth)) /* domain name unicode string */
return False;
if(!prs_align(ps))
return False;
n++;
}
if (r_r->hdr_ref_dom[i].ptr_dom_sid != 0) {
slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i);
if(!smb_io_dom_sid2("", &r_r->ref_dom[s].ref_dom, ps, depth)) /* referenced domain SIDs */
if(!smb_io_dom_sid2(t, &r_r->ref_dom[i].ref_dom, ps, depth)) /* referenced domain SIDs */
return False;
s++;
}
}
}
@ -188,6 +192,7 @@ static BOOL lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int de
if (qos->len != prs_offset(ps) - start) {
DEBUG(3,("lsa_io_sec_qos: length %x does not match size %x\n",
qos->len, prs_offset(ps) - start));
return False;
}
return True;
@ -255,6 +260,7 @@ static BOOL lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int
if (attr->len != prs_offset(ps) - start) {
DEBUG(3,("lsa_io_obj_attr: length %x does not match size %x\n",
attr->len, prs_offset(ps) - start));
return False;
}
if (attr->ptr_sec_qos != 0 && attr->sec_qos != NULL) {
@ -406,6 +412,72 @@ BOOL lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int de
return True;
}
/*******************************************************************
makes an LSA_Q_QUERY_SEC_OBJ structure.
********************************************************************/
void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *q_q, const POLICY_HND *hnd, uint32 sec_info)
{
if (q_q == NULL || hnd == NULL)
return;
DEBUG(5, ("init_q_query_sec_obj\n"));
q_q->pol = *hnd;
q_q->sec_info = sec_info;
return;
}
/*******************************************************************
Reads or writes an LSA_Q_QUERY_SEC_OBJ structure.
********************************************************************/
BOOL lsa_io_q_query_sec_obj(char *desc, LSA_Q_QUERY_SEC_OBJ *q_q, prs_struct *ps, int depth)
{
if (q_q == NULL)
return False;
prs_debug(ps, depth, desc, "lsa_io_q_query_sec_obj");
depth++;
if (!smb_io_pol_hnd("", &q_q->pol, ps, depth))
return False;
if (!prs_uint32("sec_info", ps, depth, &q_q->sec_info))
return False;
return True;
}
/*******************************************************************
Reads or writes a LSA_R_QUERY_SEC_OBJ structure.
********************************************************************/
BOOL lsa_io_r_query_sec_obj(char *desc, LSA_R_QUERY_SEC_OBJ *r_u, prs_struct *ps, int depth)
{
if (r_u == NULL)
return False;
prs_debug(ps, depth, desc, "lsa_io_r_query_sec_obj");
depth++;
if (!prs_align(ps))
return False;
if (!prs_uint32("ptr", ps, depth, &r_u->ptr))
return False;
if (r_u->ptr != 0) {
if (!sec_io_desc_buf("sec", &r_u->buf, ps, depth))
return False;
}
if (!prs_uint32("status", ps, depth, &r_u->status))
return False;
return True;
}
/*******************************************************************
Inits an LSA_Q_QUERY_INFO structure.
********************************************************************/