int main(int argc, char *argv[]) { tester_init(&argc, &argv); test_user("User channel open - Success", NULL, NULL, test_open_success); test_user("User channel open - Failed", NULL, setup_powered, test_open_failed); test_user("User channel open - Power Toggle Success", INT_TO_PTR(true), toggle_powered, test_open_success); return tester_run(); }
void runtest(void) { uint32 acc_granted; BOOL result; int i, j; for (i = 0; perms[i]; i++) { /* Test 10 users */ for (j = 0; j < 10; j++) { fstring name; /* Test user against ACL */ snprintf(name, sizeof(fstring), "%s/user%d", getenv("TEST_WORKGROUP"), j); result = test_user(name, perms[i], &acc_granted); printf("%s: %s %s 0x%08x\n", name, pace_str(perms[i]), result ? "TRUE " : "FALSE", acc_granted); /* Check results */ switch (perms[i]) { case PRINTER_ACE_PRINT: { if (!result || acc_granted != PRINTER_ACE_PRINT) { printf("FAIL: user %s can't print\n", name); failed = True; } break; } case PRINTER_ACE_FULL_CONTROL: { if (j == 3) { if (!result || acc_granted != PRINTER_ACE_FULL_CONTROL) { printf("FAIL: user %s doesn't " "have full control\n", name); failed = True; } } else { if (result || acc_granted != 0) { printf("FAIL: user %s has full " "control\n", name); failed = True; } } break; } case PRINTER_ACE_MANAGE_DOCUMENTS: { if (j == 1 || j == 2) { if (!result || acc_granted != PRINTER_ACE_MANAGE_DOCUMENTS) { printf("FAIL: user %s can't " "manage documents\n", name); failed = True; } } else { if (result || acc_granted != 0) { printf("FAIL: user %s can " "manage documents\n", name); failed = True; } } break; } default: printf("FAIL: internal error\n"); exit(1); } } } }