static bool test_str_regtype(struct torture_context *ctx) { torture_assert_str_equal(ctx, str_regtype(1), "REG_SZ", "REG_SZ failed"); torture_assert_str_equal(ctx, str_regtype(4), "REG_DWORD", "REG_DWORD failed"); return true; }
static bool netrlogonsamlogon_w2k_in_check(struct torture_context *tctx, struct netr_LogonSamLogon *r) { uint8_t credential_expected[8] = { 0x08, 0xaf, 0x72, 0x50, 0xa0, 0x5b, 0x50, 0x19 }; uint8_t return_authenticator_expected[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8_t lmpassword_expected[16] = { 0x31, 0xeb, 0xf4, 0x68, 0x62, 0x93, 0xfe, 0x38, 0x51, 0xc1, 0x1d, 0x41, 0x0a, 0xbd, 0x5d, 0xdf }; uint8_t ntpassword_expected[16] = { 0xe3, 0x4f, 0x76, 0x7f, 0x19, 0x12, 0xcd, 0xfe, 0x9c, 0x68, 0xed, 0x9b, 0x1e, 0x9c, 0x66, 0xf6 }; torture_assert_str_equal(tctx, r->in.server_name, "\\\\W2KSRV", "server_name"); torture_assert_str_equal(tctx, r->in.computer_name, "MTHELENA", "computer_name"); torture_assert_mem_equal(tctx, r->in.credential->cred.data, credential_expected, 8, "credential"); /* torture_assert_int_equal(tctx, r->in.credential->timestamp, 0, "credential.timestamp"); */ torture_assert_mem_equal(tctx, r->in.return_authenticator->cred.data, return_authenticator_expected, 8, "return_authenticator.cred.data"); torture_assert_int_equal(tctx, r->in.return_authenticator->timestamp, 0, "return_authenticator.timestamp"); torture_assert_int_equal(tctx, r->in.logon_level, NetlogonInteractiveInformation, "logon_level"); torture_assert(tctx, r->in.logon, "logon NULL pointer"); torture_assert(tctx, r->in.logon->password, "logon->password NULL pointer"); torture_assert_int_equal(tctx, r->in.logon->password->identity_info.domain_name.length, 12, "domain_name.length"); torture_assert_int_equal(tctx, r->in.logon->password->identity_info.domain_name.size, 12, "domain_name.size"); torture_assert_str_equal(tctx, r->in.logon->password->identity_info.domain_name.string, "W2KDOM", "domain_name.string"); torture_assert_int_equal(tctx, r->in.logon->password->identity_info.parameter_control, 0, "parameter_control"); torture_assert_int_equal(tctx, r->in.logon->password->identity_info.logon_id_low, 0xdead, "logon_id_low"); torture_assert_int_equal(tctx, r->in.logon->password->identity_info.logon_id_high, 0xbeef, "logon_id_high"); torture_assert_int_equal(tctx, r->in.logon->password->identity_info.account_name.length, 26, "account_name.length"); torture_assert_int_equal(tctx, r->in.logon->password->identity_info.account_name.size, 26, "account_name.size"); torture_assert_str_equal(tctx, r->in.logon->password->identity_info.account_name.string, "administrator", "account_name.string"); torture_assert_int_equal(tctx, r->in.logon->password->identity_info.workstation.length, 20, "workstation.length"); torture_assert_int_equal(tctx, r->in.logon->password->identity_info.workstation.size, 20, "workstation.size"); torture_assert_str_equal(tctx, r->in.logon->password->identity_info.workstation.string, "\\\\mthelena", "workstation.string"); torture_assert_mem_equal(tctx, r->in.logon->password->lmpassword.hash, lmpassword_expected, 16, "lmpassword"); torture_assert_mem_equal(tctx, r->in.logon->password->ntpassword.hash, ntpassword_expected, 16, "ntpassword"); torture_assert_int_equal(tctx, r->in.validation_level, 6, "validation_level"); return true; }
static bool witness_AsyncNotify_check_move_OUT(struct torture_context *tctx, struct witness_AsyncNotify *r) { struct witness_notifyResponse *n; struct witness_IPaddrInfoList *i; torture_assert(tctx, r->out.response, "r->out.response"); n = *(r->out.response); torture_assert_int_equal(tctx, n->type, WITNESS_NOTIFY_CLIENT_MOVE, "type"); torture_assert_int_equal(tctx, n->length, 36, "length"); torture_assert_int_equal(tctx, n->num, 1, "num"); i = &n->messages[0].client_move; torture_assert_int_equal(tctx, i->length, 36, "i->length"); torture_assert_int_equal(tctx, i->reserved, 0, "i->reserved"); torture_assert_int_equal(tctx, i->num, 1, "i->num"); torture_assert_int_equal(tctx, i->addr[0].flags, WITNESS_IPADDR_V4, "i->addr[0].flags"); torture_assert_str_equal(tctx, i->addr[0].ipv4, "192.168.3.45", "i->addr[0].ipv4"); torture_assert_str_equal(tctx, i->addr[0].ipv6, "0000:0000:38e8:eb26:8e00:0000:009e:6026", "i->addr[0].ipv6"); return true; }
static bool test_wbc_lookup_rids(struct torture_context *tctx) { struct wbcDomainSid builtin; uint32_t rids[2] = { 544, 545 }; const char *domain_name, **names; enum wbcSidType *types; wbcErr ret; wbcStringToSid("S-1-5-32", &builtin); ret = wbcLookupRids(&builtin, 2, rids, &domain_name, &names, &types); torture_assert_wbc_ok(tctx, ret, "wbcLookupRids failed"); torture_assert_str_equal( tctx, names[0], "Administrators", "S-1-5-32-544 not mapped to 'Administrators'"); torture_assert_str_equal( tctx, names[1], "Users", "S-1-5-32-545 not mapped to 'Users'"); wbcFreeMemory(discard_const_p(char ,domain_name)); wbcFreeMemory(names); wbcFreeMemory(types); return true; }
static bool witness_GetInterfaceList_check(struct torture_context *tctx, struct witness_GetInterfaceList *r) { struct witness_interfaceList *l; torture_assert(tctx, r->out.interface_list, "r->out.interface_list"); l = *(r->out.interface_list); torture_assert_int_equal(tctx, l->num_interfaces, 2, "l->num_interfaces"); torture_assert(tctx, l->interfaces, "l->interfaces"); torture_assert_str_equal(tctx, l->interfaces[0].group_name, "NODE2", "l->interfaces[0].group_name"); torture_assert_int_equal(tctx, l->interfaces[0].version, -1, "l->interfaces[0].version"); torture_assert_int_equal(tctx, l->interfaces[0].state, 1, "l->interfaces[0].state"); torture_assert_str_equal(tctx, l->interfaces[0].ipv4, "192.168.3.44", "l->interfaces[0].state"); torture_assert_int_equal(tctx, l->interfaces[0].flags, 5, "l->interfaces[0].flags"); torture_assert_str_equal(tctx, l->interfaces[1].group_name, "NODE1", "l->interfaces[0].group_name"); torture_assert_int_equal(tctx, l->interfaces[1].version, -1, "l->interfaces[0].version"); torture_assert_int_equal(tctx, l->interfaces[1].state, 1, "l->interfaces[0].state"); torture_assert_str_equal(tctx, l->interfaces[1].ipv4, "192.168.3.45", "l->interfaces[0].state"); torture_assert_int_equal(tctx, l->interfaces[1].flags, 1, "l->interfaces[0].flags"); torture_assert_werr_ok(tctx, r->out.result, "r->out.result"); return true; }
static bool test_rpc_netservergetinfo(struct torture_context *tctx, struct smbcli_state *cli) { struct rap_WserverGetInfo r; struct dcerpc_pipe *p; struct dcerpc_binding_handle *b; struct srvsvc_NetSrvGetInfo s; union srvsvc_NetSrvInfo info; const char *server_name; torture_assert_ntstatus_ok(tctx, torture_rpc_connection(tctx, &p, &ndr_table_srvsvc), "failed to open srvsvc"); b = p->binding_handle; s.in.server_unc = NULL; s.in.level = 101; s.out.info = &info; torture_assert_ntstatus_ok(tctx, dcerpc_srvsvc_NetSrvGetInfo_r(b, tctx, &s), "srvsvc_NetSrvGetInfo level 101 failed"); torture_assert_werr_ok(tctx, s.out.result, "srvsvc_NetSrvGetInfo level 101 failed"); r.in.bufsize = 0xffff; r.in.level = 0; torture_assert_ntstatus_ok(tctx, smbcli_rap_netservergetinfo(cli->tree, tctx, &r), "rap_netservergetinfo level 0 failed"); torture_assert_int_equal(tctx, r.out.status, 0, "rap_netservergetinfo level 0 failed"); server_name = talloc_strndup(tctx, info.info101->server_name, 16); torture_assert_str_equal(tctx, (const char *)r.out.info.info0.name, server_name, "server name"); r.in.level = 1; torture_assert_ntstatus_ok(tctx, smbcli_rap_netservergetinfo(cli->tree, tctx, &r), "rap_netservergetinfo level 1 failed"); torture_assert_int_equal(tctx, r.out.status, 0, "rap_netservergetinfo level 1 failed"); torture_assert_str_equal(tctx, (const char *)r.out.info.info1.name, server_name, "server name"); torture_assert_int_equal(tctx, r.out.info.info1.version_major, info.info101->version_major, "version major"); torture_assert_int_equal(tctx, r.out.info.info1.version_minor, info.info101->version_minor, "version minor"); torture_assert_int_equal(tctx, r.out.info.info1.servertype, info.info101->server_type, "server_type"); torture_assert_str_equal(tctx, r.out.info.info1.comment, info.info101->comment, "comment"); talloc_free(p); return true; }
static bool test_reg_val_data_string_sz(struct torture_context *ctx) { DATA_BLOB db; db.length = convert_string_talloc(ctx, CH_UNIX, CH_UTF16, "bla", 3, (void **)&db.data); torture_assert_str_equal(ctx, "bla", reg_val_data_string(ctx, REG_SZ, &db), "sz failed"); db.length = 4; torture_assert_str_equal(ctx, "bl", reg_val_data_string(ctx, REG_SZ, &db), "sz failed"); return true; }
static bool test_talloc_ptrtype(const struct torture_context *ctx) { void *top = talloc_new(ctx); struct struct1 { int foo; int bar; } *s1, *s2, **s3, ***s4; const char *location1; const char *location2; const char *location3; const char *location4; bool ret = false; if (!top) goto out; s1 = talloc_ptrtype(top, s1);location1 = __location__; if (!s1) goto out; ok1(talloc_get_size(s1) == sizeof(struct struct1)); ok1(strcmp(location1, talloc_get_name(s1)) == 0); s2 = talloc_array_ptrtype(top, s2, 10);location2 = __location__; if (!s2) goto out; ok1(talloc_get_size(s2) == (sizeof(struct struct1) * 10)); ok1(strcmp(location2, talloc_get_name(s2)) == 0); s3 = talloc_array_ptrtype(top, s3, 10);location3 = __location__; if (!s3) goto out; ok1(talloc_get_size(s3) == (sizeof(struct struct1 *) * 10)); torture_assert_str_equal("ptrtype", location3, talloc_get_name(s3), "talloc_array_ptrtype() sets the wrong name"); s4 = talloc_array_ptrtype(top, s4, 10);location4 = __location__; if (!s4) goto out; ok1(talloc_get_size(s4) == (sizeof(struct struct1 **) * 10)); torture_assert_str_equal("ptrtype", location4, talloc_get_name(s4), "talloc_array_ptrtype() sets the wrong name"); ret = true; out: talloc_free(top); return ret; }
static bool netrserverreqchallenge_in_check(struct torture_context *tctx, struct netr_ServerReqChallenge *r) { uint8_t cred_expected[8] = { 0xa3, 0x2c, 0xa2, 0x95, 0x40, 0xcc, 0xb7, 0xbb }; torture_assert_str_equal(tctx, r->in.server_name, "\\\\NATIVE-DC.NATIVE.BASE", "server name"); torture_assert_str_equal(tctx, r->in.computer_name, "NATIVE-2K", "account name"); torture_assert_mem_equal(tctx, cred_expected, r->in.credentials->data, 8, "credentials"); return true; }
static bool witness_Register_check_IN(struct torture_context *tctx, struct witness_Register *r) { torture_assert_int_equal(tctx, r->in.version, 65537, "r->in.version"); torture_assert_str_equal(tctx, r->in.net_name, "sofs", "r->in.net_name"); torture_assert_str_equal(tctx, r->in.ip_address, "192.168.3.45", "r->in.ip_address"); torture_assert_str_equal(tctx, r->in.client_computer_name, "MTHELENA", "r->in.client_computer_name"); return true; }
static bool test_next_token_quote_wrong(struct torture_context *tctx) { const char *teststr = "\"foo bar bla"; char buf[20]; torture_assert(tctx, next_token(&teststr, buf, " ", 20), "finding token works"); torture_assert_str_equal(tctx, buf, "foo bar bla", "token matches"); torture_assert_str_equal(tctx, teststr, "", "ptr modified correctly"); torture_assert(tctx, !next_token(&teststr, buf, " ", 20), "finding token doesn't work"); return true; }
static bool jobadd_in_check(struct torture_context *tctx, struct atsvc_JobAdd *r) { torture_assert_str_equal(tctx, r->in.servername, "WIN2KDC1", "servername"); torture_assert_int_equal(tctx, r->in.job_info->job_time, 84600000, "time"); torture_assert_int_equal(tctx, r->in.job_info->days_of_month, 0, "days of month"); torture_assert_int_equal(tctx, r->in.job_info->days_of_week, 0x2, "days of week"); torture_assert_int_equal(tctx, r->in.job_info->flags, 17, "flags"); torture_assert_str_equal(tctx, r->in.job_info->command, "foo.exe", "command"); return true; }
static bool netrserverauthenticate3_in_check(struct torture_context *tctx, struct netr_ServerAuthenticate3 *r) { uint8_t cred_expected[8] = { 0x68, 0x8e, 0x3c, 0xdf, 0x23, 0x02, 0xb1, 0x51 }; torture_assert_str_equal(tctx, r->in.server_name, "\\\\NATIVE-DC.NATIVE.BASE", "server name"); torture_assert_str_equal(tctx, r->in.account_name, "NATIVE-2K$", "account name"); torture_assert_int_equal(tctx, r->in.secure_channel_type, 2, "secure channel type"); torture_assert_str_equal(tctx, r->in.computer_name, "NATIVE-2K", "computer name"); torture_assert_int_equal(tctx, *r->in.negotiate_flags, 0x6007ffff, "negotiate flags"); torture_assert_mem_equal(tctx, cred_expected, r->in.credentials->data, 8, "credentials"); return true; }
static bool netlogon_logon_request_req_check(struct torture_context *tctx, struct nbt_netlogon_packet *r) { torture_assert_int_equal(tctx, r->command, LOGON_REQUEST, "command"); torture_assert_str_equal(tctx, r->req.logon0.computer_name, "WIN98", "computer name"); torture_assert_str_equal(tctx, r->req.logon0.user_name, "GD", "user_name"); torture_assert_str_equal(tctx, r->req.logon0.mailslot_name, "\\MAILSLOT\\TEMP\\NETLOGON", "mailslot_name"); torture_assert_int_equal(tctx, r->req.logon0.request_count, 1, "request_count"); torture_assert_int_equal(tctx, r->req.logon0.lmnt_token, 1, "lmnt_token"); torture_assert_int_equal(tctx, r->req.logon0.lm20_token, 0xffff, "lm20_token"); return true; }
static bool netlogon_samlogon_response_check(struct torture_context *tctx, struct netlogon_samlogon_response *r) { struct GUID guid; torture_assert_ntstatus_ok(tctx, GUID_from_string("cd441303-001c-464c-a621-e9d6b9b12fe9", &guid), ""); torture_assert_int_equal(tctx, r->ntver, 5, "ntver"); torture_assert_int_equal(tctx, r->data.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE_EX, "command"); torture_assert_int_equal(tctx, r->data.nt5_ex.sbz, 0, "sbz"); torture_assert_int_equal(tctx, r->data.nt5_ex.server_type, 0x000033fd, "server_type"); torture_assert_guid_equal(tctx, r->data.nt5_ex.domain_uuid, guid, "domain_uuid"); torture_assert_str_equal(tctx, r->data.nt5_ex.forest, "w2k8dom.ber.redhat.com", "forest"); torture_assert_str_equal(tctx, r->data.nt5_ex.dns_domain, "w2k8dom.ber.redhat.com", "dns_domain"); torture_assert_str_equal(tctx, r->data.nt5_ex.pdc_dns_name, "gdw2k8r2.w2k8dom.ber.redhat.com", "pdc_dns_name"); torture_assert_str_equal(tctx, r->data.nt5_ex.domain_name, "W2K8DOM", "domain_name"); torture_assert_str_equal(tctx, r->data.nt5_ex.pdc_name, "GDW2K8R2", "pdc_name"); torture_assert_str_equal(tctx, r->data.nt5_ex.user_name, "", "user_name"); torture_assert_str_equal(tctx, r->data.nt5_ex.server_site, "Default-First-Site-Name", "server_site"); torture_assert_str_equal(tctx, r->data.nt5_ex.client_site, "Default-First-Site-Name", "client_site"); torture_assert_int_equal(tctx, r->data.nt5_ex.sockaddr_size, 0, "sockaddr_size"); /* sockaddr: struct nbt_sockaddr * sockaddr_family : 0x00000000 (0) * pdc_ip : (null) * remaining : DATA_BLOB length=0 */ torture_assert_int_equal(tctx, r->data.nt5_ex.nt_version, 5, "nt_version"); /* next_closest_site NULL */ torture_assert_int_equal(tctx, r->data.nt5_ex.lmnt_token, 0xffff, "lmnt_token"); torture_assert_int_equal(tctx, r->data.nt5_ex.lm20_token, 0xffff, "lm20_token"); return true; }
static bool netlogon_samlogon_response_check2(struct torture_context *tctx, struct netlogon_samlogon_response *r) { struct GUID guid; torture_assert_ntstatus_ok(tctx, GUID_from_string("138daf55-918c-4170-9d46-d4d50490aa13", &guid), ""); torture_assert_int_equal(tctx, r->ntver, 5, "ntver"); torture_assert_int_equal(tctx, r->data.nt5_ex.command, LOGON_SAM_LOGON_RESPONSE_EX, "command"); torture_assert_int_equal(tctx, r->data.nt5_ex.sbz, 0, "sbz"); torture_assert_int_equal(tctx, r->data.nt5_ex.server_type, 0x000033fd, "server_type"); torture_assert_guid_equal(tctx, r->data.nt5_ex.domain_uuid, guid, "domain_uuid"); torture_assert_str_equal(tctx, r->data.nt5_ex.forest, "bla.base", "forest"); torture_assert_str_equal(tctx, r->data.nt5_ex.dns_domain, "bla.base", "dns_domain"); torture_assert_str_equal(tctx, r->data.nt5_ex.pdc_dns_name, "W2K8R2-219.bla.base", "pdc_dns_name"); torture_assert_str_equal(tctx, r->data.nt5_ex.domain_name, "BLA", "domain_name"); torture_assert_str_equal(tctx, r->data.nt5_ex.pdc_name, "W2K8R2-219", "pdc_name"); torture_assert_str_equal(tctx, r->data.nt5_ex.user_name, "w2012r2-l6.base.", "user_name"); torture_assert_str_equal(tctx, r->data.nt5_ex.server_site, "Default-First-Site-Name", "server_site"); torture_assert_str_equal(tctx, r->data.nt5_ex.client_site, "Default-First-Site-Name", "client_site"); torture_assert_int_equal(tctx, r->data.nt5_ex.sockaddr_size, 0, "sockaddr_size"); /* * sockaddr: struct nbt_sockaddr * sockaddr_family : 0x00000000 (0) * pdc_ip : (null) * remaining : DATA_BLOB length=0 */ torture_assert_int_equal(tctx, r->data.nt5_ex.nt_version, 5, "nt_version"); /* next_closest_site NULL */ torture_assert_int_equal(tctx, r->data.nt5_ex.lmnt_token, 0xffff, "lmnt_token"); torture_assert_int_equal(tctx, r->data.nt5_ex.lm20_token, 0xffff, "lm20_token"); return true; }
static bool torture_winbind_struct_check_machacc(struct torture_context *torture) { bool ok; bool strict = torture_setting_bool(torture, "strict mode", false); struct winbindd_response rep; ZERO_STRUCT(rep); torture_comment(torture, "Running WINBINDD_CHECK_MACHACC (struct based)\n"); ok = true; DO_STRUCT_REQ_REP_EXT(WINBINDD_CHECK_MACHACC, NULL, &rep, NSS_STATUS_SUCCESS, strict, ok = false, "WINBINDD_CHECK_MACHACC"); if (!ok) { torture_assert(torture, strlen(rep.data.auth.nt_status_string)>0, "Failed with empty nt_status_string"); torture_warning(torture,"%s:%s:%s:%d\n", nt_errstr(NT_STATUS(rep.data.auth.nt_status)), rep.data.auth.nt_status_string, rep.data.auth.error_string, rep.data.auth.pam_error); return true; } torture_assert_ntstatus_ok(torture, NT_STATUS(rep.data.auth.nt_status), "WINBINDD_CHECK_MACHACC ok: nt_status"); torture_assert_str_equal(torture, rep.data.auth.nt_status_string, nt_errstr(NT_STATUS_OK), "WINBINDD_CHECK_MACHACC ok:nt_status_string"); torture_assert_str_equal(torture, rep.data.auth.error_string, get_friendly_nt_error_msg(NT_STATUS_OK), "WINBINDD_CHECK_MACHACC ok: error_string"); torture_assert_int_equal(torture, rep.data.auth.pam_error, nt_status_to_pam(NT_STATUS_OK), "WINBINDD_CHECK_MACHACC ok: pam_error"); return true; }
static bool test_socket_wrapper_dir(struct torture_context *tctx) { backup_env(); setenv("SOCKET_WRAPPER_DIR", "foo", 1); torture_assert_str_equal(tctx, socket_wrapper_dir(), "foo", "setting failed"); setenv("SOCKET_WRAPPER_DIR", "./foo", 1); torture_assert_str_equal(tctx, socket_wrapper_dir(), "foo", "setting failed"); unsetenv("SOCKET_WRAPPER_DIR"); torture_assert_str_equal(tctx, socket_wrapper_dir(), NULL, "resetting failed"); restore_env(); return true; }
static bool test_init_anonymous(struct torture_context *tctx) { struct cli_credentials *creds = cli_credentials_init_anon(tctx); torture_assert_str_equal(tctx, cli_credentials_get_domain(creds), "", "domain"); torture_assert_str_equal(tctx, cli_credentials_get_username(creds), "", "username"); torture_assert(tctx, cli_credentials_get_password(creds) == NULL, "password"); return true; }
static bool nbt_netlogon_packet_logon_primary_query_check(struct torture_context *tctx, struct nbt_netlogon_packet *r) { torture_assert_int_equal(tctx, r->command, LOGON_PRIMARY_QUERY, "command"); torture_assert_str_equal(tctx, r->req.pdc.computer_name, "XPDATEV-PRO", "computer_name"); torture_assert_str_equal(tctx, r->req.pdc.mailslot_name, "\\MAILSLOT\\NET\\GETDC817", "mailslot_name"); torture_assert_int_equal(tctx, r->req.pdc._pad.length, 1, "_pad.length"); torture_assert_int_equal(tctx, r->req.pdc._pad.data[0], 0, "_pad.data"); torture_assert_str_equal(tctx, r->req.pdc.unicode_name, "XPDATEV-PRO", "unicode_name"); torture_assert_int_equal(tctx, r->req.pdc.nt_version, 0x0000000b, "nt_version"); torture_assert_int_equal(tctx, r->req.pdc.lmnt_token, 0xffff, "lmnt_token"); torture_assert_int_equal(tctx, r->req.pdc.lm20_token, 0xffff, "lm20_token"); return true; }
static bool alpha13_supplementalCredentials_check(struct torture_context *tctx, struct supplementalCredentialsBlob *r) { torture_assert_int_equal(tctx, r->unknown1, 0, "unknown1"); torture_assert_int_equal(tctx, r->__ndr_size, 0x5F8, "__ndr_size"); torture_assert_int_equal(tctx, r->unknown2, 0, "unknown2"); torture_assert_str_equal(tctx, r->sub.prefix, SUPPLEMENTAL_CREDENTIALS_PREFIX, "prefix"); torture_assert_int_equal(tctx, r->sub.signature, SUPPLEMENTAL_CREDENTIALS_SIGNATURE, "signature"); torture_assert_int_equal(tctx, r->sub.num_packages, 3, "num_packages"); torture_assert_str_equal(tctx, r->sub.packages[0].name, "Primary:Kerberos", "name of package 0"); torture_assert_str_equal(tctx, r->sub.packages[1].name, "Packages", "name of package 1"); torture_assert_str_equal(tctx, r->sub.packages[2].name, "Primary:WDigest", "name of package 2"); torture_assert_int_equal(tctx, r->unknown3, 0x00, "unknown3"); /* This is typically not initialized */ return true; }
static bool test_provision(struct torture_context *tctx) { NTSTATUS status; struct provision_settings *settings = talloc_zero(tctx, struct provision_settings); struct provision_result result; char *targetdir = NULL; torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &targetdir), "torture_temp_dir should return NT_STATUS_OK" ); settings->targetdir = talloc_steal(settings, targetdir); settings->site_name = "SOME-SITE-NAME"; settings->root_dn_str = "DC=EXAMPLE,DC=COM"; settings->domain_dn_str = "DC=EXAMPLE,DC=COM"; settings->config_dn_str = NULL; settings->schema_dn_str = NULL; settings->invocation_id = NULL; settings->netbios_name = "FOO"; settings->realm = "EXAMPLE.COM"; settings->domain = "EXAMPLE"; settings->netbios_name = "torture"; settings->ntds_dn_str = NULL; settings->machine_password = "******"; status = provision_bare(settings, tctx->lp_ctx, settings, &result); torture_assert_ntstatus_ok(tctx, status, "provision"); torture_assert_str_equal(tctx, result.domaindn, "DC=EXAMPLE,DC=COM", "domaindn incorrect"); return true; }
static bool test_reg_val_data_string_binary(struct torture_context *ctx) { uint8_t x[] = { 0x1, 0x2, 0x3, 0x4 }; DATA_BLOB db = { x, 4 }; torture_assert_str_equal(ctx, "01020304", reg_val_data_string(ctx, REG_BINARY, &db), "binary failed"); return true; }
static bool test_reg_val_data_string_dword(struct torture_context *ctx) { uint32_t d = 0x20; DATA_BLOB db = { (uint8_t *)&d, sizeof(d) }; torture_assert_str_equal(ctx, "0x20", reg_val_data_string(ctx, REG_DWORD, &db), "dword failed"); return true; }
static bool jobgetinfo_in_check(struct torture_context *tctx, struct atsvc_JobGetInfo *r) { torture_assert_str_equal(tctx, r->in.servername, "WIN2KDC1", "servername"); torture_assert_int_equal(tctx, r->in.job_id, 1, "job id"); return true; }
static bool test_set_option(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); torture_assert(tctx, lpcfg_set_option(lp_ctx, "workgroup=werkgroep"), "lpcfg_set_option failed"); torture_assert_str_equal(tctx, "WERKGROEP", lpcfg_workgroup(lp_ctx), "workgroup"); return true; }
static bool test_RestoreGUID(struct torture_context *tctx, struct dcerpc_pipe *p) { enum ndr_err_code ndr_err; struct dcerpc_binding_handle *b = p->binding_handle; DATA_BLOB out_blob; struct bkrp_client_side_unwrapped resp; if (p->conn->security_state.auth_info != NULL && p->conn->security_state.auth_info->auth_level == 6) { struct bkrp_BackupKey *r = createRestoreGUIDStruct(tctx, p, 2, &out_blob, false, false, false, false, false, false, false); torture_assert_ntstatus_ok(tctx, dcerpc_bkrp_BackupKey_r(b, tctx, r), "Restore GUID"); out_blob.length = *r->out.data_out_len; ndr_err = ndr_pull_struct_blob(&out_blob, tctx, &resp, (ndr_pull_flags_fn_t)ndr_pull_bkrp_client_side_unwrapped); torture_assert_int_equal(tctx, NDR_ERR_CODE_IS_SUCCESS(ndr_err), 1, "Unable to unmarshall bkrp_client_side_unwrapped"); torture_assert_werr_equal(tctx, r->out.result, WERR_OK, "Restore GUID"); torture_assert_str_equal(tctx, (char*)resp.secret.data, secret, "Wrong secret"); } else { struct bkrp_BackupKey *r = createRetreiveBackupKeyGUIDStruct(tctx, p, 2, &out_blob); torture_assert_ntstatus_equal(tctx, dcerpc_bkrp_BackupKey_r(b, tctx, r), NT_STATUS_ACCESS_DENIED, "Get GUID"); } return true; }
static bool ntprinting_printer_latin1_check(struct torture_context *tctx) { enum ndr_err_code ndr_err; struct ntprinting_printer r; DATA_BLOB blob; bool ok; ok = lpcfg_do_global_parameter(tctx->lp_ctx, "dos charset", "CP1252"); if (!ok) { torture_comment(tctx, "Could not set 'dos charset' option.\n"); return false; } reload_charcnv(tctx->lp_ctx); ZERO_STRUCT(r); r.info.string_flags = LIBNDR_FLAG_STR_ASCII; blob = data_blob_const(ntprinting_printer_data_latin1, sizeof(ntprinting_printer_data_latin1)); ndr_err = ndr_pull_struct_blob(&blob, tctx, &r, (ndr_pull_flags_fn_t)ndr_pull_ntprinting_printer); torture_assert_ndr_success(tctx, ndr_err, "ndr_pull_ntprinting_printer"); #if 0 ndr_print_debug((ndr_print_fn_t) ndr_print_ntprinting_printer, "ntprinter", &r); #endif torture_assert_str_equal(tctx, r.info.printername, "S0BC", "printername"); /* latin1 encoding check */ torture_assert_str_equal(tctx, r.info.comment, "\" SALA DA RECEPÇÃO DA CONSTRUÇÃO - RAND0 LOCATIO", "comment"); torture_assert_str_equal(tctx, r.info.location, "UTGCA ", "location"); return true; }
static bool jobdel_in_check(struct torture_context *tctx, struct atsvc_JobDel *r) { torture_assert_str_equal(tctx, r->in.servername, "WIN2KDC1", "servername"); torture_assert_int_equal(tctx, r->in.min_job_id, 14, "min job id"); torture_assert_int_equal(tctx, r->in.max_job_id, 14, "max job id"); return true; }
static bool openkey_in_check(struct torture_context *tctx, struct winreg_OpenKey *r) { torture_assert_int_equal(tctx, r->in.options, 0, "unknown"); torture_assert_int_equal(tctx, r->in.access_mask, 0x02000000, "access mask"); torture_assert_str_equal(tctx, r->in.keyname.name, "spottyfoot", "keyname"); /* FIXME: parent handle */ return true; }