static bool test_compare(struct torture_context *tctx, struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct libnet_rpc_usermod *mod, const char *username) { NTSTATUS status; struct libnet_rpc_userinfo info; struct samr_UserInfo21 *i; struct timeval t; ZERO_STRUCT(info); info.in.username = username; info.in.domain_handle = *handle; info.in.level = 21; /* the most rich infolevel available */ status = libnet_rpc_userinfo(p, mem_ctx, &info); torture_assert_ntstatus_ok(tctx, status, "Failed to call sync libnet_rpc_userinfo"); i = &info.out.info.info21; CMP_LSA_STRING_FLD(account_name, USERMOD_FIELD_ACCOUNT_NAME); CMP_LSA_STRING_FLD(full_name, USERMOD_FIELD_FULL_NAME); CMP_LSA_STRING_FLD(description, USERMOD_FIELD_DESCRIPTION); CMP_LSA_STRING_FLD(comment, USERMOD_FIELD_COMMENT); CMP_LSA_STRING_FLD(logon_script, USERMOD_FIELD_LOGON_SCRIPT); CMP_LSA_STRING_FLD(profile_path, USERMOD_FIELD_PROFILE_PATH); CMP_LSA_STRING_FLD(home_directory, USERMOD_FIELD_HOME_DIRECTORY); CMP_LSA_STRING_FLD(home_drive, USERMOD_FIELD_HOME_DRIVE); CMP_TIME_FLD(acct_expiry, USERMOD_FIELD_ACCT_EXPIRY); CMP_NUM_FLD(acct_flags, USERMOD_FIELD_ACCT_FLAGS) return true; }
static bool test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct dom_sid2 *domain_sid, const char* user_name, uint32_t *rid) { const uint16_t level = 5; NTSTATUS status; struct libnet_rpc_userinfo user; struct dom_sid *user_sid; user_sid = dom_sid_add_rid(mem_ctx, domain_sid, *rid); user.in.domain_handle = *domain_handle; user.in.sid = dom_sid_string(mem_ctx, user_sid); user.in.level = level; /* this should be extended */ printf("Testing sync libnet_rpc_userinfo (SID argument)\n"); status = libnet_rpc_userinfo(p, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); return false; } ZERO_STRUCT(user); user.in.domain_handle = *domain_handle; user.in.sid = NULL; user.in.username = TEST_USERNAME; user.in.level = level; printf("Testing sync libnet_rpc_userinfo (username argument)\n"); status = libnet_rpc_userinfo(p, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); return false; } return true; }
static bool test_userinfo(struct torture_context *tctx, struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct dom_sid2 *domain_sid, const char* user_name, uint32_t *rid) { const uint16_t level = 5; NTSTATUS status; struct libnet_rpc_userinfo user; struct dom_sid *user_sid; user_sid = dom_sid_add_rid(mem_ctx, domain_sid, *rid); ZERO_STRUCT(user); user.in.domain_handle = *domain_handle; user.in.sid = dom_sid_string(mem_ctx, user_sid); user.in.level = level; /* this should be extended */ torture_comment(tctx, "Testing sync libnet_rpc_userinfo (SID argument)\n"); status = libnet_rpc_userinfo(tctx->ev, p->binding_handle, mem_ctx, &user); torture_assert_ntstatus_ok(tctx, status, "Calling sync libnet_rpc_userinfo() failed"); ZERO_STRUCT(user); user.in.domain_handle = *domain_handle; user.in.sid = NULL; user.in.username = user_name; user.in.level = level; torture_comment(tctx, "Testing sync libnet_rpc_userinfo (username argument)\n"); status = libnet_rpc_userinfo(tctx->ev, p->binding_handle, mem_ctx, &user); torture_assert_ntstatus_ok(tctx, status, "Calling sync libnet_rpc_userinfo failed"); return true; }