00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "includes.h"
00027
00028 #undef DBGC_CLASS
00029 #define DBGC_CLASS DBGC_RPC_PARSE
00030
00031 static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth);
00032 static BOOL lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, prs_struct *ps, int depth);
00033
00034
00035
00036
00037
00038 void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
00039 uint16 sid_name_use, const char *name, uint32 idx)
00040 {
00041 trn->sid_name_use = sid_name_use;
00042 init_unistr2(uni_name, name, UNI_FLAGS_NONE);
00043 init_uni_hdr(&trn->hdr_name, uni_name);
00044 trn->domain_idx = idx;
00045 }
00046
00047
00048
00049
00050
00051 static BOOL lsa_io_trans_name(const char *desc, LSA_TRANS_NAME *trn, prs_struct *ps,
00052 int depth)
00053 {
00054 prs_debug(ps, depth, desc, "lsa_io_trans_name");
00055 depth++;
00056
00057 if(!prs_align(ps))
00058 return False;
00059
00060 if(!prs_uint16("sid_name_use", ps, depth, &trn->sid_name_use))
00061 return False;
00062 if(!prs_align(ps))
00063 return False;
00064
00065 if(!smb_io_unihdr ("hdr_name", &trn->hdr_name, ps, depth))
00066 return False;
00067 if(!prs_uint32("domain_idx ", ps, depth, &trn->domain_idx))
00068 return False;
00069
00070 return True;
00071 }
00072
00073
00074
00075
00076
00077 void init_lsa_trans_name2(LSA_TRANS_NAME2 *trn, UNISTR2 *uni_name,
00078 uint16 sid_name_use, const char *name, uint32 idx)
00079 {
00080 trn->sid_name_use = sid_name_use;
00081 init_unistr2(uni_name, name, UNI_FLAGS_NONE);
00082 init_uni_hdr(&trn->hdr_name, uni_name);
00083 trn->domain_idx = idx;
00084 trn->unknown = 0;
00085 }
00086
00087
00088
00089
00090
00091 static BOOL lsa_io_trans_name2(const char *desc, LSA_TRANS_NAME2 *trn, prs_struct *ps,
00092 int depth)
00093 {
00094 prs_debug(ps, depth, desc, "lsa_io_trans_name2");
00095 depth++;
00096
00097 if(!prs_align(ps))
00098 return False;
00099
00100 if(!prs_uint16("sid_name_use", ps, depth, &trn->sid_name_use))
00101 return False;
00102 if(!prs_align(ps))
00103 return False;
00104
00105 if(!smb_io_unihdr ("hdr_name", &trn->hdr_name, ps, depth))
00106 return False;
00107 if(!prs_uint32("domain_idx ", ps, depth, &trn->domain_idx))
00108 return False;
00109 if(!prs_uint32("unknown ", ps, depth, &trn->unknown))
00110 return False;
00111
00112 return True;
00113 }
00114
00115
00116
00117
00118
00119 static BOOL lsa_io_dom_r_ref(const char *desc, DOM_R_REF *dom, prs_struct *ps, int depth)
00120 {
00121 unsigned int i;
00122
00123 prs_debug(ps, depth, desc, "lsa_io_dom_r_ref");
00124 depth++;
00125
00126 if(!prs_align(ps))
00127 return False;
00128
00129 if(!prs_uint32("num_ref_doms_1", ps, depth, &dom->num_ref_doms_1))
00130 return False;
00131 if(!prs_uint32("ptr_ref_dom ", ps, depth, &dom->ptr_ref_dom))
00132 return False;
00133 if(!prs_uint32("max_entries ", ps, depth, &dom->max_entries))
00134 return False;
00135
00136 SMB_ASSERT_ARRAY(dom->hdr_ref_dom, dom->num_ref_doms_1);
00137
00138 if (dom->ptr_ref_dom != 0) {
00139
00140 if(!prs_uint32("num_ref_doms_2", ps, depth, &dom->num_ref_doms_2))
00141 return False;
00142
00143 SMB_ASSERT_ARRAY(dom->ref_dom, dom->num_ref_doms_2);
00144
00145 for (i = 0; i < dom->num_ref_doms_1; i++) {
00146 fstring t;
00147
00148 slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i);
00149 if(!smb_io_unihdr(t, &dom->hdr_ref_dom[i].hdr_dom_name, ps, depth))
00150 return False;
00151
00152 slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i);
00153 if(!prs_uint32(t, ps, depth, &dom->hdr_ref_dom[i].ptr_dom_sid))
00154 return False;
00155 }
00156
00157 for (i = 0; i < dom->num_ref_doms_2; i++) {
00158 fstring t;
00159
00160 if (dom->hdr_ref_dom[i].hdr_dom_name.buffer != 0) {
00161 slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i);
00162 if(!smb_io_unistr2(t, &dom->ref_dom[i].uni_dom_name, True, ps, depth))
00163 return False;
00164 if(!prs_align(ps))
00165 return False;
00166 }
00167
00168 if (dom->hdr_ref_dom[i].ptr_dom_sid != 0) {
00169 slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i);
00170 if(!smb_io_dom_sid2(t, &dom->ref_dom[i].ref_dom, ps, depth))
00171 return False;
00172 }
00173 }
00174 }
00175
00176 return True;
00177 }
00178
00179
00180
00181
00182
00183 void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff)
00184 {
00185 DEBUG(5, ("init_lsa_sec_qos\n"));
00186
00187 qos->len = 0x0c;
00188 qos->sec_imp_level = imp_lev;
00189 qos->sec_ctxt_mode = ctxt;
00190 qos->effective_only = eff;
00191 }
00192
00193
00194
00195
00196
00197 static BOOL lsa_io_sec_qos(const char *desc, LSA_SEC_QOS *qos, prs_struct *ps,
00198 int depth)
00199 {
00200 uint32 start;
00201
00202 prs_debug(ps, depth, desc, "lsa_io_obj_qos");
00203 depth++;
00204
00205 if(!prs_align(ps))
00206 return False;
00207
00208 start = prs_offset(ps);
00209
00210
00211
00212
00213 if(!prs_uint32("len ", ps, depth, &qos->len))
00214 return False;
00215 if(!prs_uint16("sec_imp_level ", ps, depth, &qos->sec_imp_level ))
00216 return False;
00217 if(!prs_uint8 ("sec_ctxt_mode ", ps, depth, &qos->sec_ctxt_mode ))
00218 return False;
00219 if(!prs_uint8 ("effective_only", ps, depth, &qos->effective_only))
00220 return False;
00221
00222 if (qos->len != prs_offset(ps) - start) {
00223 DEBUG(3,("lsa_io_sec_qos: length %x does not match size %x\n",
00224 qos->len, prs_offset(ps) - start));
00225 }
00226
00227 return True;
00228 }
00229
00230
00231
00232
00233
00234 static void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos)
00235 {
00236 DEBUG(5, ("init_lsa_obj_attr\n"));
00237
00238 attr->len = 0x18;
00239 attr->ptr_root_dir = 0;
00240 attr->ptr_obj_name = 0;
00241 attr->attributes = attributes;
00242 attr->ptr_sec_desc = 0;
00243
00244 if (qos != NULL) {
00245 attr->ptr_sec_qos = 1;
00246 attr->sec_qos = qos;
00247 } else {
00248 attr->ptr_sec_qos = 0;
00249 attr->sec_qos = NULL;
00250 }
00251 }
00252
00253
00254
00255
00256
00257 static BOOL lsa_io_obj_attr(const char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps,
00258 int depth)
00259 {
00260 prs_debug(ps, depth, desc, "lsa_io_obj_attr");
00261 depth++;
00262
00263 if(!prs_align(ps))
00264 return False;
00265
00266
00267
00268
00269 if(!prs_uint32("len ", ps, depth, &attr->len))
00270 return False;
00271 if(!prs_uint32("ptr_root_dir", ps, depth, &attr->ptr_root_dir))
00272 return False;
00273 if(!prs_uint32("ptr_obj_name", ps, depth, &attr->ptr_obj_name))
00274 return False;
00275 if(!prs_uint32("attributes ", ps, depth, &attr->attributes))
00276 return False;
00277 if(!prs_uint32("ptr_sec_desc", ps, depth, &attr->ptr_sec_desc))
00278 return False;
00279 if(!prs_uint32("ptr_sec_qos ", ps, depth, &attr->ptr_sec_qos ))
00280 return False;
00281
00282 if (attr->ptr_sec_qos != 0) {
00283 if (UNMARSHALLING(ps))
00284 if (!(attr->sec_qos = PRS_ALLOC_MEM(ps,LSA_SEC_QOS,1)))
00285 return False;
00286
00287 if(!lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth))
00288 return False;
00289 }
00290
00291 return True;
00292 }
00293
00294
00295
00296
00297
00298
00299 void init_q_open_pol(LSA_Q_OPEN_POL *in, uint16 system_name,
00300 uint32 attributes, uint32 desired_access,
00301 LSA_SEC_QOS *qos)
00302 {
00303 DEBUG(5, ("init_open_pol: attr:%d da:%d\n", attributes,
00304 desired_access));
00305
00306 in->ptr = 1;
00307
00308 in->des_access = desired_access;
00309
00310 in->system_name = system_name;
00311 init_lsa_obj_attr(&in->attr, attributes, qos);
00312 }
00313
00314
00315
00316
00317
00318 BOOL lsa_io_q_open_pol(const char *desc, LSA_Q_OPEN_POL *in, prs_struct *ps,
00319 int depth)
00320 {
00321 prs_debug(ps, depth, desc, "lsa_io_q_open_pol");
00322 depth++;
00323
00324 if(!prs_uint32("ptr ", ps, depth, &in->ptr))
00325 return False;
00326 if(!prs_uint16("system_name", ps, depth, &in->system_name))
00327 return False;
00328 if(!prs_align( ps ))
00329 return False;
00330
00331 if(!lsa_io_obj_attr("", &in->attr, ps, depth))
00332 return False;
00333
00334 if(!prs_uint32("des_access", ps, depth, &in->des_access))
00335 return False;
00336
00337 return True;
00338 }
00339
00340
00341
00342
00343
00344 BOOL lsa_io_r_open_pol(const char *desc, LSA_R_OPEN_POL *out, prs_struct *ps,
00345 int depth)
00346 {
00347 prs_debug(ps, depth, desc, "lsa_io_r_open_pol");
00348 depth++;
00349
00350 if(!smb_io_pol_hnd("", &out->pol, ps, depth))
00351 return False;
00352
00353 if(!prs_ntstatus("status", ps, depth, &out->status))
00354 return False;
00355
00356 return True;
00357 }
00358
00359
00360
00361
00362
00363 void init_q_open_pol2(LSA_Q_OPEN_POL2 *in, const char *server_name,
00364 uint32 attributes, uint32 desired_access,
00365 LSA_SEC_QOS *qos)
00366 {
00367 DEBUG(5, ("init_q_open_pol2: attr:%d da:%d\n", attributes,
00368 desired_access));
00369
00370 in->ptr = 1;
00371
00372 in->des_access = desired_access;
00373
00374 init_unistr2(&in->uni_server_name, server_name, UNI_STR_TERMINATE);
00375
00376 init_lsa_obj_attr(&in->attr, attributes, qos);
00377 }
00378
00379
00380
00381
00382
00383 BOOL lsa_io_q_open_pol2(const char *desc, LSA_Q_OPEN_POL2 *in, prs_struct *ps,
00384 int depth)
00385 {
00386 prs_debug(ps, depth, desc, "lsa_io_q_open_pol2");
00387 depth++;
00388
00389 if(!prs_uint32("ptr ", ps, depth, &in->ptr))
00390 return False;
00391
00392 if(!smb_io_unistr2 ("", &in->uni_server_name, in->ptr, ps, depth))
00393 return False;
00394 if(!lsa_io_obj_attr("", &in->attr, ps, depth))
00395 return False;
00396
00397 if(!prs_uint32("des_access", ps, depth, &in->des_access))
00398 return False;
00399
00400 return True;
00401 }
00402
00403
00404
00405
00406
00407 BOOL lsa_io_r_open_pol2(const char *desc, LSA_R_OPEN_POL2 *out, prs_struct *ps,
00408 int depth)
00409 {
00410 prs_debug(ps, depth, desc, "lsa_io_r_open_pol2");
00411 depth++;
00412
00413 if(!smb_io_pol_hnd("", &out->pol, ps, depth))
00414 return False;
00415
00416 if(!prs_ntstatus("status", ps, depth, &out->status))
00417 return False;
00418
00419 return True;
00420 }
00421
00422
00423
00424
00425
00426 void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *in, const POLICY_HND *hnd,
00427 uint32 sec_info)
00428 {
00429 DEBUG(5, ("init_q_query_sec_obj\n"));
00430
00431 in->pol = *hnd;
00432 in->sec_info = sec_info;
00433
00434 return;
00435 }
00436
00437
00438
00439
00440
00441 BOOL lsa_io_q_query_sec_obj(const char *desc, LSA_Q_QUERY_SEC_OBJ *in,
00442 prs_struct *ps, int depth)
00443 {
00444 prs_debug(ps, depth, desc, "lsa_io_q_query_sec_obj");
00445 depth++;
00446
00447 if (!smb_io_pol_hnd("", &in->pol, ps, depth))
00448 return False;
00449
00450 if (!prs_uint32("sec_info", ps, depth, &in->sec_info))
00451 return False;
00452
00453 return True;
00454 }
00455
00456
00457
00458
00459
00460 BOOL lsa_io_r_query_sec_obj(const char *desc, LSA_R_QUERY_SEC_OBJ *out, prs_struct *ps, int depth)
00461 {
00462 prs_debug(ps, depth, desc, "lsa_io_r_query_sec_obj");
00463 depth++;
00464
00465 if (!prs_align(ps))
00466 return False;
00467
00468 if (!prs_uint32("ptr", ps, depth, &out->ptr))
00469 return False;
00470
00471 if (out->ptr != 0) {
00472 if (!sec_io_desc_buf("sec", &out->buf, ps, depth))
00473 return False;
00474 }
00475
00476 if (!prs_ntstatus("status", ps, depth, &out->status))
00477 return False;
00478
00479 return True;
00480 }
00481
00482
00483
00484
00485
00486 void init_q_query(LSA_Q_QUERY_INFO *in, POLICY_HND *hnd, uint16 info_class)
00487 {
00488 DEBUG(5, ("init_q_query\n"));
00489
00490 memcpy(&in->pol, hnd, sizeof(in->pol));
00491
00492 in->info_class = info_class;
00493 }
00494
00495
00496
00497
00498
00499 BOOL lsa_io_q_query(const char *desc, LSA_Q_QUERY_INFO *in, prs_struct *ps,
00500 int depth)
00501 {
00502 prs_debug(ps, depth, desc, "lsa_io_q_query");
00503 depth++;
00504
00505 if(!smb_io_pol_hnd("", &in->pol, ps, depth))
00506 return False;
00507
00508 if(!prs_uint16("info_class", ps, depth, &in->info_class))
00509 return False;
00510
00511 return True;
00512 }
00513
00514
00515
00516
00517 BOOL init_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM * q_e, POLICY_HND *pol,
00518 uint32 enum_context, uint32 preferred_len)
00519 {
00520 DEBUG(5, ("init_q_enum_trust_dom\n"));
00521
00522 q_e->pol = *pol;
00523 q_e->enum_context = enum_context;
00524 q_e->preferred_len = preferred_len;
00525
00526 return True;
00527 }
00528
00529
00530
00531
00532
00533 BOOL lsa_io_q_enum_trust_dom(const char *desc, LSA_Q_ENUM_TRUST_DOM *q_e,
00534 prs_struct *ps, int depth)
00535 {
00536 prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom");
00537 depth++;
00538
00539 if(!smb_io_pol_hnd("", &q_e->pol, ps, depth))
00540 return False;
00541
00542 if(!prs_uint32("enum_context ", ps, depth, &q_e->enum_context))
00543 return False;
00544 if(!prs_uint32("preferred_len", ps, depth, &q_e->preferred_len))
00545 return False;
00546
00547 return True;
00548 }
00549
00550
00551
00552
00553
00554 void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out,
00555 uint32 enum_context, uint32 num_domains,
00556 struct trustdom_info **td)
00557 {
00558 unsigned int i;
00559
00560 DEBUG(5, ("init_r_enum_trust_dom\n"));
00561
00562 out->enum_context = enum_context;
00563 out->count = num_domains;
00564
00565 if ( num_domains != 0 ) {
00566
00567
00568
00569 out->domlist = TALLOC_P( ctx, DOMAIN_LIST );
00570
00571 if ( !out->domlist ) {
00572 out->status = NT_STATUS_NO_MEMORY;
00573 return;
00574 }
00575
00576 if (out->count) {
00577 out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO,
00578 out->count );
00579 if ( !out->domlist->domains ) {
00580 out->status = NT_STATUS_NO_MEMORY;
00581 return;
00582 }
00583 } else {
00584 out->domlist->domains = NULL;
00585 }
00586
00587 out->domlist->count = out->count;
00588
00589
00590
00591 for (i = 0; i < num_domains; i++) {
00592 smb_ucs2_t *name;
00593 if ( !(out->domlist->domains[i].sid =
00594 TALLOC_P(ctx, DOM_SID2)) ) {
00595 out->status = NT_STATUS_NO_MEMORY;
00596 return;
00597 }
00598
00599 init_dom_sid2(out->domlist->domains[i].sid,
00600 &(td[i])->sid);
00601 if (push_ucs2_talloc(ctx, &name, (td[i])->name) == (size_t)-1){
00602 out->status = NT_STATUS_NO_MEMORY;
00603 return;
00604 }
00605 init_unistr4_w(ctx, &out->domlist->domains[i].name,
00606 name);
00607 }
00608 }
00609
00610 }
00611
00612
00613
00614
00615 BOOL lsa_io_domain_list( const char *desc, prs_struct *ps, int depth, DOMAIN_LIST *domlist )
00616 {
00617 int i;
00618
00619 prs_debug(ps, depth, desc, "lsa_io_domain_list");
00620 depth++;
00621
00622 if(!prs_uint32("count", ps, depth, &domlist->count))
00623 return False;
00624
00625 if ( domlist->count == 0 )
00626 return True;
00627
00628 if ( UNMARSHALLING(ps) ) {
00629 if ( !(domlist->domains = PRS_ALLOC_MEM( ps, DOMAIN_INFO, domlist->count )) )
00630 return False;
00631 }
00632
00633
00634
00635 for ( i=0; i<domlist->count; i++ ) {
00636 if ( !prs_unistr4_hdr("name_header", ps, depth, &domlist->domains[i].name) )
00637 return False;
00638 if ( !smb_io_dom_sid2_p("sid_header", ps, depth, &domlist->domains[i].sid) )
00639 return False;
00640 }
00641
00642
00643
00644 for ( i=0; i<domlist->count; i++ ) {
00645 if ( !prs_unistr4_str("name", ps, depth, &domlist->domains[i].name) )
00646 return False;
00647 if( !smb_io_dom_sid2("sid", domlist->domains[i].sid, ps, depth) )
00648 return False;
00649 }
00650
00651 return True;
00652 }
00653
00654
00655
00656
00657
00658 BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *out,
00659 prs_struct *ps, int depth)
00660 {
00661 prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom");
00662 depth++;
00663
00664 if(!prs_uint32("enum_context", ps, depth, &out->enum_context))
00665 return False;
00666
00667 if(!prs_uint32("count", ps, depth, &out->count))
00668 return False;
00669
00670 if ( !prs_pointer("trusted_domains", ps, depth, (void*)&out->domlist, sizeof(DOMAIN_LIST), (PRS_POINTER_CAST)lsa_io_domain_list))
00671 return False;
00672
00673 if(!prs_ntstatus("status", ps, depth, &out->status))
00674 return False;
00675
00676 return True;
00677 }
00678
00679
00680
00681
00682
00683 static BOOL lsa_io_dom_query_1(const char *desc, DOM_QUERY_1 *d_q, prs_struct *ps, int depth)
00684 {
00685 if (d_q == NULL)
00686 return False;
00687
00688 prs_debug(ps, depth, desc, "lsa_io_dom_query_1");
00689 depth++;
00690
00691 if (!prs_align(ps))
00692 return False;
00693
00694 if (!prs_uint32("percent_full", ps, depth, &d_q->percent_full))
00695 return False;
00696 if (!prs_uint32("log_size", ps, depth, &d_q->log_size))
00697 return False;
00698 if (!smb_io_nttime("retention_time", ps, depth, &d_q->retention_time))
00699 return False;
00700 if (!prs_uint8("shutdown_in_progress", ps, depth, &d_q->shutdown_in_progress))
00701 return False;
00702 if (!smb_io_nttime("time_to_shutdown", ps, depth, &d_q->time_to_shutdown))
00703 return False;
00704 if (!prs_uint32("next_audit_record", ps, depth, &d_q->next_audit_record))
00705 return False;
00706 if (!prs_uint32("unknown", ps, depth, &d_q->unknown))
00707 return False;
00708
00709 return True;
00710 }
00711
00712
00713
00714
00715
00716 static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int depth)
00717 {
00718 if (d_q == NULL)
00719 return False;
00720
00721 prs_debug(ps, depth, desc, "lsa_io_dom_query_2");
00722 depth++;
00723
00724 if (!prs_align(ps))
00725 return False;
00726
00727 if (!prs_uint32("auditing_enabled", ps, depth, &d_q->auditing_enabled))
00728 return False;
00729 if (!prs_uint32("ptr ", ps, depth, &d_q->ptr))
00730 return False;
00731 if (!prs_uint32("count1", ps, depth, &d_q->count1))
00732 return False;
00733
00734 if (d_q->ptr) {
00735
00736 if (!prs_uint32("count2", ps, depth, &d_q->count2))
00737 return False;
00738
00739 if (d_q->count1 != d_q->count2)
00740 return False;
00741
00742 if (UNMARSHALLING(ps)) {
00743 if (d_q->count2) {
00744 d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2);
00745 if (!d_q->auditsettings) {
00746 return False;
00747 }
00748 } else {
00749 d_q->auditsettings = NULL;
00750 }
00751 }
00752
00753 if (!prs_uint32s(False, "auditsettings", ps, depth, d_q->auditsettings, d_q->count2))
00754 return False;
00755 }
00756
00757 return True;
00758 }
00759
00760
00761
00762
00763
00764 static BOOL lsa_io_dom_query_3(const char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth)
00765 {
00766 if (d_q == NULL)
00767 return False;
00768
00769 prs_debug(ps, depth, desc, "lsa_io_dom_query_3");
00770 depth++;
00771
00772 if(!prs_align(ps))
00773 return False;
00774
00775 if(!prs_uint16("uni_dom_max_len", ps, depth, &d_q->uni_dom_max_len))
00776 return False;
00777 if(!prs_uint16("uni_dom_str_len", ps, depth, &d_q->uni_dom_str_len))
00778 return False;
00779
00780 if(!prs_uint32("buffer_dom_name", ps, depth, &d_q->buffer_dom_name))
00781 return False;
00782 if(!prs_uint32("buffer_dom_sid ", ps, depth, &d_q->buffer_dom_sid))
00783 return False;
00784
00785 if(!smb_io_unistr2("unistr2", &d_q->uni_domain_name, d_q->buffer_dom_name, ps, depth))
00786 return False;
00787
00788 if(!prs_align(ps))
00789 return False;
00790
00791 if (d_q->buffer_dom_sid != 0) {
00792 if(!smb_io_dom_sid2("", &d_q->dom_sid, ps, depth))
00793 return False;
00794 } else {
00795 memset((char *)&d_q->dom_sid, '\0', sizeof(d_q->dom_sid));
00796 }
00797
00798 return True;
00799 }
00800
00801
00802
00803
00804
00805 static BOOL lsa_io_dom_query_5(const char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth)
00806 {
00807 return lsa_io_dom_query_3("", d_q, ps, depth);
00808 }
00809
00810
00811
00812
00813
00814 static BOOL lsa_io_dom_query_6(const char *desc, DOM_QUERY_6 *d_q, prs_struct *ps, int depth)
00815 {
00816 if (d_q == NULL)
00817 return False;
00818
00819 prs_debug(ps, depth, desc, "lsa_io_dom_query_6");
00820 depth++;
00821
00822 if (!prs_uint16("server_role", ps, depth, &d_q->server_role))
00823 return False;
00824
00825 return True;
00826 }
00827
00828
00829
00830
00831
00832 static BOOL lsa_io_dom_query_10(const char *desc, DOM_QUERY_10 *d_q, prs_struct *ps, int depth)
00833 {
00834 if (d_q == NULL)
00835 return False;
00836
00837 prs_debug(ps, depth, desc, "lsa_io_dom_query_10");
00838 depth++;
00839
00840 if (!prs_uint8("shutdown_on_full", ps, depth, &d_q->shutdown_on_full))
00841 return False;
00842
00843 return True;
00844 }
00845
00846
00847
00848
00849
00850 static BOOL lsa_io_dom_query_11(const char *desc, DOM_QUERY_11 *d_q, prs_struct *ps, int depth)
00851 {
00852 if (d_q == NULL)
00853 return False;
00854
00855 prs_debug(ps, depth, desc, "lsa_io_dom_query_11");
00856 depth++;
00857
00858 if (!prs_uint16("unknown", ps, depth, &d_q->unknown))
00859 return False;
00860 if (!prs_uint8("shutdown_on_full", ps, depth, &d_q->shutdown_on_full))
00861 return False;
00862 if (!prs_uint8("log_is_full", ps, depth, &d_q->log_is_full))
00863 return False;
00864
00865 return True;
00866 }
00867
00868
00869
00870
00871
00872 BOOL lsa_io_dom_query_12(const char *desc, DOM_QUERY_12 *info, prs_struct *ps, int depth)
00873 {
00874 prs_debug(ps, depth, desc, "lsa_io_dom_query_12");
00875 depth++;
00876
00877 if(!prs_align(ps))
00878 return False;
00879 if(!smb_io_unihdr("nb_name", &info->hdr_nb_dom_name, ps, depth))
00880 return False;
00881 if(!smb_io_unihdr("dns_name", &info->hdr_dns_dom_name, ps, depth))
00882 return False;
00883 if(!smb_io_unihdr("forest", &info->hdr_forest_name, ps, depth))
00884 return False;
00885
00886 if(!prs_align(ps))
00887 return False;
00888 if ( !smb_io_uuid("dom_guid", &info->dom_guid, ps, depth) )
00889 return False;
00890
00891 if(!prs_align(ps))
00892 return False;
00893 if(!prs_uint32("dom_sid", ps, depth, &info->ptr_dom_sid))
00894 return False;
00895
00896 if(!smb_io_unistr2("nb_name", &info->uni_nb_dom_name,
00897 info->hdr_nb_dom_name.buffer, ps, depth))
00898 return False;
00899 if(!smb_io_unistr2("dns_name", &info->uni_dns_dom_name,
00900 info->hdr_dns_dom_name.buffer, ps, depth))
00901 return False;
00902 if(!smb_io_unistr2("forest", &info->uni_forest_name,
00903 info->hdr_forest_name.buffer, ps, depth))
00904 return False;
00905
00906 if(!smb_io_dom_sid2("dom_sid", &info->dom_sid, ps, depth))
00907 return False;
00908
00909 return True;
00910
00911 }
00912
00913
00914
00915
00916
00917 void init_q_set(LSA_Q_SET_INFO *in, POLICY_HND *hnd, uint16 info_class, LSA_INFO_CTR ctr)
00918 {
00919 DEBUG(5,("init_q_set\n"));
00920
00921 in->info_class = info_class;
00922
00923 in->pol = *hnd;
00924
00925 in->ctr = ctr;
00926 in->ctr.info_class = info_class;
00927 }
00928
00929
00930
00931
00932
00933 static BOOL lsa_io_query_info_ctr2(const char *desc, prs_struct *ps, int depth, LSA_INFO_CTR2 *ctr)
00934 {
00935 prs_debug(ps, depth, desc, "lsa_io_query_info_ctr2");
00936 depth++;
00937
00938 if(!prs_uint16("info_class", ps, depth, &ctr->info_class))
00939 return False;
00940
00941 switch (ctr->info_class) {
00942 case 1:
00943 if(!lsa_io_dom_query_1("", &ctr->info.id1, ps, depth))
00944 return False;
00945 break;
00946 case 2:
00947 if(!lsa_io_dom_query_2("", &ctr->info.id2, ps, depth))
00948 return False;
00949 break;
00950 case 3:
00951 if(!lsa_io_dom_query_3("", &ctr->info.id3, ps, depth))
00952 return False;
00953 break;
00954 case 5:
00955 if(!lsa_io_dom_query_5("", &ctr->info.id5, ps, depth))
00956 return False;
00957 break;
00958 case 6:
00959 if(!lsa_io_dom_query_6("", &ctr->info.id6, ps, depth))
00960 return False;
00961 break;
00962 case 10:
00963 if(!lsa_io_dom_query_10("", &ctr->info.id10, ps, depth))
00964 return False;
00965 break;
00966 case 11:
00967 if(!lsa_io_dom_query_11("", &ctr->info.id11, ps, depth))
00968 return False;
00969 break;
00970 case 12:
00971 if(!lsa_io_dom_query_12("", &ctr->info.id12, ps, depth))
00972 return False;
00973 break;
00974 default:
00975 DEBUG(0,("invalid info_class: %d\n", ctr->info_class));
00976 return False;
00977 break;
00978 }
00979
00980 return True;
00981 }
00982
00983
00984
00985
00986
00987
00988 static BOOL lsa_io_query_info_ctr(const char *desc, prs_struct *ps, int depth, LSA_INFO_CTR *ctr)
00989 {
00990 prs_debug(ps, depth, desc, "lsa_io_query_info_ctr");
00991 depth++;
00992
00993 if(!prs_uint16("info_class", ps, depth, &ctr->info_class))
00994 return False;
00995
00996 if(!prs_align(ps))
00997 return False;
00998
00999 switch (ctr->info_class) {
01000 case 1:
01001 if(!lsa_io_dom_query_1("", &ctr->info.id1, ps, depth))
01002 return False;
01003 break;
01004 case 2:
01005 if(!lsa_io_dom_query_2("", &ctr->info.id2, ps, depth))
01006 return False;
01007 break;
01008 case 3:
01009 if(!lsa_io_dom_query_3("", &ctr->info.id3, ps, depth))
01010 return False;
01011 break;
01012 case 5:
01013 if(!lsa_io_dom_query_5("", &ctr->info.id5, ps, depth))
01014 return False;
01015 break;
01016 case 6:
01017 if(!lsa_io_dom_query_6("", &ctr->info.id6, ps, depth))
01018 return False;
01019 break;
01020 case 10:
01021 if(!lsa_io_dom_query_10("", &ctr->info.id10, ps, depth))
01022 return False;
01023 break;
01024 case 11:
01025 if(!lsa_io_dom_query_11("", &ctr->info.id11, ps, depth))
01026 return False;
01027 break;
01028 default:
01029 DEBUG(0,("invalid info_class: %d\n", ctr->info_class));
01030 return False;
01031 break;
01032 }
01033
01034 return True;
01035 }
01036
01037
01038
01039
01040
01041 BOOL lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *out, prs_struct *ps, int depth)
01042 {
01043
01044 prs_debug(ps, depth, desc, "lsa_io_r_query");
01045 depth++;
01046
01047 if(!prs_align(ps))
01048 return False;
01049
01050 if(!prs_uint32("dom_ptr", ps, depth, &out->dom_ptr))
01051 return False;
01052
01053 if (out->dom_ptr) {
01054
01055 if(!lsa_io_query_info_ctr("", ps, depth, &out->ctr))
01056 return False;
01057 }
01058
01059 if(!prs_align(ps))
01060 return False;
01061
01062 if(!prs_ntstatus("status", ps, depth, &out->status))
01063 return False;
01064
01065 return True;
01066 }
01067
01068
01069
01070
01071
01072 BOOL lsa_io_q_set(const char *desc, LSA_Q_SET_INFO *in, prs_struct *ps,
01073 int depth)
01074 {
01075 prs_debug(ps, depth, desc, "lsa_io_q_set");
01076 depth++;
01077
01078 if(!prs_align(ps))
01079 return False;
01080
01081 if(!smb_io_pol_hnd("", &in->pol, ps, depth))
01082 return False;
01083
01084 if(!prs_uint16("info_class", ps, depth, &in->info_class))
01085 return False;
01086
01087 if(!lsa_io_query_info_ctr("", ps, depth, &in->ctr))
01088 return False;
01089
01090 return True;
01091 }
01092
01093
01094
01095
01096
01097 BOOL lsa_io_r_set(const char *desc, LSA_R_SET_INFO *out, prs_struct *ps, int depth)
01098 {
01099 prs_debug(ps, depth, desc, "lsa_io_r_set");
01100 depth++;
01101
01102 if(!prs_align(ps))
01103 return False;
01104
01105 if(!prs_ntstatus("status", ps, depth, &out->status))
01106 return False;
01107
01108 return True;
01109 }
01110
01111
01112
01113
01114
01115 static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen,
01116 int num_entries, const DOM_SID *sids)
01117 {
01118 int i;
01119
01120 DEBUG(5, ("init_lsa_sid_enum\n"));
01121
01122 sen->num_entries = num_entries;
01123 sen->ptr_sid_enum = (num_entries != 0);
01124 sen->num_entries2 = num_entries;
01125
01126
01127
01128 if (num_entries) {
01129 if ((sen->ptr_sid = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_entries )) == NULL) {
01130 DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n"));
01131 return;
01132 }
01133
01134 if ((sen->sid = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID2, num_entries)) == NULL) {
01135 DEBUG(3, ("init_lsa_sid_enum(): out of memory for sids\n"));
01136 return;
01137 }
01138 }
01139
01140
01141
01142 for (i = 0; i < num_entries; i++) {
01143 sen->ptr_sid[i] = 1;
01144 init_dom_sid2(&sen->sid[i], &sids[i]);
01145 }
01146 }
01147
01148
01149
01150
01151
01152 static BOOL lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps,
01153 int depth)
01154 {
01155 unsigned int i;
01156
01157 prs_debug(ps, depth, desc, "lsa_io_sid_enum");
01158 depth++;
01159
01160 if(!prs_align(ps))
01161 return False;
01162
01163 if(!prs_uint32("num_entries ", ps, depth, &sen->num_entries))
01164 return False;
01165 if(!prs_uint32("ptr_sid_enum", ps, depth, &sen->ptr_sid_enum))
01166 return False;
01167
01168
01169
01170
01171
01172
01173 if (sen->ptr_sid_enum==0)
01174 return True;
01175
01176 if(!prs_uint32("num_entries2", ps, depth, &sen->num_entries2))
01177 return False;
01178
01179
01180
01181 if (UNMARSHALLING(ps) && sen->num_entries) {
01182 if ((sen->ptr_sid = PRS_ALLOC_MEM( ps, uint32, sen->num_entries)) == NULL) {
01183 DEBUG(3, ("init_lsa_sid_enum(): out of memory for "
01184 "ptr_sid\n"));
01185 return False;
01186 }
01187
01188 if ((sen->sid = PRS_ALLOC_MEM( ps, DOM_SID2, sen->num_entries)) == NULL) {
01189 DEBUG(3, ("init_lsa_sid_enum(): out of memory for "
01190 "sids\n"));
01191 return False;
01192 }
01193 }
01194
01195 for (i = 0; i < sen->num_entries; i++) {
01196 fstring temp;
01197
01198 slprintf(temp, sizeof(temp) - 1, "ptr_sid[%d]", i);
01199 if(!prs_uint32(temp, ps, depth, &sen->ptr_sid[i])) {
01200 return False;
01201 }
01202 }
01203
01204 for (i = 0; i < sen->num_entries; i++) {
01205 fstring temp;
01206
01207 slprintf(temp, sizeof(temp) - 1, "sid[%d]", i);
01208 if(!smb_io_dom_sid2(temp, &sen->sid[i], ps, depth)) {
01209 return False;
01210 }
01211 }
01212
01213 return True;
01214 }
01215
01216
01217
01218
01219
01220 void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l,
01221 POLICY_HND *hnd, int num_sids, const DOM_SID *sids,
01222 uint16 level)
01223 {
01224 DEBUG(5, ("init_q_lookup_sids\n"));
01225
01226 ZERO_STRUCTP(q_l);
01227
01228 memcpy(&q_l->pol, hnd, sizeof(q_l->pol));
01229 init_lsa_sid_enum(mem_ctx, &q_l->sids, num_sids, sids);
01230
01231 q_l->level = level;
01232 }
01233
01234
01235
01236
01237
01238 BOOL lsa_io_q_lookup_sids(const char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps,
01239 int depth)
01240 {
01241 prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids");
01242 depth++;
01243
01244 if(!prs_align(ps))
01245 return False;
01246
01247 if(!smb_io_pol_hnd("pol_hnd", &q_s->pol, ps, depth))
01248 return False;
01249 if(!lsa_io_sid_enum("sids ", &q_s->sids, ps, depth))
01250 return False;
01251 if(!lsa_io_trans_names("names ", &q_s->names, ps, depth))
01252 return False;
01253
01254 if(!prs_uint16("level", ps, depth, &q_s->level))
01255 return False;
01256 if(!prs_align(ps))
01257 return False;
01258
01259 if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count))
01260 return False;
01261
01262 return True;
01263 }
01264
01265
01266
01267
01268
01269 BOOL lsa_io_q_lookup_sids2(const char *desc, LSA_Q_LOOKUP_SIDS2 *q_s, prs_struct *ps,
01270 int depth)
01271 {
01272 prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids2");
01273 depth++;
01274
01275 if(!prs_align(ps))
01276 return False;
01277
01278 if(!smb_io_pol_hnd("pol_hnd", &q_s->pol, ps, depth))
01279 return False;
01280 if(!lsa_io_sid_enum("sids ", &q_s->sids, ps, depth))
01281 return False;
01282 if(!lsa_io_trans_names2("names ", &q_s->names, ps, depth))
01283 return False;
01284
01285 if(!prs_uint16("level", ps, depth, &q_s->level))
01286 return False;
01287 if(!prs_align(ps))
01288 return False;
01289
01290 if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count))
01291 return False;
01292 if(!prs_uint32("unknown1", ps, depth, &q_s->unknown1))
01293 return False;
01294 if(!prs_uint32("unknown2", ps, depth, &q_s->unknown2))
01295 return False;
01296
01297 return True;
01298 }
01299
01300
01301
01302
01303
01304 BOOL lsa_io_q_lookup_sids3(const char *desc, LSA_Q_LOOKUP_SIDS3 *q_s, prs_struct *ps,
01305 int depth)
01306 {
01307 prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids3");
01308 depth++;
01309
01310 if(!prs_align(ps))
01311 return False;
01312
01313 if(!lsa_io_sid_enum("sids ", &q_s->sids, ps, depth))
01314 return False;
01315 if(!lsa_io_trans_names2("names ", &q_s->names, ps, depth))
01316 return False;
01317
01318 if(!prs_uint16("level", ps, depth, &q_s->level))
01319 return False;
01320 if(!prs_align(ps))
01321 return False;
01322
01323 if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count))
01324 return False;
01325 if(!prs_uint32("unknown1", ps, depth, &q_s->unknown1))
01326 return False;
01327 if(!prs_uint32("unknown2", ps, depth, &q_s->unknown2))
01328 return False;
01329
01330 return True;
01331 }
01332
01333
01334
01335
01336
01337
01338 static BOOL lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn,
01339 prs_struct *ps, int depth)
01340 {
01341 unsigned int i;
01342
01343 prs_debug(ps, depth, desc, "lsa_io_trans_names");
01344 depth++;
01345
01346 if(!prs_align(ps))
01347 return False;
01348
01349 if(!prs_uint32("num_entries ", ps, depth, &trn->num_entries))
01350 return False;
01351 if(!prs_uint32("ptr_trans_names", ps, depth, &trn->ptr_trans_names))
01352 return False;
01353
01354 if (trn->ptr_trans_names != 0) {
01355 if(!prs_uint32("num_entries2 ", ps, depth,
01356 &trn->num_entries2))
01357 return False;
01358
01359 if (trn->num_entries2 != trn->num_entries) {
01360
01361 return False;
01362 }
01363
01364 if (UNMARSHALLING(ps) && trn->num_entries2) {
01365 if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME, trn->num_entries2)) == NULL) {
01366 return False;
01367 }
01368
01369 if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries2)) == NULL) {
01370 return False;
01371 }
01372 }
01373
01374 for (i = 0; i < trn->num_entries2; i++) {
01375 fstring t;
01376 slprintf(t, sizeof(t) - 1, "name[%d] ", i);
01377
01378 if(!lsa_io_trans_name(t, &trn->name[i], ps, depth))
01379 return False;
01380 }
01381
01382 for (i = 0; i < trn->num_entries2; i++) {
01383 fstring t;
01384 slprintf(t, sizeof(t) - 1, "name[%d] ", i);
01385
01386 if(!smb_io_unistr2(t, &trn->uni_name[i], trn->name[i].hdr_name.buffer, ps, depth))
01387 return False;
01388 if(!prs_align(ps))
01389 return False;
01390 }
01391 }
01392
01393 return True;
01394 }
01395
01396
01397
01398
01399
01400 static BOOL lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn,
01401 prs_struct *ps, int depth)
01402 {
01403 unsigned int i;
01404
01405 prs_debug(ps, depth, desc, "lsa_io_trans_names2");
01406 depth++;
01407
01408 if(!prs_align(ps))
01409 return False;
01410
01411 if(!prs_uint32("num_entries ", ps, depth, &trn->num_entries))
01412 return False;
01413 if(!prs_uint32("ptr_trans_names", ps, depth, &trn->ptr_trans_names))
01414 return False;
01415
01416 if (trn->ptr_trans_names != 0) {
01417 if(!prs_uint32("num_entries2 ", ps, depth,
01418 &trn->num_entries2))
01419 return False;
01420
01421 if (trn->num_entries2 != trn->num_entries) {
01422
01423 return False;
01424 }
01425
01426 if (UNMARSHALLING(ps) && trn->num_entries2) {
01427 if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME2, trn->num_entries2)) == NULL) {
01428 return False;
01429 }
01430
01431 if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries2)) == NULL) {
01432 return False;
01433 }
01434 }
01435
01436 for (i = 0; i < trn->num_entries2; i++) {
01437 fstring t;
01438 slprintf(t, sizeof(t) - 1, "name[%d] ", i);
01439
01440 if(!lsa_io_trans_name2(t, &trn->name[i], ps, depth))
01441 return False;
01442 }
01443
01444 for (i = 0; i < trn->num_entries2; i++) {
01445 fstring t;
01446 slprintf(t, sizeof(t) - 1, "name[%d] ", i);
01447
01448 if(!smb_io_unistr2(t, &trn->uni_name[i], trn->name[i].hdr_name.buffer, ps, depth))
01449 return False;
01450 if(!prs_align(ps))
01451 return False;
01452 }
01453 }
01454
01455 return True;
01456 }
01457
01458
01459
01460
01461
01462
01463 BOOL lsa_io_r_lookup_sids(const char *desc, LSA_R_LOOKUP_SIDS *r_s,
01464 prs_struct *ps, int depth)
01465 {
01466 prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids");
01467 depth++;
01468
01469 if(!prs_align(ps))
01470 return False;
01471
01472 if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref))
01473 return False;
01474
01475 if (r_s->ptr_dom_ref != 0)
01476 if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth))
01477 return False;
01478
01479 if(!lsa_io_trans_names("names ", &r_s->names, ps, depth))
01480 return False;
01481
01482 if(!prs_align(ps))
01483 return False;
01484
01485 if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count))
01486 return False;
01487
01488 if(!prs_ntstatus("status ", ps, depth, &r_s->status))
01489 return False;
01490
01491 return True;
01492 }
01493
01494
01495
01496
01497
01498 BOOL lsa_io_r_lookup_sids2(const char *desc, LSA_R_LOOKUP_SIDS2 *r_s,
01499 prs_struct *ps, int depth)
01500 {
01501 prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids2");
01502 depth++;
01503
01504 if(!prs_align(ps))
01505 return False;
01506
01507 if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref))
01508 return False;
01509
01510 if (r_s->ptr_dom_ref != 0)
01511 if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth))
01512 return False;
01513
01514 if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth))
01515 return False;
01516
01517 if(!prs_align(ps))
01518 return False;
01519
01520 if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count))
01521 return False;
01522
01523 if(!prs_ntstatus("status ", ps, depth, &r_s->status))
01524 return False;
01525
01526 return True;
01527 }
01528
01529
01530
01531
01532
01533
01534 BOOL lsa_io_r_lookup_sids3(const char *desc, LSA_R_LOOKUP_SIDS3 *r_s,
01535 prs_struct *ps, int depth)
01536 {
01537 prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids3");
01538 depth++;
01539
01540 if(!prs_align(ps))
01541 return False;
01542
01543 if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref))
01544 return False;
01545
01546 if (r_s->ptr_dom_ref != 0)
01547 if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth))
01548 return False;
01549
01550 if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth))
01551 return False;
01552
01553 if(!prs_align(ps))
01554 return False;
01555
01556 if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count))
01557 return False;
01558
01559 if(!prs_ntstatus("status ", ps, depth, &r_s->status))
01560 return False;
01561
01562 return True;
01563 }
01564
01565
01566
01567
01568
01569 void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l,
01570 POLICY_HND *hnd, int num_names, const char **names)
01571 {
01572 unsigned int i;
01573
01574 DEBUG(5, ("init_q_lookup_names\n"));
01575
01576 ZERO_STRUCTP(q_l);
01577
01578 q_l->pol = *hnd;
01579 q_l->num_entries = num_names;
01580 q_l->num_entries2 = num_names;
01581 q_l->lookup_level = 1;
01582
01583 if (num_names) {
01584 if ((q_l->uni_name = TALLOC_ZERO_ARRAY(mem_ctx, UNISTR2, num_names)) == NULL) {
01585 DEBUG(3, ("init_q_lookup_names(): out of memory\n"));
01586 return;
01587 }
01588
01589 if ((q_l->hdr_name = TALLOC_ZERO_ARRAY(mem_ctx, UNIHDR, num_names)) == NULL) {
01590 DEBUG(3, ("init_q_lookup_names(): out of memory\n"));
01591 return;
01592 }
01593 } else {
01594 q_l->uni_name = NULL;
01595 q_l->hdr_name = NULL;
01596 }
01597
01598 for (i = 0; i < num_names; i++) {
01599 init_unistr2(&q_l->uni_name[i], names[i], UNI_FLAGS_NONE);
01600 init_uni_hdr(&q_l->hdr_name[i], &q_l->uni_name[i]);
01601 }
01602 }
01603
01604
01605
01606
01607
01608 BOOL lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r,
01609 prs_struct *ps, int depth)
01610 {
01611 unsigned int i;
01612
01613 prs_debug(ps, depth, desc, "lsa_io_q_lookup_names");
01614 depth++;
01615
01616 if(!prs_align(ps))
01617 return False;
01618
01619 if(!smb_io_pol_hnd("", &q_r->pol, ps, depth))
01620 return False;
01621
01622 if(!prs_align(ps))
01623 return False;
01624 if(!prs_uint32("num_entries ", ps, depth, &q_r->num_entries))
01625 return False;
01626 if(!prs_uint32("num_entries2 ", ps, depth, &q_r->num_entries2))
01627 return False;
01628
01629 if (UNMARSHALLING(ps)) {
01630 if (q_r->num_entries) {
01631 if ((q_r->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_r->num_entries)) == NULL)
01632 return False;
01633 if ((q_r->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_r->num_entries)) == NULL)
01634 return False;
01635 }
01636 }
01637
01638 for (i = 0; i < q_r->num_entries; i++) {
01639 if(!prs_align(ps))
01640 return False;
01641 if(!smb_io_unihdr("hdr_name", &q_r->hdr_name[i], ps, depth))
01642 return False;
01643 }
01644
01645 for (i = 0; i < q_r->num_entries; i++) {
01646 if(!prs_align(ps))
01647 return False;
01648 if(!smb_io_unistr2("dom_name", &q_r->uni_name[i], q_r->hdr_name[i].buffer, ps, depth))
01649 return False;
01650 }
01651
01652 if(!prs_align(ps))
01653 return False;
01654 if(!prs_uint32("num_trans_entries ", ps, depth, &q_r->num_trans_entries))
01655 return False;
01656 if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids))
01657 return False;
01658 if(!prs_uint16("lookup_level ", ps, depth, &q_r->lookup_level))
01659 return False;
01660 if(!prs_align(ps))
01661 return False;
01662 if(!prs_uint32("mapped_count ", ps, depth, &q_r->mapped_count))
01663 return False;
01664
01665 return True;
01666 }
01667
01668
01669
01670
01671
01672 BOOL lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct *ps, int depth)
01673 {
01674 unsigned int i;
01675
01676 prs_debug(ps, depth, desc, "lsa_io_r_lookup_names");
01677 depth++;
01678
01679 if(!prs_align(ps))
01680 return False;
01681
01682 if(!prs_uint32("ptr_dom_ref", ps, depth, &out->ptr_dom_ref))
01683 return False;
01684
01685 if (out->ptr_dom_ref != 0)
01686 if(!lsa_io_dom_r_ref("", out->dom_ref, ps, depth))
01687 return False;
01688
01689 if(!prs_uint32("num_entries", ps, depth, &out->num_entries))
01690 return False;
01691 if(!prs_uint32("ptr_entries", ps, depth, &out->ptr_entries))
01692 return False;
01693
01694 if (out->ptr_entries != 0) {
01695 if(!prs_uint32("num_entries2", ps, depth, &out->num_entries2))
01696 return False;
01697
01698 if (out->num_entries2 != out->num_entries) {
01699
01700 return False;
01701 }
01702
01703 if (UNMARSHALLING(ps) && out->num_entries2) {
01704 if ((out->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID, out->num_entries2))
01705 == NULL) {
01706 DEBUG(3, ("lsa_io_r_lookup_names(): out of memory\n"));
01707 return False;
01708 }
01709 }
01710
01711 for (i = 0; i < out->num_entries2; i++)
01712 if(!smb_io_dom_rid("", &out->dom_rid[i], ps, depth))
01713 return False;
01714 }
01715
01716 if(!prs_uint32("mapped_count", ps, depth, &out->mapped_count))
01717 return False;
01718
01719 if(!prs_ntstatus("status ", ps, depth, &out->status))
01720 return False;
01721
01722 return True;
01723 }
01724
01725
01726
01727
01728
01729 BOOL lsa_io_q_lookup_names2(const char *desc, LSA_Q_LOOKUP_NAMES2 *q_r,
01730 prs_struct *ps, int depth)
01731 {
01732 unsigned int i;
01733
01734 prs_debug(ps, depth, desc, "lsa_io_q_lookup_names2");
01735 depth++;
01736
01737 if(!prs_align(ps))
01738 return False;
01739
01740 if(!smb_io_pol_hnd("", &q_r->pol, ps, depth))
01741 return False;
01742
01743 if(!prs_align(ps))
01744 return False;
01745 if(!prs_uint32("num_entries ", ps, depth, &q_r->num_entries))
01746 return False;
01747 if(!prs_uint32("num_entries2 ", ps, depth, &q_r->num_entries2))
01748 return False;
01749
01750 if (UNMARSHALLING(ps)) {
01751 if (q_r->num_entries) {
01752 if ((q_r->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_r->num_entries)) == NULL)
01753 return False;
01754 if ((q_r->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_r->num_entries)) == NULL)
01755 return False;
01756 }
01757 }
01758
01759 for (i = 0; i < q_r->num_entries; i++) {
01760 if(!prs_align(ps))
01761 return False;
01762 if(!smb_io_unihdr("hdr_name", &q_r->hdr_name[i], ps, depth))
01763 return False;
01764 }
01765
01766 for (i = 0; i < q_r->num_entries; i++) {
01767 if(!prs_align(ps))
01768 return False;
01769 if(!smb_io_unistr2("dom_name", &q_r->uni_name[i], q_r->hdr_name[i].buffer, ps, depth))
01770 return False;
01771 }
01772
01773 if(!prs_align(ps))
01774 return False;
01775 if(!prs_uint32("num_trans_entries ", ps, depth, &q_r->num_trans_entries))
01776 return False;
01777 if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids))
01778 return False;
01779 if(!prs_uint16("lookup_level ", ps, depth, &q_r->lookup_level))
01780 return False;
01781 if(!prs_align(ps))
01782 return False;
01783 if(!prs_uint32("mapped_count ", ps, depth, &q_r->mapped_count))
01784 return False;
01785 if(!prs_uint32("unknown1 ", ps, depth, &q_r->unknown1))
01786 return False;
01787 if(!prs_uint32("unknown2 ", ps, depth, &q_r->unknown2))
01788 return False;
01789
01790 return True;
01791 }
01792
01793
01794
01795
01796
01797 BOOL lsa_io_r_lookup_names2(const char *desc, LSA_R_LOOKUP_NAMES2 *out, prs_struct *ps, int depth)
01798 {
01799 unsigned int i;
01800
01801 prs_debug(ps, depth, desc, "lsa_io_r_lookup_names2");
01802 depth++;
01803
01804 if(!prs_align(ps))
01805 return False;
01806
01807 if(!prs_uint32("ptr_dom_ref", ps, depth, &out->ptr_dom_ref))
01808 return False;
01809
01810 if (out->ptr_dom_ref != 0)
01811 if(!lsa_io_dom_r_ref("", out->dom_ref, ps, depth))
01812 return False;
01813
01814 if(!prs_uint32("num_entries", ps, depth, &out->num_entries))
01815 return False;
01816 if(!prs_uint32("ptr_entries", ps, depth, &out->ptr_entries))
01817 return False;
01818
01819 if (out->ptr_entries != 0) {
01820 if(!prs_uint32("num_entries2", ps, depth, &out->num_entries2))
01821 return False;
01822
01823 if (out->num_entries2 != out->num_entries) {
01824
01825 return False;
01826 }
01827
01828 if (UNMARSHALLING(ps) && out->num_entries2) {
01829 if ((out->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID2, out->num_entries2))
01830 == NULL) {
01831 DEBUG(3, ("lsa_io_r_lookup_names2(): out of memory\n"));
01832 return False;
01833 }
01834 }
01835
01836 for (i = 0; i < out->num_entries2; i++)
01837 if(!smb_io_dom_rid2("", &out->dom_rid[i], ps, depth))
01838 return False;
01839 }
01840
01841 if(!prs_uint32("mapped_count", ps, depth, &out->mapped_count))
01842 return False;
01843
01844 if(!prs_ntstatus("status ", ps, depth, &out->status))
01845 return False;
01846
01847 return True;
01848 }
01849
01850
01851
01852
01853
01854
01855 BOOL smb_io_lsa_translated_sids3(const char *desc, LSA_TRANSLATED_SID3 *q_r,
01856 prs_struct *ps, int depth)
01857 {
01858 prs_debug(ps, depth, desc, "smb_io_lsa_translated_sids3");
01859 depth++;
01860
01861 if(!prs_align(ps))
01862 return False;
01863 if(!prs_uint8 ("sid_type ", ps, depth, &q_r->sid_type ))
01864 return False;
01865 if(!prs_align(ps))
01866 return False;
01867
01868 if (!smb_io_dom_sid2_p("sid_header", ps, depth, &q_r->sid2))
01869 return False;
01870 if(!prs_uint32("sid_idx ", ps, depth, &q_r->sid_idx ))
01871 return False;
01872 if(!prs_uint32("unknown ", ps, depth, &q_r->unknown ))
01873 return False;
01874
01875 return True;
01876 }
01877
01878
01879
01880
01881
01882 BOOL lsa_io_q_lookup_names3(const char *desc, LSA_Q_LOOKUP_NAMES3 *q_r,
01883 prs_struct *ps, int depth)
01884 {
01885 unsigned int i;
01886
01887 prs_debug(ps, depth, desc, "lsa_io_q_lookup_names3");
01888 depth++;
01889
01890 if(!prs_align(ps))
01891 return False;
01892
01893 if(!smb_io_pol_hnd("", &q_r->pol, ps, depth))
01894 return False;
01895
01896 if(!prs_align(ps))
01897 return False;
01898 if(!prs_uint32("num_entries ", ps, depth, &q_r->num_entries))
01899 return False;
01900 if(!prs_uint32("num_entries2 ", ps, depth, &q_r->num_entries2))
01901 return False;
01902
01903 if (UNMARSHALLING(ps)) {
01904 if (q_r->num_entries) {
01905 if ((q_r->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_r->num_entries)) == NULL)
01906 return False;
01907 if ((q_r->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_r->num_entries)) == NULL)
01908 return False;
01909 }
01910 }
01911
01912 for (i = 0; i < q_r->num_entries; i++) {
01913 if(!prs_align(ps))
01914 return False;
01915 if(!smb_io_unihdr("hdr_name", &q_r->hdr_name[i], ps, depth))
01916 return False;
01917 }
01918
01919 for (i = 0; i < q_r->num_entries; i++) {
01920 if(!prs_align(ps))
01921 return False;
01922 if(!smb_io_unistr2("dom_name", &q_r->uni_name[i], q_r->hdr_name[i].buffer, ps, depth))
01923 return False;
01924 }
01925
01926 if(!prs_align(ps))
01927 return False;
01928 if(!prs_uint32("num_trans_entries ", ps, depth, &q_r->num_trans_entries))
01929 return False;
01930 if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids))
01931 return False;
01932 if(!prs_uint16("lookup_level ", ps, depth, &q_r->lookup_level))
01933 return False;
01934 if(!prs_align(ps))
01935 return False;
01936 if(!prs_uint32("mapped_count ", ps, depth, &q_r->mapped_count))
01937 return False;
01938 if(!prs_uint32("unknown1 ", ps, depth, &q_r->unknown1))
01939 return False;
01940 if(!prs_uint32("unknown2 ", ps, depth, &q_r->unknown2))
01941 return False;
01942
01943 return True;
01944 }
01945
01946
01947
01948
01949
01950 BOOL lsa_io_r_lookup_names3(const char *desc, LSA_R_LOOKUP_NAMES3 *out, prs_struct *ps, int depth)
01951 {
01952 unsigned int i;
01953
01954 prs_debug(ps, depth, desc, "lsa_io_r_lookup_names3");
01955 depth++;
01956
01957 if(!prs_align(ps))
01958 return False;
01959
01960 if(!prs_uint32("ptr_dom_ref", ps, depth, &out->ptr_dom_ref))
01961 return False;
01962
01963 if (out->ptr_dom_ref != 0)
01964 if(!lsa_io_dom_r_ref("", out->dom_ref, ps, depth))
01965 return False;
01966
01967 if(!prs_uint32("num_entries", ps, depth, &out->num_entries))
01968 return False;
01969 if(!prs_uint32("ptr_entries", ps, depth, &out->ptr_entries))
01970 return False;
01971
01972 if (out->ptr_entries != 0) {
01973 if(!prs_uint32("num_entries2", ps, depth, &out->num_entries2))
01974 return False;
01975
01976 if (out->num_entries2 != out->num_entries) {
01977
01978 return False;
01979 }
01980
01981 if (UNMARSHALLING(ps) && out->num_entries2) {
01982 if ((out->trans_sids = PRS_ALLOC_MEM(ps, LSA_TRANSLATED_SID3, out->num_entries2))
01983 == NULL) {
01984 DEBUG(3, ("lsa_io_r_lookup_names3(): out of memory\n"));
01985 return False;
01986 }
01987 }
01988
01989 for (i = 0; i < out->num_entries2; i++) {
01990 if(!smb_io_lsa_translated_sids3("", &out->trans_sids[i], ps, depth)) {
01991 return False;
01992 }
01993 }
01994
01995 for (i = 0; i < out->num_entries2; i++) {
01996 if (out->trans_sids[i].sid2) {
01997 if( !smb_io_dom_sid2("sid2", out->trans_sids[i].sid2, ps, depth) ) {
01998 return False;
01999 }
02000 }
02001 }
02002 }
02003
02004 if(!prs_uint32("mapped_count", ps, depth, &out->mapped_count))
02005 return False;
02006
02007 if(!prs_ntstatus("status ", ps, depth, &out->status))
02008 return False;
02009
02010 return True;
02011 }
02012
02013
02014
02015
02016 BOOL lsa_io_q_lookup_names4(const char *desc, LSA_Q_LOOKUP_NAMES4 *q_r,
02017 prs_struct *ps, int depth)
02018 {
02019 unsigned int i;
02020
02021 prs_debug(ps, depth, desc, "lsa_io_q_lookup_names4");
02022 depth++;
02023
02024 if(!prs_align(ps))
02025 return False;
02026
02027 if(!prs_uint32("num_entries ", ps, depth, &q_r->num_entries))
02028 return False;
02029 if(!prs_uint32("num_entries2 ", ps, depth, &q_r->num_entries2))
02030 return False;
02031
02032 if (UNMARSHALLING(ps)) {
02033 if (q_r->num_entries) {
02034 if ((q_r->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_r->num_entries)) == NULL)
02035 return False;
02036 if ((q_r->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_r->num_entries)) == NULL)
02037 return False;
02038 }
02039 }
02040
02041 for (i = 0; i < q_r->num_entries; i++) {
02042 if(!prs_align(ps))
02043 return False;
02044 if(!smb_io_unihdr("hdr_name", &q_r->hdr_name[i], ps, depth))
02045 return False;
02046 }
02047
02048 for (i = 0; i < q_r->num_entries; i++) {
02049 if(!prs_align(ps))
02050 return False;
02051 if(!smb_io_unistr2("dom_name", &q_r->uni_name[i], q_r->hdr_name[i].buffer, ps, depth))
02052 return False;
02053 }
02054
02055 if(!prs_align(ps))
02056 return False;
02057 if(!prs_uint32("num_trans_entries ", ps, depth, &q_r->num_trans_entries))
02058 return False;
02059 if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids))
02060 return False;
02061 if(!prs_uint16("lookup_level ", ps, depth, &q_r->lookup_level))
02062 return False;
02063 if(!prs_align(ps))
02064 return False;
02065 if(!prs_uint32("mapped_count ", ps, depth, &q_r->mapped_count))
02066 return False;
02067 if(!prs_uint32("unknown1 ", ps, depth, &q_r->unknown1))
02068 return False;
02069 if(!prs_uint32("unknown2 ", ps, depth, &q_r->unknown2))
02070 return False;
02071
02072 return True;
02073 }
02074
02075
02076
02077
02078
02079 BOOL lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_struct *ps, int depth)
02080 {
02081 unsigned int i;
02082
02083 prs_debug(ps, depth, desc, "lsa_io_r_lookup_names4");
02084 depth++;
02085
02086 if(!prs_align(ps))
02087 return False;
02088
02089 if(!prs_uint32("ptr_dom_ref", ps, depth, &out->ptr_dom_ref))
02090 return False;
02091
02092 if (out->ptr_dom_ref != 0)
02093 if(!lsa_io_dom_r_ref("", out->dom_ref, ps, depth))
02094 return False;
02095
02096 if(!prs_uint32("num_entries", ps, depth, &out->num_entries))
02097 return False;
02098 if(!prs_uint32("ptr_entries", ps, depth, &out->ptr_entries))
02099 return False;
02100
02101 if (out->ptr_entries != 0) {
02102 if(!prs_uint32("num_entries2", ps, depth, &out->num_entries2))
02103 return False;
02104
02105 if (out->num_entries2 != out->num_entries) {
02106
02107 return False;
02108 }
02109
02110 if (UNMARSHALLING(ps) && out->num_entries2) {
02111 if ((out->trans_sids = PRS_ALLOC_MEM(ps, LSA_TRANSLATED_SID3, out->num_entries2))
02112 == NULL) {
02113 DEBUG(3, ("lsa_io_r_lookup_names4(): out of memory\n"));
02114 return False;
02115 }
02116 }
02117
02118 for (i = 0; i < out->num_entries2; i++) {
02119 if(!smb_io_lsa_translated_sids3("", &out->trans_sids[i], ps, depth)) {
02120 return False;
02121 }
02122 }
02123
02124 for (i = 0; i < out->num_entries2; i++) {
02125 if (out->trans_sids[i].sid2) {
02126 if( !smb_io_dom_sid2("sid2", out->trans_sids[i].sid2, ps, depth) ) {
02127 return False;
02128 }
02129 }
02130 }
02131 }
02132
02133 if(!prs_uint32("mapped_count", ps, depth, &out->mapped_count))
02134 return False;
02135
02136 if(!prs_ntstatus("status ", ps, depth, &out->status))
02137 return False;
02138
02139 return True;
02140 }
02141
02142
02143
02144
02145
02146 void init_lsa_q_close(LSA_Q_CLOSE *in, POLICY_HND *hnd)
02147 {
02148 DEBUG(5, ("init_lsa_q_close\n"));
02149
02150 memcpy(&in->pol, hnd, sizeof(in->pol));
02151 }
02152
02153
02154
02155
02156
02157 BOOL lsa_io_q_close(const char *desc, LSA_Q_CLOSE *in, prs_struct *ps, int depth)
02158 {
02159 prs_debug(ps, depth, desc, "lsa_io_q_close");
02160 depth++;
02161
02162 if(!smb_io_pol_hnd("", &in->pol, ps, depth))
02163 return False;
02164
02165 return True;
02166 }
02167
02168
02169
02170
02171
02172 BOOL lsa_io_r_close(const char *desc, LSA_R_CLOSE *out, prs_struct *ps, int depth)
02173 {
02174 prs_debug(ps, depth, desc, "lsa_io_r_close");
02175 depth++;
02176
02177 if(!smb_io_pol_hnd("", &out->pol, ps, depth))
02178 return False;
02179
02180 if(!prs_ntstatus("status", ps, depth, &out->status))
02181 return False;
02182
02183 return True;
02184 }
02185
02186
02187
02188
02189
02190 BOOL lsa_io_q_open_secret(const char *desc, LSA_Q_OPEN_SECRET *in, prs_struct *ps, int depth)
02191 {
02192 prs_debug(ps, depth, desc, "lsa_io_q_open_secret");
02193 depth++;
02194
02195 if(!prs_align(ps))
02196 return False;
02197
02198 if(!smb_io_pol_hnd("", &in->handle, ps, depth))
02199 return False;
02200
02201 if(!prs_unistr4 ("secretname", ps, depth, &in->secretname))
02202 return False;
02203 if(!prs_align(ps))
02204 return False;
02205
02206 if(!prs_uint32("access", ps, depth, &in->access))
02207 return False;
02208
02209 return True;
02210 }
02211
02212
02213
02214
02215
02216 BOOL lsa_io_r_open_secret(const char *desc, LSA_R_OPEN_SECRET *out, prs_struct *ps, int depth)
02217 {
02218 prs_debug(ps, depth, desc, "lsa_io_r_open_secret");
02219 depth++;
02220
02221 if(!prs_align(ps))
02222 return False;
02223
02224 if(!smb_io_pol_hnd("", &out->handle, ps, depth))
02225 return False;
02226
02227 if(!prs_ntstatus("status", ps, depth, &out->status))
02228 return False;
02229
02230 return True;
02231 }
02232
02233
02234
02235
02236
02237 void init_q_enum_privs(LSA_Q_ENUM_PRIVS *in, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length)
02238 {
02239 DEBUG(5, ("init_q_enum_privs\n"));
02240
02241 memcpy(&in->pol, hnd, sizeof(in->pol));
02242
02243 in->enum_context = enum_context;
02244 in->pref_max_length = pref_max_length;
02245 }
02246
02247
02248
02249
02250 BOOL lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *in, prs_struct *ps, int depth)
02251 {
02252 if (in == NULL)
02253 return False;
02254
02255 prs_debug(ps, depth, desc, "lsa_io_q_enum_privs");
02256 depth++;
02257
02258 if (!smb_io_pol_hnd("", &in->pol, ps, depth))
02259 return False;
02260
02261 if(!prs_uint32("enum_context ", ps, depth, &in->enum_context))
02262 return False;
02263 if(!prs_uint32("pref_max_length", ps, depth, &in->pref_max_length))
02264 return False;
02265
02266 return True;
02267 }
02268
02269
02270
02271
02272 static BOOL lsa_io_priv_entries(const char *desc, LSA_PRIV_ENTRY *entries, uint32 count, prs_struct *ps, int depth)
02273 {
02274 uint32 i;
02275
02276 if (entries == NULL)
02277 return False;
02278
02279 prs_debug(ps, depth, desc, "lsa_io_priv_entries");
02280 depth++;
02281
02282 if(!prs_align(ps))
02283 return False;
02284
02285 for (i = 0; i < count; i++) {
02286 if (!smb_io_unihdr("", &entries[i].hdr_name, ps, depth))
02287 return False;
02288 if(!prs_uint32("luid_low ", ps, depth, &entries[i].luid_low))
02289 return False;
02290 if(!prs_uint32("luid_high", ps, depth, &entries[i].luid_high))
02291 return False;
02292 }
02293
02294 for (i = 0; i < count; i++)
02295 if (!smb_io_unistr2("", &entries[i].name, entries[i].hdr_name.buffer, ps, depth))
02296 return False;
02297
02298 return True;
02299 }
02300
02301
02302
02303
02304
02305 void init_lsa_r_enum_privs(LSA_R_ENUM_PRIVS *out, uint32 enum_context,
02306 uint32 count, LSA_PRIV_ENTRY *entries)
02307 {
02308 DEBUG(5, ("init_lsa_r_enum_privs\n"));
02309
02310 out->enum_context=enum_context;
02311 out->count=count;
02312
02313 if (entries!=NULL) {
02314 out->ptr=1;
02315 out->count1=count;
02316 out->privs=entries;
02317 } else {
02318 out->ptr=0;
02319 out->count1=0;
02320 out->privs=NULL;
02321 }
02322 }
02323
02324
02325
02326
02327 BOOL lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *out, prs_struct *ps, int depth)
02328 {
02329 if (out == NULL)
02330 return False;
02331
02332 prs_debug(ps, depth, desc, "lsa_io_r_enum_privs");
02333 depth++;
02334
02335 if(!prs_align(ps))
02336 return False;
02337
02338 if(!prs_uint32("enum_context", ps, depth, &out->enum_context))
02339 return False;
02340 if(!prs_uint32("count", ps, depth, &out->count))
02341 return False;
02342 if(!prs_uint32("ptr", ps, depth, &out->ptr))
02343 return False;
02344
02345 if (out->ptr) {
02346 if(!prs_uint32("count1", ps, depth, &out->count1))
02347 return False;
02348
02349 if (UNMARSHALLING(ps) && out->count1)
02350 if (!(out->privs = PRS_ALLOC_MEM(ps, LSA_PRIV_ENTRY, out->count1)))
02351 return False;
02352
02353 if (!lsa_io_priv_entries("", out->privs, out->count1, ps, depth))
02354 return False;
02355 }
02356
02357 if(!prs_align(ps))
02358 return False;
02359
02360 if(!prs_ntstatus("status", ps, depth, &out->status))
02361 return False;
02362
02363 return True;
02364 }
02365
02366 void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, const char *name, uint16 lang_id, uint16 lang_id_sys)
02367 {
02368 memcpy(&trn->pol, hnd, sizeof(trn->pol));
02369
02370 init_unistr2(&trn->name, name, UNI_FLAGS_NONE);
02371 init_uni_hdr(&trn->hdr_name, &trn->name);
02372 trn->lang_id = lang_id;
02373 trn->lang_id_sys = lang_id_sys;
02374 }
02375
02376
02377
02378
02379 BOOL lsa_io_q_priv_get_dispname(const char *desc, LSA_Q_PRIV_GET_DISPNAME *in, prs_struct *ps, int depth)
02380 {
02381 if (in == NULL)
02382 return False;
02383
02384 prs_debug(ps, depth, desc, "lsa_io_q_priv_get_dispname");
02385 depth++;
02386
02387 if(!prs_align(ps))
02388 return False;
02389
02390 if (!smb_io_pol_hnd("", &in->pol, ps, depth))
02391 return False;
02392
02393 if (!smb_io_unihdr("hdr_name", &in->hdr_name, ps, depth))
02394 return False;
02395
02396 if (!smb_io_unistr2("name", &in->name, in->hdr_name.buffer, ps, depth))
02397 return False;
02398
02399 if(!prs_uint16("lang_id ", ps, depth, &in->lang_id))
02400 return False;
02401 if(!prs_uint16("lang_id_sys", ps, depth, &in->lang_id_sys))
02402 return False;
02403
02404 return True;
02405 }
02406
02407
02408
02409
02410 BOOL lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *out, prs_struct *ps, int depth)
02411 {
02412 if (out == NULL)
02413 return False;
02414
02415 prs_debug(ps, depth, desc, "lsa_io_r_priv_get_dispname");
02416 depth++;
02417
02418 if (!prs_align(ps))
02419 return False;
02420
02421 if (!prs_uint32("ptr_info", ps, depth, &out->ptr_info))
02422 return False;
02423
02424 if (out->ptr_info){
02425 if (!smb_io_unihdr("hdr_name", &out->hdr_desc, ps, depth))
02426 return False;
02427
02428 if (!smb_io_unistr2("desc", &out->desc, out->hdr_desc.buffer, ps, depth))
02429 return False;
02430 }
02431
02432
02433
02434
02435 if(!prs_uint16("lang_id", ps, depth, &out->lang_id))
02436 return False;
02437
02438 if(!prs_align(ps))
02439 return False;
02440 if(!prs_ntstatus("status", ps, depth, &out->status))
02441 return False;
02442
02443 return True;
02444 }
02445
02446
02447
02448
02449 void init_lsa_q_enum_accounts(LSA_Q_ENUM_ACCOUNTS *trn, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length)
02450 {
02451 memcpy(&trn->pol, hnd, sizeof(trn->pol));
02452
02453 trn->enum_context = enum_context;
02454 trn->pref_max_length = pref_max_length;
02455 }
02456
02457
02458
02459
02460 BOOL lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *in, prs_struct *ps, int depth)
02461 {
02462 if (in == NULL)
02463 return False;
02464
02465 prs_debug(ps, depth, desc, "lsa_io_q_enum_accounts");
02466 depth++;
02467
02468 if (!smb_io_pol_hnd("", &in->pol, ps, depth))
02469 return False;
02470
02471 if(!prs_uint32("enum_context ", ps, depth, &in->enum_context))
02472 return False;
02473 if(!prs_uint32("pref_max_length", ps, depth, &in->pref_max_length))
02474 return False;
02475
02476 return True;
02477 }
02478
02479
02480
02481
02482
02483
02484 void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS *out, uint32 enum_context)
02485 {
02486 DEBUG(5, ("init_lsa_r_enum_accounts\n"));
02487
02488 out->enum_context=enum_context;
02489 if (out->enum_context!=0) {
02490 out->sids.num_entries=enum_context;
02491 out->sids.ptr_sid_enum=1;
02492 out->sids.num_entries2=enum_context;
02493 } else {
02494 out->sids.num_entries=0;
02495 out->sids.ptr_sid_enum=0;
02496 out->sids.num_entries2=0;
02497 }
02498 }
02499
02500
02501
02502
02503 BOOL lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *out, prs_struct *ps, int depth)
02504 {
02505 if (out == NULL)
02506 return False;
02507
02508 prs_debug(ps, depth, desc, "lsa_io_r_enum_accounts");
02509 depth++;
02510
02511 if (!prs_align(ps))
02512 return False;
02513
02514 if(!prs_uint32("enum_context", ps, depth, &out->enum_context))
02515 return False;
02516
02517 if (!lsa_io_sid_enum("sids", &out->sids, ps, depth))
02518 return False;
02519
02520 if (!prs_align(ps))
02521 return False;
02522
02523 if(!prs_ntstatus("status", ps, depth, &out->status))
02524 return False;
02525
02526 return True;
02527 }
02528
02529
02530
02531
02532
02533
02534 BOOL lsa_io_q_unk_get_connuser(const char *desc, LSA_Q_UNK_GET_CONNUSER *in, prs_struct *ps, int depth)
02535 {
02536 prs_debug(ps, depth, desc, "lsa_io_q_unk_get_connuser");
02537 depth++;
02538
02539 if(!prs_align(ps))
02540 return False;
02541
02542 if(!prs_uint32("ptr_srvname", ps, depth, &in->ptr_srvname))
02543 return False;
02544
02545 if(!smb_io_unistr2("uni2_srvname", &in->uni2_srvname, in->ptr_srvname, ps, depth))
02546 return False;
02547
02548 if (!prs_align(ps))
02549 return False;
02550
02551 if(!prs_uint32("unk1", ps, depth, &in->unk1))
02552 return False;
02553 if(!prs_uint32("unk2", ps, depth, &in->unk2))
02554 return False;
02555 if(!prs_uint32("unk3", ps, depth, &in->unk3))
02556 return False;
02557
02558
02559 return True;
02560 }
02561
02562
02563
02564
02565
02566 BOOL lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *out, prs_struct *ps, int depth)
02567 {
02568 prs_debug(ps, depth, desc, "lsa_io_r_unk_get_connuser");
02569 depth++;
02570
02571 if(!prs_align(ps))
02572 return False;
02573
02574 if(!prs_uint32("ptr_user_name", ps, depth, &out->ptr_user_name))
02575 return False;
02576 if(!smb_io_unihdr("hdr_user_name", &out->hdr_user_name, ps, depth))
02577 return False;
02578 if(!smb_io_unistr2("uni2_user_name", &out->uni2_user_name, out->ptr_user_name, ps, depth))
02579 return False;
02580
02581 if (!prs_align(ps))
02582 return False;
02583
02584 if(!prs_uint32("unk1", ps, depth, &out->unk1))
02585 return False;
02586
02587 if(!prs_uint32("ptr_dom_name", ps, depth, &out->ptr_dom_name))
02588 return False;
02589 if(!smb_io_unihdr("hdr_dom_name", &out->hdr_dom_name, ps, depth))
02590 return False;
02591 if(!smb_io_unistr2("uni2_dom_name", &out->uni2_dom_name, out->ptr_dom_name, ps, depth))
02592 return False;
02593
02594 if (!prs_align(ps))
02595 return False;
02596
02597 if(!prs_ntstatus("status", ps, depth, &out->status))
02598 return False;
02599
02600 return True;
02601 }
02602
02603 void init_lsa_q_create_account(LSA_Q_CREATEACCOUNT *trn, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access)
02604 {
02605 memcpy(&trn->pol, hnd, sizeof(trn->pol));
02606
02607 init_dom_sid2(&trn->sid, sid);
02608 trn->access = desired_access;
02609 }
02610
02611
02612
02613
02614
02615
02616 BOOL lsa_io_q_create_account(const char *desc, LSA_Q_CREATEACCOUNT *out, prs_struct *ps, int depth)
02617 {
02618 prs_debug(ps, depth, desc, "lsa_io_q_create_account");
02619 depth++;
02620
02621 if(!prs_align(ps))
02622 return False;
02623
02624 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
02625 return False;
02626
02627 if(!smb_io_dom_sid2("sid", &out->sid, ps, depth))
02628 return False;
02629
02630 if(!prs_uint32("access", ps, depth, &out->access))
02631 return False;
02632
02633 return True;
02634 }
02635
02636
02637
02638
02639
02640 BOOL lsa_io_r_create_account(const char *desc, LSA_R_CREATEACCOUNT *out, prs_struct *ps, int depth)
02641 {
02642 prs_debug(ps, depth, desc, "lsa_io_r_open_account");
02643 depth++;
02644
02645 if(!prs_align(ps))
02646 return False;
02647
02648 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
02649 return False;
02650
02651 if(!prs_ntstatus("status", ps, depth, &out->status))
02652 return False;
02653
02654 return True;
02655 }
02656
02657
02658 void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access)
02659 {
02660 memcpy(&trn->pol, hnd, sizeof(trn->pol));
02661
02662 init_dom_sid2(&trn->sid, sid);
02663 trn->access = desired_access;
02664 }
02665
02666
02667
02668
02669
02670 BOOL lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *out, prs_struct *ps, int depth)
02671 {
02672 prs_debug(ps, depth, desc, "lsa_io_q_open_account");
02673 depth++;
02674
02675 if(!prs_align(ps))
02676 return False;
02677
02678 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
02679 return False;
02680
02681 if(!smb_io_dom_sid2("sid", &out->sid, ps, depth))
02682 return False;
02683
02684 if(!prs_uint32("access", ps, depth, &out->access))
02685 return False;
02686
02687 return True;
02688 }
02689
02690
02691
02692
02693
02694 BOOL lsa_io_r_open_account(const char *desc, LSA_R_OPENACCOUNT *out, prs_struct *ps, int depth)
02695 {
02696 prs_debug(ps, depth, desc, "lsa_io_r_open_account");
02697 depth++;
02698
02699 if(!prs_align(ps))
02700 return False;
02701
02702 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
02703 return False;
02704
02705 if(!prs_ntstatus("status", ps, depth, &out->status))
02706 return False;
02707
02708 return True;
02709 }
02710
02711
02712 void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd)
02713 {
02714 memcpy(&trn->pol, hnd, sizeof(trn->pol));
02715
02716 }
02717
02718
02719
02720
02721
02722 BOOL lsa_io_q_enum_privsaccount(const char *desc, LSA_Q_ENUMPRIVSACCOUNT *out, prs_struct *ps, int depth)
02723 {
02724 prs_debug(ps, depth, desc, "lsa_io_q_enum_privsaccount");
02725 depth++;
02726
02727 if(!prs_align(ps))
02728 return False;
02729
02730 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
02731 return False;
02732
02733 return True;
02734 }
02735
02736
02737
02738
02739
02740 static BOOL lsa_io_luid(const char *desc, LUID *out, prs_struct *ps, int depth)
02741 {
02742 prs_debug(ps, depth, desc, "lsa_io_luid");
02743 depth++;
02744
02745 if(!prs_align(ps))
02746 return False;
02747
02748 if(!prs_uint32("low", ps, depth, &out->low))
02749 return False;
02750
02751 if(!prs_uint32("high", ps, depth, &out->high))
02752 return False;
02753
02754 return True;
02755 }
02756
02757
02758
02759
02760
02761 static BOOL lsa_io_luid_attr(const char *desc, LUID_ATTR *out, prs_struct *ps, int depth)
02762 {
02763 prs_debug(ps, depth, desc, "lsa_io_luid_attr");
02764 depth++;
02765
02766 if(!prs_align(ps))
02767 return False;
02768
02769 if (!lsa_io_luid(desc, &out->luid, ps, depth))
02770 return False;
02771
02772 if(!prs_uint32("attr", ps, depth, &out->attr))
02773 return False;
02774
02775 return True;
02776 }
02777
02778
02779
02780
02781
02782 static BOOL lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *out, prs_struct *ps, int depth)
02783 {
02784 uint32 i, dummy;
02785
02786 prs_debug(ps, depth, desc, "lsa_io_privilege_set");
02787 depth++;
02788
02789 if(!prs_align(ps))
02790 return False;
02791
02792 if(!prs_uint32("count", ps, depth, &dummy))
02793 return False;
02794 if(!prs_uint32("control", ps, depth, &out->control))
02795 return False;
02796
02797 for (i=0; i<out->count; i++) {
02798 if (!lsa_io_luid_attr(desc, &out->set[i], ps, depth))
02799 return False;
02800 }
02801
02802 return True;
02803 }
02804
02805 NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUNT *out, LUID_ATTR *set, uint32 count, uint32 control)
02806 {
02807 NTSTATUS ret = NT_STATUS_OK;
02808
02809 out->ptr = 1;
02810 out->count = count;
02811
02812 if ( !NT_STATUS_IS_OK(ret = privilege_set_init_by_ctx(mem_ctx, &(out->set))) )
02813 return ret;
02814
02815 out->set.count = count;
02816
02817 if (!NT_STATUS_IS_OK(ret = dup_luid_attr(out->set.mem_ctx, &(out->set.set), set, count)))
02818 return ret;
02819
02820 DEBUG(10,("init_lsa_r_enum_privsaccount: %d privileges\n", out->count));
02821
02822 return ret;
02823 }
02824
02825
02826
02827
02828
02829 BOOL lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *out, prs_struct *ps, int depth)
02830 {
02831 prs_debug(ps, depth, desc, "lsa_io_r_enum_privsaccount");
02832 depth++;
02833
02834 if(!prs_align(ps))
02835 return False;
02836
02837 if(!prs_uint32("ptr", ps, depth, &out->ptr))
02838 return False;
02839
02840 if (out->ptr!=0) {
02841 if(!prs_uint32("count", ps, depth, &out->count))
02842 return False;
02843
02844
02845
02846 if (UNMARSHALLING(ps) && out->count != 0) {
02847 if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(out->set))))
02848 return False;
02849
02850 if (!(out->set.set = PRS_ALLOC_MEM(ps,LUID_ATTR,out->count)))
02851 return False;
02852
02853 }
02854
02855 if(!lsa_io_privilege_set(desc, &out->set, ps, depth))
02856 return False;
02857 }
02858
02859 if(!prs_ntstatus("status", ps, depth, &out->status))
02860 return False;
02861
02862 return True;
02863 }
02864
02865
02866
02867
02868
02869
02870
02871 BOOL lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *out, prs_struct *ps, int depth)
02872 {
02873 prs_debug(ps, depth, desc, "lsa_io_q_getsystemaccount");
02874 depth++;
02875
02876 if(!prs_align(ps))
02877 return False;
02878
02879 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
02880 return False;
02881
02882 return True;
02883 }
02884
02885
02886
02887
02888
02889 BOOL lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *out, prs_struct *ps, int depth)
02890 {
02891 prs_debug(ps, depth, desc, "lsa_io_r_getsystemaccount");
02892 depth++;
02893
02894 if(!prs_align(ps))
02895 return False;
02896
02897 if(!prs_uint32("access", ps, depth, &out->access))
02898 return False;
02899
02900 if(!prs_ntstatus("status", ps, depth, &out->status))
02901 return False;
02902
02903 return True;
02904 }
02905
02906
02907
02908
02909
02910
02911 BOOL lsa_io_q_setsystemaccount(const char *desc, LSA_Q_SETSYSTEMACCOUNT *out, prs_struct *ps, int depth)
02912 {
02913 prs_debug(ps, depth, desc, "lsa_io_q_setsystemaccount");
02914 depth++;
02915
02916 if(!prs_align(ps))
02917 return False;
02918
02919 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
02920 return False;
02921
02922 if(!prs_uint32("access", ps, depth, &out->access))
02923 return False;
02924
02925 return True;
02926 }
02927
02928
02929
02930
02931
02932 BOOL lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *out, prs_struct *ps, int depth)
02933 {
02934 prs_debug(ps, depth, desc, "lsa_io_r_setsystemaccount");
02935 depth++;
02936
02937 if(!prs_align(ps))
02938 return False;
02939
02940 if(!prs_ntstatus("status", ps, depth, &out->status))
02941 return False;
02942
02943 return True;
02944 }
02945
02946
02947 void init_lsa_string( LSA_STRING *uni, const char *string )
02948 {
02949 init_unistr2(&uni->unistring, string, UNI_FLAGS_NONE);
02950 init_uni_hdr(&uni->hdr, &uni->unistring);
02951 }
02952
02953 void init_lsa_q_lookup_priv_value(LSA_Q_LOOKUP_PRIV_VALUE *q_u, POLICY_HND *hnd, const char *name)
02954 {
02955 memcpy(&q_u->pol, hnd, sizeof(q_u->pol));
02956 init_lsa_string( &q_u->privname, name );
02957 }
02958
02959 BOOL smb_io_lsa_string( const char *desc, LSA_STRING *string, prs_struct *ps, int depth )
02960 {
02961 prs_debug(ps, depth, desc, "smb_io_lsa_string");
02962 depth++;
02963
02964 if(!smb_io_unihdr ("hdr", &string->hdr, ps, depth))
02965 return False;
02966 if(!smb_io_unistr2("unistring", &string->unistring, string->hdr.buffer, ps, depth))
02967 return False;
02968
02969 return True;
02970 }
02971
02972
02973
02974
02975
02976 BOOL lsa_io_q_lookup_priv_value(const char *desc, LSA_Q_LOOKUP_PRIV_VALUE *out, prs_struct *ps, int depth)
02977 {
02978 prs_debug(ps, depth, desc, "lsa_io_q_lookup_priv_value");
02979 depth++;
02980
02981 if(!prs_align(ps))
02982 return False;
02983
02984 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
02985 return False;
02986 if(!smb_io_lsa_string("privname", &out->privname, ps, depth))
02987 return False;
02988
02989 return True;
02990 }
02991
02992
02993
02994
02995
02996 BOOL lsa_io_r_lookup_priv_value(const char *desc, LSA_R_LOOKUP_PRIV_VALUE *out, prs_struct *ps, int depth)
02997 {
02998 prs_debug(ps, depth, desc, "lsa_io_r_lookup_priv_value");
02999 depth++;
03000
03001 if(!prs_align(ps))
03002 return False;
03003
03004 if(!lsa_io_luid("luid", &out->luid, ps, depth))
03005 return False;
03006
03007 if(!prs_ntstatus("status", ps, depth, &out->status))
03008 return False;
03009
03010 return True;
03011 }
03012
03013
03014
03015
03016
03017
03018 BOOL lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *out, prs_struct *ps, int depth)
03019 {
03020 prs_debug(ps, depth, desc, "lsa_io_q_addprivs");
03021 depth++;
03022
03023 if(!prs_align(ps))
03024 return False;
03025
03026 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
03027 return False;
03028
03029 if(!prs_uint32("count", ps, depth, &out->count))
03030 return False;
03031
03032 if (UNMARSHALLING(ps) && out->count!=0) {
03033 if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(out->set))))
03034 return False;
03035
03036 if (!(out->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, out->count)))
03037 return False;
03038 }
03039
03040 if(!lsa_io_privilege_set(desc, &out->set, ps, depth))
03041 return False;
03042
03043 return True;
03044 }
03045
03046
03047
03048
03049
03050 BOOL lsa_io_r_addprivs(const char *desc, LSA_R_ADDPRIVS *out, prs_struct *ps, int depth)
03051 {
03052 prs_debug(ps, depth, desc, "lsa_io_r_addprivs");
03053 depth++;
03054
03055 if(!prs_align(ps))
03056 return False;
03057
03058 if(!prs_ntstatus("status", ps, depth, &out->status))
03059 return False;
03060
03061 return True;
03062 }
03063
03064
03065
03066
03067
03068 BOOL lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *out, prs_struct *ps, int depth)
03069 {
03070 prs_debug(ps, depth, desc, "lsa_io_q_removeprivs");
03071 depth++;
03072
03073 if(!prs_align(ps))
03074 return False;
03075
03076 if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
03077 return False;
03078
03079 if(!prs_uint32("allrights", ps, depth, &out->allrights))
03080 return False;
03081
03082 if(!prs_uint32("ptr", ps, depth, &out->ptr))
03083 return False;
03084
03085
03086
03087
03088
03089
03090 if (out->ptr!=0) {
03091 if(!prs_uint32("count", ps, depth, &out->count))
03092 return False;
03093
03094 if (UNMARSHALLING(ps) && out->count!=0) {
03095 if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(out->set))))
03096 return False;
03097
03098 if (!(out->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, out->count)))
03099 return False;
03100 }
03101
03102 if(!lsa_io_privilege_set(desc, &out->set, ps, depth))
03103 return False;
03104 }
03105
03106 return True;
03107 }
03108
03109
03110
03111
03112
03113 BOOL lsa_io_r_removeprivs(const char *desc, LSA_R_REMOVEPRIVS *out, prs_struct *ps, int depth)
03114 {
03115 prs_debug(ps, depth, desc, "lsa_io_r_removeprivs");
03116 depth++;
03117
03118 if(!prs_align(ps))
03119 return False;
03120
03121 if(!prs_ntstatus("status", ps, depth, &out->status))
03122 return False;
03123
03124 return True;
03125 }
03126
03127 BOOL policy_handle_is_valid(const POLICY_HND *hnd)
03128 {
03129 POLICY_HND zero_pol;
03130
03131 ZERO_STRUCT(zero_pol);
03132 return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? False : True );
03133 }
03134
03135
03136
03137
03138
03139 void init_q_query2(LSA_Q_QUERY_INFO2 *in, POLICY_HND *hnd, uint16 info_class)
03140 {
03141 DEBUG(5, ("init_q_query2\n"));
03142
03143 memcpy(&in->pol, hnd, sizeof(in->pol));
03144
03145 in->info_class = info_class;
03146 }
03147
03148
03149
03150
03151
03152 BOOL lsa_io_q_query_info2(const char *desc, LSA_Q_QUERY_INFO2 *in, prs_struct *ps, int depth)
03153 {
03154 prs_debug(ps, depth, desc, "lsa_io_q_query_info2");
03155 depth++;
03156
03157 if(!prs_align(ps))
03158 return False;
03159
03160 if(!smb_io_pol_hnd("pol", &in->pol, ps, depth))
03161 return False;
03162
03163 if(!prs_uint16("info_class", ps, depth, &in->info_class))
03164 return False;
03165
03166 return True;
03167 }
03168
03169
03170
03171
03172
03173 BOOL lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *out,
03174 prs_struct *ps, int depth)
03175 {
03176 prs_debug(ps, depth, desc, "lsa_io_r_query_info2");
03177 depth++;
03178
03179 if(!prs_align(ps))
03180 return False;
03181
03182 if(!prs_uint32("dom_ptr", ps, depth, &out->dom_ptr))
03183 return False;
03184
03185 if (out->dom_ptr) {
03186
03187 if(!lsa_io_query_info_ctr2("", ps, depth, &out->ctr))
03188 return False;
03189 }
03190
03191 if(!prs_align(ps))
03192 return False;
03193 if(!prs_ntstatus("status", ps, depth, &out->status))
03194 return False;
03195
03196 return True;
03197 }
03198
03199
03200
03201
03202 void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *in,
03203 POLICY_HND *hnd,
03204 uint32 count,
03205 DOM_SID *sid)
03206 {
03207 DEBUG(5, ("init_q_enum_acct_rights\n"));
03208
03209 in->pol = *hnd;
03210 init_dom_sid2(&in->sid, sid);
03211 }
03212
03213
03214
03215 NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *privileges )
03216 {
03217 uint32 i;
03218 char *privname;
03219 const char **privname_array = NULL;
03220 int num_priv = 0;
03221
03222 for ( i=0; i<privileges->count; i++ ) {
03223 privname = luid_to_privilege_name( &privileges->set[i].luid );
03224 if ( privname ) {
03225 if ( !add_string_to_array( get_talloc_ctx(), privname, &privname_array, &num_priv ) )
03226 return NT_STATUS_NO_MEMORY;
03227 }
03228 }
03229
03230 if ( num_priv ) {
03231 out->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY );
03232 if (!out->rights) {
03233 return NT_STATUS_NO_MEMORY;
03234 }
03235
03236 if ( !init_unistr4_array( out->rights, num_priv, privname_array ) )
03237 return NT_STATUS_NO_MEMORY;
03238
03239 out->count = num_priv;
03240 }
03241
03242 return NT_STATUS_OK;
03243 }
03244
03245
03246
03247
03248 BOOL lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *in, prs_struct *ps, int depth)
03249 {
03250
03251 if (in == NULL)
03252 return False;
03253
03254 prs_debug(ps, depth, desc, "lsa_io_q_enum_acct_rights");
03255 depth++;
03256
03257 if (!smb_io_pol_hnd("", &in->pol, ps, depth))
03258 return False;
03259
03260 if(!smb_io_dom_sid2("sid", &in->sid, ps, depth))
03261 return False;
03262
03263 return True;
03264 }
03265
03266
03267
03268
03269
03270 BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *out, prs_struct *ps, int depth)
03271 {
03272 prs_debug(ps, depth, desc, "lsa_io_r_enum_acct_rights");
03273 depth++;
03274
03275 if(!prs_uint32("count ", ps, depth, &out->count))
03276 return False;
03277
03278 if ( !prs_pointer("rights", ps, depth, (void*)&out->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
03279 return False;
03280
03281 if(!prs_align(ps))
03282 return False;
03283
03284 if(!prs_ntstatus("status", ps, depth, &out->status))
03285 return False;
03286
03287 return True;
03288 }
03289
03290
03291
03292
03293
03294 void init_q_add_acct_rights( LSA_Q_ADD_ACCT_RIGHTS *in, POLICY_HND *hnd,
03295 DOM_SID *sid, uint32 count, const char **rights )
03296 {
03297 DEBUG(5, ("init_q_add_acct_rights\n"));
03298
03299 in->pol = *hnd;
03300 init_dom_sid2(&in->sid, sid);
03301
03302 in->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY );
03303 if (!in->rights) {
03304 smb_panic("init_q_add_acct_rights: talloc fail\n");
03305 return;
03306 }
03307 init_unistr4_array( in->rights, count, rights );
03308
03309 in->count = count;
03310 }
03311
03312
03313
03314
03315
03316 BOOL lsa_io_q_add_acct_rights(const char *desc, LSA_Q_ADD_ACCT_RIGHTS *in, prs_struct *ps, int depth)
03317 {
03318 prs_debug(ps, depth, desc, "lsa_io_q_add_acct_rights");
03319 depth++;
03320
03321 if (!smb_io_pol_hnd("", &in->pol, ps, depth))
03322 return False;
03323
03324 if(!smb_io_dom_sid2("sid", &in->sid, ps, depth))
03325 return False;
03326
03327 if(!prs_uint32("count", ps, depth, &in->count))
03328 return False;
03329
03330 if ( !prs_pointer("rights", ps, depth, (void*)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
03331 return False;
03332
03333 return True;
03334 }
03335
03336
03337
03338
03339 BOOL lsa_io_r_add_acct_rights(const char *desc, LSA_R_ADD_ACCT_RIGHTS *out, prs_struct *ps, int depth)
03340 {
03341 prs_debug(ps, depth, desc, "lsa_io_r_add_acct_rights");
03342 depth++;
03343
03344 if(!prs_ntstatus("status", ps, depth, &out->status))
03345 return False;
03346
03347 return True;
03348 }
03349
03350
03351
03352
03353
03354 void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *in,
03355 POLICY_HND *hnd,
03356 DOM_SID *sid,
03357 uint32 removeall,
03358 uint32 count,
03359 const char **rights)
03360 {
03361 DEBUG(5, ("init_q_remove_acct_rights\n"));
03362
03363 in->pol = *hnd;
03364
03365 init_dom_sid2(&in->sid, sid);
03366
03367 in->removeall = removeall;
03368 in->count = count;
03369
03370 in->rights = TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY );
03371 if (!in->rights) {
03372 smb_panic("init_q_remove_acct_rights: talloc fail\n");
03373 return;
03374 }
03375 init_unistr4_array( in->rights, count, rights );
03376 }
03377
03378
03379
03380
03381
03382 BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *in, prs_struct *ps, int depth)
03383 {
03384 prs_debug(ps, depth, desc, "lsa_io_q_remove_acct_rights");
03385 depth++;
03386
03387 if (!smb_io_pol_hnd("", &in->pol, ps, depth))
03388 return False;
03389
03390 if(!smb_io_dom_sid2("sid", &in->sid, ps, depth))
03391 return False;
03392
03393 if(!prs_uint32("removeall", ps, depth, &in->removeall))
03394 return False;
03395
03396 if(!prs_uint32("count", ps, depth, &in->count))
03397 return False;
03398
03399 if ( !prs_pointer("rights", ps, depth, (void*)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
03400 return False;
03401
03402 return True;
03403 }
03404
03405
03406
03407
03408 BOOL lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *out, prs_struct *ps, int depth)
03409 {
03410 prs_debug(ps, depth, desc, "lsa_io_r_remove_acct_rights");
03411 depth++;
03412
03413 if(!prs_ntstatus("status", ps, depth, &out->status))
03414 return False;
03415
03416 return True;
03417 }
03418
03419
03420
03421
03422
03423 void init_lsa_q_open_trusted_domain(LSA_Q_OPEN_TRUSTED_DOMAIN *q, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access)
03424 {
03425 memcpy(&q->pol, hnd, sizeof(q->pol));
03426
03427 init_dom_sid2(&q->sid, sid);
03428 q->access_mask = desired_access;
03429 }
03430
03431
03432
03433
03434 #if 0
03435 BOOL lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *in, prs_struct *ps, int depth)
03436 {
03437 prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain");
03438 depth++;
03439
03440 if(!prs_align(ps))
03441 return False;
03442
03443 if (!smb_io_pol_hnd("", &in->handle, ps, depth))
03444 return False;
03445
03446 if(!prs_uint32("count", ps, depth, &in->count))
03447 return False;
03448
03449 if(!smb_io_dom_sid("sid", &in->sid, ps, depth))
03450 return False;
03451
03452 return True;
03453 }
03454 #endif
03455
03456
03457
03458
03459
03460
03461 void init_lsa_q_open_trusted_domain_by_name(LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q,
03462 POLICY_HND *hnd,
03463 const char *name,
03464 uint32 desired_access)
03465 {
03466 memcpy(&q->pol, hnd, sizeof(q->pol));
03467
03468 init_lsa_string(&q->name, name);
03469 q->access_mask = desired_access;
03470 }
03471
03472
03473
03474
03475
03476
03477
03478
03479
03480 BOOL lsa_io_q_open_trusted_domain_by_name(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q_o, prs_struct *ps, int depth)
03481 {
03482 prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain_by_name");
03483 depth++;
03484
03485 if(!prs_align(ps))
03486 return False;
03487
03488 if(!smb_io_pol_hnd("pol", &q_o->pol, ps, depth))
03489 return False;
03490
03491 if(!prs_align(ps))
03492 return False;
03493
03494 if(!smb_io_lsa_string("name", &q_o->name, ps, depth))
03495 return False;
03496
03497 if(!prs_align(ps))
03498 return False;
03499
03500 if(!prs_uint32("access", ps, depth, &q_o->access_mask))
03501 return False;
03502
03503 return True;
03504 }
03505
03506
03507
03508
03509
03510 BOOL lsa_io_r_open_trusted_domain_by_name(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME *out, prs_struct *ps, int depth)
03511 {
03512 prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain_by_name");
03513 depth++;
03514
03515 if(!prs_align(ps))
03516 return False;
03517
03518 if (!smb_io_pol_hnd("handle", &out->handle, ps, depth))
03519 return False;
03520
03521 if(!prs_ntstatus("status", ps, depth, &out->status))
03522 return False;
03523
03524 return True;
03525 }
03526
03527
03528
03529
03530 BOOL lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *q_o, prs_struct *ps, int depth)
03531 {
03532 prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain");
03533 depth++;
03534
03535 if(!prs_align(ps))
03536 return False;
03537
03538 if(!smb_io_pol_hnd("pol", &q_o->pol, ps, depth))
03539 return False;
03540
03541 if(!smb_io_dom_sid2("sid", &q_o->sid, ps, depth))
03542 return False;
03543
03544 if(!prs_uint32("access", ps, depth, &q_o->access_mask))
03545 return False;
03546
03547 return True;
03548 }
03549
03550
03551
03552
03553
03554 BOOL lsa_io_r_open_trusted_domain(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN *out, prs_struct *ps, int depth)
03555 {
03556 prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain");
03557 depth++;
03558
03559 if(!prs_align(ps))
03560 return False;
03561
03562 if (!smb_io_pol_hnd("handle", &out->handle, ps, depth))
03563 return False;
03564
03565 if(!prs_ntstatus("status", ps, depth, &out->status))
03566 return False;
03567
03568 return True;
03569 }
03570
03571
03572
03573
03574 BOOL lsa_io_q_create_trusted_domain(const char *desc, LSA_Q_CREATE_TRUSTED_DOMAIN *in, prs_struct *ps, int depth)
03575 {
03576 prs_debug(ps, depth, desc, "lsa_io_q_create_trusted_domain");
03577 depth++;
03578
03579 if(!prs_align(ps))
03580 return False;
03581
03582 if(!smb_io_pol_hnd("", &in->handle, ps, depth))
03583 return False;
03584
03585 if(!prs_unistr4 ("secretname", ps, depth, &in->secretname))
03586 return False;
03587 if(!prs_align(ps))
03588 return False;
03589
03590 if(!prs_uint32("access", ps, depth, &in->access))
03591 return False;
03592
03593 return True;
03594 }
03595
03596
03597
03598
03599 BOOL lsa_io_r_create_trusted_domain(const char *desc, LSA_R_CREATE_TRUSTED_DOMAIN *out, prs_struct *ps, int depth)
03600 {
03601 prs_debug(ps, depth, desc, "lsa_io_r_create_trusted_domain");
03602 depth++;
03603
03604 if(!prs_align(ps))
03605 return False;
03606
03607 if (!smb_io_pol_hnd("", &out->handle, ps, depth))
03608 return False;
03609
03610 if(!prs_ntstatus("status", ps, depth, &out->status))
03611 return False;
03612
03613 return True;
03614 }
03615
03616
03617
03618
03619 BOOL lsa_io_q_create_secret(const char *desc, LSA_Q_CREATE_SECRET *in, prs_struct *ps, int depth)
03620 {
03621 prs_debug(ps, depth, desc, "lsa_io_q_create_secret");
03622 depth++;
03623
03624 if(!prs_align(ps))
03625 return False;
03626
03627 if(!smb_io_pol_hnd("", &in->handle, ps, depth))
03628 return False;
03629
03630 if(!prs_unistr4 ("secretname", ps, depth, &in->secretname))
03631 return False;
03632 if(!prs_align(ps))
03633 return False;
03634
03635 if(!prs_uint32("access", ps, depth, &in->access))
03636 return False;
03637
03638 return True;
03639 }
03640
03641
03642
03643
03644 BOOL lsa_io_r_create_secret(const char *desc, LSA_R_CREATE_SECRET *out, prs_struct *ps, int depth)
03645 {
03646 prs_debug(ps, depth, desc, "lsa_io_r_create_secret");
03647 depth++;
03648
03649 if(!prs_align(ps))
03650 return False;
03651
03652 if (!smb_io_pol_hnd("", &out->handle, ps, depth))
03653 return False;
03654
03655 if(!prs_ntstatus("status", ps, depth, &out->status))
03656 return False;
03657
03658 return True;
03659 }
03660
03661
03662
03663
03664
03665
03666 static BOOL lsa_io_data_blob( const char *desc, prs_struct *ps, int depth, LSA_DATA_BLOB *blob )
03667 {
03668 prs_debug(ps, depth, desc, "lsa_io_data_blob");
03669 depth++;
03670
03671 if ( !prs_uint32("size", ps, depth, &blob->size) )
03672 return False;
03673 if ( !prs_uint32("size", ps, depth, &blob->size) )
03674 return False;
03675
03676 if ( !prs_io_unistr2_p(desc, ps, depth, &blob->data) )
03677 return False;
03678
03679 return True;
03680 }
03681
03682
03683
03684
03685 BOOL lsa_io_q_set_secret(const char *desc, LSA_Q_SET_SECRET *in, prs_struct *ps, int depth)
03686 {
03687 prs_debug(ps, depth, desc, "lsa_io_q_set_secret");
03688 depth++;
03689
03690 if ( !prs_align(ps) )
03691 return False;
03692
03693 if ( !smb_io_pol_hnd("", &in->handle, ps, depth) )
03694 return False;
03695
03696 if ( !prs_pointer( "old_value", ps, depth, (void*)&in->old_value, sizeof(LSA_DATA_BLOB), (PRS_POINTER_CAST)lsa_io_data_blob ))
03697 return False;
03698
03699 if( !prs_align(ps) )
03700 return False;
03701 if ( !prs_pointer( "old_value", ps, depth, (void*)&in->old_value, sizeof(LSA_DATA_BLOB), (PRS_POINTER_CAST)lsa_io_data_blob ))
03702 return False;
03703
03704
03705 return True;
03706 }
03707
03708
03709
03710
03711 BOOL lsa_io_r_set_secret(const char *desc, LSA_R_SET_SECRET *out, prs_struct *ps, int depth)
03712 {
03713 prs_debug(ps, depth, desc, "lsa_io_r_set_secret");
03714 depth++;
03715
03716 if(!prs_ntstatus("status", ps, depth, &out->status))
03717 return False;
03718
03719 return True;
03720 }
03721
03722
03723
03724
03725 BOOL lsa_io_q_delete_object(const char *desc, LSA_Q_DELETE_OBJECT *in, prs_struct *ps, int depth)
03726 {
03727 prs_debug(ps, depth, desc, "lsa_io_q_delete_object");
03728 depth++;
03729
03730 if(!prs_align(ps))
03731 return False;
03732
03733 if(!smb_io_pol_hnd("", &in->handle, ps, depth))
03734 return False;
03735
03736 return True;
03737 }
03738
03739
03740
03741
03742 BOOL lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_struct *ps, int depth)
03743 {
03744 prs_debug(ps, depth, desc, "lsa_io_r_delete_object");
03745 depth++;
03746
03747 if(!prs_ntstatus("status", ps, depth, &out->status))
03748 return False;
03749
03750 return True;
03751 }
03752
03753
03754
03755
03756
03757 void init_q_query_trusted_domain_info(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q,
03758 POLICY_HND *hnd, uint16 info_class)
03759 {
03760 DEBUG(5, ("init_q_query_trusted_domain_info\n"));
03761
03762 q->pol = *hnd;
03763 q->info_class = info_class;
03764 }
03765
03766
03767
03768
03769
03770 void init_q_query_trusted_domain_info_by_name(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q,
03771 POLICY_HND *hnd, uint16 info_class,
03772 const char *dom_name)
03773 {
03774 DEBUG(5, ("init_q_query_trusted_domain_info_by_name\n"));
03775
03776 q->pol = *hnd;
03777 init_lsa_string(&q->domain_name, dom_name );
03778 q->info_class = info_class;
03779 }
03780
03781
03782
03783
03784
03785 void init_q_query_trusted_domain_info_by_sid(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q,
03786 POLICY_HND *hnd, uint16 info_class,
03787 DOM_SID *dom_sid)
03788 {
03789 DEBUG(5, ("init_q_query_trusted_domain_info_by_sid\n"));
03790
03791 q->pol = *hnd;
03792 init_dom_sid2(&q->dom_sid, dom_sid);
03793 q->info_class = info_class;
03794 }
03795
03796
03797
03798
03799
03800 BOOL lsa_io_q_query_trusted_domain_info(const char *desc,
03801 LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q_q,
03802 prs_struct *ps, int depth)
03803 {
03804 prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info");
03805 depth++;
03806
03807 if(!prs_align(ps))
03808 return False;
03809
03810 if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth))
03811 return False;
03812
03813 if(!prs_uint16("info_class", ps, depth, &q_q->info_class))
03814 return False;
03815
03816 return True;
03817 }
03818
03819
03820
03821
03822
03823
03824 BOOL lsa_io_q_query_trusted_domain_info_by_sid(const char *desc,
03825 LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q_q,
03826 prs_struct *ps, int depth)
03827 {
03828 prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_sid");
03829 depth++;
03830
03831 if(!prs_align(ps))
03832 return False;
03833
03834 if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth))
03835 return False;
03836
03837 if(!prs_align(ps))
03838 return False;
03839
03840 if(!smb_io_dom_sid2("dom_sid", &q_q->dom_sid, ps, depth))
03841 return False;
03842
03843 if(!prs_uint16("info_class", ps, depth, &q_q->info_class))
03844 return False;
03845
03846 return True;
03847 }
03848
03849
03850
03851
03852
03853 BOOL lsa_io_q_query_trusted_domain_info_by_name(const char *desc,
03854 LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q_q,
03855 prs_struct *ps, int depth)
03856 {
03857 prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_name");
03858 depth++;
03859
03860 if(!prs_align(ps))
03861 return False;
03862
03863 if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth))
03864 return False;
03865
03866 if(!prs_align(ps))
03867 return False;
03868
03869 if(!smb_io_lsa_string("domain_name", &q_q->domain_name, ps, depth))
03870 return False;
03871
03872 if(!prs_uint16("info_class", ps, depth, &q_q->info_class))
03873 return False;
03874
03875 return True;
03876 }
03877
03878
03879
03880
03881 static BOOL smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr,
03882 prs_struct *ps, int depth)
03883 {
03884 prs_debug(ps, depth, desc, "smb_io_lsa_data_buf_hdr");
03885 depth++;
03886
03887 if(!prs_align(ps))
03888 return False;
03889
03890 if(!prs_uint32("length", ps, depth, &buf_hdr->length))
03891 return False;
03892
03893 if(!prs_uint32("size", ps, depth, &buf_hdr->size))
03894 return False;
03895
03896 if (!prs_uint32("data_ptr", ps, depth, &buf_hdr->data_ptr))
03897 return False;
03898
03899 return True;
03900 }
03901
03902
03903
03904
03905 static BOOL smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf,
03906 prs_struct *ps, int depth, int length, int size)
03907 {
03908 prs_debug(ps, depth, desc, "smb_io_lsa_data_buf");
03909 depth++;
03910
03911 if ( UNMARSHALLING(ps) && length ) {
03912 if ( !(buf->data = PRS_ALLOC_MEM( ps, uint8, length )) )
03913 return False;
03914 }
03915
03916 if (!prs_uint32("size", ps, depth, &buf->size))
03917 return False;
03918
03919 if (!prs_uint32("offset", ps, depth, &buf->offset))
03920 return False;
03921
03922 if (!prs_uint32("length", ps, depth, &buf->length))
03923 return False;
03924
03925 if(!prs_uint8s(False, "data", ps, depth, buf->data, length))
03926 return False;
03927
03928 return True;
03929 }
03930
03931
03932
03933
03934 static BOOL lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME *name,
03935 prs_struct *ps, int depth)
03936 {
03937 if (!smb_io_lsa_string("netbios_name", &name->netbios_name, ps, depth))
03938 return False;
03939
03940 return True;
03941 }
03942
03943
03944
03945
03946 static BOOL lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_OFFSET *posix,
03947 prs_struct *ps, int depth)
03948 {
03949 if(!prs_uint32("posix_offset", ps, depth, &posix->posix_offset))
03950 return False;
03951
03952 return True;
03953 }
03954
03955
03956
03957
03958 static BOOL lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWORD *password,
03959 prs_struct *ps, int depth)
03960 {
03961 if(!prs_align(ps))
03962 return False;
03963
03964 if(!prs_uint32("ptr_password", ps, depth, &password->ptr_password))
03965 return False;
03966
03967 if(!prs_uint32("ptr_old_password", ps, depth, &password->ptr_old_password))
03968 return False;
03969
03970 if (&password->ptr_password) {
03971
03972 if (!smb_io_lsa_data_buf_hdr("password_hdr", &password->password_hdr, ps, depth))
03973 return False;
03974
03975 if (!smb_io_lsa_data_buf("password", &password->password, ps, depth,
03976 password->password_hdr.length, password->password_hdr.size))
03977 return False;
03978 }
03979
03980 if (&password->ptr_old_password) {
03981
03982 if (!smb_io_lsa_data_buf_hdr("old_password_hdr", &password->old_password_hdr, ps, depth))
03983 return False;
03984
03985 if (!smb_io_lsa_data_buf("old_password", &password->old_password, ps, depth,
03986 password->old_password_hdr.length, password->old_password_hdr.size))
03987 return False;
03988 }
03989
03990 return True;
03991 }
03992
03993
03994
03995
03996 static BOOL lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *info_ex,
03997 prs_struct *ps, int depth)
03998 {
03999 uint32 dom_sid_ptr;
04000
04001 if (!smb_io_unihdr("domain_name_hdr", &info_ex->domain_name.hdr, ps, depth))
04002 return False;
04003
04004 if (!smb_io_unihdr("netbios_name_hdr", &info_ex->netbios_name.hdr, ps, depth))
04005 return False;
04006
04007 if (!prs_uint32("dom_sid_ptr", ps, depth, &dom_sid_ptr))
04008 return False;
04009
04010 if (!prs_uint32("trust_direction", ps, depth, &info_ex->trust_direction))
04011 return False;
04012
04013 if (!prs_uint32("trust_type", ps, depth, &info_ex->trust_type))
04014 return False;
04015
04016 if (!prs_uint32("trust_attributes", ps, depth, &info_ex->trust_attributes))
04017 return False;
04018
04019 if (!smb_io_unistr2("domain_name_unistring", &info_ex->domain_name.unistring, info_ex->domain_name.hdr.buffer, ps, depth))
04020 return False;
04021
04022 if (!smb_io_unistr2("netbios_name_unistring", &info_ex->netbios_name.unistring, info_ex->netbios_name.hdr.buffer, ps, depth))
04023 return False;
04024
04025 if (!smb_io_dom_sid2("sid", &info_ex->sid, ps, depth))
04026 return False;
04027
04028 return True;
04029 }
04030
04031
04032
04033
04034 static BOOL lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info)
04035 {
04036 prs_debug(ps, depth, desc, "lsa_io_trustdom_query");
04037 depth++;
04038
04039 if(!prs_uint16("info_class", ps, depth, &info->info_class))
04040 return False;
04041
04042 if(!prs_align(ps))
04043 return False;
04044
04045 switch (info->info_class) {
04046 case 1:
04047 if(!lsa_io_trustdom_query_1("name", &info->name, ps, depth))
04048 return False;
04049 break;
04050 case 3:
04051 if(!lsa_io_trustdom_query_3("posix_offset", &info->posix_offset, ps, depth))
04052 return False;
04053 break;
04054 case 4:
04055 if(!lsa_io_trustdom_query_4("password", &info->password, ps, depth))
04056 return False;
04057 break;
04058 case 6:
04059 if(!lsa_io_trustdom_query_6("info_ex", &info->info_ex, ps, depth))
04060 return False;
04061 break;
04062 default:
04063 DEBUG(0,("unsupported info-level: %d\n", info->info_class));
04064 return False;
04065 }
04066
04067 return True;
04068 }
04069
04070
04071
04072
04073
04074 BOOL lsa_io_r_query_trusted_domain_info(const char *desc,
04075 LSA_R_QUERY_TRUSTED_DOMAIN_INFO *r_q,
04076 prs_struct *ps, int depth)
04077 {
04078 if (r_q == NULL)
04079 return False;
04080
04081 prs_debug(ps, depth, desc, "lsa_io_r_query_trusted_domain_info");
04082 depth++;
04083
04084 if (!prs_pointer("trustdom", ps, depth, (void*)&r_q->info,
04085 sizeof(LSA_TRUSTED_DOMAIN_INFO),
04086 (PRS_POINTER_CAST)lsa_io_trustdom_query) )
04087 return False;
04088
04089 if(!prs_align(ps))
04090 return False;
04091
04092 if(!prs_ntstatus("status", ps, depth, &r_q->status))
04093 return False;
04094
04095 return True;
04096 }
04097
04098
04099
04100
04101
04102 void init_q_query_dom_info(LSA_Q_QUERY_DOM_INFO_POLICY *in, POLICY_HND *hnd, uint16 info_class)
04103 {
04104 DEBUG(5, ("init_q_query_dom_info\n"));
04105
04106 memcpy(&in->pol, hnd, sizeof(in->pol));
04107
04108 in->info_class = info_class;
04109 }
04110
04111
04112
04113
04114
04115 BOOL lsa_io_q_query_dom_info(const char *desc, LSA_Q_QUERY_DOM_INFO_POLICY *in, prs_struct *ps, int depth)
04116 {
04117 prs_debug(ps, depth, desc, "lsa_io_q_query_dom_info");
04118 depth++;
04119
04120 if(!prs_align(ps))
04121 return False;
04122
04123 if(!smb_io_pol_hnd("pol", &in->pol, ps, depth))
04124 return False;
04125
04126 if(!prs_uint16("info_class", ps, depth, &in->info_class))
04127 return False;
04128
04129 return True;
04130 }
04131
04132
04133
04134
04135
04136 static BOOL lsa_io_dominfo_query_3(const char *desc, LSA_DOM_INFO_POLICY_KERBEROS *krb_policy,
04137 prs_struct *ps, int depth)
04138 {
04139 if (!prs_align_uint64(ps))
04140 return False;
04141
04142 if (!prs_align(ps))
04143 return False;
04144
04145 if (!prs_uint32("enforce_restrictions", ps, depth, &krb_policy->enforce_restrictions))
04146 return False;
04147
04148 if (!prs_align_uint64(ps))
04149 return False;
04150
04151 if (!smb_io_nttime("service_tkt_lifetime", ps, depth, &krb_policy->service_tkt_lifetime))
04152 return False;
04153
04154 if (!prs_align_uint64(ps))
04155 return False;
04156
04157 if (!smb_io_nttime("user_tkt_lifetime", ps, depth, &krb_policy->user_tkt_lifetime))
04158 return False;
04159
04160 if (!prs_align_uint64(ps))
04161 return False;
04162
04163 if (!smb_io_nttime("user_tkt_renewaltime", ps, depth, &krb_policy->user_tkt_renewaltime))
04164 return False;
04165
04166 if (!prs_align_uint64(ps))
04167 return False;
04168
04169 if (!smb_io_nttime("clock_skew", ps, depth, &krb_policy->clock_skew))
04170 return False;
04171
04172 if (!prs_align_uint64(ps))
04173 return False;
04174
04175 if (!smb_io_nttime("unknown6", ps, depth, &krb_policy->unknown6))
04176 return False;
04177
04178 return True;
04179 }
04180
04181 static BOOL lsa_io_dom_info_query(const char *desc, prs_struct *ps, int depth, LSA_DOM_INFO_UNION *info)
04182 {
04183 prs_debug(ps, depth, desc, "lsa_io_dom_info_query");
04184 depth++;
04185
04186 if(!prs_align_uint16(ps))
04187 return False;
04188
04189 if(!prs_uint16("info_class", ps, depth, &info->info_class))
04190 return False;
04191
04192 switch (info->info_class) {
04193 case 3:
04194 if (!lsa_io_dominfo_query_3("krb_policy", &info->krb_policy, ps, depth))
04195 return False;
04196 break;
04197 default:
04198 DEBUG(0,("unsupported info-level: %d\n", info->info_class));
04199 return False;
04200 break;
04201 }
04202
04203 return True;
04204 }
04205
04206
04207 BOOL lsa_io_r_query_dom_info(const char *desc, LSA_R_QUERY_DOM_INFO_POLICY *out,
04208 prs_struct *ps, int depth)
04209 {
04210 prs_debug(ps, depth, desc, "lsa_io_r_query_dom_info");
04211 depth++;
04212
04213 if (!prs_pointer("dominfo", ps, depth, (void*)&out->info,
04214 sizeof(LSA_DOM_INFO_UNION),
04215 (PRS_POINTER_CAST)lsa_io_dom_info_query) )
04216 return False;
04217
04218 if(!prs_ntstatus("status", ps, depth, &out->status))
04219 return False;
04220
04221 return True;
04222 }