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
00027 #include "includes.h"
00028
00029 #undef DBGC_CLASS
00030 #define DBGC_CLASS DBGC_RPC_PARSE
00031
00032
00033
00034
00035
00036 void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd)
00037 {
00038 DEBUG(5, ("init_samr_q_close_hnd\n"));
00039
00040 q_c->pol = *hnd;
00041 }
00042
00043
00044
00045
00046
00047 BOOL samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u,
00048 prs_struct *ps, int depth)
00049 {
00050 if (q_u == NULL)
00051 return False;
00052
00053 prs_debug(ps, depth, desc, "samr_io_q_close_hnd");
00054 depth++;
00055
00056 if(!prs_align(ps))
00057 return False;
00058
00059 return smb_io_pol_hnd("pol", &q_u->pol, ps, depth);
00060 }
00061
00062
00063
00064
00065
00066 BOOL samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u,
00067 prs_struct *ps, int depth)
00068 {
00069 if (r_u == NULL)
00070 return False;
00071
00072 prs_debug(ps, depth, desc, "samr_io_r_close_hnd");
00073 depth++;
00074
00075 if(!prs_align(ps))
00076 return False;
00077
00078 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
00079 return False;
00080
00081 if(!prs_ntstatus("status", ps, depth, &r_u->status))
00082 return False;
00083
00084 return True;
00085 }
00086
00087
00088
00089
00090
00091 void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u,
00092 POLICY_HND *pol, char *dom_name)
00093 {
00094 DEBUG(5, ("init_samr_q_lookup_domain\n"));
00095
00096 q_u->connect_pol = *pol;
00097
00098 init_unistr2(&q_u->uni_domain, dom_name, UNI_FLAGS_NONE);
00099 init_uni_hdr(&q_u->hdr_domain, &q_u->uni_domain);
00100 }
00101
00102
00103
00104
00105 BOOL samr_io_q_lookup_domain(const char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u,
00106 prs_struct *ps, int depth)
00107 {
00108 if (q_u == NULL)
00109 return False;
00110
00111 prs_debug(ps, depth, desc, "samr_io_q_lookup_domain");
00112 depth++;
00113
00114 if(!prs_align(ps))
00115 return False;
00116
00117 if(!smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth))
00118 return False;
00119
00120 if(!smb_io_unihdr("hdr_domain", &q_u->hdr_domain, ps, depth))
00121 return False;
00122
00123 if(!smb_io_unistr2("uni_domain", &q_u->uni_domain, q_u->hdr_domain.buffer, ps, depth))
00124 return False;
00125
00126 return True;
00127 }
00128
00129
00130
00131
00132
00133 void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u,
00134 DOM_SID *dom_sid, NTSTATUS status)
00135 {
00136 DEBUG(5, ("init_samr_r_lookup_domain\n"));
00137
00138 r_u->status = status;
00139 r_u->ptr_sid = 0;
00140 if (NT_STATUS_IS_OK(status)) {
00141 r_u->ptr_sid = 1;
00142 init_dom_sid2(&r_u->dom_sid, dom_sid);
00143 }
00144 }
00145
00146
00147
00148
00149
00150 BOOL samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u,
00151 prs_struct *ps, int depth)
00152 {
00153 if (r_u == NULL)
00154 return False;
00155
00156 prs_debug(ps, depth, desc, "samr_io_r_lookup_domain");
00157 depth++;
00158
00159 if(!prs_align(ps))
00160 return False;
00161
00162 if(!prs_uint32("ptr", ps, depth, &r_u->ptr_sid))
00163 return False;
00164
00165 if (r_u->ptr_sid != 0) {
00166 if(!smb_io_dom_sid2("sid", &r_u->dom_sid, ps, depth))
00167 return False;
00168 if(!prs_align(ps))
00169 return False;
00170 }
00171
00172 if(!prs_ntstatus("status", ps, depth, &r_u->status))
00173 return False;
00174
00175 return True;
00176 }
00177
00178
00179
00180
00181
00182 void init_samr_q_remove_sid_foreign_domain(SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u, POLICY_HND *dom_pol, DOM_SID *sid)
00183 {
00184 DEBUG(5, ("samr_init_samr_q_remove_sid_foreign_domain\n"));
00185
00186 q_u->dom_pol = *dom_pol;
00187 init_dom_sid2(&q_u->sid, sid);
00188 }
00189
00190
00191
00192
00193
00194 BOOL samr_io_q_remove_sid_foreign_domain(const char *desc, SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u,
00195 prs_struct *ps, int depth)
00196 {
00197 if (q_u == NULL)
00198 return False;
00199
00200 prs_debug(ps, depth, desc, "samr_io_q_remove_sid_foreign_domain");
00201 depth++;
00202
00203 if(!prs_align(ps))
00204 return False;
00205
00206 if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
00207 return False;
00208
00209 if(!smb_io_dom_sid2("sid", &q_u->sid, ps, depth))
00210 return False;
00211
00212 if(!prs_align(ps))
00213 return False;
00214
00215 return True;
00216 }
00217
00218
00219
00220
00221
00222 BOOL samr_io_r_remove_sid_foreign_domain(const char *desc, SAMR_R_REMOVE_SID_FOREIGN_DOMAIN * r_u,
00223 prs_struct *ps, int depth)
00224 {
00225 if (r_u == NULL)
00226 return False;
00227
00228 prs_debug(ps, depth, desc, "samr_io_r_remove_sid_foreign_domain");
00229 depth++;
00230
00231 if(!prs_align(ps))
00232 return False;
00233
00234 if(!prs_ntstatus("status", ps, depth, &r_u->status))
00235 return False;
00236
00237 return True;
00238 }
00239
00240
00241
00242
00243
00244 void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u,
00245 POLICY_HND *pol, uint32 flags,
00246 const DOM_SID *sid)
00247 {
00248 DEBUG(5, ("samr_init_samr_q_open_domain\n"));
00249
00250 q_u->pol = *pol;
00251 q_u->flags = flags;
00252 init_dom_sid2(&q_u->dom_sid, sid);
00253 }
00254
00255
00256
00257
00258
00259 BOOL samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u,
00260 prs_struct *ps, int depth)
00261 {
00262 if (q_u == NULL)
00263 return False;
00264
00265 prs_debug(ps, depth, desc, "samr_io_q_open_domain");
00266 depth++;
00267
00268 if(!prs_align(ps))
00269 return False;
00270
00271 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
00272 return False;
00273
00274 if(!prs_uint32("flags", ps, depth, &q_u->flags))
00275 return False;
00276
00277 if(!smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth))
00278 return False;
00279
00280 return True;
00281 }
00282
00283
00284
00285
00286
00287 BOOL samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u,
00288 prs_struct *ps, int depth)
00289 {
00290 if (r_u == NULL)
00291 return False;
00292
00293 prs_debug(ps, depth, desc, "samr_io_r_open_domain");
00294 depth++;
00295
00296 if(!prs_align(ps))
00297 return False;
00298
00299 if(!smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth))
00300 return False;
00301
00302 if(!prs_ntstatus("status", ps, depth, &r_u->status))
00303 return False;
00304
00305 return True;
00306 }
00307
00308
00309
00310
00311
00312 void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u,
00313 POLICY_HND *user_pol)
00314 {
00315 DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n"));
00316
00317 q_u->user_pol = *user_pol;
00318 }
00319
00320
00321
00322
00323
00324 BOOL samr_io_q_get_usrdom_pwinfo(const char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u,
00325 prs_struct *ps, int depth)
00326 {
00327 if (q_u == NULL)
00328 return False;
00329
00330 prs_debug(ps, depth, desc, "samr_io_q_get_usrdom_pwinfo");
00331 depth++;
00332
00333 if(!prs_align(ps))
00334 return False;
00335
00336 return smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth);
00337 }
00338
00339
00340
00341
00342
00343 void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS status)
00344 {
00345 DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n"));
00346
00347 r_u->min_pwd_length = 0x0000;
00348
00349
00350
00351
00352
00353
00354 r_u->unknown_1 = 0x01D1;
00355 r_u->unknown_1 = 0x0015;
00356
00357 r_u->password_properties = 0x00000000;
00358
00359 r_u->status = status;
00360 }
00361
00362
00363
00364
00365
00366 BOOL samr_io_r_get_usrdom_pwinfo(const char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u,
00367 prs_struct *ps, int depth)
00368 {
00369 if (r_u == NULL)
00370 return False;
00371
00372 prs_debug(ps, depth, desc, "samr_io_r_get_usrdom_pwinfo");
00373 depth++;
00374
00375 if(!prs_align(ps))
00376 return False;
00377
00378 if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
00379 return False;
00380 if(!prs_uint16("unknown_1", ps, depth, &r_u->unknown_1))
00381 return False;
00382 if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
00383 return False;
00384
00385 if(!prs_ntstatus("status ", ps, depth, &r_u->status))
00386 return False;
00387
00388 return True;
00389 }
00390
00391
00392
00393
00394
00395
00396 BOOL samr_io_q_set_sec_obj(const char *desc, SAMR_Q_SET_SEC_OBJ * q_u,
00397 prs_struct *ps, int depth)
00398 {
00399 if (q_u == NULL)
00400 return False;
00401
00402 prs_debug(ps, depth, desc, "samr_io_q_set_sec_obj");
00403 depth++;
00404
00405 if(!prs_align(ps))
00406 return False;
00407
00408 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
00409 return False;
00410
00411 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
00412 return False;
00413
00414 if(!sec_io_desc_buf("sec_desc", &q_u->buf, ps, depth))
00415 return False;
00416
00417 return True;
00418 }
00419
00420
00421
00422
00423
00424
00425 void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ * q_u,
00426 POLICY_HND *user_pol, uint32 sec_info)
00427 {
00428 DEBUG(5, ("samr_init_samr_q_query_sec_obj\n"));
00429
00430 q_u->user_pol = *user_pol;
00431 q_u->sec_info = sec_info;
00432 }
00433
00434
00435
00436
00437
00438
00439 BOOL samr_io_q_query_sec_obj(const char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u,
00440 prs_struct *ps, int depth)
00441 {
00442 if (q_u == NULL)
00443 return False;
00444
00445 prs_debug(ps, depth, desc, "samr_io_q_query_sec_obj");
00446 depth++;
00447
00448 if(!prs_align(ps))
00449 return False;
00450
00451 if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
00452 return False;
00453
00454 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
00455 return False;
00456
00457 return True;
00458 }
00459
00460
00461
00462
00463
00464 void init_samr_q_query_domain_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u,
00465 POLICY_HND *domain_pol, uint16 switch_value)
00466 {
00467 DEBUG(5, ("samr_init_samr_q_query_domain_info\n"));
00468
00469 q_u->domain_pol = *domain_pol;
00470 q_u->switch_value = switch_value;
00471 }
00472
00473
00474
00475
00476
00477 BOOL samr_io_q_query_domain_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u,
00478 prs_struct *ps, int depth)
00479 {
00480 if (q_u == NULL)
00481 return False;
00482
00483 prs_debug(ps, depth, desc, "samr_io_q_query_domain_info");
00484 depth++;
00485
00486 if(!prs_align(ps))
00487 return False;
00488
00489 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
00490 return False;
00491
00492 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
00493 return False;
00494
00495 return True;
00496 }
00497
00498
00499
00500
00501
00502 void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist,
00503 uint32 password_properties, NTTIME nt_expire, NTTIME nt_min_age)
00504 {
00505 u_1->min_length_password = min_pass_len;
00506 u_1->password_history = pass_hist;
00507
00508 if (lp_check_password_script() && *lp_check_password_script()) {
00509 password_properties |= DOMAIN_PASSWORD_COMPLEX;
00510 }
00511 u_1->password_properties = password_properties;
00512
00513
00514 u_1->expire = nt_expire;
00515
00516
00517 u_1->min_passwordage = nt_min_age;
00518
00519 }
00520
00521
00522
00523
00524
00525 static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1,
00526 prs_struct *ps, int depth)
00527 {
00528 if (u_1 == NULL)
00529 return False;
00530
00531 prs_debug(ps, depth, desc, "sam_io_unk_info1");
00532 depth++;
00533
00534 if(!prs_uint16("min_length_password", ps, depth, &u_1->min_length_password))
00535 return False;
00536 if(!prs_uint16("password_history", ps, depth, &u_1->password_history))
00537 return False;
00538 if(!prs_uint32("password_properties", ps, depth, &u_1->password_properties))
00539 return False;
00540 if(!smb_io_time("expire", &u_1->expire, ps, depth))
00541 return False;
00542 if(!smb_io_time("min_passwordage", &u_1->min_passwordage, ps, depth))
00543 return False;
00544
00545 return True;
00546 }
00547
00548
00549
00550
00551
00552 void init_unk_info2(SAM_UNK_INFO_2 * u_2,
00553 const char *comment, const char *domain, const char *server,
00554 uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias, NTTIME nt_logout, uint32 server_role)
00555 {
00556 u_2->logout = nt_logout;
00557
00558 u_2->seq_num = seq_num;
00559
00560
00561 u_2->unknown_4 = 0x00000001;
00562 u_2->server_role = server_role;
00563 u_2->unknown_6 = 0x00000001;
00564 u_2->num_domain_usrs = num_users;
00565 u_2->num_domain_grps = num_groups;
00566 u_2->num_local_grps = num_alias;
00567
00568 init_unistr2(&u_2->uni_comment, comment, UNI_FLAGS_NONE);
00569 init_uni_hdr(&u_2->hdr_comment, &u_2->uni_comment);
00570 init_unistr2(&u_2->uni_domain, domain, UNI_FLAGS_NONE);
00571 init_uni_hdr(&u_2->hdr_domain, &u_2->uni_domain);
00572 init_unistr2(&u_2->uni_server, server, UNI_FLAGS_NONE);
00573 init_uni_hdr(&u_2->hdr_server, &u_2->uni_server);
00574 }
00575
00576
00577
00578
00579
00580 static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2,
00581 prs_struct *ps, int depth)
00582 {
00583 if (u_2 == NULL)
00584 return False;
00585
00586 prs_debug(ps, depth, desc, "sam_io_unk_info2");
00587 depth++;
00588
00589 if(!smb_io_time("logout", &u_2->logout, ps, depth))
00590 return False;
00591 if(!smb_io_unihdr("hdr_comment", &u_2->hdr_comment, ps, depth))
00592 return False;
00593 if(!smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth))
00594 return False;
00595 if(!smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth))
00596 return False;
00597
00598
00599
00600
00601
00602 if(!prs_uint64("seq_num ", ps, depth, &u_2->seq_num))
00603 return False;
00604
00605 if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4))
00606 return False;
00607 if(!prs_uint32("server_role ", ps, depth, &u_2->server_role))
00608 return False;
00609 if(!prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6))
00610 return False;
00611 if(!prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs))
00612 return False;
00613 if(!prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps))
00614 return False;
00615 if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps))
00616 return False;
00617
00618 if(!smb_io_unistr2("uni_comment", &u_2->uni_comment, u_2->hdr_comment.buffer, ps, depth))
00619 return False;
00620 if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth))
00621 return False;
00622 if(!smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth))
00623 return False;
00624
00625 return True;
00626 }
00627
00628
00629
00630
00631
00632 void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout)
00633 {
00634 u_3->logout = nt_logout;
00635 }
00636
00637
00638
00639
00640
00641 static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3,
00642 prs_struct *ps, int depth)
00643 {
00644 if (u_3 == NULL)
00645 return False;
00646
00647 prs_debug(ps, depth, desc, "sam_io_unk_info3");
00648 depth++;
00649
00650 if(!smb_io_time("logout", &u_3->logout, ps, depth))
00651 return False;
00652
00653 return True;
00654 }
00655
00656
00657
00658
00659
00660 void init_unk_info4(SAM_UNK_INFO_4 * u_4,const char *comment)
00661 {
00662 init_unistr2(&u_4->uni_comment, comment, UNI_FLAGS_NONE);
00663 init_uni_hdr(&u_4->hdr_comment, &u_4->uni_comment);
00664 }
00665
00666
00667
00668
00669
00670 static BOOL sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4,
00671 prs_struct *ps, int depth)
00672 {
00673 if (u_4 == NULL)
00674 return False;
00675
00676 prs_debug(ps, depth, desc, "sam_io_unk_info4");
00677 depth++;
00678
00679 if(!smb_io_unihdr("hdr_comment", &u_4->hdr_comment, ps, depth))
00680 return False;
00681
00682 if(!smb_io_unistr2("uni_comment", &u_4->uni_comment, u_4->hdr_comment.buffer, ps, depth))
00683 return False;
00684
00685 return True;
00686 }
00687
00688
00689
00690
00691
00692 void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain)
00693 {
00694 init_unistr2(&u_5->uni_domain, domain, UNI_FLAGS_NONE);
00695 init_uni_hdr(&u_5->hdr_domain, &u_5->uni_domain);
00696 }
00697
00698
00699
00700
00701
00702 static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5,
00703 prs_struct *ps, int depth)
00704 {
00705 if (u_5 == NULL)
00706 return False;
00707
00708 prs_debug(ps, depth, desc, "sam_io_unk_info5");
00709 depth++;
00710
00711 if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth))
00712 return False;
00713
00714 if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth))
00715 return False;
00716
00717 return True;
00718 }
00719
00720
00721
00722
00723
00724 void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server)
00725 {
00726 init_unistr2(&u_6->uni_server, server, UNI_FLAGS_NONE);
00727 init_uni_hdr(&u_6->hdr_server, &u_6->uni_server);
00728 }
00729
00730
00731
00732
00733
00734 static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6,
00735 prs_struct *ps, int depth)
00736 {
00737 if (u_6 == NULL)
00738 return False;
00739
00740 prs_debug(ps, depth, desc, "sam_io_unk_info6");
00741 depth++;
00742
00743 if(!smb_io_unihdr("hdr_server", &u_6->hdr_server, ps, depth))
00744 return False;
00745
00746 if(!smb_io_unistr2("uni_server", &u_6->uni_server, u_6->hdr_server.buffer, ps, depth))
00747 return False;
00748
00749 return True;
00750 }
00751
00752
00753
00754
00755
00756 void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role)
00757 {
00758 u_7->server_role = server_role;
00759 }
00760
00761
00762
00763
00764
00765 static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7,
00766 prs_struct *ps, int depth)
00767 {
00768 if (u_7 == NULL)
00769 return False;
00770
00771 prs_debug(ps, depth, desc, "sam_io_unk_info7");
00772 depth++;
00773
00774 if(!prs_uint16("server_role", ps, depth, &u_7->server_role))
00775 return False;
00776
00777 return True;
00778 }
00779
00780
00781
00782
00783
00784 void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num)
00785 {
00786 unix_to_nt_time(&u_8->domain_create_time, 0);
00787 u_8->seq_num = seq_num;
00788 }
00789
00790
00791
00792
00793
00794 static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8,
00795 prs_struct *ps, int depth)
00796 {
00797 if (u_8 == NULL)
00798 return False;
00799
00800 prs_debug(ps, depth, desc, "sam_io_unk_info8");
00801 depth++;
00802
00803 if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num))
00804 return False;
00805
00806 if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth))
00807 return False;
00808
00809 return True;
00810 }
00811
00812
00813
00814
00815
00816 void init_unk_info9(SAM_UNK_INFO_9 * u_9, uint32 unknown)
00817 {
00818 u_9->unknown = unknown;
00819 }
00820
00821
00822
00823
00824
00825 static BOOL sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9,
00826 prs_struct *ps, int depth)
00827 {
00828 if (u_9 == NULL)
00829 return False;
00830
00831 prs_debug(ps, depth, desc, "sam_io_unk_info9");
00832 depth++;
00833
00834 if (!prs_uint32("unknown", ps, depth, &u_9->unknown))
00835 return False;
00836
00837 return True;
00838 }
00839
00840
00841
00842
00843
00844 void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout)
00845 {
00846 u_12->duration = nt_lock_duration;
00847 u_12->reset_count = nt_reset_time;
00848
00849 u_12->bad_attempt_lockout = lockout;
00850 }
00851
00852
00853
00854
00855
00856 static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12,
00857 prs_struct *ps, int depth)
00858 {
00859 if (u_12 == NULL)
00860 return False;
00861
00862 prs_debug(ps, depth, desc, "sam_io_unk_info12");
00863 depth++;
00864
00865 if(!smb_io_time("duration", &u_12->duration, ps, depth))
00866 return False;
00867 if(!smb_io_time("reset_count", &u_12->reset_count, ps, depth))
00868 return False;
00869 if(!prs_uint16("bad_attempt_lockout", ps, depth, &u_12->bad_attempt_lockout))
00870 return False;
00871
00872 return True;
00873 }
00874
00875
00876
00877
00878
00879 void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num)
00880 {
00881 unix_to_nt_time(&u_13->domain_create_time, 0);
00882 u_13->seq_num = seq_num;
00883 u_13->unknown1 = 0;
00884 u_13->unknown2 = 0;
00885 }
00886
00887
00888
00889
00890
00891 static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13,
00892 prs_struct *ps, int depth)
00893 {
00894 if (u_13 == NULL)
00895 return False;
00896
00897 prs_debug(ps, depth, desc, "sam_io_unk_info13");
00898 depth++;
00899
00900 if (!prs_uint64("seq_num", ps, depth, &u_13->seq_num))
00901 return False;
00902
00903 if(!smb_io_time("domain_create_time", &u_13->domain_create_time, ps, depth))
00904 return False;
00905
00906 if (!prs_uint32("unknown1", ps, depth, &u_13->unknown1))
00907 return False;
00908 if (!prs_uint32("unknown2", ps, depth, &u_13->unknown2))
00909 return False;
00910
00911 return True;
00912 }
00913
00914
00915
00916
00917
00918 void init_samr_r_query_domain_info(SAMR_R_QUERY_DOMAIN_INFO * r_u,
00919 uint16 switch_value, SAM_UNK_CTR * ctr,
00920 NTSTATUS status)
00921 {
00922 DEBUG(5, ("init_samr_r_query_domain_info\n"));
00923
00924 r_u->ptr_0 = 0;
00925 r_u->switch_value = 0;
00926 r_u->status = status;
00927
00928 if (NT_STATUS_IS_OK(status)) {
00929 r_u->switch_value = switch_value;
00930 r_u->ptr_0 = 1;
00931 r_u->ctr = ctr;
00932 }
00933 }
00934
00935
00936
00937
00938
00939 BOOL samr_io_r_query_domain_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u,
00940 prs_struct *ps, int depth)
00941 {
00942 if (r_u == NULL)
00943 return False;
00944
00945 prs_debug(ps, depth, desc, "samr_io_r_query_domain_info");
00946 depth++;
00947
00948 if(!prs_align(ps))
00949 return False;
00950
00951 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
00952 return False;
00953
00954 if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
00955 if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
00956 return False;
00957 if(!prs_align(ps))
00958 return False;
00959
00960 switch (r_u->switch_value) {
00961 case 0x0d:
00962 if(!sam_io_unk_info13("unk_inf13", &r_u->ctr->info.inf13, ps, depth))
00963 return False;
00964 break;
00965 case 0x0c:
00966 if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
00967 return False;
00968 break;
00969 case 0x09:
00970 if(!sam_io_unk_info9("unk_inf9",&r_u->ctr->info.inf9, ps,depth))
00971 return False;
00972 break;
00973 case 0x08:
00974 if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth))
00975 return False;
00976 break;
00977 case 0x07:
00978 if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
00979 return False;
00980 break;
00981 case 0x06:
00982 if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
00983 return False;
00984 break;
00985 case 0x05:
00986 if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
00987 return False;
00988 break;
00989 case 0x04:
00990 if(!sam_io_unk_info4("unk_inf4",&r_u->ctr->info.inf4, ps,depth))
00991 return False;
00992 break;
00993 case 0x03:
00994 if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
00995 return False;
00996 break;
00997 case 0x02:
00998 if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
00999 return False;
01000 break;
01001 case 0x01:
01002 if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
01003 return False;
01004 break;
01005 default:
01006 DEBUG(0, ("samr_io_r_query_domain_info: unknown switch level 0x%x\n",
01007 r_u->switch_value));
01008 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
01009 return False;
01010 }
01011 }
01012
01013 if(!prs_align(ps))
01014 return False;
01015
01016 if(!prs_ntstatus("status", ps, depth, &r_u->status))
01017 return False;
01018
01019 return True;
01020 }
01021
01022
01023
01024
01025
01026 void init_samr_q_set_sec_obj(SAMR_Q_SET_SEC_OBJ * q_u,
01027 POLICY_HND *pol, uint32 sec_info, SEC_DESC_BUF *buf)
01028 {
01029 DEBUG(5, ("samr_init_samr_q_set_sec_obj\n"));
01030
01031 q_u->pol = *pol;
01032 q_u->sec_info = sec_info;
01033 q_u->buf = buf;
01034 }
01035
01036
01037
01038
01039
01040
01041 BOOL samr_io_r_set_sec_obj(const char *desc, SAMR_R_SET_SEC_OBJ * r_u,
01042 prs_struct *ps, int depth)
01043 {
01044 if (r_u == NULL)
01045 return False;
01046
01047 prs_debug(ps, depth, desc, "samr_io_r_set_sec_obj");
01048 depth++;
01049
01050 if(!prs_align(ps))
01051 return False;
01052
01053 if(!prs_ntstatus("status", ps, depth, &r_u->status))
01054 return False;
01055
01056 return True;
01057 }
01058
01059
01060
01061
01062
01063 BOOL samr_io_r_query_sec_obj(const char *desc, SAMR_R_QUERY_SEC_OBJ * r_u,
01064 prs_struct *ps, int depth)
01065 {
01066 if (r_u == NULL)
01067 return False;
01068
01069 prs_debug(ps, depth, desc, "samr_io_r_query_sec_obj");
01070 depth++;
01071
01072 if(!prs_align(ps))
01073 return False;
01074
01075 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
01076 return False;
01077 if (r_u->ptr != 0) {
01078 if(!sec_io_desc_buf("sec", &r_u->buf, ps, depth))
01079 return False;
01080 }
01081
01082 if(!prs_ntstatus("status", ps, depth, &r_u->status))
01083 return False;
01084
01085 return True;
01086 }
01087
01088
01089
01090
01091
01092 static BOOL sam_io_sam_str1(const char *desc, SAM_STR1 * sam, uint32 acct_buf,
01093 uint32 name_buf, uint32 desc_buf,
01094 prs_struct *ps, int depth)
01095 {
01096 if (sam == NULL)
01097 return False;
01098
01099 prs_debug(ps, depth, desc, "sam_io_sam_str1");
01100 depth++;
01101
01102 if(!prs_align(ps))
01103 return False;
01104 if (!smb_io_unistr2("name", &sam->uni_acct_name, acct_buf, ps, depth))
01105 return False;
01106
01107 if (!smb_io_unistr2("desc", &sam->uni_acct_desc, desc_buf, ps, depth))
01108 return False;
01109
01110 if (!smb_io_unistr2("full", &sam->uni_full_name, name_buf, ps, depth))
01111 return False;
01112
01113 return True;
01114 }
01115
01116
01117
01118
01119
01120 static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx,
01121 UNISTR2 *sam_name, UNISTR2 *sam_full,
01122 UNISTR2 *sam_desc, uint32 rid_user,
01123 uint32 acb_info)
01124 {
01125 DEBUG(5, ("init_sam_entry1\n"));
01126
01127 ZERO_STRUCTP(sam);
01128
01129 sam->user_idx = user_idx;
01130 sam->rid_user = rid_user;
01131 sam->acb_info = acb_info;
01132
01133 init_uni_hdr(&sam->hdr_acct_name, sam_name);
01134 init_uni_hdr(&sam->hdr_user_name, sam_full);
01135 init_uni_hdr(&sam->hdr_user_desc, sam_desc);
01136 }
01137
01138
01139
01140
01141
01142 static BOOL sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam,
01143 prs_struct *ps, int depth)
01144 {
01145 if (sam == NULL)
01146 return False;
01147
01148 prs_debug(ps, depth, desc, "sam_io_sam_entry1");
01149 depth++;
01150
01151 if(!prs_align(ps))
01152 return False;
01153
01154 if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
01155 return False;
01156
01157 if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
01158 return False;
01159 if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
01160 return False;
01161
01162 if (!smb_io_unihdr("hdr_acct_name", &sam->hdr_acct_name, ps, depth))
01163 return False;
01164 if (!smb_io_unihdr("hdr_user_desc", &sam->hdr_user_desc, ps, depth))
01165 return False;
01166 if (!smb_io_unihdr("hdr_user_name", &sam->hdr_user_name, ps, depth))
01167 return False;
01168
01169 return True;
01170 }
01171
01172
01173
01174
01175
01176 static BOOL sam_io_sam_str2(const char *desc, SAM_STR2 * sam, uint32 acct_buf,
01177 uint32 desc_buf, prs_struct *ps, int depth)
01178 {
01179 if (sam == NULL)
01180 return False;
01181
01182 prs_debug(ps, depth, desc, "sam_io_sam_str2");
01183 depth++;
01184
01185 if(!prs_align(ps))
01186 return False;
01187
01188 if(!smb_io_unistr2("uni_srv_name", &sam->uni_srv_name, acct_buf, ps, depth))
01189 return False;
01190 if(!smb_io_unistr2("uni_srv_desc", &sam->uni_srv_desc, desc_buf, ps, depth))
01191 return False;
01192
01193 return True;
01194 }
01195
01196
01197
01198
01199 static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx,
01200 UNISTR2 *sam_name, UNISTR2 *sam_desc,
01201 uint32 rid_user, uint32 acb_info)
01202 {
01203 DEBUG(5, ("init_sam_entry2\n"));
01204
01205 sam->user_idx = user_idx;
01206 sam->rid_user = rid_user;
01207 sam->acb_info = acb_info;
01208
01209 init_uni_hdr(&sam->hdr_srv_name, sam_name);
01210 init_uni_hdr(&sam->hdr_srv_desc, sam_desc);
01211 }
01212
01213
01214
01215
01216
01217 static BOOL sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam,
01218 prs_struct *ps, int depth)
01219 {
01220 if (sam == NULL)
01221 return False;
01222
01223 prs_debug(ps, depth, desc, "sam_io_sam_entry2");
01224 depth++;
01225
01226 if(!prs_align(ps))
01227 return False;
01228
01229 if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
01230 return False;
01231
01232 if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
01233 return False;
01234 if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
01235 return False;
01236
01237 if(!smb_io_unihdr("unihdr", &sam->hdr_srv_name, ps, depth))
01238 return False;
01239 if(!smb_io_unihdr("unihdr", &sam->hdr_srv_desc, ps, depth))
01240 return False;
01241
01242 return True;
01243 }
01244
01245
01246
01247
01248
01249 static BOOL sam_io_sam_str3(const char *desc, SAM_STR3 * sam, uint32 acct_buf,
01250 uint32 desc_buf, prs_struct *ps, int depth)
01251 {
01252 if (sam == NULL)
01253 return False;
01254
01255 prs_debug(ps, depth, desc, "sam_io_sam_str3");
01256 depth++;
01257
01258 if(!prs_align(ps))
01259 return False;
01260
01261 if(!smb_io_unistr2("uni_grp_name", &sam->uni_grp_name, acct_buf, ps, depth))
01262 return False;
01263 if(!smb_io_unistr2("uni_grp_desc", &sam->uni_grp_desc, desc_buf, ps, depth))
01264 return False;
01265
01266 return True;
01267 }
01268
01269
01270
01271
01272
01273 static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx,
01274 UNISTR2 *grp_name, UNISTR2 *grp_desc,
01275 uint32 rid_grp)
01276 {
01277 DEBUG(5, ("init_sam_entry3\n"));
01278
01279 sam->grp_idx = grp_idx;
01280 sam->rid_grp = rid_grp;
01281 sam->attr = 0x07;
01282
01283 init_uni_hdr(&sam->hdr_grp_name, grp_name);
01284 init_uni_hdr(&sam->hdr_grp_desc, grp_desc);
01285 }
01286
01287
01288
01289
01290
01291 static BOOL sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam,
01292 prs_struct *ps, int depth)
01293 {
01294 if (sam == NULL)
01295 return False;
01296
01297 prs_debug(ps, depth, desc, "sam_io_sam_entry3");
01298 depth++;
01299
01300 if(!prs_align(ps))
01301 return False;
01302
01303 if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
01304 return False;
01305
01306 if(!prs_uint32("rid_grp", ps, depth, &sam->rid_grp))
01307 return False;
01308 if(!prs_uint32("attr ", ps, depth, &sam->attr))
01309 return False;
01310
01311 if(!smb_io_unihdr("unihdr", &sam->hdr_grp_name, ps, depth))
01312 return False;
01313 if(!smb_io_unihdr("unihdr", &sam->hdr_grp_desc, ps, depth))
01314 return False;
01315
01316 return True;
01317 }
01318
01319
01320
01321
01322
01323 static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx,
01324 uint32 len_acct_name)
01325 {
01326 DEBUG(5, ("init_sam_entry4\n"));
01327
01328 sam->user_idx = user_idx;
01329 init_str_hdr(&sam->hdr_acct_name, len_acct_name+1, len_acct_name, len_acct_name != 0);
01330 }
01331
01332
01333
01334
01335
01336 static BOOL sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam,
01337 prs_struct *ps, int depth)
01338 {
01339 if (sam == NULL)
01340 return False;
01341
01342 prs_debug(ps, depth, desc, "sam_io_sam_entry4");
01343 depth++;
01344
01345 if(!prs_align(ps))
01346 return False;
01347
01348 if(!prs_uint32("user_idx", ps, depth, &sam->user_idx))
01349 return False;
01350 if(!smb_io_strhdr("strhdr", &sam->hdr_acct_name, ps, depth))
01351 return False;
01352
01353 return True;
01354 }
01355
01356
01357
01358
01359
01360 static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx,
01361 uint32 len_grp_name)
01362 {
01363 DEBUG(5, ("init_sam_entry5\n"));
01364
01365 sam->grp_idx = grp_idx;
01366 init_str_hdr(&sam->hdr_grp_name, len_grp_name, len_grp_name,
01367 len_grp_name != 0);
01368 }
01369
01370
01371
01372
01373
01374 static BOOL sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam,
01375 prs_struct *ps, int depth)
01376 {
01377 if (sam == NULL)
01378 return False;
01379
01380 prs_debug(ps, depth, desc, "sam_io_sam_entry5");
01381 depth++;
01382
01383 if(!prs_align(ps))
01384 return False;
01385
01386 if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
01387 return False;
01388 if(!smb_io_strhdr("strhdr", &sam->hdr_grp_name, ps, depth))
01389 return False;
01390
01391 return True;
01392 }
01393
01394
01395
01396
01397
01398 void init_sam_entry(SAM_ENTRY *sam, UNISTR2 *uni2, uint32 rid)
01399 {
01400 DEBUG(10, ("init_sam_entry: %d\n", rid));
01401
01402 sam->rid = rid;
01403 init_uni_hdr(&sam->hdr_name, uni2);
01404 }
01405
01406
01407
01408
01409
01410 static BOOL sam_io_sam_entry(const char *desc, SAM_ENTRY * sam,
01411 prs_struct *ps, int depth)
01412 {
01413 if (sam == NULL)
01414 return False;
01415
01416 prs_debug(ps, depth, desc, "sam_io_sam_entry");
01417 depth++;
01418
01419 if(!prs_align(ps))
01420 return False;
01421 if(!prs_uint32("rid", ps, depth, &sam->rid))
01422 return False;
01423 if(!smb_io_unihdr("unihdr", &sam->hdr_name, ps, depth))
01424 return False;
01425
01426 return True;
01427 }
01428
01429
01430
01431
01432
01433 void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol,
01434 uint32 start_idx,
01435 uint32 acb_mask, uint32 size)
01436 {
01437 DEBUG(5, ("init_samr_q_enum_dom_users\n"));
01438
01439 q_e->pol = *pol;
01440
01441 q_e->start_idx = start_idx;
01442 q_e->acb_mask = acb_mask;
01443 q_e->max_size = size;
01444 }
01445
01446
01447
01448
01449
01450 BOOL samr_io_q_enum_dom_users(const char *desc, SAMR_Q_ENUM_DOM_USERS * q_e,
01451 prs_struct *ps, int depth)
01452 {
01453 if (q_e == NULL)
01454 return False;
01455
01456 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users");
01457 depth++;
01458
01459 if(!prs_align(ps))
01460 return False;
01461
01462 if(!smb_io_pol_hnd("domain_pol", &q_e->pol, ps, depth))
01463 return False;
01464
01465 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
01466 return False;
01467 if(!prs_uint32("acb_mask ", ps, depth, &q_e->acb_mask))
01468 return False;
01469
01470 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
01471 return False;
01472
01473 return True;
01474 }
01475
01476
01477
01478
01479
01480
01481 void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u,
01482 uint32 next_idx, uint32 num_sam_entries)
01483 {
01484 DEBUG(5, ("init_samr_r_enum_dom_users\n"));
01485
01486 r_u->next_idx = next_idx;
01487
01488 if (num_sam_entries != 0) {
01489 r_u->ptr_entries1 = 1;
01490 r_u->ptr_entries2 = 1;
01491 r_u->num_entries2 = num_sam_entries;
01492 r_u->num_entries3 = num_sam_entries;
01493
01494 r_u->num_entries4 = num_sam_entries;
01495 } else {
01496 r_u->ptr_entries1 = 0;
01497 r_u->num_entries2 = num_sam_entries;
01498 r_u->ptr_entries2 = 1;
01499 }
01500 }
01501
01502
01503
01504
01505
01506 BOOL samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u,
01507 prs_struct *ps, int depth)
01508 {
01509 uint32 i;
01510
01511 if (r_u == NULL)
01512 return False;
01513
01514 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users");
01515 depth++;
01516
01517 if(!prs_align(ps))
01518 return False;
01519
01520 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
01521 return False;
01522 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
01523 return False;
01524
01525 if (r_u->ptr_entries1 != 0) {
01526 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
01527 return False;
01528 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
01529 return False;
01530 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
01531 return False;
01532
01533 if (UNMARSHALLING(ps) && (r_u->num_entries2 != 0)) {
01534 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY, r_u->num_entries2);
01535 r_u->uni_acct_name = PRS_ALLOC_MEM(ps,UNISTR2, r_u->num_entries2);
01536 }
01537
01538 if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) {
01539 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
01540 r_u->num_entries4 = 0;
01541 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
01542 return False;
01543 }
01544
01545 for (i = 0; i < r_u->num_entries2; i++) {
01546 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
01547 return False;
01548 }
01549
01550 for (i = 0; i < r_u->num_entries2; i++) {
01551 if(!smb_io_unistr2("", &r_u->uni_acct_name[i],r_u->sam[i].hdr_name.buffer, ps,depth))
01552 return False;
01553 }
01554
01555 }
01556
01557 if(!prs_align(ps))
01558 return False;
01559
01560 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
01561 return False;
01562 if(!prs_ntstatus("status", ps, depth, &r_u->status))
01563 return False;
01564
01565 return True;
01566 }
01567
01568
01569
01570
01571
01572 void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol,
01573 uint16 switch_level, uint32 start_idx,
01574 uint32 max_entries, uint32 max_size)
01575 {
01576 DEBUG(5, ("init_samr_q_query_dispinfo\n"));
01577
01578 q_e->domain_pol = *pol;
01579
01580 q_e->switch_level = switch_level;
01581
01582 q_e->start_idx = start_idx;
01583 q_e->max_entries = max_entries;
01584 q_e->max_size = max_size;
01585 }
01586
01587
01588
01589
01590
01591 BOOL samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e,
01592 prs_struct *ps, int depth)
01593 {
01594 if (q_e == NULL)
01595 return False;
01596
01597 prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo");
01598 depth++;
01599
01600 if(!prs_align(ps))
01601 return False;
01602
01603 if(!smb_io_pol_hnd("domain_pol", &q_e->domain_pol, ps, depth))
01604 return False;
01605
01606 if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
01607 return False;
01608 if(!prs_align(ps))
01609 return False;
01610
01611 if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx))
01612 return False;
01613 if(!prs_uint32("max_entries ", ps, depth, &q_e->max_entries))
01614 return False;
01615 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
01616 return False;
01617
01618 return True;
01619 }
01620
01621
01622
01623
01624
01625 NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 **sam,
01626 uint32 num_entries, uint32 start_idx,
01627 struct samr_displayentry *entries)
01628 {
01629 uint32 i;
01630
01631 DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries));
01632
01633 if (num_entries==0)
01634 return NT_STATUS_OK;
01635
01636 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_1, num_entries);
01637 if (*sam == NULL)
01638 return NT_STATUS_NO_MEMORY;
01639
01640 (*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY1, num_entries);
01641 if ((*sam)->sam == NULL)
01642 return NT_STATUS_NO_MEMORY;
01643
01644 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR1, num_entries);
01645 if ((*sam)->str == NULL)
01646 return NT_STATUS_NO_MEMORY;
01647
01648 for (i = 0; i < num_entries ; i++) {
01649 init_unistr2(&(*sam)->str[i].uni_acct_name,
01650 entries[i].account_name, UNI_FLAGS_NONE);
01651 init_unistr2(&(*sam)->str[i].uni_full_name,
01652 entries[i].fullname, UNI_FLAGS_NONE);
01653 init_unistr2(&(*sam)->str[i].uni_acct_desc,
01654 entries[i].description, UNI_FLAGS_NONE);
01655
01656 init_sam_entry1(&(*sam)->sam[i], start_idx+i+1,
01657 &(*sam)->str[i].uni_acct_name,
01658 &(*sam)->str[i].uni_full_name,
01659 &(*sam)->str[i].uni_acct_desc,
01660 entries[i].rid, entries[i].acct_flags);
01661 }
01662
01663 return NT_STATUS_OK;
01664 }
01665
01666
01667
01668
01669
01670 static BOOL sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam,
01671 uint32 num_entries,
01672 prs_struct *ps, int depth)
01673 {
01674 uint32 i;
01675
01676 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1");
01677 depth++;
01678
01679 if(!prs_align(ps))
01680 return False;
01681
01682 if (UNMARSHALLING(ps) && num_entries > 0) {
01683
01684 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY1, num_entries)) == NULL) {
01685 DEBUG(0, ("out of memory allocating SAM_ENTRY1\n"));
01686 return False;
01687 }
01688
01689 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR1, num_entries)) == NULL) {
01690 DEBUG(0, ("out of memory allocating SAM_STR1\n"));
01691 return False;
01692 }
01693 }
01694
01695 for (i = 0; i < num_entries; i++) {
01696 if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth))
01697 return False;
01698 }
01699
01700 for (i = 0; i < num_entries; i++) {
01701 if(!sam_io_sam_str1("", &sam->str[i],
01702 sam->sam[i].hdr_acct_name.buffer,
01703 sam->sam[i].hdr_user_name.buffer,
01704 sam->sam[i].hdr_user_desc.buffer, ps, depth))
01705 return False;
01706 }
01707
01708 return True;
01709 }
01710
01711
01712
01713
01714
01715 NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 **sam,
01716 uint32 num_entries, uint32 start_idx,
01717 struct samr_displayentry *entries)
01718 {
01719 uint32 i;
01720
01721 DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries));
01722
01723 if (num_entries==0)
01724 return NT_STATUS_OK;
01725
01726 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_2, num_entries);
01727 if (*sam == NULL)
01728 return NT_STATUS_NO_MEMORY;
01729
01730 (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY2, num_entries);
01731 if ((*sam)->sam == NULL)
01732 return NT_STATUS_NO_MEMORY;
01733
01734 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR2, num_entries);
01735 if ((*sam)->str == NULL)
01736 return NT_STATUS_NO_MEMORY;
01737
01738 for (i = 0; i < num_entries; i++) {
01739 init_unistr2(&(*sam)->str[i].uni_srv_name,
01740 entries[i].account_name, UNI_FLAGS_NONE);
01741 init_unistr2(&(*sam)->str[i].uni_srv_desc,
01742 entries[i].description, UNI_FLAGS_NONE);
01743
01744 init_sam_entry2(&(*sam)->sam[i], start_idx + i + 1,
01745 &(*sam)->str[i].uni_srv_name,
01746 &(*sam)->str[i].uni_srv_desc,
01747 entries[i].rid, entries[i].acct_flags);
01748 }
01749
01750 return NT_STATUS_OK;
01751 }
01752
01753
01754
01755
01756
01757 static BOOL sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam,
01758 uint32 num_entries,
01759 prs_struct *ps, int depth)
01760 {
01761 uint32 i;
01762
01763 if (sam == NULL)
01764 return False;
01765
01766 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2");
01767 depth++;
01768
01769 if(!prs_align(ps))
01770 return False;
01771
01772 if (UNMARSHALLING(ps) && num_entries > 0) {
01773
01774 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY2, num_entries)) == NULL) {
01775 DEBUG(0, ("out of memory allocating SAM_ENTRY2\n"));
01776 return False;
01777 }
01778
01779 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR2, num_entries)) == NULL) {
01780 DEBUG(0, ("out of memory allocating SAM_STR2\n"));
01781 return False;
01782 }
01783 }
01784
01785 for (i = 0; i < num_entries; i++) {
01786 if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth))
01787 return False;
01788 }
01789
01790 for (i = 0; i < num_entries; i++) {
01791 if(!sam_io_sam_str2("", &sam->str[i],
01792 sam->sam[i].hdr_srv_name.buffer,
01793 sam->sam[i].hdr_srv_desc.buffer, ps, depth))
01794 return False;
01795 }
01796
01797 return True;
01798 }
01799
01800
01801
01802
01803
01804 NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam,
01805 uint32 num_entries, uint32 start_idx,
01806 struct samr_displayentry *entries)
01807 {
01808 uint32 i;
01809
01810 DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries));
01811
01812 if (num_entries==0)
01813 return NT_STATUS_OK;
01814
01815 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_3, num_entries);
01816 if (*sam == NULL)
01817 return NT_STATUS_NO_MEMORY;
01818
01819 if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY3, num_entries)))
01820 return NT_STATUS_NO_MEMORY;
01821
01822 if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR3, num_entries)))
01823 return NT_STATUS_NO_MEMORY;
01824
01825 for (i = 0; i < num_entries; i++) {
01826 DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i));
01827
01828 init_unistr2(&(*sam)->str[i].uni_grp_name,
01829 entries[i].account_name, UNI_FLAGS_NONE);
01830 init_unistr2(&(*sam)->str[i].uni_grp_desc,
01831 entries[i].description, UNI_FLAGS_NONE);
01832
01833 init_sam_entry3(&(*sam)->sam[i], start_idx+i+1,
01834 &(*sam)->str[i].uni_grp_name,
01835 &(*sam)->str[i].uni_grp_desc,
01836 entries[i].rid);
01837 }
01838
01839 return NT_STATUS_OK;
01840 }
01841
01842
01843
01844
01845
01846 static BOOL sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam,
01847 uint32 num_entries,
01848 prs_struct *ps, int depth)
01849 {
01850 uint32 i;
01851
01852 if (sam == NULL)
01853 return False;
01854
01855 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3");
01856 depth++;
01857
01858 if(!prs_align(ps))
01859 return False;
01860
01861 if (UNMARSHALLING(ps) && num_entries > 0) {
01862
01863 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY3, num_entries)) == NULL) {
01864 DEBUG(0, ("out of memory allocating SAM_ENTRY3\n"));
01865 return False;
01866 }
01867
01868 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR3, num_entries)) == NULL) {
01869 DEBUG(0, ("out of memory allocating SAM_STR3\n"));
01870 return False;
01871 }
01872 }
01873
01874 for (i = 0; i < num_entries; i++) {
01875 if(!sam_io_sam_entry3("", &sam->sam[i], ps, depth))
01876 return False;
01877 }
01878
01879 for (i = 0; i < num_entries; i++) {
01880 if(!sam_io_sam_str3("", &sam->str[i],
01881 sam->sam[i].hdr_grp_name.buffer,
01882 sam->sam[i].hdr_grp_desc.buffer, ps, depth))
01883 return False;
01884 }
01885
01886 return True;
01887 }
01888
01889
01890
01891
01892
01893 NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 **sam,
01894 uint32 num_entries, uint32 start_idx,
01895 struct samr_displayentry *entries)
01896 {
01897 uint32 i;
01898
01899 DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries));
01900
01901 if (num_entries==0)
01902 return NT_STATUS_OK;
01903
01904 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_4, num_entries);
01905 if (*sam == NULL)
01906 return NT_STATUS_NO_MEMORY;
01907
01908 (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY4, num_entries);
01909 if ((*sam)->sam == NULL)
01910 return NT_STATUS_NO_MEMORY;
01911
01912 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR4, num_entries);
01913 if ((*sam)->str == NULL)
01914 return NT_STATUS_NO_MEMORY;
01915
01916 for (i = 0; i < num_entries; i++) {
01917 size_t len_sam_name = strlen(entries[i].account_name);
01918
01919 DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i));
01920
01921 init_sam_entry4(&(*sam)->sam[i], start_idx + i + 1,
01922 len_sam_name);
01923
01924 init_string2(&(*sam)->str[i].acct_name,
01925 entries[i].account_name, len_sam_name+1,
01926 len_sam_name);
01927 }
01928
01929 return NT_STATUS_OK;
01930 }
01931
01932
01933
01934
01935
01936 static BOOL sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam,
01937 uint32 num_entries,
01938 prs_struct *ps, int depth)
01939 {
01940 uint32 i;
01941
01942 if (sam == NULL)
01943 return False;
01944
01945 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4");
01946 depth++;
01947
01948 if(!prs_align(ps))
01949 return False;
01950
01951 if (UNMARSHALLING(ps) && num_entries > 0) {
01952
01953 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY4, num_entries)) == NULL) {
01954 DEBUG(0, ("out of memory allocating SAM_ENTRY4\n"));
01955 return False;
01956 }
01957
01958 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR4, num_entries)) == NULL) {
01959 DEBUG(0, ("out of memory allocating SAM_STR4\n"));
01960 return False;
01961 }
01962 }
01963
01964 for (i = 0; i < num_entries; i++) {
01965 if(!sam_io_sam_entry4("", &sam->sam[i], ps, depth))
01966 return False;
01967 }
01968
01969 for (i = 0; i < num_entries; i++) {
01970 if(!smb_io_string2("acct_name", &sam->str[i].acct_name,
01971 sam->sam[i].hdr_acct_name.buffer, ps, depth))
01972 return False;
01973 }
01974
01975 return True;
01976 }
01977
01978
01979
01980
01981
01982 NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 **sam,
01983 uint32 num_entries, uint32 start_idx,
01984 struct samr_displayentry *entries)
01985 {
01986 uint32 len_sam_name;
01987 uint32 i;
01988
01989 DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries));
01990
01991 if (num_entries==0)
01992 return NT_STATUS_OK;
01993
01994 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_5, num_entries);
01995 if (*sam == NULL)
01996 return NT_STATUS_NO_MEMORY;
01997
01998 if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY5, num_entries)))
01999 return NT_STATUS_NO_MEMORY;
02000
02001 if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR5, num_entries)))
02002 return NT_STATUS_NO_MEMORY;
02003
02004 for (i = 0; i < num_entries; i++) {
02005 DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i));
02006
02007 len_sam_name = strlen(entries[i].account_name);
02008
02009 init_sam_entry5(&(*sam)->sam[i], start_idx+i+1, len_sam_name);
02010 init_string2(&(*sam)->str[i].grp_name, entries[i].account_name,
02011 len_sam_name+1, len_sam_name);
02012 }
02013
02014 return NT_STATUS_OK;
02015 }
02016
02017
02018
02019
02020
02021 static BOOL sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam,
02022 uint32 num_entries,
02023 prs_struct *ps, int depth)
02024 {
02025 uint32 i;
02026
02027 if (sam == NULL)
02028 return False;
02029
02030 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5");
02031 depth++;
02032
02033 if(!prs_align(ps))
02034 return False;
02035
02036 if (UNMARSHALLING(ps) && num_entries > 0) {
02037
02038 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY5, num_entries)) == NULL) {
02039 DEBUG(0, ("out of memory allocating SAM_ENTRY5\n"));
02040 return False;
02041 }
02042
02043 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR5, num_entries)) == NULL) {
02044 DEBUG(0, ("out of memory allocating SAM_STR5\n"));
02045 return False;
02046 }
02047 }
02048
02049 for (i = 0; i < num_entries; i++) {
02050 if(!sam_io_sam_entry5("", &sam->sam[i], ps, depth))
02051 return False;
02052 }
02053
02054 for (i = 0; i < num_entries; i++) {
02055 if(!smb_io_string2("grp_name", &sam->str[i].grp_name,
02056 sam->sam[i].hdr_grp_name.buffer, ps, depth))
02057 return False;
02058 }
02059
02060 return True;
02061 }
02062
02063
02064
02065
02066
02067 void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u,
02068 uint32 num_entries, uint32 total_size, uint32 data_size,
02069 uint16 switch_level, SAM_DISPINFO_CTR * ctr,
02070 NTSTATUS status)
02071 {
02072 DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level));
02073
02074 r_u->total_size = total_size;
02075
02076 r_u->data_size = data_size;
02077
02078 r_u->switch_level = switch_level;
02079 r_u->num_entries = num_entries;
02080
02081 if (num_entries==0)
02082 r_u->ptr_entries = 0;
02083 else
02084 r_u->ptr_entries = 1;
02085
02086 r_u->num_entries2 = num_entries;
02087 r_u->ctr = ctr;
02088
02089 r_u->status = status;
02090 }
02091
02092
02093
02094
02095
02096 BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u,
02097 prs_struct *ps, int depth)
02098 {
02099 if (r_u == NULL)
02100 return False;
02101
02102 prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo");
02103 depth++;
02104
02105 if(!prs_align(ps))
02106 return False;
02107
02108 if(!prs_uint32("total_size ", ps, depth, &r_u->total_size))
02109 return False;
02110 if(!prs_uint32("data_size ", ps, depth, &r_u->data_size))
02111 return False;
02112 if(!prs_uint16("switch_level", ps, depth, &r_u->switch_level))
02113 return False;
02114 if(!prs_align(ps))
02115 return False;
02116
02117 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
02118 return False;
02119 if(!prs_uint32("ptr_entries ", ps, depth, &r_u->ptr_entries))
02120 return False;
02121
02122 if (r_u->ptr_entries==0) {
02123 if(!prs_align(ps))
02124 return False;
02125 if(!prs_ntstatus("status", ps, depth, &r_u->status))
02126 return False;
02127
02128 return True;
02129 }
02130
02131 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
02132 return False;
02133
02134 switch (r_u->switch_level) {
02135 case 0x1:
02136 if(!sam_io_sam_dispinfo_1("users", r_u->ctr->sam.info1,
02137 r_u->num_entries, ps, depth))
02138 return False;
02139 break;
02140 case 0x2:
02141 if(!sam_io_sam_dispinfo_2("servers", r_u->ctr->sam.info2,
02142 r_u->num_entries, ps, depth))
02143 return False;
02144 break;
02145 case 0x3:
02146 if(!sam_io_sam_dispinfo_3("groups", r_u->ctr->sam.info3,
02147 r_u->num_entries, ps, depth))
02148 return False;
02149 break;
02150 case 0x4:
02151 if(!sam_io_sam_dispinfo_4("user list",
02152 r_u->ctr->sam.info4,
02153 r_u->num_entries, ps, depth))
02154 return False;
02155 break;
02156 case 0x5:
02157 if(!sam_io_sam_dispinfo_5("group list",
02158 r_u->ctr->sam.info5,
02159 r_u->num_entries, ps, depth))
02160 return False;
02161 break;
02162 default:
02163 DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n"));
02164 break;
02165 }
02166
02167 if(!prs_align(ps))
02168 return False;
02169 if(!prs_ntstatus("status", ps, depth, &r_u->status))
02170 return False;
02171
02172 return True;
02173 }
02174
02175
02176
02177
02178
02179 void init_samr_q_get_dispenum_index(SAMR_Q_GET_DISPENUM_INDEX * q_e, POLICY_HND *pol,
02180 uint16 switch_level, const char *name)
02181 {
02182 DEBUG(5, ("init_samr_q_get_dispenum_index\n"));
02183
02184 q_e->domain_pol = *pol;
02185
02186 q_e->switch_level = switch_level;
02187
02188 init_lsa_string(&q_e->name, name);
02189 }
02190
02191
02192
02193
02194
02195 BOOL samr_io_q_get_dispenum_index(const char *desc, SAMR_Q_GET_DISPENUM_INDEX * q_e,
02196 prs_struct *ps, int depth)
02197 {
02198 if (q_e == NULL)
02199 return False;
02200
02201 prs_debug(ps, depth, desc, "samr_io_q_get_dispenum_index");
02202 depth++;
02203
02204 if(!prs_align(ps))
02205 return False;
02206
02207 if(!smb_io_pol_hnd("domain_pol", &q_e->domain_pol, ps, depth))
02208 return False;
02209
02210 if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
02211 return False;
02212
02213 if (!smb_io_lsa_string("name", &q_e->name, ps, depth))
02214 return False;
02215
02216 return True;
02217 }
02218
02219
02220
02221
02222
02223 BOOL samr_io_r_get_dispenum_index(const char *desc, SAMR_R_GET_DISPENUM_INDEX * r_u,
02224 prs_struct *ps, int depth)
02225 {
02226 if (r_u == NULL)
02227 return False;
02228
02229 prs_debug(ps, depth, desc, "samr_io_r_get_dispenum_index");
02230 depth++;
02231
02232 if(!prs_align(ps))
02233 return False;
02234
02235 if(!prs_uint32("idx", ps, depth, &r_u->idx))
02236 return False;
02237
02238 if(!prs_ntstatus("status", ps, depth, &r_u->status))
02239 return False;
02240
02241 return True;
02242 }
02243
02244
02245
02246
02247
02248
02249 void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c,
02250 POLICY_HND *hnd,
02251 uint32 access_mask, uint32 rid)
02252 {
02253 DEBUG(5, ("init_samr_q_open_group\n"));
02254
02255 q_c->domain_pol = *hnd;
02256 q_c->access_mask = access_mask;
02257 q_c->rid_group = rid;
02258 }
02259
02260
02261
02262
02263
02264 void init_samr_r_get_dispenum_index(SAMR_R_GET_DISPENUM_INDEX * q_e, uint32 idx)
02265 {
02266 DEBUG(5, ("init_samr_r_get_dispenum_index\n"));
02267
02268 q_e->idx = idx;
02269 }
02270
02271
02272
02273
02274
02275 BOOL samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u,
02276 prs_struct *ps, int depth)
02277 {
02278 if (q_u == NULL)
02279 return False;
02280
02281 prs_debug(ps, depth, desc, "samr_io_q_open_group");
02282 depth++;
02283
02284 if(!prs_align(ps))
02285 return False;
02286
02287 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
02288 return False;
02289
02290 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
02291 return False;
02292 if(!prs_uint32("rid_group", ps, depth, &q_u->rid_group))
02293 return False;
02294
02295 return True;
02296 }
02297
02298
02299
02300
02301
02302 BOOL samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u,
02303 prs_struct *ps, int depth)
02304 {
02305 if (r_u == NULL)
02306 return False;
02307
02308 prs_debug(ps, depth, desc, "samr_io_r_open_group");
02309 depth++;
02310
02311 if(!prs_align(ps))
02312 return False;
02313
02314 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
02315 return False;
02316
02317 if(!prs_ntstatus("status", ps, depth, &r_u->status))
02318 return False;
02319
02320 return True;
02321 }
02322
02323
02324
02325
02326
02327 void init_samr_group_info1(GROUP_INFO1 * gr1,
02328 char *acct_name, char *acct_desc,
02329 uint32 num_members)
02330 {
02331 DEBUG(5, ("init_samr_group_info1\n"));
02332
02333 gr1->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT);
02334 gr1->num_members = num_members;
02335
02336 init_unistr2(&gr1->uni_acct_name, acct_name, UNI_FLAGS_NONE);
02337 init_uni_hdr(&gr1->hdr_acct_name, &gr1->uni_acct_name);
02338 init_unistr2(&gr1->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
02339 init_uni_hdr(&gr1->hdr_acct_desc, &gr1->uni_acct_desc);
02340 }
02341
02342
02343
02344
02345
02346 BOOL samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1,
02347 prs_struct *ps, int depth)
02348 {
02349 uint16 dummy = 1;
02350
02351 if (gr1 == NULL)
02352 return False;
02353
02354 prs_debug(ps, depth, desc, "samr_io_group_info1");
02355 depth++;
02356
02357 if(!prs_uint16("level", ps, depth, &dummy))
02358 return False;
02359
02360 if(!prs_align(ps))
02361 return False;
02362
02363 if(!smb_io_unihdr("hdr_acct_name", &gr1->hdr_acct_name, ps, depth))
02364 return False;
02365
02366 if(!prs_uint32("group_attr", ps, depth, &gr1->group_attr))
02367 return False;
02368 if(!prs_uint32("num_members", ps, depth, &gr1->num_members))
02369 return False;
02370
02371 if(!smb_io_unihdr("hdr_acct_desc", &gr1->hdr_acct_desc, ps, depth))
02372 return False;
02373
02374 if(!smb_io_unistr2("uni_acct_name", &gr1->uni_acct_name,
02375 gr1->hdr_acct_name.buffer, ps, depth))
02376 return False;
02377
02378 if(!smb_io_unistr2("uni_acct_desc", &gr1->uni_acct_desc,
02379 gr1->hdr_acct_desc.buffer, ps, depth))
02380 return False;
02381
02382 return True;
02383 }
02384
02385
02386
02387
02388
02389 void init_samr_group_info2(GROUP_INFO2 * gr2, const char *acct_name)
02390 {
02391 DEBUG(5, ("init_samr_group_info2\n"));
02392
02393 gr2->level = 2;
02394 init_unistr2(&gr2->uni_acct_name, acct_name, UNI_FLAGS_NONE);
02395 init_uni_hdr(&gr2->hdr_acct_name, &gr2->uni_acct_name);
02396 }
02397
02398
02399
02400
02401
02402 BOOL samr_io_group_info2(const char *desc, GROUP_INFO2 *gr2, prs_struct *ps, int depth)
02403 {
02404 if (gr2 == NULL)
02405 return False;
02406
02407 prs_debug(ps, depth, desc, "samr_io_group_info2");
02408 depth++;
02409
02410 if(!prs_uint16("hdr_level", ps, depth, &gr2->level))
02411 return False;
02412
02413 if(!smb_io_unihdr("hdr_acct_name", &gr2->hdr_acct_name, ps, depth))
02414 return False;
02415 if(!smb_io_unistr2("uni_acct_name", &gr2->uni_acct_name,
02416 gr2->hdr_acct_name.buffer, ps, depth))
02417 return False;
02418
02419 return True;
02420 }
02421
02422
02423
02424
02425
02426 void init_samr_group_info3(GROUP_INFO3 *gr3)
02427 {
02428 DEBUG(5, ("init_samr_group_info3\n"));
02429
02430 gr3->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT);
02431 }
02432
02433
02434
02435
02436
02437 BOOL samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth)
02438 {
02439 if (gr3 == NULL)
02440 return False;
02441
02442 prs_debug(ps, depth, desc, "samr_io_group_info3");
02443 depth++;
02444
02445 if(!prs_align(ps))
02446 return False;
02447
02448 if(!prs_uint32("group_attr", ps, depth, &gr3->group_attr))
02449 return False;
02450
02451 return True;
02452 }
02453
02454
02455
02456
02457
02458 void init_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc)
02459 {
02460 DEBUG(5, ("init_samr_group_info4\n"));
02461
02462 gr4->level = 4;
02463 init_unistr2(&gr4->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
02464 init_uni_hdr(&gr4->hdr_acct_desc, &gr4->uni_acct_desc);
02465 }
02466
02467
02468
02469
02470
02471 BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4,
02472 prs_struct *ps, int depth)
02473 {
02474 if (gr4 == NULL)
02475 return False;
02476
02477 prs_debug(ps, depth, desc, "samr_io_group_info4");
02478 depth++;
02479
02480 if(!prs_uint16("hdr_level", ps, depth, &gr4->level))
02481 return False;
02482 if(!smb_io_unihdr("hdr_acct_desc", &gr4->hdr_acct_desc, ps, depth))
02483 return False;
02484 if(!smb_io_unistr2("uni_acct_desc", &gr4->uni_acct_desc,
02485 gr4->hdr_acct_desc.buffer, ps, depth))
02486 return False;
02487
02488 return True;
02489 }
02490
02491
02492
02493
02494
02495 void init_samr_group_info5(GROUP_INFO5 * gr5,
02496 char *acct_name, char *acct_desc,
02497 uint32 num_members)
02498 {
02499 DEBUG(5, ("init_samr_group_info5\n"));
02500
02501 gr5->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT);
02502 gr5->num_members = num_members;
02503
02504 init_unistr2(&gr5->uni_acct_name, acct_name, UNI_FLAGS_NONE);
02505 init_uni_hdr(&gr5->hdr_acct_name, &gr5->uni_acct_name);
02506 init_unistr2(&gr5->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
02507 init_uni_hdr(&gr5->hdr_acct_desc, &gr5->uni_acct_desc);
02508 }
02509
02510
02511
02512
02513
02514 BOOL samr_io_group_info5(const char *desc, GROUP_INFO5 * gr5,
02515 prs_struct *ps, int depth)
02516 {
02517 uint16 dummy = 1;
02518
02519 if (gr5 == NULL)
02520 return False;
02521
02522 prs_debug(ps, depth, desc, "samr_io_group_info5");
02523 depth++;
02524
02525 if(!prs_uint16("level", ps, depth, &dummy))
02526 return False;
02527
02528 if(!prs_align(ps))
02529 return False;
02530
02531 if(!smb_io_unihdr("hdr_acct_name", &gr5->hdr_acct_name, ps, depth))
02532 return False;
02533
02534 if(!prs_uint32("group_attr", ps, depth, &gr5->group_attr))
02535 return False;
02536 if(!prs_uint32("num_members", ps, depth, &gr5->num_members))
02537 return False;
02538
02539 if(!smb_io_unihdr("hdr_acct_desc", &gr5->hdr_acct_desc, ps, depth))
02540 return False;
02541
02542 if(!smb_io_unistr2("uni_acct_name", &gr5->uni_acct_name,
02543 gr5->hdr_acct_name.buffer, ps, depth))
02544 return False;
02545
02546 if(!smb_io_unistr2("uni_acct_desc", &gr5->uni_acct_desc,
02547 gr5->hdr_acct_desc.buffer, ps, depth))
02548 return False;
02549
02550 return True;
02551 }
02552
02553
02554
02555
02556
02557
02558 static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr,
02559 prs_struct *ps, int depth)
02560 {
02561 if (UNMARSHALLING(ps))
02562 *ctr = PRS_ALLOC_MEM(ps,GROUP_INFO_CTR,1);
02563
02564 if (*ctr == NULL)
02565 return False;
02566
02567 prs_debug(ps, depth, desc, "samr_group_info_ctr");
02568 depth++;
02569
02570 if(!prs_uint16("switch_value1", ps, depth, &(*ctr)->switch_value1))
02571 return False;
02572
02573 switch ((*ctr)->switch_value1) {
02574 case 1:
02575 if(!samr_io_group_info1("group_info1", &(*ctr)->group.info1, ps, depth))
02576 return False;
02577 break;
02578 case 2:
02579 if(!samr_io_group_info2("group_info2", &(*ctr)->group.info2, ps, depth))
02580 return False;
02581 break;
02582 case 3:
02583 if(!samr_io_group_info3("group_info3", &(*ctr)->group.info3, ps, depth))
02584 return False;
02585 break;
02586 case 4:
02587 if(!samr_io_group_info4("group_info4", &(*ctr)->group.info4, ps, depth))
02588 return False;
02589 break;
02590 case 5:
02591 if(!samr_io_group_info5("group_info5", &(*ctr)->group.info5, ps, depth))
02592 return False;
02593 break;
02594 default:
02595 DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
02596 break;
02597 }
02598
02599 return True;
02600 }
02601
02602
02603
02604
02605
02606 void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e,
02607 POLICY_HND *pol, const char *acct_desc,
02608 uint32 access_mask)
02609 {
02610 DEBUG(5, ("init_samr_q_create_dom_group\n"));
02611
02612 q_e->pol = *pol;
02613
02614 init_unistr2(&q_e->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
02615 init_uni_hdr(&q_e->hdr_acct_desc, &q_e->uni_acct_desc);
02616
02617 q_e->access_mask = access_mask;
02618 }
02619
02620
02621
02622
02623
02624 BOOL samr_io_q_create_dom_group(const char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e,
02625 prs_struct *ps, int depth)
02626 {
02627 if (q_e == NULL)
02628 return False;
02629
02630 prs_debug(ps, depth, desc, "samr_io_q_create_dom_group");
02631 depth++;
02632
02633 if(!prs_align(ps))
02634 return False;
02635
02636 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
02637 return False;
02638
02639 if(!smb_io_unihdr("hdr_acct_desc", &q_e->hdr_acct_desc, ps, depth))
02640 return False;
02641 if(!smb_io_unistr2("uni_acct_desc", &q_e->uni_acct_desc,
02642 q_e->hdr_acct_desc.buffer, ps, depth))
02643 return False;
02644
02645 if(!prs_align(ps))
02646 return False;
02647 if(!prs_uint32("access", ps, depth, &q_e->access_mask))
02648 return False;
02649
02650 return True;
02651 }
02652
02653
02654
02655
02656
02657 BOOL samr_io_r_create_dom_group(const char *desc, SAMR_R_CREATE_DOM_GROUP * r_u,
02658 prs_struct *ps, int depth)
02659 {
02660 if (r_u == NULL)
02661 return False;
02662
02663 prs_debug(ps, depth, desc, "samr_io_r_create_dom_group");
02664 depth++;
02665
02666 if(!prs_align(ps))
02667 return False;
02668
02669 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
02670 return False;
02671
02672 if(!prs_uint32("rid ", ps, depth, &r_u->rid))
02673 return False;
02674 if(!prs_ntstatus("status", ps, depth, &r_u->status))
02675 return False;
02676
02677 return True;
02678 }
02679
02680
02681
02682
02683
02684 void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c,
02685 POLICY_HND *hnd)
02686 {
02687 DEBUG(5, ("init_samr_q_delete_dom_group\n"));
02688
02689 q_c->group_pol = *hnd;
02690 }
02691
02692
02693
02694
02695
02696 BOOL samr_io_q_delete_dom_group(const char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u,
02697 prs_struct *ps, int depth)
02698 {
02699 if (q_u == NULL)
02700 return False;
02701
02702 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group");
02703 depth++;
02704
02705 if(!prs_align(ps))
02706 return False;
02707
02708 if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
02709 return False;
02710
02711 return True;
02712 }
02713
02714
02715
02716
02717
02718 BOOL samr_io_r_delete_dom_group(const char *desc, SAMR_R_DELETE_DOM_GROUP * r_u,
02719 prs_struct *ps, int depth)
02720 {
02721 if (r_u == NULL)
02722 return False;
02723
02724 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group");
02725 depth++;
02726
02727 if(!prs_align(ps))
02728 return False;
02729
02730 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
02731 return False;
02732
02733 if(!prs_ntstatus("status", ps, depth, &r_u->status))
02734 return False;
02735
02736 return True;
02737 }
02738
02739
02740
02741
02742
02743 void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM * q_e,
02744 POLICY_HND *pol, uint32 rid)
02745 {
02746 DEBUG(5, ("init_samr_q_del_groupmem\n"));
02747
02748 q_e->pol = *pol;
02749 q_e->rid = rid;
02750 }
02751
02752
02753
02754
02755
02756 BOOL samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e,
02757 prs_struct *ps, int depth)
02758 {
02759 if (q_e == NULL)
02760 return False;
02761
02762 prs_debug(ps, depth, desc, "samr_io_q_del_groupmem");
02763 depth++;
02764
02765 if(!prs_align(ps))
02766 return False;
02767
02768 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
02769 return False;
02770
02771 if(!prs_uint32("rid", ps, depth, &q_e->rid))
02772 return False;
02773
02774 return True;
02775 }
02776
02777
02778
02779
02780
02781 void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol,
02782 NTSTATUS status)
02783 {
02784 DEBUG(5, ("init_samr_r_del_groupmem\n"));
02785
02786 r_u->status = status;
02787 }
02788
02789
02790
02791
02792
02793 BOOL samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u,
02794 prs_struct *ps, int depth)
02795 {
02796 if (r_u == NULL)
02797 return False;
02798
02799 prs_debug(ps, depth, desc, "samr_io_r_del_groupmem");
02800 depth++;
02801
02802 if(!prs_align(ps))
02803 return False;
02804
02805 if(!prs_ntstatus("status", ps, depth, &r_u->status))
02806 return False;
02807
02808 return True;
02809 }
02810
02811
02812
02813
02814
02815 void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e,
02816 POLICY_HND *pol, uint32 rid)
02817 {
02818 DEBUG(5, ("init_samr_q_add_groupmem\n"));
02819
02820 q_e->pol = *pol;
02821 q_e->rid = rid;
02822 q_e->unknown = 0x0005;
02823 }
02824
02825
02826
02827
02828
02829 BOOL samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e,
02830 prs_struct *ps, int depth)
02831 {
02832 if (q_e == NULL)
02833 return False;
02834
02835 prs_debug(ps, depth, desc, "samr_io_q_add_groupmem");
02836 depth++;
02837
02838 if(!prs_align(ps))
02839 return False;
02840
02841 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
02842 return False;
02843
02844 if(!prs_uint32("rid ", ps, depth, &q_e->rid))
02845 return False;
02846 if(!prs_uint32("unknown", ps, depth, &q_e->unknown))
02847 return False;
02848
02849 return True;
02850 }
02851
02852
02853
02854
02855
02856 void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol,
02857 NTSTATUS status)
02858 {
02859 DEBUG(5, ("init_samr_r_add_groupmem\n"));
02860
02861 r_u->status = status;
02862 }
02863
02864
02865
02866
02867
02868 BOOL samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u,
02869 prs_struct *ps, int depth)
02870 {
02871 if (r_u == NULL)
02872 return False;
02873
02874 prs_debug(ps, depth, desc, "samr_io_r_add_groupmem");
02875 depth++;
02876
02877 if(!prs_align(ps))
02878 return False;
02879
02880 if(!prs_ntstatus("status", ps, depth, &r_u->status))
02881 return False;
02882
02883 return True;
02884 }
02885
02886
02887
02888
02889
02890 void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO * q_e,
02891 POLICY_HND *pol, GROUP_INFO_CTR * ctr)
02892 {
02893 DEBUG(5, ("init_samr_q_set_groupinfo\n"));
02894
02895 q_e->pol = *pol;
02896 q_e->ctr = ctr;
02897 }
02898
02899
02900
02901
02902
02903 BOOL samr_io_q_set_groupinfo(const char *desc, SAMR_Q_SET_GROUPINFO * q_e,
02904 prs_struct *ps, int depth)
02905 {
02906 if (q_e == NULL)
02907 return False;
02908
02909 prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo");
02910 depth++;
02911
02912 if(!prs_align(ps))
02913 return False;
02914
02915 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
02916 return False;
02917
02918 if(!samr_group_info_ctr("ctr", &q_e->ctr, ps, depth))
02919 return False;
02920
02921 return True;
02922 }
02923
02924
02925
02926
02927
02928 void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, NTSTATUS status)
02929 {
02930 DEBUG(5, ("init_samr_r_set_groupinfo\n"));
02931
02932 r_u->status = status;
02933 }
02934
02935
02936
02937
02938
02939 BOOL samr_io_r_set_groupinfo(const char *desc, SAMR_R_SET_GROUPINFO * r_u,
02940 prs_struct *ps, int depth)
02941 {
02942 if (r_u == NULL)
02943 return False;
02944
02945 prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo");
02946 depth++;
02947
02948 if(!prs_align(ps))
02949 return False;
02950
02951 if(!prs_ntstatus("status", ps, depth, &r_u->status))
02952 return False;
02953
02954 return True;
02955 }
02956
02957
02958
02959
02960
02961 void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO * q_e,
02962 POLICY_HND *pol, uint16 switch_level)
02963 {
02964 DEBUG(5, ("init_samr_q_query_groupinfo\n"));
02965
02966 q_e->pol = *pol;
02967
02968 q_e->switch_level = switch_level;
02969 }
02970
02971
02972
02973
02974
02975 BOOL samr_io_q_query_groupinfo(const char *desc, SAMR_Q_QUERY_GROUPINFO * q_e,
02976 prs_struct *ps, int depth)
02977 {
02978 if (q_e == NULL)
02979 return False;
02980
02981 prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo");
02982 depth++;
02983
02984 if(!prs_align(ps))
02985 return False;
02986
02987 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
02988 return False;
02989
02990 if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
02991 return False;
02992
02993 return True;
02994 }
02995
02996
02997
02998
02999
03000 void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u,
03001 GROUP_INFO_CTR * ctr, NTSTATUS status)
03002 {
03003 DEBUG(5, ("init_samr_r_query_groupinfo\n"));
03004
03005 r_u->ptr = (NT_STATUS_IS_OK(status) && ctr != NULL) ? 1 : 0;
03006 r_u->ctr = ctr;
03007 r_u->status = status;
03008 }
03009
03010
03011
03012
03013
03014 BOOL samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u,
03015 prs_struct *ps, int depth)
03016 {
03017 if (r_u == NULL)
03018 return False;
03019
03020 prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo");
03021 depth++;
03022
03023 if(!prs_align(ps))
03024 return False;
03025
03026 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
03027 return False;
03028
03029 if (r_u->ptr != 0) {
03030 if(!samr_group_info_ctr("ctr", &r_u->ctr, ps, depth))
03031 return False;
03032 }
03033
03034 if(!prs_align(ps))
03035 return False;
03036 if(!prs_ntstatus("status", ps, depth, &r_u->status))
03037 return False;
03038
03039 return True;
03040 }
03041
03042
03043
03044
03045
03046 void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd)
03047 {
03048 DEBUG(5, ("init_samr_q_query_groupmem\n"));
03049
03050 q_c->group_pol = *hnd;
03051 }
03052
03053
03054
03055
03056
03057 BOOL samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u,
03058 prs_struct *ps, int depth)
03059 {
03060 if (q_u == NULL)
03061 return False;
03062
03063 prs_debug(ps, depth, desc, "samr_io_q_query_groupmem");
03064 depth++;
03065
03066 if(!prs_align(ps))
03067 return False;
03068
03069 if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
03070 return False;
03071
03072 return True;
03073 }
03074
03075
03076
03077
03078
03079 void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u,
03080 uint32 num_entries, uint32 *rid,
03081 uint32 *attr, NTSTATUS status)
03082 {
03083 DEBUG(5, ("init_samr_r_query_groupmem\n"));
03084
03085 if (NT_STATUS_IS_OK(status)) {
03086 r_u->ptr = 1;
03087 r_u->num_entries = num_entries;
03088
03089 r_u->ptr_attrs = attr != NULL ? 1 : 0;
03090 r_u->ptr_rids = rid != NULL ? 1 : 0;
03091
03092 r_u->num_rids = num_entries;
03093 r_u->rid = rid;
03094
03095 r_u->num_attrs = num_entries;
03096 r_u->attr = attr;
03097 } else {
03098 r_u->ptr = 0;
03099 r_u->num_entries = 0;
03100 }
03101
03102 r_u->status = status;
03103 }
03104
03105
03106
03107
03108
03109 BOOL samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u,
03110 prs_struct *ps, int depth)
03111 {
03112 uint32 i;
03113
03114 if (r_u == NULL)
03115 return False;
03116
03117 if (UNMARSHALLING(ps))
03118 ZERO_STRUCTP(r_u);
03119
03120 prs_debug(ps, depth, desc, "samr_io_r_query_groupmem");
03121 depth++;
03122
03123 if(!prs_align(ps))
03124 return False;
03125
03126 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
03127 return False;
03128 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
03129 return False;
03130
03131 if (r_u->ptr != 0) {
03132 if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
03133 return False;
03134 if(!prs_uint32("ptr_attrs", ps, depth, &r_u->ptr_attrs))
03135 return False;
03136
03137 if (r_u->ptr_rids != 0) {
03138 if(!prs_uint32("num_rids", ps, depth, &r_u->num_rids))
03139 return False;
03140 if (UNMARSHALLING(ps) && r_u->num_rids != 0) {
03141 r_u->rid = PRS_ALLOC_MEM(ps,uint32,r_u->num_rids);
03142 if (r_u->rid == NULL)
03143 return False;
03144 }
03145
03146 for (i = 0; i < r_u->num_rids; i++) {
03147 if(!prs_uint32("", ps, depth, &r_u->rid[i]))
03148 return False;
03149 }
03150 }
03151
03152 if (r_u->ptr_attrs != 0) {
03153 if(!prs_uint32("num_attrs", ps, depth, &r_u->num_attrs))
03154 return False;
03155
03156 if (UNMARSHALLING(ps) && r_u->num_attrs != 0) {
03157 r_u->attr = PRS_ALLOC_MEM(ps,uint32,r_u->num_attrs);
03158 if (r_u->attr == NULL)
03159 return False;
03160 }
03161
03162 for (i = 0; i < r_u->num_attrs; i++) {
03163 if(!prs_uint32("", ps, depth, &r_u->attr[i]))
03164 return False;
03165 }
03166 }
03167 }
03168
03169 if(!prs_ntstatus("status", ps, depth, &r_u->status))
03170 return False;
03171
03172 return True;
03173 }
03174
03175
03176
03177
03178
03179 void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS * q_u,
03180 POLICY_HND *hnd)
03181 {
03182 DEBUG(5, ("init_samr_q_query_usergroups\n"));
03183
03184 q_u->pol = *hnd;
03185 }
03186
03187
03188
03189
03190
03191 BOOL samr_io_q_query_usergroups(const char *desc, SAMR_Q_QUERY_USERGROUPS * q_u,
03192 prs_struct *ps, int depth)
03193 {
03194 if (q_u == NULL)
03195 return False;
03196
03197 prs_debug(ps, depth, desc, "samr_io_q_query_usergroups");
03198 depth++;
03199
03200 if(!prs_align(ps))
03201 return False;
03202
03203 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
03204 return False;
03205
03206 return True;
03207 }
03208
03209
03210
03211
03212
03213 void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS * r_u,
03214 uint32 num_gids, DOM_GID * gid,
03215 NTSTATUS status)
03216 {
03217 DEBUG(5, ("init_samr_r_query_usergroups\n"));
03218
03219 if (NT_STATUS_IS_OK(status)) {
03220 r_u->ptr_0 = 1;
03221 r_u->num_entries = num_gids;
03222 r_u->ptr_1 = (num_gids != 0) ? 1 : 0;
03223 r_u->num_entries2 = num_gids;
03224
03225 r_u->gid = gid;
03226 } else {
03227 r_u->ptr_0 = 0;
03228 r_u->num_entries = 0;
03229 r_u->ptr_1 = 0;
03230 r_u->gid = NULL;
03231 }
03232
03233 r_u->status = status;
03234 }
03235
03236
03237
03238
03239
03240 BOOL samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid,
03241 prs_struct *ps, int depth)
03242 {
03243 uint32 i;
03244 if (gid == NULL)
03245 return False;
03246
03247 prs_debug(ps, depth, desc, "samr_io_gids");
03248 depth++;
03249
03250 if(!prs_align(ps))
03251 return False;
03252
03253 if(!prs_uint32("num_gids", ps, depth, num_gids))
03254 return False;
03255
03256 if ((*num_gids) != 0) {
03257 if (UNMARSHALLING(ps)) {
03258 (*gid) = PRS_ALLOC_MEM(ps,DOM_GID,*num_gids);
03259 }
03260
03261 if ((*gid) == NULL) {
03262 return False;
03263 }
03264
03265 for (i = 0; i < (*num_gids); i++) {
03266 if(!smb_io_gid("gids", &(*gid)[i], ps, depth))
03267 return False;
03268 }
03269 }
03270
03271 return True;
03272 }
03273
03274
03275
03276
03277
03278 BOOL samr_io_r_query_usergroups(const char *desc, SAMR_R_QUERY_USERGROUPS * r_u,
03279 prs_struct *ps, int depth)
03280 {
03281 if (r_u == NULL)
03282 return False;
03283
03284 prs_debug(ps, depth, desc, "samr_io_r_query_usergroups");
03285 depth++;
03286
03287 if(!prs_align(ps))
03288 return False;
03289
03290 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
03291 return False;
03292
03293 if (r_u->ptr_0 != 0) {
03294 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
03295 return False;
03296 if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1))
03297 return False;
03298
03299 if (r_u->num_entries != 0 && r_u->ptr_1 != 0) {
03300 if(!samr_io_gids("gids", &r_u->num_entries2, &r_u->gid, ps, depth))
03301 return False;
03302 }
03303 }
03304
03305 if(!prs_align(ps))
03306 return False;
03307 if(!prs_ntstatus("status", ps, depth, &r_u->status))
03308 return False;
03309
03310 return True;
03311 }
03312
03313
03314
03315
03316
03317 void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS * q_e,
03318 POLICY_HND *pol,
03319 uint32 start_idx, uint32 size)
03320 {
03321 DEBUG(5, ("init_samr_q_enum_domains\n"));
03322
03323 q_e->pol = *pol;
03324
03325 q_e->start_idx = start_idx;
03326 q_e->max_size = size;
03327 }
03328
03329
03330
03331
03332
03333 BOOL samr_io_q_enum_domains(const char *desc, SAMR_Q_ENUM_DOMAINS * q_e,
03334 prs_struct *ps, int depth)
03335 {
03336 if (q_e == NULL)
03337 return False;
03338
03339 prs_debug(ps, depth, desc, "samr_io_q_enum_domains");
03340 depth++;
03341
03342 if(!prs_align(ps))
03343 return False;
03344
03345 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
03346 return False;
03347
03348 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
03349 return False;
03350 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
03351 return False;
03352
03353 return True;
03354 }
03355
03356
03357
03358
03359
03360 void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u,
03361 uint32 next_idx, uint32 num_sam_entries)
03362 {
03363 DEBUG(5, ("init_samr_r_enum_domains\n"));
03364
03365 r_u->next_idx = next_idx;
03366
03367 if (num_sam_entries != 0) {
03368 r_u->ptr_entries1 = 1;
03369 r_u->ptr_entries2 = 1;
03370 r_u->num_entries2 = num_sam_entries;
03371 r_u->num_entries3 = num_sam_entries;
03372
03373 r_u->num_entries4 = num_sam_entries;
03374 } else {
03375 r_u->ptr_entries1 = 0;
03376 r_u->num_entries2 = num_sam_entries;
03377 r_u->ptr_entries2 = 1;
03378 }
03379 }
03380
03381
03382
03383
03384
03385 BOOL samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u,
03386 prs_struct *ps, int depth)
03387 {
03388 uint32 i;
03389
03390 if (r_u == NULL)
03391 return False;
03392
03393 prs_debug(ps, depth, desc, "samr_io_r_enum_domains");
03394 depth++;
03395
03396 if(!prs_align(ps))
03397 return False;
03398
03399 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
03400 return False;
03401 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
03402 return False;
03403
03404 if (r_u->ptr_entries1 != 0) {
03405 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
03406 return False;
03407 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
03408 return False;
03409 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
03410 return False;
03411
03412 if (UNMARSHALLING(ps) && r_u->num_entries2) {
03413 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
03414 r_u->uni_dom_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
03415 }
03416
03417 if ((r_u->sam == NULL || r_u->uni_dom_name == NULL) && r_u->num_entries2 != 0) {
03418 DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
03419 r_u->num_entries4 = 0;
03420 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
03421 return False;
03422 }
03423
03424 for (i = 0; i < r_u->num_entries2; i++) {
03425 fstring tmp;
03426 slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
03427 if(!sam_io_sam_entry(tmp, &r_u->sam[i], ps, depth))
03428 return False;
03429 }
03430
03431 for (i = 0; i < r_u->num_entries2; i++) {
03432 fstring tmp;
03433 slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
03434 if(!smb_io_unistr2(tmp, &r_u->uni_dom_name[i],
03435 r_u->sam[i].hdr_name.buffer, ps,
03436 depth))
03437 return False;
03438 }
03439
03440 }
03441
03442 if(!prs_align(ps))
03443 return False;
03444 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
03445 return False;
03446 if(!prs_ntstatus("status", ps, depth, &r_u->status))
03447 return False;
03448
03449 return True;
03450 }
03451
03452
03453
03454
03455
03456 void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS * q_e,
03457 POLICY_HND *pol,
03458 uint32 start_idx, uint32 size)
03459 {
03460 DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
03461
03462 q_e->pol = *pol;
03463
03464 q_e->start_idx = start_idx;
03465 q_e->max_size = size;
03466 }
03467
03468
03469
03470
03471
03472 BOOL samr_io_q_enum_dom_groups(const char *desc, SAMR_Q_ENUM_DOM_GROUPS * q_e,
03473 prs_struct *ps, int depth)
03474 {
03475 if (q_e == NULL)
03476 return False;
03477
03478 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups");
03479 depth++;
03480
03481 if(!prs_align(ps))
03482 return False;
03483
03484 if(!smb_io_pol_hnd("pol", &(q_e->pol), ps, depth))
03485 return False;
03486
03487 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
03488 return False;
03489 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
03490 return False;
03491
03492 return True;
03493 }
03494
03495
03496
03497
03498
03499 void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS * r_u,
03500 uint32 next_idx, uint32 num_sam_entries)
03501 {
03502 DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
03503
03504 r_u->next_idx = next_idx;
03505
03506 if (num_sam_entries != 0) {
03507 r_u->ptr_entries1 = 1;
03508 r_u->ptr_entries2 = 1;
03509 r_u->num_entries2 = num_sam_entries;
03510 r_u->num_entries3 = num_sam_entries;
03511
03512 r_u->num_entries4 = num_sam_entries;
03513 } else {
03514 r_u->ptr_entries1 = 0;
03515 r_u->num_entries2 = num_sam_entries;
03516 r_u->ptr_entries2 = 1;
03517 }
03518 }
03519
03520
03521
03522
03523
03524 BOOL samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u,
03525 prs_struct *ps, int depth)
03526 {
03527 uint32 i;
03528
03529 if (r_u == NULL)
03530 return False;
03531
03532 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups");
03533 depth++;
03534
03535 if(!prs_align(ps))
03536 return False;
03537
03538 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
03539 return False;
03540 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
03541 return False;
03542
03543 if (r_u->ptr_entries1 != 0) {
03544 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
03545 return False;
03546 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
03547 return False;
03548 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
03549 return False;
03550
03551 if (UNMARSHALLING(ps) && r_u->num_entries2) {
03552 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
03553 r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
03554 }
03555
03556 if ((r_u->sam == NULL || r_u->uni_grp_name == NULL) && r_u->num_entries2 != 0) {
03557 DEBUG(0,
03558 ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
03559 r_u->num_entries4 = 0;
03560 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
03561 return False;
03562 }
03563
03564 for (i = 0; i < r_u->num_entries2; i++) {
03565 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
03566 return False;
03567 }
03568
03569 for (i = 0; i < r_u->num_entries2; i++) {
03570 if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
03571 r_u->sam[i].hdr_name.buffer, ps, depth))
03572 return False;
03573 }
03574 }
03575
03576 if(!prs_align(ps))
03577 return False;
03578 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
03579 return False;
03580 if(!prs_ntstatus("status", ps, depth, &r_u->status))
03581 return False;
03582
03583 return True;
03584 }
03585
03586
03587
03588
03589
03590 void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES * q_e,
03591 POLICY_HND *pol, uint32 start_idx,
03592 uint32 size)
03593 {
03594 DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
03595
03596 q_e->pol = *pol;
03597
03598 q_e->start_idx = start_idx;
03599 q_e->max_size = size;
03600 }
03601
03602
03603
03604
03605
03606
03607 BOOL samr_io_q_enum_dom_aliases(const char *desc, SAMR_Q_ENUM_DOM_ALIASES * q_e,
03608 prs_struct *ps, int depth)
03609 {
03610 if (q_e == NULL)
03611 return False;
03612
03613 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases");
03614 depth++;
03615
03616 if(!prs_align(ps))
03617 return False;
03618
03619 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
03620 return False;
03621
03622 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
03623 return False;
03624 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
03625 return False;
03626
03627 return True;
03628 }
03629
03630
03631
03632
03633
03634 void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 next_idx, uint32 num_sam_entries)
03635 {
03636 DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
03637
03638 r_u->next_idx = next_idx;
03639
03640 if (num_sam_entries != 0) {
03641 r_u->ptr_entries1 = 1;
03642 r_u->ptr_entries2 = 1;
03643 r_u->num_entries2 = num_sam_entries;
03644 r_u->num_entries3 = num_sam_entries;
03645
03646 r_u->num_entries4 = num_sam_entries;
03647 } else {
03648 r_u->ptr_entries1 = 0;
03649 r_u->num_entries2 = num_sam_entries;
03650 r_u->ptr_entries2 = 1;
03651 }
03652 }
03653
03654
03655
03656
03657
03658 BOOL samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u,
03659 prs_struct *ps, int depth)
03660 {
03661 uint32 i;
03662
03663 if (r_u == NULL)
03664 return False;
03665
03666 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases");
03667 depth++;
03668
03669 if(!prs_align(ps))
03670 return False;
03671
03672 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
03673 return False;
03674 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
03675 return False;
03676
03677 if (r_u->ptr_entries1 != 0) {
03678 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
03679 return False;
03680 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
03681 return False;
03682 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
03683 return False;
03684
03685 if (UNMARSHALLING(ps) && (r_u->num_entries2 > 0)) {
03686 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
03687 r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
03688 }
03689
03690 if (r_u->num_entries2 != 0 &&
03691 (r_u->sam == NULL || r_u->uni_grp_name == NULL)) {
03692 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
03693 r_u->num_entries4 = 0;
03694 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
03695 return False;
03696 }
03697
03698 for (i = 0; i < r_u->num_entries2; i++) {
03699 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
03700 return False;
03701 }
03702
03703 for (i = 0; i < r_u->num_entries2; i++) {
03704 if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
03705 r_u->sam[i].hdr_name.buffer, ps,
03706 depth))
03707 return False;
03708 }
03709 }
03710
03711 if(!prs_align(ps))
03712 return False;
03713 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
03714 return False;
03715 if(!prs_ntstatus("status", ps, depth, &r_u->status))
03716 return False;
03717
03718 return True;
03719 }
03720
03721
03722
03723
03724
03725 void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc)
03726 {
03727 DEBUG(5, ("init_samr_alias_info1\n"));
03728
03729 init_unistr4(&al1->name, acct_name, UNI_FLAGS_NONE);
03730 al1->num_member = num_member;
03731 init_unistr4(&al1->description, acct_desc, UNI_FLAGS_NONE);
03732 }
03733
03734
03735
03736
03737
03738 BOOL samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1,
03739 prs_struct *ps, int depth)
03740 {
03741 if (al1 == NULL)
03742 return False;
03743
03744 prs_debug(ps, depth, desc, "samr_io_alias_info1");
03745 depth++;
03746
03747 if(!prs_align(ps))
03748 return False;
03749
03750 if ( !prs_unistr4_hdr("name", ps, depth, &al1->name) )
03751 return False;
03752 if ( !prs_uint32("num_member", ps, depth, &al1->num_member) )
03753 return False;
03754 if ( !prs_unistr4_hdr("description", ps, depth, &al1->description) )
03755 return False;
03756
03757 if ( !prs_unistr4_str("name", ps, depth, &al1->name) )
03758 return False;
03759 if ( !prs_align(ps) )
03760 return False;
03761 if ( !prs_unistr4_str("description", ps, depth, &al1->description) )
03762 return False;
03763 if ( !prs_align(ps) )
03764 return False;
03765
03766 return True;
03767 }
03768
03769
03770
03771
03772
03773 void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc)
03774 {
03775 DEBUG(5, ("init_samr_alias_info3\n"));
03776
03777 init_unistr4(&al3->description, acct_desc, UNI_FLAGS_NONE);
03778 }
03779
03780
03781
03782
03783
03784 BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3,
03785 prs_struct *ps, int depth)
03786 {
03787 if (al3 == NULL)
03788 return False;
03789
03790 prs_debug(ps, depth, desc, "samr_io_alias_info3");
03791 depth++;
03792
03793 if(!prs_align(ps))
03794 return False;
03795
03796 if (!prs_unistr4("description", ps, depth, &al3->description))
03797 return False;
03798
03799 return True;
03800 }
03801
03802
03803
03804
03805
03806 BOOL samr_io_alias_info2(const char *desc, ALIAS_INFO2 *al2,
03807 prs_struct *ps, int depth)
03808 {
03809 if (al2 == NULL)
03810 return False;
03811
03812 prs_debug(ps, depth, desc, "samr_io_alias_info2");
03813 depth++;
03814
03815 if(!prs_align(ps))
03816 return False;
03817
03818 if (!prs_unistr4("name", ps, depth, &al2->name))
03819 return False;
03820
03821 return True;
03822 }
03823
03824
03825
03826
03827
03828 BOOL samr_alias_info_ctr(const char *desc, prs_struct *ps, int depth, ALIAS_INFO_CTR * ctr)
03829 {
03830 if ( !ctr )
03831 return False;
03832
03833 prs_debug(ps, depth, desc, "samr_alias_info_ctr");
03834 depth++;
03835
03836 if ( !prs_uint16("level", ps, depth, &ctr->level) )
03837 return False;
03838
03839 if(!prs_align(ps))
03840 return False;
03841 switch (ctr->level) {
03842 case 1:
03843 if(!samr_io_alias_info1("alias_info1", &ctr->alias.info1, ps, depth))
03844 return False;
03845 break;
03846 case 2:
03847 if(!samr_io_alias_info2("alias_info2", &ctr->alias.info2, ps, depth))
03848 return False;
03849 break;
03850 case 3:
03851 if(!samr_io_alias_info3("alias_info3", &ctr->alias.info3, ps, depth))
03852 return False;
03853 break;
03854 default:
03855 DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
03856 break;
03857 }
03858
03859 return True;
03860 }
03861
03862
03863
03864
03865
03866 void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO * q_e,
03867 POLICY_HND *pol, uint32 switch_level)
03868 {
03869 DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
03870
03871 q_e->pol = *pol;
03872 q_e->level = switch_level;
03873 }
03874
03875
03876
03877
03878
03879 BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO *in,
03880 prs_struct *ps, int depth)
03881 {
03882 if ( !in )
03883 return False;
03884
03885 prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo");
03886 depth++;
03887
03888 if(!prs_align(ps))
03889 return False;
03890
03891 if ( !smb_io_pol_hnd("pol", &(in->pol), ps, depth) )
03892 return False;
03893
03894 if ( !prs_uint16("level", ps, depth, &in->level) )
03895 return False;
03896
03897 return True;
03898 }
03899
03900
03901
03902
03903
03904 void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *out,
03905 ALIAS_INFO_CTR * ctr, NTSTATUS status)
03906 {
03907 DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
03908
03909 out->ctr = ctr;
03910 out->status = status;
03911 }
03912
03913
03914
03915
03916
03917 BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out,
03918 prs_struct *ps, int depth)
03919 {
03920 if ( !out )
03921 return False;
03922
03923 prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo");
03924 depth++;
03925
03926 if(!prs_align(ps))
03927 return False;
03928
03929 if ( !prs_pointer("alias", ps, depth, (void*)&out->ctr, sizeof(ALIAS_INFO_CTR), (PRS_POINTER_CAST)samr_alias_info_ctr))
03930 return False;
03931 if(!prs_align(ps))
03932 return False;
03933
03934 if(!prs_ntstatus("status", ps, depth, &out->status))
03935 return False;
03936
03937 return True;
03938 }
03939
03940
03941
03942
03943
03944 void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO * q_u,
03945 POLICY_HND *hnd, ALIAS_INFO_CTR * ctr)
03946 {
03947 DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
03948
03949 q_u->alias_pol = *hnd;
03950 q_u->ctr = *ctr;
03951 }
03952
03953
03954
03955
03956
03957 BOOL samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u,
03958 prs_struct *ps, int depth)
03959 {
03960 if (q_u == NULL)
03961 return False;
03962
03963 prs_debug(ps, depth, desc, "samr_io_q_set_aliasinfo");
03964 depth++;
03965
03966 if(!prs_align(ps))
03967 return False;
03968
03969 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
03970 return False;
03971 if(!samr_alias_info_ctr("ctr", ps, depth, &q_u->ctr))
03972 return False;
03973
03974 return True;
03975 }
03976
03977
03978
03979
03980
03981 BOOL samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u,
03982 prs_struct *ps, int depth)
03983 {
03984 if (r_u == NULL)
03985 return False;
03986
03987 prs_debug(ps, depth, desc, "samr_io_r_set_aliasinfo");
03988 depth++;
03989
03990 if(!prs_align(ps))
03991 return False;
03992 if(!prs_ntstatus("status", ps, depth, &r_u->status))
03993 return False;
03994
03995 return True;
03996 }
03997
03998
03999
04000
04001
04002 void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES * q_u,
04003 POLICY_HND *hnd,
04004 uint32 num_sids,
04005 uint32 *ptr_sid, DOM_SID2 * sid)
04006 {
04007 DEBUG(5, ("init_samr_q_query_useraliases\n"));
04008
04009 q_u->pol = *hnd;
04010
04011 q_u->num_sids1 = num_sids;
04012 q_u->ptr = 1;
04013 q_u->num_sids2 = num_sids;
04014
04015 q_u->ptr_sid = ptr_sid;
04016 q_u->sid = sid;
04017 }
04018
04019
04020
04021
04022
04023 BOOL samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u,
04024 prs_struct *ps, int depth)
04025 {
04026 fstring tmp;
04027 uint32 i;
04028
04029 if (q_u == NULL)
04030 return False;
04031
04032 prs_debug(ps, depth, desc, "samr_io_q_query_useraliases");
04033 depth++;
04034
04035 if(!prs_align(ps))
04036 return False;
04037
04038 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
04039 return False;
04040
04041 if(!prs_uint32("num_sids1", ps, depth, &q_u->num_sids1))
04042 return False;
04043 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
04044 return False;
04045
04046 if (q_u->ptr==0)
04047 return True;
04048
04049 if(!prs_uint32("num_sids2", ps, depth, &q_u->num_sids2))
04050 return False;
04051
04052 if (UNMARSHALLING(ps) && (q_u->num_sids2 != 0)) {
04053 q_u->ptr_sid = PRS_ALLOC_MEM(ps,uint32,q_u->num_sids2);
04054 if (q_u->ptr_sid == NULL)
04055 return False;
04056
04057 q_u->sid = PRS_ALLOC_MEM(ps, DOM_SID2, q_u->num_sids2);
04058 if (q_u->sid == NULL)
04059 return False;
04060 }
04061
04062 for (i = 0; i < q_u->num_sids2; i++) {
04063 slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i);
04064 if(!prs_uint32(tmp, ps, depth, &q_u->ptr_sid[i]))
04065 return False;
04066 }
04067
04068 for (i = 0; i < q_u->num_sids2; i++) {
04069 if (q_u->ptr_sid[i] != 0) {
04070 slprintf(tmp, sizeof(tmp) - 1, "sid[%02d]", i);
04071 if(!smb_io_dom_sid2(tmp, &q_u->sid[i], ps, depth))
04072 return False;
04073 }
04074 }
04075
04076 return True;
04077 }
04078
04079
04080
04081
04082
04083 void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u,
04084 uint32 num_rids, uint32 *rid,
04085 NTSTATUS status)
04086 {
04087 DEBUG(5, ("init_samr_r_query_useraliases\n"));
04088
04089 if (NT_STATUS_IS_OK(status)) {
04090 r_u->num_entries = num_rids;
04091 r_u->ptr = 1;
04092 r_u->num_entries2 = num_rids;
04093
04094 r_u->rid = rid;
04095 } else {
04096 r_u->num_entries = 0;
04097 r_u->ptr = 0;
04098 r_u->num_entries2 = 0;
04099 }
04100
04101 r_u->status = status;
04102 }
04103
04104
04105
04106
04107
04108 BOOL samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid,
04109 prs_struct *ps, int depth)
04110 {
04111 fstring tmp;
04112 uint32 i;
04113 if (rid == NULL)
04114 return False;
04115
04116 prs_debug(ps, depth, desc, "samr_io_rids");
04117 depth++;
04118
04119 if(!prs_align(ps))
04120 return False;
04121
04122 if(!prs_uint32("num_rids", ps, depth, num_rids))
04123 return False;
04124
04125 if ((*num_rids) != 0) {
04126 if (UNMARSHALLING(ps)) {
04127
04128 (*rid) = PRS_ALLOC_MEM(ps,uint32, *num_rids);
04129 }
04130 if ((*rid) == NULL)
04131 return False;
04132
04133 for (i = 0; i < (*num_rids); i++) {
04134 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d]", i);
04135 if(!prs_uint32(tmp, ps, depth, &((*rid)[i])))
04136 return False;
04137 }
04138 }
04139
04140 return True;
04141 }
04142
04143
04144
04145
04146
04147 BOOL samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u,
04148 prs_struct *ps, int depth)
04149 {
04150 if (r_u == NULL)
04151 return False;
04152
04153 prs_debug(ps, depth, desc, "samr_io_r_query_useraliases");
04154 depth++;
04155
04156 if(!prs_align(ps))
04157 return False;
04158
04159 if(!prs_uint32("num_entries", ps, depth, &r_u->num_entries))
04160 return False;
04161 if(!prs_uint32("ptr ", ps, depth, &r_u->ptr))
04162 return False;
04163
04164 if (r_u->ptr != 0) {
04165 if(!samr_io_rids("rids", &r_u->num_entries2, &r_u->rid, ps, depth))
04166 return False;
04167 }
04168
04169 if(!prs_align(ps))
04170 return False;
04171 if(!prs_ntstatus("status", ps, depth, &r_u->status))
04172 return False;
04173
04174 return True;
04175 }
04176
04177
04178
04179
04180
04181 void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol,
04182 uint32 access_mask, uint32 rid)
04183 {
04184 DEBUG(5, ("init_samr_q_open_alias\n"));
04185
04186 q_u->dom_pol = *pol;
04187 q_u->access_mask = access_mask;
04188 q_u->rid_alias = rid;
04189 }
04190
04191
04192
04193
04194
04195 BOOL samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u,
04196 prs_struct *ps, int depth)
04197 {
04198 if (q_u == NULL)
04199 return False;
04200
04201 prs_debug(ps, depth, desc, "samr_io_q_open_alias");
04202 depth++;
04203
04204 if(!prs_align(ps))
04205 return False;
04206
04207 if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
04208 return False;
04209
04210 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
04211 return False;
04212 if(!prs_uint32("rid_alias", ps, depth, &q_u->rid_alias))
04213 return False;
04214
04215 return True;
04216 }
04217
04218
04219
04220
04221
04222 BOOL samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u,
04223 prs_struct *ps, int depth)
04224 {
04225 if (r_u == NULL)
04226 return False;
04227
04228 prs_debug(ps, depth, desc, "samr_io_r_open_alias");
04229 depth++;
04230
04231 if(!prs_align(ps))
04232 return False;
04233
04234 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
04235 return False;
04236
04237 if(!prs_ntstatus("status", ps, depth, &r_u->status))
04238 return False;
04239
04240 return True;
04241 }
04242
04243
04244
04245
04246
04247 void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u,
04248 POLICY_HND *pol, uint32 flags,
04249 uint32 num_rids, uint32 *rid)
04250 {
04251 DEBUG(5, ("init_samr_q_lookup_rids\n"));
04252
04253 q_u->pol = *pol;
04254
04255 q_u->num_rids1 = num_rids;
04256 q_u->flags = flags;
04257 q_u->ptr = 0;
04258 q_u->num_rids2 = num_rids;
04259 if (num_rids) {
04260 q_u->rid = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids );
04261 } else {
04262 q_u->rid = NULL;
04263 }
04264 if (q_u->rid == NULL) {
04265 q_u->num_rids1 = 0;
04266 q_u->num_rids2 = 0;
04267 } else {
04268 memcpy(q_u->rid, rid, num_rids * sizeof(q_u->rid[0]));
04269 }
04270 }
04271
04272
04273
04274
04275
04276 BOOL samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u,
04277 prs_struct *ps, int depth)
04278 {
04279 uint32 i;
04280 fstring tmp;
04281
04282 if (q_u == NULL)
04283 return False;
04284
04285 prs_debug(ps, depth, desc, "samr_io_q_lookup_rids");
04286 depth++;
04287
04288 if (UNMARSHALLING(ps))
04289 ZERO_STRUCTP(q_u);
04290
04291 if(!prs_align(ps))
04292 return False;
04293
04294 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
04295 return False;
04296
04297 if(!prs_uint32("num_rids1", ps, depth, &q_u->num_rids1))
04298 return False;
04299 if(!prs_uint32("flags ", ps, depth, &q_u->flags))
04300 return False;
04301 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
04302 return False;
04303 if(!prs_uint32("num_rids2", ps, depth, &q_u->num_rids2))
04304 return False;
04305
04306 if (UNMARSHALLING(ps) && (q_u->num_rids2 != 0)) {
04307 q_u->rid = PRS_ALLOC_MEM(ps, uint32, q_u->num_rids2);
04308 if (q_u->rid == NULL)
04309 return False;
04310 }
04311
04312 for (i = 0; i < q_u->num_rids2; i++) {
04313 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
04314 if(!prs_uint32(tmp, ps, depth, &q_u->rid[i]))
04315 return False;
04316 }
04317
04318 return True;
04319 }
04320
04321
04322
04323
04324
04325 void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS * r_u,
04326 uint32 num_names, UNIHDR * hdr_name,
04327 UNISTR2 *uni_name, uint32 *type)
04328 {
04329 DEBUG(5, ("init_samr_r_lookup_rids\n"));
04330
04331 r_u->hdr_name = NULL;
04332 r_u->uni_name = NULL;
04333 r_u->type = NULL;
04334
04335 if (num_names != 0) {
04336 r_u->num_names1 = num_names;
04337 r_u->ptr_names = 1;
04338 r_u->num_names2 = num_names;
04339
04340 r_u->num_types1 = num_names;
04341 r_u->ptr_types = 1;
04342 r_u->num_types2 = num_names;
04343
04344 r_u->hdr_name = hdr_name;
04345 r_u->uni_name = uni_name;
04346 r_u->type = type;
04347 } else {
04348 r_u->num_names1 = num_names;
04349 r_u->ptr_names = 0;
04350 r_u->num_names2 = num_names;
04351
04352 r_u->num_types1 = num_names;
04353 r_u->ptr_types = 0;
04354 r_u->num_types2 = num_names;
04355 }
04356 }
04357
04358
04359
04360
04361
04362 BOOL samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u,
04363 prs_struct *ps, int depth)
04364 {
04365 uint32 i;
04366 fstring tmp;
04367 if (r_u == NULL)
04368 return False;
04369
04370 prs_debug(ps, depth, desc, "samr_io_r_lookup_rids");
04371 depth++;
04372
04373 if(!prs_align(ps))
04374 return False;
04375
04376 if(!prs_uint32("num_names1", ps, depth, &r_u->num_names1))
04377 return False;
04378 if(!prs_uint32("ptr_names ", ps, depth, &r_u->ptr_names))
04379 return False;
04380
04381 if (r_u->ptr_names != 0) {
04382
04383 if(!prs_uint32("num_names2", ps, depth, &r_u->num_names2))
04384 return False;
04385
04386
04387 if (UNMARSHALLING(ps) && (r_u->num_names2 != 0)) {
04388 r_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, r_u->num_names2);
04389 if (r_u->hdr_name == NULL)
04390 return False;
04391
04392 r_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, r_u->num_names2);
04393 if (r_u->uni_name == NULL)
04394 return False;
04395 }
04396
04397 for (i = 0; i < r_u->num_names2; i++) {
04398 slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i);
04399 if(!smb_io_unihdr("", &r_u->hdr_name[i], ps, depth))
04400 return False;
04401 }
04402 for (i = 0; i < r_u->num_names2; i++) {
04403 slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i);
04404 if(!smb_io_unistr2("", &r_u->uni_name[i], r_u->hdr_name[i].buffer, ps, depth))
04405 return False;
04406 }
04407
04408 }
04409
04410 if(!prs_align(ps))
04411 return False;
04412 if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
04413 return False;
04414 if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
04415 return False;
04416
04417 if (r_u->ptr_types != 0) {
04418
04419 if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
04420 return False;
04421
04422 if (UNMARSHALLING(ps) && (r_u->num_types2 != 0)) {
04423 r_u->type = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
04424 if (r_u->type == NULL)
04425 return False;
04426 }
04427
04428 for (i = 0; i < r_u->num_types2; i++) {
04429 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
04430 if(!prs_uint32(tmp, ps, depth, &r_u->type[i]))
04431 return False;
04432 }
04433 }
04434
04435 if(!prs_ntstatus("status", ps, depth, &r_u->status))
04436 return False;
04437
04438 return True;
04439 }
04440
04441
04442
04443
04444
04445 void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd)
04446 {
04447 DEBUG(5, ("init_samr_q_delete_alias\n"));
04448
04449 q_u->alias_pol = *hnd;
04450 }
04451
04452
04453
04454
04455
04456 BOOL samr_io_q_delete_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
04457 prs_struct *ps, int depth)
04458 {
04459 if (q_u == NULL)
04460 return False;
04461
04462 prs_debug(ps, depth, desc, "samr_io_q_delete_alias");
04463 depth++;
04464
04465 if(!prs_align(ps))
04466 return False;
04467
04468 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
04469 return False;
04470
04471 return True;
04472 }
04473
04474
04475
04476
04477
04478 BOOL samr_io_r_delete_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
04479 prs_struct *ps, int depth)
04480 {
04481 if (r_u == NULL)
04482 return False;
04483
04484 prs_debug(ps, depth, desc, "samr_io_r_delete_alias");
04485 depth++;
04486
04487 if(!prs_align(ps))
04488 return False;
04489
04490 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
04491 return False;
04492 if(!prs_ntstatus("status", ps, depth, &r_u->status))
04493 return False;
04494
04495 return True;
04496 }
04497
04498
04499
04500
04501
04502 void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u,
04503 POLICY_HND *hnd, const char *acct_desc)
04504 {
04505 DEBUG(5, ("init_samr_q_create_dom_alias\n"));
04506
04507 q_u->dom_pol = *hnd;
04508
04509 init_unistr2(&q_u->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
04510 init_uni_hdr(&q_u->hdr_acct_desc, &q_u->uni_acct_desc);
04511
04512 q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
04513 }
04514
04515
04516
04517
04518
04519 BOOL samr_io_q_create_dom_alias(const char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u,
04520 prs_struct *ps, int depth)
04521 {
04522 if (q_u == NULL)
04523 return False;
04524
04525 prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias");
04526 depth++;
04527
04528 if(!prs_align(ps))
04529 return False;
04530
04531 if(!smb_io_pol_hnd("dom_pol", &q_u->dom_pol, ps, depth))
04532 return False;
04533
04534 if(!smb_io_unihdr("hdr_acct_desc", &q_u->hdr_acct_desc, ps, depth))
04535 return False;
04536 if(!smb_io_unistr2("uni_acct_desc", &q_u->uni_acct_desc,
04537 q_u->hdr_acct_desc.buffer, ps, depth))
04538 return False;
04539
04540 if(!prs_align(ps))
04541 return False;
04542 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
04543 return False;
04544
04545 return True;
04546 }
04547
04548
04549
04550
04551
04552 BOOL samr_io_r_create_dom_alias(const char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u,
04553 prs_struct *ps, int depth)
04554 {
04555 if (r_u == NULL)
04556 return False;
04557
04558 prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias");
04559 depth++;
04560
04561 if(!prs_align(ps))
04562 return False;
04563
04564 if(!smb_io_pol_hnd("alias_pol", &r_u->alias_pol, ps, depth))
04565 return False;
04566
04567 if(!prs_uint32("rid", ps, depth, &r_u->rid))
04568 return False;
04569
04570 if(!prs_ntstatus("status", ps, depth, &r_u->status))
04571 return False;
04572
04573 return True;
04574 }
04575
04576
04577
04578
04579
04580 void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND *hnd,
04581 DOM_SID *sid)
04582 {
04583 DEBUG(5, ("init_samr_q_add_aliasmem\n"));
04584
04585 q_u->alias_pol = *hnd;
04586 init_dom_sid2(&q_u->sid, sid);
04587 }
04588
04589
04590
04591
04592
04593 BOOL samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u,
04594 prs_struct *ps, int depth)
04595 {
04596 if (q_u == NULL)
04597 return False;
04598
04599 prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem");
04600 depth++;
04601
04602 if(!prs_align(ps))
04603 return False;
04604
04605 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
04606 return False;
04607 if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
04608 return False;
04609
04610 return True;
04611 }
04612
04613
04614
04615
04616
04617 BOOL samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u,
04618 prs_struct *ps, int depth)
04619 {
04620 if (r_u == NULL)
04621 return False;
04622
04623 prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
04624 depth++;
04625
04626 if(!prs_align(ps))
04627 return False;
04628
04629 if(!prs_ntstatus("status", ps, depth, &r_u->status))
04630 return False;
04631
04632 return True;
04633 }
04634
04635
04636
04637
04638
04639 void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd,
04640 DOM_SID *sid)
04641 {
04642 DEBUG(5, ("init_samr_q_del_aliasmem\n"));
04643
04644 q_u->alias_pol = *hnd;
04645 init_dom_sid2(&q_u->sid, sid);
04646 }
04647
04648
04649
04650
04651
04652 BOOL samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u,
04653 prs_struct *ps, int depth)
04654 {
04655 if (q_u == NULL)
04656 return False;
04657
04658 prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
04659 depth++;
04660
04661 if(!prs_align(ps))
04662 return False;
04663
04664 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
04665 return False;
04666 if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
04667 return False;
04668
04669 return True;
04670 }
04671
04672
04673
04674
04675
04676 BOOL samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u,
04677 prs_struct *ps, int depth)
04678 {
04679 if (r_u == NULL)
04680 return False;
04681
04682 prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
04683 depth++;
04684
04685 if(!prs_align(ps))
04686 return False;
04687
04688 if(!prs_ntstatus("status", ps, depth, &r_u->status))
04689 return False;
04690
04691 return True;
04692 }
04693
04694
04695
04696
04697
04698 void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c,
04699 POLICY_HND *hnd)
04700 {
04701 DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
04702
04703 q_c->alias_pol = *hnd;
04704 }
04705
04706
04707
04708
04709
04710 BOOL samr_io_q_delete_dom_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
04711 prs_struct *ps, int depth)
04712 {
04713 if (q_u == NULL)
04714 return False;
04715
04716 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias");
04717 depth++;
04718
04719 if(!prs_align(ps))
04720 return False;
04721
04722 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
04723 return False;
04724
04725 return True;
04726 }
04727
04728
04729
04730
04731
04732 void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u,
04733 NTSTATUS status)
04734 {
04735 DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
04736
04737 r_u->status = status;
04738 }
04739
04740
04741
04742
04743
04744 BOOL samr_io_r_delete_dom_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
04745 prs_struct *ps, int depth)
04746 {
04747 if (r_u == NULL)
04748 return False;
04749
04750 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias");
04751 depth++;
04752
04753 if(!prs_align(ps))
04754 return False;
04755
04756 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
04757 return False;
04758
04759 if(!prs_ntstatus("status", ps, depth, &r_u->status))
04760 return False;
04761
04762 return True;
04763 }
04764
04765
04766
04767
04768
04769 void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c,
04770 POLICY_HND *hnd)
04771 {
04772 DEBUG(5, ("init_samr_q_query_aliasmem\n"));
04773
04774 q_c->alias_pol = *hnd;
04775 }
04776
04777
04778
04779
04780
04781 BOOL samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u,
04782 prs_struct *ps, int depth)
04783 {
04784 if (q_u == NULL)
04785 return False;
04786
04787 prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem");
04788 depth++;
04789
04790 if(!prs_align(ps))
04791 return False;
04792
04793 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
04794 return False;
04795
04796 return True;
04797 }
04798
04799
04800
04801
04802
04803 void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u,
04804 uint32 num_sids, DOM_SID2 * sid,
04805 NTSTATUS status)
04806 {
04807 DEBUG(5, ("init_samr_r_query_aliasmem\n"));
04808
04809 if (NT_STATUS_IS_OK(status)) {
04810 r_u->num_sids = num_sids;
04811 r_u->ptr = (num_sids != 0) ? 1 : 0;
04812 r_u->num_sids1 = num_sids;
04813
04814 r_u->sid = sid;
04815 } else {
04816 r_u->ptr = 0;
04817 r_u->num_sids = 0;
04818 }
04819
04820 r_u->status = status;
04821 }
04822
04823
04824
04825
04826
04827 BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u,
04828 prs_struct *ps, int depth)
04829 {
04830 uint32 i;
04831
04832 if (r_u == NULL)
04833 return False;
04834
04835 prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem");
04836 depth++;
04837
04838 if(!prs_align(ps))
04839 return False;
04840
04841 if(!prs_uint32("num_sids ", ps, depth, &r_u->num_sids))
04842 return False;
04843 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
04844 return False;
04845
04846 if (r_u->ptr != 0 && r_u->num_sids != 0) {
04847 uint32 *ptr_sid = NULL;
04848
04849 if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1))
04850 return False;
04851
04852
04853 if (r_u->num_sids1) {
04854 ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1);
04855 if (!ptr_sid) {
04856 return False;
04857 }
04858 } else {
04859 ptr_sid = NULL;
04860 }
04861
04862 for (i = 0; i < r_u->num_sids1; i++) {
04863 ptr_sid[i] = 1;
04864 if(!prs_uint32("ptr_sid", ps, depth, &ptr_sid[i]))
04865 return False;
04866 }
04867
04868 if (UNMARSHALLING(ps)) {
04869 if (r_u->num_sids1) {
04870 r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1);
04871 if (!r_u->sid) {
04872 return False;
04873 }
04874 } else {
04875 r_u->sid = NULL;
04876 }
04877 }
04878
04879 for (i = 0; i < r_u->num_sids1; i++) {
04880 if (ptr_sid[i] != 0) {
04881 if(!smb_io_dom_sid2("sid", &r_u->sid[i], ps, depth))
04882 return False;
04883 }
04884 }
04885 }
04886
04887 if(!prs_align(ps))
04888 return False;
04889 if(!prs_ntstatus("status", ps, depth, &r_u->status))
04890 return False;
04891
04892 return True;
04893 }
04894
04895
04896
04897
04898
04899 NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u,
04900 POLICY_HND *pol, uint32 flags,
04901 uint32 num_names, const char **name)
04902 {
04903 uint32 i;
04904
04905 DEBUG(5, ("init_samr_q_lookup_names\n"));
04906
04907 q_u->pol = *pol;
04908
04909 q_u->num_names1 = num_names;
04910 q_u->flags = flags;
04911 q_u->ptr = 0;
04912 q_u->num_names2 = num_names;
04913
04914 if (num_names) {
04915 if (!(q_u->hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names)))
04916 return NT_STATUS_NO_MEMORY;
04917
04918 if (!(q_u->uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_names)))
04919 return NT_STATUS_NO_MEMORY;
04920 } else {
04921 q_u->hdr_name = NULL;
04922 q_u->uni_name = NULL;
04923 }
04924
04925 for (i = 0; i < num_names; i++) {
04926 init_unistr2(&q_u->uni_name[i], name[i], UNI_FLAGS_NONE);
04927 init_uni_hdr(&q_u->hdr_name[i], &q_u->uni_name[i]);
04928 }
04929
04930 return NT_STATUS_OK;
04931 }
04932
04933
04934
04935
04936
04937 BOOL samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u,
04938 prs_struct *ps, int depth)
04939 {
04940 uint32 i;
04941
04942 if (q_u == NULL)
04943 return False;
04944
04945 prs_debug(ps, depth, desc, "samr_io_q_lookup_names");
04946 depth++;
04947
04948 if (UNMARSHALLING(ps))
04949 ZERO_STRUCTP(q_u);
04950
04951 if(!prs_align(ps))
04952 return False;
04953
04954 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
04955 return False;
04956
04957 if(!prs_uint32("num_names1", ps, depth, &q_u->num_names1))
04958 return False;
04959 if(!prs_uint32("flags ", ps, depth, &q_u->flags))
04960 return False;
04961 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
04962 return False;
04963 if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2))
04964 return False;
04965
04966 if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) {
04967 q_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_u->num_names2);
04968 q_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_u->num_names2);
04969 if (!q_u->hdr_name || !q_u->uni_name)
04970 return False;
04971 }
04972
04973 for (i = 0; i < q_u->num_names2; i++) {
04974 if(!smb_io_unihdr("", &q_u->hdr_name[i], ps, depth))
04975 return False;
04976 }
04977
04978 for (i = 0; i < q_u->num_names2; i++) {
04979 if(!smb_io_unistr2("", &q_u->uni_name[i], q_u->hdr_name[i].buffer, ps, depth))
04980 return False;
04981 }
04982
04983 return True;
04984 }
04985
04986
04987
04988
04989
04990 NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u,
04991 uint32 num_rids,
04992 uint32 *rid, enum lsa_SidType *type,
04993 NTSTATUS status)
04994 {
04995 DEBUG(5, ("init_samr_r_lookup_names\n"));
04996
04997 if (NT_STATUS_IS_OK(status) && (num_rids != 0)) {
04998 uint32 i;
04999
05000 r_u->num_types1 = num_rids;
05001 r_u->ptr_types = 1;
05002 r_u->num_types2 = num_rids;
05003
05004 r_u->num_rids1 = num_rids;
05005 r_u->ptr_rids = 1;
05006 r_u->num_rids2 = num_rids;
05007
05008 if (num_rids) {
05009 if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
05010 return NT_STATUS_NO_MEMORY;
05011 if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
05012 return NT_STATUS_NO_MEMORY;
05013 } else {
05014 r_u->rids = NULL;
05015 r_u->types = NULL;
05016 }
05017
05018 if (!r_u->rids || !r_u->types)
05019 goto empty;
05020
05021 for (i = 0; i < num_rids; i++) {
05022 r_u->rids[i] = rid[i];
05023 r_u->types[i] = type[i];
05024 }
05025 } else {
05026
05027 empty:
05028 r_u->num_types1 = 0;
05029 r_u->ptr_types = 0;
05030 r_u->num_types2 = 0;
05031
05032 r_u->num_rids1 = 0;
05033 r_u->ptr_rids = 0;
05034 r_u->num_rids2 = 0;
05035
05036 r_u->rids = NULL;
05037 r_u->types = NULL;
05038 }
05039
05040 r_u->status = status;
05041
05042 return NT_STATUS_OK;
05043 }
05044
05045
05046
05047
05048
05049 BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u,
05050 prs_struct *ps, int depth)
05051 {
05052 uint32 i;
05053 fstring tmp;
05054
05055 if (r_u == NULL)
05056 return False;
05057
05058 prs_debug(ps, depth, desc, "samr_io_r_lookup_names");
05059 depth++;
05060
05061 if (UNMARSHALLING(ps))
05062 ZERO_STRUCTP(r_u);
05063
05064 if(!prs_align(ps))
05065 return False;
05066
05067 if(!prs_uint32("num_rids1", ps, depth, &r_u->num_rids1))
05068 return False;
05069 if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
05070 return False;
05071
05072 if (r_u->ptr_rids != 0) {
05073 if(!prs_uint32("num_rids2", ps, depth, &r_u->num_rids2))
05074 return False;
05075
05076 if (r_u->num_rids2 != r_u->num_rids1) {
05077
05078 return False;
05079 }
05080
05081 if (UNMARSHALLING(ps) && r_u->num_rids2) {
05082 r_u->rids = PRS_ALLOC_MEM(ps, uint32, r_u->num_rids2);
05083
05084 if (!r_u->rids) {
05085 DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
05086 return False;
05087 }
05088 }
05089
05090 for (i = 0; i < r_u->num_rids2; i++) {
05091 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
05092 if(!prs_uint32(tmp, ps, depth, &r_u->rids[i]))
05093 return False;
05094 }
05095 }
05096
05097 if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
05098 return False;
05099 if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
05100 return False;
05101
05102 if (r_u->ptr_types != 0) {
05103 if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
05104 return False;
05105
05106 if (r_u->num_types2 != r_u->num_types1) {
05107
05108 return False;
05109 }
05110
05111 if (UNMARSHALLING(ps) && r_u->num_types2) {
05112 r_u->types = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
05113
05114 if (!r_u->types) {
05115 DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
05116 return False;
05117 }
05118 }
05119
05120 for (i = 0; i < r_u->num_types2; i++) {
05121 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
05122 if(!prs_uint32(tmp, ps, depth, &r_u->types[i]))
05123 return False;
05124 }
05125 }
05126
05127 if(!prs_ntstatus("status", ps, depth, &r_u->status))
05128 return False;
05129
05130 return True;
05131 }
05132
05133
05134
05135
05136
05137 void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c,
05138 POLICY_HND *hnd)
05139 {
05140 DEBUG(5, ("init_samr_q_delete_dom_user\n"));
05141
05142 q_c->user_pol = *hnd;
05143 }
05144
05145
05146
05147
05148
05149 BOOL samr_io_q_delete_dom_user(const char *desc, SAMR_Q_DELETE_DOM_USER * q_u,
05150 prs_struct *ps, int depth)
05151 {
05152 if (q_u == NULL)
05153 return False;
05154
05155 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_user");
05156 depth++;
05157
05158 if(!prs_align(ps))
05159 return False;
05160
05161 if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
05162 return False;
05163
05164 return True;
05165 }
05166
05167
05168
05169
05170
05171 BOOL samr_io_r_delete_dom_user(const char *desc, SAMR_R_DELETE_DOM_USER * r_u,
05172 prs_struct *ps, int depth)
05173 {
05174 if (r_u == NULL)
05175 return False;
05176
05177 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_user");
05178 depth++;
05179
05180 if(!prs_align(ps))
05181 return False;
05182
05183 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
05184 return False;
05185 if(!prs_ntstatus("status", ps, depth, &r_u->status))
05186 return False;
05187
05188 return True;
05189 }
05190
05191
05192
05193
05194
05195 void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u,
05196 POLICY_HND *pol,
05197 uint32 access_mask, uint32 rid)
05198 {
05199 DEBUG(5, ("samr_init_samr_q_open_user\n"));
05200
05201 q_u->domain_pol = *pol;
05202 q_u->access_mask = access_mask;
05203 q_u->user_rid = rid;
05204 }
05205
05206
05207
05208
05209
05210 BOOL samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u,
05211 prs_struct *ps, int depth)
05212 {
05213 if (q_u == NULL)
05214 return False;
05215
05216 prs_debug(ps, depth, desc, "samr_io_q_open_user");
05217 depth++;
05218
05219 if(!prs_align(ps))
05220 return False;
05221
05222 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
05223 return False;
05224
05225 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
05226 return False;
05227 if(!prs_uint32("user_rid ", ps, depth, &q_u->user_rid))
05228 return False;
05229
05230 return True;
05231 }
05232
05233
05234
05235
05236
05237 BOOL samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u,
05238 prs_struct *ps, int depth)
05239 {
05240 if (r_u == NULL)
05241 return False;
05242
05243 prs_debug(ps, depth, desc, "samr_io_r_open_user");
05244 depth++;
05245
05246 if(!prs_align(ps))
05247 return False;
05248
05249 if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
05250 return False;
05251
05252 if(!prs_ntstatus("status", ps, depth, &r_u->status))
05253 return False;
05254
05255 return True;
05256 }
05257
05258
05259
05260
05261
05262
05263 void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u,
05264 POLICY_HND *pol,
05265 const char *name,
05266 uint32 acb_info, uint32 acct_flags)
05267 {
05268 DEBUG(5, ("samr_init_samr_q_create_user\n"));
05269
05270 q_u->domain_pol = *pol;
05271
05272 init_unistr2(&q_u->uni_name, name, UNI_FLAGS_NONE);
05273 init_uni_hdr(&q_u->hdr_name, &q_u->uni_name);
05274
05275 q_u->acb_info = acb_info;
05276 q_u->acct_flags = acct_flags;
05277 }
05278
05279
05280
05281
05282
05283 BOOL samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u,
05284 prs_struct *ps, int depth)
05285 {
05286 if (q_u == NULL)
05287 return False;
05288
05289 prs_debug(ps, depth, desc, "samr_io_q_create_user");
05290 depth++;
05291
05292 if(!prs_align(ps))
05293 return False;
05294
05295 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
05296 return False;
05297
05298 if(!smb_io_unihdr("hdr_name", &q_u->hdr_name, ps, depth))
05299 return False;
05300 if(!smb_io_unistr2("uni_name", &q_u->uni_name, q_u->hdr_name.buffer, ps, depth))
05301 return False;
05302
05303 if(!prs_align(ps))
05304 return False;
05305 if(!prs_uint32("acb_info ", ps, depth, &q_u->acb_info))
05306 return False;
05307 if(!prs_uint32("acct_flags", ps, depth, &q_u->acct_flags))
05308 return False;
05309
05310 return True;
05311 }
05312
05313
05314
05315
05316
05317 BOOL samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u,
05318 prs_struct *ps, int depth)
05319 {
05320 if (r_u == NULL)
05321 return False;
05322
05323 prs_debug(ps, depth, desc, "samr_io_r_create_user");
05324 depth++;
05325
05326 if(!prs_align(ps))
05327 return False;
05328
05329 if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
05330 return False;
05331
05332 if(!prs_uint32("access_granted", ps, depth, &r_u->access_granted))
05333 return False;
05334 if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid))
05335 return False;
05336 if(!prs_ntstatus("status", ps, depth, &r_u->status))
05337 return False;
05338
05339 return True;
05340 }
05341
05342
05343
05344
05345
05346 void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u,
05347 const POLICY_HND *hnd, uint16 switch_value)
05348 {
05349 DEBUG(5, ("init_samr_q_query_userinfo\n"));
05350
05351 q_u->pol = *hnd;
05352 q_u->switch_value = switch_value;
05353 }
05354
05355
05356
05357
05358
05359 BOOL samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u,
05360 prs_struct *ps, int depth)
05361 {
05362 if (q_u == NULL)
05363 return False;
05364
05365 prs_debug(ps, depth, desc, "samr_io_q_query_userinfo");
05366 depth++;
05367
05368 if(!prs_align(ps))
05369 return False;
05370
05371 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
05372 return False;
05373
05374 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
05375 return False;
05376
05377 return True;
05378 }
05379
05380
05381
05382
05383
05384 static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs,
05385 prs_struct *ps, int depth)
05386 {
05387 if (hrs == NULL)
05388 return False;
05389
05390 prs_debug(ps, depth, desc, "sam_io_logon_hrs");
05391 depth++;
05392
05393 if(!prs_align(ps))
05394 return False;
05395
05396 if(!prs_uint32("maxlen", ps, depth, &hrs->max_len))
05397 return False;
05398
05399 if(!prs_uint32("offset", ps, depth, &hrs->offset))
05400 return False;
05401
05402 if(!prs_uint32("len ", ps, depth, &hrs->len))
05403 return False;
05404
05405 if (hrs->len > sizeof(hrs->hours)) {
05406 DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs->len));
05407 hrs->len = sizeof(hrs->hours);
05408 }
05409
05410 if(!prs_uint8s(False, "hours", ps, depth, hrs->hours, hrs->len))
05411 return False;
05412
05413 return True;
05414 }
05415
05416
05417
05418
05419
05420 void init_sam_user_info18(SAM_USER_INFO_18 * usr,
05421 const uint8 lm_pwd[16], const uint8 nt_pwd[16])
05422 {
05423 DEBUG(5, ("init_sam_user_info18\n"));
05424
05425 usr->lm_pwd_active =
05426 memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd)) ? 1 : 0;
05427 usr->nt_pwd_active =
05428 memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd)) ? 1 : 0;
05429 }
05430
05431
05432
05433
05434
05435 static BOOL sam_io_user_info18(const char *desc, SAM_USER_INFO_18 * u,
05436 prs_struct *ps, int depth)
05437 {
05438 if (u == NULL)
05439 return False;
05440
05441 prs_debug(ps, depth, desc, "samr_io_r_user_info18");
05442 depth++;
05443
05444 if(!prs_align(ps))
05445 return False;
05446
05447 if(!prs_uint8s(False, "lm_pwd", ps, depth, u->lm_pwd, sizeof(u->lm_pwd)))
05448 return False;
05449 if(!prs_uint8s(False, "nt_pwd", ps, depth, u->nt_pwd, sizeof(u->nt_pwd)))
05450 return False;
05451
05452 if(!prs_uint8("lm_pwd_active", ps, depth, &u->lm_pwd_active))
05453 return False;
05454 if(!prs_uint8("nt_pwd_active", ps, depth, &u->nt_pwd_active))
05455 return False;
05456
05457 return True;
05458 }
05459
05460
05461
05462
05463
05464 void init_sam_user_info7(SAM_USER_INFO_7 * usr, const char *name)
05465 {
05466 DEBUG(5, ("init_sam_user_info7\n"));
05467
05468 init_unistr2(&usr->uni_name, name, UNI_FLAGS_NONE);
05469 init_uni_hdr(&usr->hdr_name, &usr->uni_name);
05470
05471 }
05472
05473
05474
05475
05476
05477 static BOOL sam_io_user_info7(const char *desc, SAM_USER_INFO_7 * usr,
05478 prs_struct *ps, int depth)
05479 {
05480 if (usr == NULL)
05481 return False;
05482
05483 prs_debug(ps, depth, desc, "samr_io_r_user_info7");
05484 depth++;
05485
05486 if(!prs_align(ps))
05487 return False;
05488
05489 if(!smb_io_unihdr("unihdr", &usr->hdr_name, ps, depth))
05490 return False;
05491
05492 if(!smb_io_unistr2("unistr2", &usr->uni_name, True, ps, depth))
05493 return False;
05494
05495 return True;
05496 }
05497
05498
05499
05500
05501
05502 void init_sam_user_info9(SAM_USER_INFO_9 * usr, uint32 rid_group)
05503 {
05504 DEBUG(5, ("init_sam_user_info9\n"));
05505
05506 usr->rid_group = rid_group;
05507 }
05508
05509
05510
05511
05512
05513 static BOOL sam_io_user_info9(const char *desc, SAM_USER_INFO_9 * usr,
05514 prs_struct *ps, int depth)
05515 {
05516 if (usr == NULL)
05517 return False;
05518
05519 prs_debug(ps, depth, desc, "samr_io_r_user_info9");
05520 depth++;
05521
05522 if(!prs_align(ps))
05523 return False;
05524
05525 if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
05526 return False;
05527
05528 return True;
05529 }
05530
05531
05532
05533
05534
05535 void init_sam_user_info16(SAM_USER_INFO_16 * usr, uint32 acb_info)
05536 {
05537 DEBUG(5, ("init_sam_user_info16\n"));
05538
05539 usr->acb_info = acb_info;
05540 }
05541
05542
05543
05544
05545
05546 static BOOL sam_io_user_info16(const char *desc, SAM_USER_INFO_16 * usr,
05547 prs_struct *ps, int depth)
05548 {
05549 if (usr == NULL)
05550 return False;
05551
05552 prs_debug(ps, depth, desc, "samr_io_r_user_info16");
05553 depth++;
05554
05555 if(!prs_align(ps))
05556 return False;
05557
05558 if(!prs_uint32("acb_info", ps, depth, &usr->acb_info))
05559 return False;
05560
05561 return True;
05562 }
05563
05564
05565
05566
05567
05568 void init_sam_user_info17(SAM_USER_INFO_17 * usr,
05569 NTTIME * expiry,
05570 char *mach_acct,
05571 uint32 rid_user, uint32 rid_group, uint16 acct_ctrl)
05572 {
05573 DEBUG(5, ("init_sam_user_info17\n"));
05574
05575 memcpy(&usr->expiry, expiry, sizeof(usr->expiry));
05576 ZERO_STRUCT(usr->padding_1);
05577
05578 usr->padding_2 = 0;
05579
05580 usr->ptr_1 = 1;
05581 ZERO_STRUCT(usr->padding_3);
05582 usr->padding_4 = 0;
05583
05584 usr->ptr_2 = 1;
05585 usr->padding_5 = 0;
05586
05587 usr->ptr_3 = 1;
05588 ZERO_STRUCT(usr->padding_6);
05589
05590 usr->rid_user = rid_user;
05591 usr->rid_group = rid_group;
05592
05593 usr->acct_ctrl = acct_ctrl;
05594 usr->unknown_3 = 0x0000;
05595
05596 usr->unknown_4 = 0x003f;
05597 usr->unknown_5 = 0x003c;
05598
05599 ZERO_STRUCT(usr->padding_7);
05600 usr->padding_8 = 0;
05601
05602 init_unistr2(&usr->uni_mach_acct, mach_acct, UNI_FLAGS_NONE);
05603 init_uni_hdr(&usr->hdr_mach_acct, &usr->uni_mach_acct);
05604 }
05605
05606
05607
05608
05609
05610 static BOOL sam_io_user_info17(const char *desc, SAM_USER_INFO_17 * usr,
05611 prs_struct *ps, int depth)
05612 {
05613 if (usr == NULL)
05614 return False;
05615
05616 prs_debug(ps, depth, desc, "samr_io_r_unknown_17");
05617 depth++;
05618
05619 if(!prs_align(ps))
05620 return False;
05621
05622 if(!prs_uint8s(False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0)))
05623 return False;
05624
05625 if(!smb_io_time("time", &usr->expiry, ps, depth))
05626 return False;
05627
05628 if(!prs_uint8s(False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1)))
05629 return False;
05630
05631 if(!smb_io_unihdr("unihdr", &usr->hdr_mach_acct, ps, depth))
05632 return False;
05633
05634 if(!prs_uint32("padding_2", ps, depth, &usr->padding_2))
05635 return False;
05636
05637 if(!prs_uint32("ptr_1 ", ps, depth, &usr->ptr_1))
05638 return False;
05639 if(!prs_uint8s(False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3)))
05640 return False;
05641
05642 if(!prs_uint32("padding_4", ps, depth, &usr->padding_4))
05643 return False;
05644
05645 if(!prs_uint32("ptr_2 ", ps, depth, &usr->ptr_2))
05646 return False;
05647 if(!prs_uint32("padding_5", ps, depth, &usr->padding_5))
05648 return False;
05649
05650 if(!prs_uint32("ptr_3 ", ps, depth, &usr->ptr_3))
05651 return False;
05652 if(!prs_uint8s(False, "padding_6", ps, depth, usr->padding_6,sizeof(usr->padding_6)))
05653 return False;
05654
05655 if(!prs_uint32("rid_user ", ps, depth, &usr->rid_user))
05656 return False;
05657 if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
05658 return False;
05659 if(!prs_uint16("acct_ctrl", ps, depth, &usr->acct_ctrl))
05660 return False;
05661 if(!prs_uint16("unknown_3", ps, depth, &usr->unknown_3))
05662 return False;
05663 if(!prs_uint16("unknown_4", ps, depth, &usr->unknown_4))
05664 return False;
05665 if(!prs_uint16("unknown_5", ps, depth, &usr->unknown_5))
05666 return False;
05667
05668 if(!prs_uint8s(False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7)))
05669 return False;
05670
05671 if(!prs_uint32("padding_8", ps, depth, &(usr->padding_8)))
05672 return False;
05673
05674 if(!smb_io_unistr2("unistr2", &usr->uni_mach_acct, True, ps, depth))
05675 return False;
05676
05677 if(!prs_align(ps))
05678 return False;
05679
05680 if(!prs_uint8s(False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)))
05681 return False;
05682
05683 return True;
05684 }
05685
05686
05687
05688
05689
05690 void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516],
05691 uint8 pw_len)
05692 {
05693 DEBUG(10, ("init_sam_user_info24:\n"));
05694 memcpy(usr->pass, newpass, sizeof(usr->pass));
05695 usr->pw_len = pw_len;
05696 }
05697
05698
05699
05700
05701
05702 static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr,
05703 prs_struct *ps, int depth)
05704 {
05705 if (usr == NULL)
05706 return False;
05707
05708 prs_debug(ps, depth, desc, "sam_io_user_info24");
05709 depth++;
05710
05711 if(!prs_align(ps))
05712 return False;
05713
05714 if(!prs_uint8s(False, "password", ps, depth, usr->pass,
05715 sizeof(usr->pass)))
05716 return False;
05717
05718 if (MARSHALLING(ps) && (usr->pw_len != 0)) {
05719 if (!prs_uint8("pw_len", ps, depth, &usr->pw_len))
05720 return False;
05721 } else if (UNMARSHALLING(ps)) {
05722 if (!prs_uint8("pw_len", ps, depth, &usr->pw_len))
05723 return False;
05724 }
05725
05726 return True;
05727 }
05728
05729
05730
05731
05732
05733 static BOOL sam_io_user_info26(const char *desc, SAM_USER_INFO_26 * usr,
05734 prs_struct *ps, int depth)
05735 {
05736 if (usr == NULL)
05737 return False;
05738
05739 prs_debug(ps, depth, desc, "sam_io_user_info26");
05740 depth++;
05741
05742 if(!prs_align(ps))
05743 return False;
05744
05745 if(!prs_uint8s(False, "password", ps, depth, usr->pass,
05746 sizeof(usr->pass)))
05747 return False;
05748
05749 if (!prs_uint8("pw_len", ps, depth, &usr->pw_len))
05750 return False;
05751
05752 return True;
05753 }
05754
05755
05756
05757
05758
05759
05760
05761
05762
05763 void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time,
05764 NTTIME * logoff_time,
05765 NTTIME * kickoff_time,
05766 NTTIME * pass_last_set_time,
05767 NTTIME * pass_can_change_time,
05768 NTTIME * pass_must_change_time,
05769 UNISTR2 *user_name,
05770 UNISTR2 *full_name,
05771 UNISTR2 *home_dir,
05772 UNISTR2 *dir_drive,
05773 UNISTR2 *log_scr,
05774 UNISTR2 *prof_path,
05775 UNISTR2 *desc,
05776 UNISTR2 *wkstas,
05777 UNISTR2 *unk_str,
05778 UNISTR2 *mung_dial,
05779 uint32 user_rid,
05780 uint32 group_rid,
05781 uint32 acb_info,
05782 uint32 fields_present,
05783 uint16 logon_divs,
05784 LOGON_HRS * hrs,
05785 uint16 bad_password_count,
05786 uint16 logon_count,
05787 char newpass[516])
05788 {
05789 usr->logon_time = *logon_time;
05790 usr->logoff_time = *logoff_time;
05791 usr->kickoff_time = *kickoff_time;
05792 usr->pass_last_set_time = *pass_last_set_time;
05793 usr->pass_can_change_time = *pass_can_change_time;
05794 usr->pass_must_change_time = *pass_must_change_time;
05795
05796 ZERO_STRUCT(usr->nt_pwd);
05797 ZERO_STRUCT(usr->lm_pwd);
05798
05799 usr->user_rid = user_rid;
05800 usr->group_rid = group_rid;
05801 usr->acb_info = acb_info;
05802 usr->fields_present = fields_present;
05803
05804 usr->logon_divs = logon_divs;
05805 usr->ptr_logon_hrs = hrs ? 1 : 0;
05806
05807 if (nt_time_is_zero(pass_must_change_time)) {
05808 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
05809 } else {
05810 usr->passmustchange=0;
05811 }
05812
05813 ZERO_STRUCT(usr->padding1);
05814 ZERO_STRUCT(usr->padding2);
05815
05816 usr->bad_password_count = bad_password_count;
05817 usr->logon_count = logon_count;
05818
05819 memcpy(usr->pass, newpass, sizeof(usr->pass));
05820
05821 copy_unistr2(&usr->uni_user_name, user_name);
05822 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
05823
05824 copy_unistr2(&usr->uni_full_name, full_name);
05825 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
05826
05827 copy_unistr2(&usr->uni_home_dir, home_dir);
05828 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
05829
05830 copy_unistr2(&usr->uni_dir_drive, dir_drive);
05831 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
05832
05833 copy_unistr2(&usr->uni_logon_script, log_scr);
05834 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
05835
05836 copy_unistr2(&usr->uni_profile_path, prof_path);
05837 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
05838
05839 copy_unistr2(&usr->uni_acct_desc, desc);
05840 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
05841
05842 copy_unistr2(&usr->uni_workstations, wkstas);
05843 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
05844
05845 copy_unistr2(&usr->uni_comment, unk_str);
05846 init_uni_hdr(&usr->hdr_comment, &usr->uni_comment);
05847
05848 copy_unistr2(&usr->uni_munged_dial, mung_dial);
05849 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
05850
05851 if (hrs) {
05852 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
05853 } else {
05854 ZERO_STRUCT(usr->logon_hrs);
05855 }
05856 }
05857
05858
05859
05860
05861
05862
05863
05864
05865 void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time,
05866 NTTIME * logoff_time,
05867 NTTIME * kickoff_time,
05868 NTTIME * pass_last_set_time,
05869 NTTIME * pass_can_change_time,
05870 NTTIME * pass_must_change_time,
05871 char *user_name,
05872 char *full_name,
05873 char *home_dir, char *dir_drive, char *log_scr,
05874 char *prof_path, const char *desc, char *wkstas,
05875 char *unk_str, char *mung_dial, uint32 user_rid,
05876 uint32 group_rid, uint32 acb_info,
05877 uint32 fields_present, uint16 logon_divs,
05878 LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count,
05879 char newpass[516])
05880 {
05881 DATA_BLOB blob = base64_decode_data_blob(mung_dial);
05882
05883 usr->logon_time = *logon_time;
05884 usr->logoff_time = *logoff_time;
05885 usr->kickoff_time = *kickoff_time;
05886 usr->pass_last_set_time = *pass_last_set_time;
05887 usr->pass_can_change_time = *pass_can_change_time;
05888 usr->pass_must_change_time = *pass_must_change_time;
05889
05890 ZERO_STRUCT(usr->nt_pwd);
05891 ZERO_STRUCT(usr->lm_pwd);
05892
05893 usr->user_rid = user_rid;
05894 usr->group_rid = group_rid;
05895 usr->acb_info = acb_info;
05896 usr->fields_present = fields_present;
05897
05898 usr->logon_divs = logon_divs;
05899 usr->ptr_logon_hrs = hrs ? 1 : 0;
05900
05901 if (nt_time_is_zero(pass_must_change_time)) {
05902 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
05903 } else {
05904 usr->passmustchange=0;
05905 }
05906
05907 ZERO_STRUCT(usr->padding1);
05908 ZERO_STRUCT(usr->padding2);
05909
05910 usr->bad_password_count = bad_password_count;
05911 usr->logon_count = logon_count;
05912
05913 memcpy(usr->pass, newpass, sizeof(usr->pass));
05914
05915 init_unistr2(&usr->uni_user_name, user_name, UNI_FLAGS_NONE);
05916 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
05917
05918 init_unistr2(&usr->uni_full_name, full_name, UNI_FLAGS_NONE);
05919 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
05920
05921 init_unistr2(&usr->uni_home_dir, home_dir, UNI_FLAGS_NONE);
05922 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
05923
05924 init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_FLAGS_NONE);
05925 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
05926
05927 init_unistr2(&usr->uni_logon_script, log_scr, UNI_FLAGS_NONE);
05928 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
05929
05930 init_unistr2(&usr->uni_profile_path, prof_path, UNI_FLAGS_NONE);
05931 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
05932
05933 init_unistr2(&usr->uni_acct_desc, desc, UNI_FLAGS_NONE);
05934 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
05935
05936 init_unistr2(&usr->uni_workstations, wkstas, UNI_FLAGS_NONE);
05937 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
05938
05939 init_unistr2(&usr->uni_comment, unk_str, UNI_FLAGS_NONE);
05940 init_uni_hdr(&usr->hdr_comment, &usr->uni_comment);
05941
05942 init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
05943 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
05944
05945 data_blob_free(&blob);
05946
05947 if (hrs) {
05948 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
05949 } else {
05950 ZERO_STRUCT(usr->logon_hrs);
05951 }
05952 }
05953
05954
05955
05956
05957
05958
05959
05960 void init_sam_user_info25P(SAM_USER_INFO_25 * usr,
05961 uint32 fields_present, uint32 acb_info,
05962 char newpass[532])
05963 {
05964 usr->fields_present = fields_present;
05965 ZERO_STRUCT(usr->padding1);
05966 ZERO_STRUCT(usr->padding2);
05967
05968 usr->acb_info = acb_info;
05969 memcpy(usr->pass, newpass, sizeof(usr->pass));
05970 }
05971
05972
05973
05974
05975
05976
05977 static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr,
05978 prs_struct *ps, int depth)
05979 {
05980 if (usr == NULL)
05981 return False;
05982
05983 prs_debug(ps, depth, desc, "sam_io_user_info23");
05984 depth++;
05985
05986 if(!prs_align(ps))
05987 return False;
05988
05989 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
05990 return False;
05991 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
05992 return False;
05993 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
05994 return False;
05995 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
05996 return False;
05997 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
05998 return False;
05999 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
06000 return False;
06001
06002 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth))
06003 return False;
06004 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth))
06005 return False;
06006 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth))
06007 return False;
06008 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth))
06009 return False;
06010 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth))
06011 return False;
06012 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth))
06013 return False;
06014 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth))
06015 return False;
06016 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth))
06017 return False;
06018 if(!smb_io_unihdr("hdr_comment ", &usr->hdr_comment, ps, depth))
06019 return False;
06020 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth))
06021 return False;
06022
06023 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
06024 return False;
06025 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
06026 return False;
06027
06028 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid))
06029 return False;
06030 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid))
06031 return False;
06032 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
06033 return False;
06034
06035 if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
06036 return False;
06037 if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs))
06038 return False;
06039 if(!prs_align(ps))
06040 return False;
06041 if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
06042 return False;
06043
06044 if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
06045 return False;
06046 if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
06047 return False;
06048
06049 if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
06050 return False;
06051 if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
06052 return False;
06053 if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
06054 return False;
06055
06056
06057 if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
06058 return False;
06059
06060
06061
06062 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth))
06063 return False;
06064
06065 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth))
06066 return False;
06067
06068 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth))
06069 return False;
06070
06071 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth))
06072 return False;
06073
06074 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth))
06075 return False;
06076
06077 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth))
06078 return False;
06079
06080 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth))
06081 return False;
06082
06083 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth))
06084 return False;
06085
06086 if(!smb_io_unistr2("uni_comment ", &usr->uni_comment, usr->hdr_comment.buffer, ps, depth))
06087 return False;
06088
06089 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
06090 return False;
06091
06092
06093 if (usr->ptr_logon_hrs) {
06094 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
06095 return False;
06096 }
06097
06098 return True;
06099 }
06100
06101
06102
06103
06104
06105
06106
06107
06108 static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth)
06109 {
06110 if (usr == NULL)
06111 return False;
06112
06113 prs_debug(ps, depth, desc, "sam_io_user_info25");
06114 depth++;
06115
06116 if(!prs_align(ps))
06117 return False;
06118
06119 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
06120 return False;
06121 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
06122 return False;
06123 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
06124 return False;
06125 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
06126 return False;
06127 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
06128 return False;
06129 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
06130 return False;
06131
06132 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth))
06133 return False;
06134 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth))
06135 return False;
06136 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth))
06137 return False;
06138 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth))
06139 return False;
06140 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth))
06141 return False;
06142 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth))
06143 return False;
06144 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth))
06145 return False;
06146 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth))
06147 return False;
06148 if(!smb_io_unihdr("hdr_comment ", &usr->hdr_comment, ps, depth))
06149 return False;
06150 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth))
06151 return False;
06152
06153 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
06154 return False;
06155 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
06156 return False;
06157
06158 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid))
06159 return False;
06160 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid))
06161 return False;
06162 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
06163 return False;
06164 if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
06165 return False;
06166
06167 if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs))
06168 return False;
06169 if(!prs_align(ps))
06170 return False;
06171 if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
06172 return False;
06173
06174 if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
06175 return False;
06176 if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
06177 return False;
06178
06179 if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
06180 return False;
06181 if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
06182 return False;
06183 if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
06184 return False;
06185
06186
06187 if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
06188 return False;
06189
06190
06191
06192 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth))
06193 return False;
06194
06195 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth))
06196 return False;
06197
06198 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth))
06199 return False;
06200
06201 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth))
06202 return False;
06203
06204 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth))
06205 return False;
06206
06207 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth))
06208 return False;
06209
06210 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth))
06211 return False;
06212
06213 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth))
06214 return False;
06215
06216 if(!smb_io_unistr2("uni_comment ", &usr->uni_comment, usr->hdr_comment.buffer, ps, depth))
06217 return False;
06218
06219 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
06220 return False;
06221
06222
06223 if (usr->ptr_logon_hrs) {
06224 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
06225 return False;
06226 }
06227
06228 return True;
06229 }
06230
06231
06232
06233
06234
06235
06236
06237
06238
06239 void init_sam_user_info21W(SAM_USER_INFO_21 * usr,
06240 NTTIME * logon_time,
06241 NTTIME * logoff_time,
06242 NTTIME * kickoff_time,
06243 NTTIME * pass_last_set_time,
06244 NTTIME * pass_can_change_time,
06245 NTTIME * pass_must_change_time,
06246 UNISTR2 *user_name,
06247 UNISTR2 *full_name,
06248 UNISTR2 *home_dir,
06249 UNISTR2 *dir_drive,
06250 UNISTR2 *log_scr,
06251 UNISTR2 *prof_path,
06252 UNISTR2 *desc,
06253 UNISTR2 *wkstas,
06254 UNISTR2 *unk_str,
06255 UNISTR2 *mung_dial,
06256 uchar lm_pwd[16],
06257 uchar nt_pwd[16],
06258 uint32 user_rid,
06259 uint32 group_rid,
06260 uint32 acb_info,
06261 uint32 fields_present,
06262 uint16 logon_divs,
06263 LOGON_HRS * hrs,
06264 uint16 bad_password_count,
06265 uint16 logon_count)
06266 {
06267 usr->logon_time = *logon_time;
06268 usr->logoff_time = *logoff_time;
06269 usr->kickoff_time = *kickoff_time;
06270 usr->pass_last_set_time = *pass_last_set_time;
06271 usr->pass_can_change_time = *pass_can_change_time;
06272 usr->pass_must_change_time = *pass_must_change_time;
06273
06274 memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd));
06275 memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd));
06276
06277 usr->user_rid = user_rid;
06278 usr->group_rid = group_rid;
06279 usr->acb_info = acb_info;
06280 usr->fields_present = fields_present;
06281
06282 usr->logon_divs = logon_divs;
06283 usr->ptr_logon_hrs = hrs ? 1 : 0;
06284 usr->bad_password_count = bad_password_count;
06285 usr->logon_count = logon_count;
06286
06287 if (nt_time_is_zero(pass_must_change_time)) {
06288 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
06289 } else {
06290 usr->passmustchange=0;
06291 }
06292
06293 ZERO_STRUCT(usr->padding1);
06294 ZERO_STRUCT(usr->padding2);
06295
06296 copy_unistr2(&usr->uni_user_name, user_name);
06297 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
06298
06299 copy_unistr2(&usr->uni_full_name, full_name);
06300 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
06301
06302 copy_unistr2(&usr->uni_home_dir, home_dir);
06303 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
06304
06305 copy_unistr2(&usr->uni_dir_drive, dir_drive);
06306 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
06307
06308 copy_unistr2(&usr->uni_logon_script, log_scr);
06309 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
06310
06311 copy_unistr2(&usr->uni_profile_path, prof_path);
06312 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
06313
06314 copy_unistr2(&usr->uni_acct_desc, desc);
06315 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
06316
06317 copy_unistr2(&usr->uni_workstations, wkstas);
06318 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
06319
06320 copy_unistr2(&usr->uni_comment, unk_str);
06321 init_uni_hdr(&usr->hdr_comment, &usr->uni_comment);
06322
06323 copy_unistr2(&usr->uni_munged_dial, mung_dial);
06324 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
06325
06326 if (hrs) {
06327 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
06328 } else {
06329 ZERO_STRUCT(usr->logon_hrs);
06330 }
06331 }
06332
06333
06334
06335
06336
06337
06338
06339
06340 NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID *domain_sid)
06341 {
06342 NTTIME logon_time, logoff_time, kickoff_time,
06343 pass_last_set_time, pass_can_change_time,
06344 pass_must_change_time;
06345
06346 time_t must_change_time;
06347 const char* user_name = pdb_get_username(pw);
06348 const char* full_name = pdb_get_fullname(pw);
06349 const char* home_dir = pdb_get_homedir(pw);
06350 const char* dir_drive = pdb_get_dir_drive(pw);
06351 const char* logon_script = pdb_get_logon_script(pw);
06352 const char* profile_path = pdb_get_profile_path(pw);
06353 const char* description = pdb_get_acct_desc(pw);
06354 const char* workstations = pdb_get_workstations(pw);
06355 const char* munged_dial = pdb_get_munged_dial(pw);
06356 DATA_BLOB munged_dial_blob;
06357
06358 uint32 user_rid;
06359 const DOM_SID *user_sid;
06360
06361 uint32 group_rid;
06362 const DOM_SID *group_sid;
06363
06364 if (munged_dial) {
06365 munged_dial_blob = base64_decode_data_blob(munged_dial);
06366 } else {
06367 munged_dial_blob = data_blob(NULL, 0);
06368 }
06369
06370
06371 unix_to_nt_time (&logon_time, pdb_get_logon_time(pw));
06372 unix_to_nt_time (&logoff_time, pdb_get_logoff_time(pw));
06373 unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(pw));
06374 unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(pw));
06375 unix_to_nt_time (&pass_can_change_time,pdb_get_pass_can_change_time(pw));
06376 must_change_time = pdb_get_pass_must_change_time(pw);
06377 if (must_change_time == get_time_t_max())
06378 unix_to_nt_time_abs(&pass_must_change_time, must_change_time);
06379 else
06380 unix_to_nt_time(&pass_must_change_time, must_change_time);
06381
06382
06383 usr->logon_time = logon_time;
06384 usr->logoff_time = logoff_time;
06385 usr->kickoff_time = kickoff_time;
06386 usr->pass_last_set_time = pass_last_set_time;
06387 usr->pass_can_change_time = pass_can_change_time;
06388 usr->pass_must_change_time = pass_must_change_time;
06389
06390 ZERO_STRUCT(usr->nt_pwd);
06391 ZERO_STRUCT(usr->lm_pwd);
06392
06393 user_sid = pdb_get_user_sid(pw);
06394
06395 if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) {
06396 fstring user_sid_string;
06397 fstring domain_sid_string;
06398 DEBUG(0, ("init_sam_user_info_21A: User %s has SID %s, \nwhich conflicts with "
06399 "the domain sid %s. Failing operation.\n",
06400 user_name,
06401 sid_to_string(user_sid_string, user_sid),
06402 sid_to_string(domain_sid_string, domain_sid)));
06403 data_blob_free(&munged_dial_blob);
06404 return NT_STATUS_UNSUCCESSFUL;
06405 }
06406
06407 become_root();
06408 group_sid = pdb_get_group_sid(pw);
06409 unbecome_root();
06410
06411 if (!sid_peek_check_rid(domain_sid, group_sid, &group_rid)) {
06412 fstring group_sid_string;
06413 fstring domain_sid_string;
06414 DEBUG(0, ("init_sam_user_info_21A: User %s has Primary Group SID %s, \n"
06415 "which conflicts with the domain sid %s. Failing operation.\n",
06416 user_name,
06417 sid_to_string(group_sid_string, group_sid),
06418 sid_to_string(domain_sid_string, domain_sid)));
06419 data_blob_free(&munged_dial_blob);
06420 return NT_STATUS_UNSUCCESSFUL;
06421 }
06422
06423 usr->user_rid = user_rid;
06424 usr->group_rid = group_rid;
06425 usr->acb_info = pdb_get_acct_ctrl(pw);
06426
06427
06428
06429
06430
06431
06432
06433
06434
06435
06436 usr->fields_present = pdb_build_fields_present(pw);
06437
06438 usr->logon_divs = pdb_get_logon_divs(pw);
06439 usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0;
06440 usr->bad_password_count = pdb_get_bad_password_count(pw);
06441 usr->logon_count = pdb_get_logon_count(pw);
06442
06443 if (pdb_get_pass_must_change_time(pw) == 0) {
06444 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
06445 } else {
06446 usr->passmustchange=0;
06447 }
06448
06449 ZERO_STRUCT(usr->padding1);
06450 ZERO_STRUCT(usr->padding2);
06451
06452 init_unistr2(&usr->uni_user_name, user_name, UNI_STR_TERMINATE);
06453 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
06454
06455 init_unistr2(&usr->uni_full_name, full_name, UNI_STR_TERMINATE);
06456 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
06457
06458 init_unistr2(&usr->uni_home_dir, home_dir, UNI_STR_TERMINATE);
06459 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
06460
06461 init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_STR_TERMINATE);
06462 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
06463
06464 init_unistr2(&usr->uni_logon_script, logon_script, UNI_STR_TERMINATE);
06465 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
06466
06467 init_unistr2(&usr->uni_profile_path, profile_path, UNI_STR_TERMINATE);
06468 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
06469
06470 init_unistr2(&usr->uni_acct_desc, description, UNI_STR_TERMINATE);
06471 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
06472
06473 init_unistr2(&usr->uni_workstations, workstations, UNI_STR_TERMINATE);
06474 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
06475
06476 init_unistr2(&usr->uni_comment, NULL, UNI_STR_TERMINATE);
06477 init_uni_hdr(&usr->hdr_comment, &usr->uni_comment);
06478
06479 init_unistr2_from_datablob(&usr->uni_munged_dial, &munged_dial_blob);
06480 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
06481 data_blob_free(&munged_dial_blob);
06482
06483 if (pdb_get_hours(pw)) {
06484 usr->logon_hrs.max_len = 1260;
06485 usr->logon_hrs.offset = 0;
06486 usr->logon_hrs.len = pdb_get_hours_len(pw);
06487 memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN);
06488 } else {
06489 usr->logon_hrs.max_len = 1260;
06490 usr->logon_hrs.offset = 0;
06491 usr->logon_hrs.len = 0;
06492 memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs));
06493 }
06494
06495 return NT_STATUS_OK;
06496 }
06497
06498
06499
06500
06501
06502 static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr,
06503 prs_struct *ps, int depth)
06504 {
06505 if (usr == NULL)
06506 return False;
06507
06508 prs_debug(ps, depth, desc, "sam_io_user_info21");
06509 depth++;
06510
06511 if(!prs_align(ps))
06512 return False;
06513
06514 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
06515 return False;
06516 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
06517 return False;
06518 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps,depth))
06519 return False;
06520 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
06521 return False;
06522 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps,depth))
06523 return False;
06524 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
06525 return False;
06526
06527 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth))
06528 return False;
06529 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth))
06530 return False;
06531 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth))
06532 return False;
06533 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth))
06534 return False;
06535 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth))
06536 return False;
06537 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth))
06538 return False;
06539 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth))
06540 return False;
06541 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth))
06542 return False;
06543 if(!smb_io_unihdr("hdr_comment ", &usr->hdr_comment, ps, depth))
06544 return False;
06545 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth))
06546 return False;
06547
06548 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
06549 return False;
06550 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
06551 return False;
06552
06553 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid))
06554 return False;
06555 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid))
06556 return False;
06557 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
06558 return False;
06559
06560 if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
06561 return False;
06562 if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs))
06563 return False;
06564 if(!prs_align(ps))
06565 return False;
06566 if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
06567 return False;
06568
06569 if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
06570 return False;
06571 if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
06572 return False;
06573
06574 if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
06575 return False;
06576 if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
06577 return False;
06578 if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
06579 return False;
06580
06581
06582
06583 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name,usr->hdr_user_name.buffer, ps, depth))
06584 return False;
06585 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth))
06586 return False;
06587 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth))
06588 return False;
06589 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth))
06590 return False;
06591 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth))
06592 return False;
06593 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth))
06594 return False;
06595 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth))
06596 return False;
06597 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth))
06598 return False;
06599 if(!smb_io_unistr2("uni_comment", &usr->uni_comment, usr->hdr_comment.buffer, ps, depth))
06600 return False;
06601 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth))
06602 return False;
06603
06604
06605 if (usr->ptr_logon_hrs) {
06606 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
06607 return False;
06608 }
06609
06610 return True;
06611 }
06612
06613 void init_sam_user_info20A(SAM_USER_INFO_20 *usr, struct samu *pw)
06614 {
06615 const char *munged_dial = pdb_get_munged_dial(pw);
06616 DATA_BLOB blob;
06617
06618 if (munged_dial) {
06619 blob = base64_decode_data_blob(munged_dial);
06620 } else {
06621 blob = data_blob(NULL, 0);
06622 }
06623
06624 init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
06625 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
06626 data_blob_free(&blob);
06627 }
06628
06629
06630
06631
06632
06633 static BOOL sam_io_user_info20(const char *desc, SAM_USER_INFO_20 *usr,
06634 prs_struct *ps, int depth)
06635 {
06636 if (usr == NULL)
06637 return False;
06638
06639 prs_debug(ps, depth, desc, "sam_io_user_info20");
06640 depth++;
06641
06642 if(!prs_align(ps))
06643 return False;
06644
06645 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth))
06646 return False;
06647
06648 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth))
06649 return False;
06650
06651 return True;
06652 }
06653
06654
06655
06656
06657
06658 NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr,
06659 uint16 switch_value,
06660 SAM_USER_INFO_21 * usr)
06661 {
06662 DEBUG(5, ("make_samr_userinfo_ctr_usr21\n"));
06663
06664 ctr->switch_value = switch_value;
06665 ctr->info.id = NULL;
06666
06667 switch (switch_value) {
06668 case 16:
06669 ctr->info.id16 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_16);
06670 if (ctr->info.id16 == NULL)
06671 return NT_STATUS_NO_MEMORY;
06672
06673 init_sam_user_info16(ctr->info.id16, usr->acb_info);
06674 break;
06675 #if 0
06676
06677 case 17:
06678 {
06679 NTTIME expire;
06680 info = (void *)&id11;
06681
06682 expire.low = 0xffffffff;
06683 expire.high = 0x7fffffff;
06684
06685 ctr->info.id = TALLOC_ZERO_P(ctx,SAM_USER_INFO_17);
06686 init_sam_user_info11(ctr->info.id17, &expire,
06687 "BROOKFIELDS$",
06688 0x03ef,
06689 0x201,
06690 0x0080);
06691
06692 break;
06693 }
06694 #endif
06695 case 18:
06696 ctr->info.id18 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_18);
06697 if (ctr->info.id18 == NULL)
06698 return NT_STATUS_NO_MEMORY;
06699
06700 init_sam_user_info18(ctr->info.id18, usr->lm_pwd, usr->nt_pwd);
06701 break;
06702 case 21:
06703 {
06704 SAM_USER_INFO_21 *cusr;
06705 cusr = TALLOC_ZERO_P(ctx,SAM_USER_INFO_21);
06706 ctr->info.id21 = cusr;
06707 if (ctr->info.id21 == NULL)
06708 return NT_STATUS_NO_MEMORY;
06709 memcpy(cusr, usr, sizeof(*usr));
06710 memset(cusr->lm_pwd, 0, sizeof(cusr->lm_pwd));
06711 memset(cusr->nt_pwd, 0, sizeof(cusr->nt_pwd));
06712 break;
06713 }
06714 default:
06715 DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
06716 return NT_STATUS_INVALID_INFO_CLASS;
06717 }
06718
06719 return NT_STATUS_OK;
06720 }
06721
06722
06723
06724
06725
06726 static void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB *sess_key,
06727 uint16 switch_value, void *info)
06728 {
06729 DEBUG(5, ("init_samr_userinfo_ctr\n"));
06730
06731 ctr->switch_value = switch_value;
06732 ctr->info.id = info;
06733
06734 switch (switch_value) {
06735 case 0x18:
06736 SamOEMhashBlob(ctr->info.id24->pass, 516, sess_key);
06737 dump_data(100, (char *)sess_key->data, sess_key->length);
06738 dump_data(100, (char *)ctr->info.id24->pass, 516);
06739 break;
06740 case 0x17:
06741 SamOEMhashBlob(ctr->info.id23->pass, 516, sess_key);
06742 dump_data(100, (char *)sess_key->data, sess_key->length);
06743 dump_data(100, (char *)ctr->info.id23->pass, 516);
06744 break;
06745 case 0x07:
06746 break;
06747 default:
06748 DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level: %d\n", switch_value));
06749 }
06750 }
06751
06752
06753
06754
06755
06756 static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr,
06757 prs_struct *ps, int depth)
06758 {
06759 BOOL ret;
06760 SAM_USERINFO_CTR *ctr;
06761
06762 prs_debug(ps, depth, desc, "samr_io_userinfo_ctr");
06763 depth++;
06764
06765 if (UNMARSHALLING(ps)) {
06766 ctr = PRS_ALLOC_MEM(ps,SAM_USERINFO_CTR,1);
06767 if (ctr == NULL)
06768 return False;
06769 *ppctr = ctr;
06770 } else {
06771 ctr = *ppctr;
06772 }
06773
06774
06775
06776 if(!prs_uint16("switch_value", ps, depth, &ctr->switch_value))
06777 return False;
06778 if(!prs_align(ps))
06779 return False;
06780
06781 ret = False;
06782
06783 switch (ctr->switch_value) {
06784 case 7:
06785 if (UNMARSHALLING(ps))
06786 ctr->info.id7 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_7,1);
06787 if (ctr->info.id7 == NULL) {
06788 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06789 return False;
06790 }
06791 ret = sam_io_user_info7("", ctr->info.id7, ps, depth);
06792 break;
06793 case 9:
06794 if (UNMARSHALLING(ps))
06795 ctr->info.id9 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_9,1);
06796 if (ctr->info.id9 == NULL) {
06797 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06798 return False;
06799 }
06800 ret = sam_io_user_info9("", ctr->info.id9, ps, depth);
06801 break;
06802 case 16:
06803 if (UNMARSHALLING(ps))
06804 ctr->info.id16 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_16,1);
06805 if (ctr->info.id16 == NULL) {
06806 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06807 return False;
06808 }
06809 ret = sam_io_user_info16("", ctr->info.id16, ps, depth);
06810 break;
06811 case 17:
06812 if (UNMARSHALLING(ps))
06813 ctr->info.id17 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_17,1);
06814
06815 if (ctr->info.id17 == NULL) {
06816 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06817 return False;
06818 }
06819 ret = sam_io_user_info17("", ctr->info.id17, ps, depth);
06820 break;
06821 case 18:
06822 if (UNMARSHALLING(ps))
06823 ctr->info.id18 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_18,1);
06824
06825 if (ctr->info.id18 == NULL) {
06826 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06827 return False;
06828 }
06829 ret = sam_io_user_info18("", ctr->info.id18, ps, depth);
06830 break;
06831 case 20:
06832 if (UNMARSHALLING(ps))
06833 ctr->info.id20 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_20,1);
06834
06835 if (ctr->info.id20 == NULL) {
06836 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06837 return False;
06838 }
06839 ret = sam_io_user_info20("", ctr->info.id20, ps, depth);
06840 break;
06841 case 21:
06842 if (UNMARSHALLING(ps))
06843 ctr->info.id21 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_21,1);
06844
06845 if (ctr->info.id21 == NULL) {
06846 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06847 return False;
06848 }
06849 ret = sam_io_user_info21("", ctr->info.id21, ps, depth);
06850 break;
06851 case 23:
06852 if (UNMARSHALLING(ps))
06853 ctr->info.id23 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_23,1);
06854
06855 if (ctr->info.id23 == NULL) {
06856 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06857 return False;
06858 }
06859 ret = sam_io_user_info23("", ctr->info.id23, ps, depth);
06860 break;
06861 case 24:
06862 if (UNMARSHALLING(ps))
06863 ctr->info.id24 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_24,1);
06864
06865 if (ctr->info.id24 == NULL) {
06866 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06867 return False;
06868 }
06869 ret = sam_io_user_info24("", ctr->info.id24, ps, depth);
06870 break;
06871 case 25:
06872 if (UNMARSHALLING(ps))
06873 ctr->info.id25 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_25,1);
06874
06875 if (ctr->info.id25 == NULL) {
06876 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06877 return False;
06878 }
06879 ret = sam_io_user_info25("", ctr->info.id25, ps, depth);
06880 break;
06881 case 26:
06882 if (UNMARSHALLING(ps))
06883 ctr->info.id26 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_26,1);
06884
06885 if (ctr->info.id26 == NULL) {
06886 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
06887 return False;
06888 }
06889 ret = sam_io_user_info26("", ctr->info.id26, ps, depth);
06890 break;
06891 default:
06892 DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value));
06893 ret = False;
06894 break;
06895 }
06896
06897 return ret;
06898 }
06899
06900
06901
06902
06903
06904 void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u,
06905 SAM_USERINFO_CTR * ctr, NTSTATUS status)
06906 {
06907 DEBUG(5, ("init_samr_r_query_userinfo\n"));
06908
06909 r_u->ptr = 0;
06910 r_u->ctr = NULL;
06911
06912 if (NT_STATUS_IS_OK(status)) {
06913 r_u->ptr = 1;
06914 r_u->ctr = ctr;
06915 }
06916
06917 r_u->status = status;
06918 }
06919
06920
06921
06922
06923
06924 BOOL samr_io_r_query_userinfo(const char *desc, SAMR_R_QUERY_USERINFO * r_u,
06925 prs_struct *ps, int depth)
06926 {
06927 if (r_u == NULL)
06928 return False;
06929
06930 prs_debug(ps, depth, desc, "samr_io_r_query_userinfo");
06931 depth++;
06932
06933 if(!prs_align(ps))
06934 return False;
06935
06936 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
06937 return False;
06938
06939 if (r_u->ptr != 0) {
06940 if(!samr_io_userinfo_ctr("ctr", &r_u->ctr, ps, depth))
06941 return False;
06942 }
06943
06944 if(!prs_align(ps))
06945 return False;
06946 if(!prs_ntstatus("status", ps, depth, &r_u->status))
06947 return False;
06948
06949 return True;
06950 }
06951
06952
06953
06954
06955
06956 void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u,
06957 const POLICY_HND *hnd, DATA_BLOB *sess_key,
06958 uint16 switch_value, void *info)
06959 {
06960 DEBUG(5, ("init_samr_q_set_userinfo\n"));
06961
06962 q_u->pol = *hnd;
06963 q_u->switch_value = switch_value;
06964 init_samr_userinfo_ctr(q_u->ctr, sess_key, switch_value, info);
06965 }
06966
06967
06968
06969
06970
06971 BOOL samr_io_q_set_userinfo(const char *desc, SAMR_Q_SET_USERINFO * q_u,
06972 prs_struct *ps, int depth)
06973 {
06974 if (q_u == NULL)
06975 return False;
06976
06977 prs_debug(ps, depth, desc, "samr_io_q_set_userinfo");
06978 depth++;
06979
06980 if(!prs_align(ps))
06981 return False;
06982
06983 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
06984
06985 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
06986 return False;
06987 if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
06988 return False;
06989
06990 return True;
06991 }
06992
06993
06994
06995
06996
06997 void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, NTSTATUS status)
06998 {
06999 DEBUG(5, ("init_samr_r_set_userinfo\n"));
07000
07001 r_u->status = status;
07002 }
07003
07004
07005
07006
07007
07008 BOOL samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u,
07009 prs_struct *ps, int depth)
07010 {
07011 if (r_u == NULL)
07012 return False;
07013
07014 prs_debug(ps, depth, desc, "samr_io_r_set_userinfo");
07015 depth++;
07016
07017 if(!prs_align(ps))
07018 return False;
07019
07020 if(!prs_ntstatus("status", ps, depth, &r_u->status))
07021 return False;
07022
07023 return True;
07024 }
07025
07026
07027
07028
07029
07030 void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u,
07031 const POLICY_HND *hnd, DATA_BLOB *sess_key,
07032 uint16 switch_value, SAM_USERINFO_CTR * ctr)
07033 {
07034 DEBUG(5, ("init_samr_q_set_userinfo2\n"));
07035
07036 q_u->pol = *hnd;
07037 q_u->switch_value = switch_value;
07038 q_u->ctr = ctr;
07039
07040 q_u->ctr->switch_value = switch_value;
07041
07042 switch (switch_value) {
07043 case 18:
07044 SamOEMhashBlob(ctr->info.id18->lm_pwd, 16, sess_key);
07045 SamOEMhashBlob(ctr->info.id18->nt_pwd, 16, sess_key);
07046 dump_data(100, (char *)sess_key->data, sess_key->length);
07047 dump_data(100, (char *)ctr->info.id18->lm_pwd, 16);
07048 dump_data(100, (char *)ctr->info.id18->nt_pwd, 16);
07049 break;
07050 }
07051 }
07052
07053
07054
07055
07056
07057 BOOL samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u,
07058 prs_struct *ps, int depth)
07059 {
07060 if (q_u == NULL)
07061 return False;
07062
07063 prs_debug(ps, depth, desc, "samr_io_q_set_userinfo2");
07064 depth++;
07065
07066 if(!prs_align(ps))
07067 return False;
07068
07069 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
07070 return False;
07071
07072 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
07073 return False;
07074 if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
07075 return False;
07076
07077 return True;
07078 }
07079
07080
07081
07082
07083
07084 void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status)
07085 {
07086 DEBUG(5, ("init_samr_r_set_userinfo2\n"));
07087
07088 r_u->status = status;
07089 }
07090
07091
07092
07093
07094
07095 BOOL samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u,
07096 prs_struct *ps, int depth)
07097 {
07098 if (r_u == NULL)
07099 return False;
07100
07101 prs_debug(ps, depth, desc, "samr_io_r_set_userinfo2");
07102 depth++;
07103
07104 if(!prs_align(ps))
07105 return False;
07106
07107 if(!prs_ntstatus("status", ps, depth, &r_u->status))
07108 return False;
07109
07110 return True;
07111 }
07112
07113
07114
07115
07116
07117 void init_samr_q_connect(SAMR_Q_CONNECT * q_u,
07118 char *srv_name, uint32 access_mask)
07119 {
07120 DEBUG(5, ("init_samr_q_connect\n"));
07121
07122
07123 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
07124 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
07125
07126
07127 q_u->access_mask = access_mask;
07128 }
07129
07130
07131
07132
07133
07134 BOOL samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u,
07135 prs_struct *ps, int depth)
07136 {
07137 if (q_u == NULL)
07138 return False;
07139
07140 prs_debug(ps, depth, desc, "samr_io_q_connect");
07141 depth++;
07142
07143 if(!prs_align(ps))
07144 return False;
07145
07146 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
07147 return False;
07148 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
07149 return False;
07150
07151 if(!prs_align(ps))
07152 return False;
07153 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
07154 return False;
07155
07156 return True;
07157 }
07158
07159
07160
07161
07162
07163 BOOL samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u,
07164 prs_struct *ps, int depth)
07165 {
07166 if (r_u == NULL)
07167 return False;
07168
07169 prs_debug(ps, depth, desc, "samr_io_r_connect");
07170 depth++;
07171
07172 if(!prs_align(ps))
07173 return False;
07174
07175 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
07176 return False;
07177
07178 if(!prs_ntstatus("status", ps, depth, &r_u->status))
07179 return False;
07180
07181 return True;
07182 }
07183
07184
07185
07186
07187
07188 void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u,
07189 char *srv_name, uint32 access_mask)
07190 {
07191 DEBUG(5, ("init_samr_q_connect4\n"));
07192
07193
07194 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
07195 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
07196
07197
07198 q_u->unk_0 = 2;
07199
07200
07201 q_u->access_mask = access_mask;
07202 }
07203
07204
07205
07206
07207
07208 BOOL samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u,
07209 prs_struct *ps, int depth)
07210 {
07211 if (q_u == NULL)
07212 return False;
07213
07214 prs_debug(ps, depth, desc, "samr_io_q_connect4");
07215 depth++;
07216
07217 if(!prs_align(ps))
07218 return False;
07219
07220 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
07221 return False;
07222 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
07223 return False;
07224
07225 if(!prs_align(ps))
07226 return False;
07227 if(!prs_uint32("unk_0", ps, depth, &q_u->unk_0))
07228 return False;
07229 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
07230 return False;
07231
07232 return True;
07233 }
07234
07235
07236
07237
07238
07239 BOOL samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u,
07240 prs_struct *ps, int depth)
07241 {
07242 if (r_u == NULL)
07243 return False;
07244
07245 prs_debug(ps, depth, desc, "samr_io_r_connect4");
07246 depth++;
07247
07248 if(!prs_align(ps))
07249 return False;
07250
07251 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
07252 return False;
07253
07254 if(!prs_ntstatus("status", ps, depth, &r_u->status))
07255 return False;
07256
07257 return True;
07258 }
07259
07260
07261
07262
07263
07264 void init_samr_q_connect5(SAMR_Q_CONNECT5 * q_u,
07265 char *srv_name, uint32 access_mask)
07266 {
07267 DEBUG(5, ("init_samr_q_connect5\n"));
07268
07269
07270 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
07271 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
07272
07273
07274 q_u->access_mask = access_mask;
07275
07276 q_u->level = 1;
07277 q_u->info1_unk1 = 3;
07278 q_u->info1_unk2 = 0;
07279 }
07280
07281
07282
07283
07284
07285 void init_samr_r_connect5(SAMR_R_CONNECT5 * r_u, POLICY_HND *pol, NTSTATUS status)
07286 {
07287 DEBUG(5, ("init_samr_q_connect5\n"));
07288
07289 r_u->level = 1;
07290 r_u->info1_unk1 = 3;
07291 r_u->info1_unk2 = 0;
07292
07293 r_u->connect_pol = *pol;
07294 r_u->status = status;
07295 }
07296
07297
07298
07299
07300
07301 BOOL samr_io_q_connect5(const char *desc, SAMR_Q_CONNECT5 * q_u,
07302 prs_struct *ps, int depth)
07303 {
07304 if (q_u == NULL)
07305 return False;
07306
07307 prs_debug(ps, depth, desc, "samr_io_q_connect5");
07308 depth++;
07309
07310 if(!prs_align(ps))
07311 return False;
07312
07313 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
07314 return False;
07315 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
07316 return False;
07317
07318 if(!prs_align(ps))
07319 return False;
07320 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
07321 return False;
07322
07323 if(!prs_uint32("level", ps, depth, &q_u->level))
07324 return False;
07325 if(!prs_uint32("level", ps, depth, &q_u->level))
07326 return False;
07327
07328 if(!prs_uint32("info1_unk1", ps, depth, &q_u->info1_unk1))
07329 return False;
07330 if(!prs_uint32("info1_unk2", ps, depth, &q_u->info1_unk2))
07331 return False;
07332
07333 return True;
07334 }
07335
07336
07337
07338
07339
07340 BOOL samr_io_r_connect5(const char *desc, SAMR_R_CONNECT5 * r_u,
07341 prs_struct *ps, int depth)
07342 {
07343 if (r_u == NULL)
07344 return False;
07345
07346 prs_debug(ps, depth, desc, "samr_io_r_connect5");
07347 depth++;
07348
07349 if(!prs_align(ps))
07350 return False;
07351
07352 if(!prs_uint32("level", ps, depth, &r_u->level))
07353 return False;
07354 if(!prs_uint32("level", ps, depth, &r_u->level))
07355 return False;
07356 if(!prs_uint32("info1_unk1", ps, depth, &r_u->info1_unk1))
07357 return False;
07358 if(!prs_uint32("info1_unk2", ps, depth, &r_u->info1_unk2))
07359 return False;
07360
07361 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
07362 return False;
07363
07364 if(!prs_ntstatus("status", ps, depth, &r_u->status))
07365 return False;
07366
07367 return True;
07368 }
07369
07370
07371
07372
07373
07374 void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u)
07375 {
07376 DEBUG(5, ("init_samr_q_connect_anon\n"));
07377
07378 q_u->ptr = 1;
07379 q_u->unknown_0 = 0x5c;
07380 q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
07381 }
07382
07383
07384
07385
07386
07387 BOOL samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u,
07388 prs_struct *ps, int depth)
07389 {
07390 if (q_u == NULL)
07391 return False;
07392
07393 prs_debug(ps, depth, desc, "samr_io_q_connect_anon");
07394 depth++;
07395
07396 if(!prs_align(ps))
07397 return False;
07398
07399 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
07400 return False;
07401 if (q_u->ptr) {
07402 if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0))
07403 return False;
07404 }
07405 if(!prs_align(ps))
07406 return False;
07407 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
07408 return False;
07409
07410 return True;
07411 }
07412
07413
07414
07415
07416
07417 BOOL samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u,
07418 prs_struct *ps, int depth)
07419 {
07420 if (r_u == NULL)
07421 return False;
07422
07423 prs_debug(ps, depth, desc, "samr_io_r_connect_anon");
07424 depth++;
07425
07426 if(!prs_align(ps))
07427 return False;
07428
07429 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
07430 return False;
07431
07432 if(!prs_ntstatus("status", ps, depth, &r_u->status))
07433 return False;
07434
07435 return True;
07436 }
07437
07438
07439
07440
07441
07442 void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u,
07443 char *srv_name)
07444 {
07445 DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
07446
07447 q_u->ptr = 1;
07448 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_FLAGS_NONE);
07449 init_uni_hdr(&q_u->hdr_srv_name, &q_u->uni_srv_name);
07450 }
07451
07452
07453
07454
07455
07456 BOOL samr_io_q_get_dom_pwinfo(const char *desc, SAMR_Q_GET_DOM_PWINFO * q_u,
07457 prs_struct *ps, int depth)
07458 {
07459 if (q_u == NULL)
07460 return False;
07461
07462 prs_debug(ps, depth, desc, "samr_io_q_get_dom_pwinfo");
07463 depth++;
07464
07465 if(!prs_align(ps))
07466 return False;
07467
07468 if(!prs_uint32("ptr", ps, depth, &q_u->ptr))
07469 return False;
07470 if (q_u->ptr != 0) {
07471 if(!smb_io_unihdr("", &q_u->hdr_srv_name, ps, depth))
07472 return False;
07473 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->hdr_srv_name.buffer, ps, depth))
07474 return False;
07475 }
07476
07477 return True;
07478 }
07479
07480
07481
07482
07483
07484 BOOL samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u,
07485 prs_struct *ps, int depth)
07486 {
07487 if (r_u == NULL)
07488 return False;
07489
07490 prs_debug(ps, depth, desc, "samr_io_r_get_dom_pwinfo");
07491 depth++;
07492
07493 if(!prs_align(ps))
07494 return False;
07495
07496 if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
07497 return False;
07498 if(!prs_align(ps))
07499 return False;
07500 if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
07501 return False;
07502
07503 if(!prs_ntstatus("status", ps, depth, &r_u->status))
07504 return False;
07505
07506 return True;
07507 }
07508
07509
07510
07511
07512
07513 void init_enc_passwd(SAMR_ENC_PASSWD * pwd, const char pass[512])
07514 {
07515 ZERO_STRUCTP(pwd);
07516
07517 if (pass == NULL) {
07518 pwd->ptr = 0;
07519 } else {
07520 pwd->ptr = 1;
07521 memcpy(pwd->pass, pass, sizeof(pwd->pass));
07522 }
07523 }
07524
07525
07526
07527
07528
07529 BOOL samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd,
07530 prs_struct *ps, int depth)
07531 {
07532 if (pwd == NULL)
07533 return False;
07534
07535 prs_debug(ps, depth, desc, "samr_io_enc_passwd");
07536 depth++;
07537
07538 if(!prs_align(ps))
07539 return False;
07540
07541 if(!prs_uint32("ptr", ps, depth, &pwd->ptr))
07542 return False;
07543
07544 if (pwd->ptr != 0) {
07545 if(!prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)))
07546 return False;
07547 }
07548
07549 return True;
07550 }
07551
07552
07553
07554
07555
07556 void init_enc_hash(SAMR_ENC_HASH * hsh, const uchar hash[16])
07557 {
07558 ZERO_STRUCTP(hsh);
07559
07560 if (hash == NULL) {
07561 hsh->ptr = 0;
07562 } else {
07563 hsh->ptr = 1;
07564 memcpy(hsh->hash, hash, sizeof(hsh->hash));
07565 }
07566 }
07567
07568
07569
07570
07571
07572 BOOL samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh,
07573 prs_struct *ps, int depth)
07574 {
07575 if (hsh == NULL)
07576 return False;
07577
07578 prs_debug(ps, depth, desc, "samr_io_enc_hash");
07579 depth++;
07580
07581 if(!prs_align(ps))
07582 return False;
07583
07584 if(!prs_uint32("ptr ", ps, depth, &hsh->ptr))
07585 return False;
07586 if (hsh->ptr != 0) {
07587 if(!prs_uint8s(False, "hash", ps, depth, hsh->hash,sizeof(hsh->hash)))
07588 return False;
07589 }
07590
07591 return True;
07592 }
07593
07594
07595
07596
07597
07598 void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u,
07599 const char *dest_host, const char *user_name,
07600 const uchar nt_newpass[516],
07601 const uchar nt_oldhash[16],
07602 const uchar lm_newpass[516],
07603 const uchar lm_oldhash[16])
07604 {
07605 DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
07606
07607 q_u->ptr_0 = 1;
07608 init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
07609 init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
07610
07611 init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
07612 init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
07613
07614 init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
07615 init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
07616
07617 q_u->unknown = 0x01;
07618
07619 init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
07620 init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
07621 }
07622
07623
07624
07625
07626
07627 BOOL samr_io_q_chgpasswd_user(const char *desc, SAMR_Q_CHGPASSWD_USER * q_u,
07628 prs_struct *ps, int depth)
07629 {
07630 if (q_u == NULL)
07631 return False;
07632
07633 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user");
07634 depth++;
07635
07636 if(!prs_align(ps))
07637 return False;
07638
07639 if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
07640 return False;
07641
07642 if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
07643 return False;
07644 if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
07645 return False;
07646
07647 if(!prs_align(ps))
07648 return False;
07649 if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
07650 return False;
07651 if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
07652 return False;
07653
07654 if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
07655 return False;
07656 if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
07657 return False;
07658
07659 if(!prs_uint32("unknown", ps, depth, &q_u->unknown))
07660 return False;
07661
07662 if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
07663 return False;
07664 if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
07665 return False;
07666
07667 return True;
07668 }
07669
07670
07671
07672
07673
07674 void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status)
07675 {
07676 DEBUG(5, ("init_samr_r_chgpasswd_user\n"));
07677
07678 r_u->status = status;
07679 }
07680
07681
07682
07683
07684
07685 BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u,
07686 prs_struct *ps, int depth)
07687 {
07688 if (r_u == NULL)
07689 return False;
07690
07691 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user");
07692 depth++;
07693
07694 if(!prs_align(ps))
07695 return False;
07696
07697 if(!prs_ntstatus("status", ps, depth, &r_u->status))
07698 return False;
07699
07700 return True;
07701 }
07702
07703
07704
07705
07706
07707 void init_samr_q_chgpasswd_user3(SAMR_Q_CHGPASSWD_USER3 * q_u,
07708 const char *dest_host, const char *user_name,
07709 const uchar nt_newpass[516],
07710 const uchar nt_oldhash[16],
07711 const uchar lm_newpass[516],
07712 const uchar lm_oldhash[16])
07713 {
07714 DEBUG(5, ("init_samr_q_chgpasswd_user3\n"));
07715
07716 q_u->ptr_0 = 1;
07717 init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
07718 init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
07719
07720 init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
07721 init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
07722
07723 init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
07724 init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
07725
07726 q_u->lm_change = 0x01;
07727
07728 init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
07729 init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
07730
07731 init_enc_passwd(&q_u->password3, NULL);
07732 }
07733
07734
07735
07736
07737
07738 BOOL samr_io_q_chgpasswd_user3(const char *desc, SAMR_Q_CHGPASSWD_USER3 * q_u,
07739 prs_struct *ps, int depth)
07740 {
07741 if (q_u == NULL)
07742 return False;
07743
07744 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user3");
07745 depth++;
07746
07747 if(!prs_align(ps))
07748 return False;
07749
07750 if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
07751 return False;
07752
07753 if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
07754 return False;
07755 if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
07756 return False;
07757
07758 if(!prs_align(ps))
07759 return False;
07760 if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
07761 return False;
07762 if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
07763 return False;
07764
07765 if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
07766 return False;
07767 if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
07768 return False;
07769
07770 if(!prs_uint32("lm_change", ps, depth, &q_u->lm_change))
07771 return False;
07772
07773 if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
07774 return False;
07775 if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
07776 return False;
07777
07778 if(!samr_io_enc_passwd("password3", &q_u->password3, ps, depth))
07779 return False;
07780
07781 return True;
07782 }
07783
07784
07785
07786
07787
07788 void init_samr_r_chgpasswd_user3(SAMR_R_CHGPASSWD_USER3 *r_u, NTSTATUS status,
07789 SAMR_CHANGE_REJECT *reject, SAM_UNK_INFO_1 *info)
07790 {
07791 DEBUG(5, ("init_samr_r_chgpasswd_user3\n"));
07792
07793 r_u->status = status;
07794 r_u->info = 0;
07795 r_u->ptr_info = 0;
07796 r_u->reject = 0;
07797 r_u->ptr_reject = 0;
07798
07799 if (info) {
07800 r_u->info = info;
07801 r_u->ptr_info = 1;
07802 }
07803 if (reject && (reject->reject_reason != Undefined)) {
07804 r_u->reject = reject;
07805 r_u->ptr_reject = 1;
07806 }
07807 }
07808
07809
07810
07811
07812
07813 BOOL samr_io_change_reject(const char *desc, SAMR_CHANGE_REJECT *reject, prs_struct *ps, int depth)
07814 {
07815 if (reject == NULL)
07816 return False;
07817
07818 prs_debug(ps, depth, desc, "samr_io_change_reject");
07819 depth++;
07820
07821 if(!prs_align(ps))
07822 return False;
07823
07824 if(UNMARSHALLING(ps))
07825 ZERO_STRUCTP(reject);
07826
07827 if (!prs_uint32("reject_reason", ps, depth, &reject->reject_reason))
07828 return False;
07829
07830 if (!prs_uint32("unknown1", ps, depth, &reject->unknown1))
07831 return False;
07832
07833 if (!prs_uint32("unknown2", ps, depth, &reject->unknown2))
07834 return False;
07835
07836 return True;
07837 }
07838
07839
07840
07841
07842
07843 BOOL samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u,
07844 prs_struct *ps, int depth)
07845 {
07846 if (r_u == NULL)
07847 return False;
07848
07849 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user3");
07850 depth++;
07851
07852 if (!prs_align(ps))
07853 return False;
07854
07855 if (!prs_uint32("ptr_info", ps, depth, &r_u->ptr_info))
07856 return False;
07857
07858
07859
07860
07861 if ( NT_STATUS_EQUAL( NT_STATUS_NOT_SUPPORTED, NT_STATUS(r_u->ptr_info)) ) {
07862 r_u->status = NT_STATUS_NOT_SUPPORTED;
07863 return True;
07864 }
07865
07866 if (r_u->ptr_info && r_u->info != NULL) {
07867
07868 if (!sam_io_unk_info1("info", r_u->info, ps, depth))
07869 return False;
07870 }
07871
07872 if (!prs_uint32("ptr_reject", ps, depth, &r_u->ptr_reject))
07873 return False;
07874
07875 if (r_u->ptr_reject && r_u->reject != NULL) {
07876
07877 if (!samr_io_change_reject("reject", r_u->reject, ps, depth))
07878 return False;
07879 }
07880
07881 if (!prs_ntstatus("status", ps, depth, &r_u->status))
07882 return False;
07883
07884 return True;
07885 }
07886
07887
07888
07889
07890
07891 void init_samr_q_query_domain_info2(SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
07892 POLICY_HND *domain_pol, uint16 switch_value)
07893 {
07894 DEBUG(5, ("init_samr_q_query_domain_info2\n"));
07895
07896 q_u->domain_pol = *domain_pol;
07897 q_u->switch_value = switch_value;
07898 }
07899
07900
07901
07902
07903
07904 BOOL samr_io_q_query_domain_info2(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
07905 prs_struct *ps, int depth)
07906 {
07907 if (q_u == NULL)
07908 return False;
07909
07910 prs_debug(ps, depth, desc, "samr_io_q_query_domain_info2");
07911 depth++;
07912
07913 if(!prs_align(ps))
07914 return False;
07915
07916 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
07917 return False;
07918
07919 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
07920 return False;
07921
07922 return True;
07923 }
07924
07925
07926
07927
07928
07929 void init_samr_r_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
07930 uint16 switch_value, SAM_UNK_CTR * ctr,
07931 NTSTATUS status)
07932 {
07933 DEBUG(5, ("init_samr_r_query_domain_info2\n"));
07934
07935 r_u->ptr_0 = 0;
07936 r_u->switch_value = 0;
07937 r_u->status = status;
07938
07939 if (NT_STATUS_IS_OK(status)) {
07940 r_u->switch_value = switch_value;
07941 r_u->ptr_0 = 1;
07942 r_u->ctr = ctr;
07943 }
07944 }
07945
07946
07947
07948
07949
07950 BOOL samr_io_r_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
07951 prs_struct *ps, int depth)
07952 {
07953 if (r_u == NULL)
07954 return False;
07955
07956 prs_debug(ps, depth, desc, "samr_io_r_query_domain_info2");
07957 depth++;
07958
07959 if(!prs_align(ps))
07960 return False;
07961
07962 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
07963 return False;
07964
07965 if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
07966 if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
07967 return False;
07968 if(!prs_align(ps))
07969 return False;
07970
07971 switch (r_u->switch_value) {
07972 case 0x0d:
07973 if(!sam_io_unk_info13("unk_inf13", &r_u->ctr->info.inf13, ps, depth))
07974 return False;
07975 break;
07976 case 0x0c:
07977 if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
07978 return False;
07979 break;
07980 case 0x09:
07981 if(!sam_io_unk_info9("unk_inf9",&r_u->ctr->info.inf9, ps,depth))
07982 return False;
07983 break;
07984 case 0x08:
07985 if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth))
07986 return False;
07987 break;
07988 case 0x07:
07989 if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
07990 return False;
07991 break;
07992 case 0x06:
07993 if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
07994 return False;
07995 break;
07996 case 0x05:
07997 if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
07998 return False;
07999 break;
08000 case 0x04:
08001 if(!sam_io_unk_info4("unk_inf4",&r_u->ctr->info.inf4, ps,depth))
08002 return False;
08003 break;
08004 case 0x03:
08005 if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
08006 return False;
08007 break;
08008 case 0x02:
08009 if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
08010 return False;
08011 break;
08012 case 0x01:
08013 if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
08014 return False;
08015 break;
08016 default:
08017 DEBUG(0, ("samr_io_r_query_domain_info2: unknown switch level 0x%x\n",
08018 r_u->switch_value));
08019 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
08020 return False;
08021 }
08022 }
08023
08024 if(!prs_align(ps))
08025 return False;
08026
08027 if(!prs_ntstatus("status", ps, depth, &r_u->status))
08028 return False;
08029
08030 return True;
08031 }
08032
08033
08034
08035
08036
08037
08038 void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO *q_u,
08039 POLICY_HND *domain_pol, uint16 switch_value, SAM_UNK_CTR *ctr)
08040 {
08041 DEBUG(5, ("init_samr_q_set_domain_info\n"));
08042
08043 q_u->domain_pol = *domain_pol;
08044 q_u->switch_value0 = switch_value;
08045
08046 q_u->switch_value = switch_value;
08047 q_u->ctr = ctr;
08048
08049 }
08050
08051
08052
08053
08054
08055 BOOL samr_io_q_set_domain_info(const char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u,
08056 prs_struct *ps, int depth)
08057 {
08058 if (q_u == NULL)
08059 return False;
08060
08061 prs_debug(ps, depth, desc, "samr_io_q_set_domain_info");
08062 depth++;
08063
08064 if(!prs_align(ps))
08065 return False;
08066
08067 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
08068 return False;
08069
08070 if(!prs_uint16("switch_value0", ps, depth, &q_u->switch_value0))
08071 return False;
08072
08073 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
08074 return False;
08075
08076 if(!prs_align(ps))
08077 return False;
08078
08079 if (UNMARSHALLING(ps)) {
08080 if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL)
08081 return False;
08082 }
08083
08084 switch (q_u->switch_value) {
08085
08086 case 0x0c:
08087 if(!sam_io_unk_info12("unk_inf12", &q_u->ctr->info.inf12, ps, depth))
08088 return False;
08089 break;
08090 case 0x07:
08091 if(!sam_io_unk_info7("unk_inf7",&q_u->ctr->info.inf7, ps,depth))
08092 return False;
08093 break;
08094 case 0x06:
08095 if(!sam_io_unk_info6("unk_inf6",&q_u->ctr->info.inf6, ps,depth))
08096 return False;
08097 break;
08098 case 0x05:
08099 if(!sam_io_unk_info5("unk_inf5",&q_u->ctr->info.inf5, ps,depth))
08100 return False;
08101 break;
08102 case 0x03:
08103 if(!sam_io_unk_info3("unk_inf3",&q_u->ctr->info.inf3, ps,depth))
08104 return False;
08105 break;
08106 case 0x02:
08107 if(!sam_io_unk_info2("unk_inf2",&q_u->ctr->info.inf2, ps,depth))
08108 return False;
08109 break;
08110 case 0x01:
08111 if(!sam_io_unk_info1("unk_inf1",&q_u->ctr->info.inf1, ps,depth))
08112 return False;
08113 break;
08114 default:
08115 DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
08116 q_u->switch_value));
08117 return False;
08118 }
08119
08120 return True;
08121 }
08122
08123
08124
08125
08126
08127 void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO * r_u, NTSTATUS status)
08128 {
08129 DEBUG(5, ("init_samr_r_set_domain_info\n"));
08130
08131 r_u->status = status;
08132 }
08133
08134
08135
08136
08137
08138 BOOL samr_io_r_set_domain_info(const char *desc, SAMR_R_SET_DOMAIN_INFO * r_u,
08139 prs_struct *ps, int depth)
08140 {
08141 if (r_u == NULL)
08142 return False;
08143
08144 prs_debug(ps, depth, desc, "samr_io_r_samr_unknown_2e");
08145 depth++;
08146
08147 if(!prs_align(ps))
08148 return False;
08149
08150 if(!prs_ntstatus("status", ps, depth, &r_u->status))
08151 return False;
08152
08153 return True;
08154 }