Пример #1
0
static int
group_test_getgrnam(struct group *grp_model, void *mdata)
{
	struct group *grp;
		
	if (debug) {
		printf("testing getgrnam() with the following data:\n");
		dump_group(grp_model);
	}

	grp = getgrnam(grp_model->gr_name);
	if (group_test_correctness(grp, NULL) != 0)
		goto errfin;
	
	if ((compare_group(grp, grp_model, NULL) != 0) &&
	    (group_check_ambiguity((struct group_test_data *)mdata, grp) 
	    !=0))
	    goto errfin;
		
	if (debug)
		printf("ok\n");
	return (0);
	
errfin:
	if (debug)
		printf("not ok\n");
	
	return (-1);
}
Пример #2
0
static int
group_test_getgrgid(struct group *grp_model, void *mdata)
{
	struct group *grp;

	printf("testing getgrgid() with the following data...\n");
	dump_group(grp_model);

	grp = getgrgid(grp_model->gr_gid);
	if (group_test_correctness(grp, NULL) != 0 ||
	    (compare_group(grp, grp_model, NULL) != 0 &&
	     group_check_ambiguity((struct group_test_data *)mdata, grp) != 0)) {
		return (-1);
	} else {
		return (0);
	}
}
Пример #3
0
static int
group_test_getgrgid(struct group *grp_model, void *mdata)
{
	struct group *grp;
		
	if (debug) {
		printf("testing getgrgid() with the following data...\n");
		dump_group(grp_model);
	}	
	
	grp = getgrgid(grp_model->gr_gid);
	if ((group_test_correctness(grp, NULL) != 0) || 
	    ((compare_group(grp, grp_model, NULL) != 0) &&
	    (group_check_ambiguity((struct group_test_data *)mdata, grp)
	    != 0))) {
	    if (debug)
		printf("not ok\n");
	    return (-1);
	} else {
	    if (debug)
		printf("ok\n");
	    return (0);
	}
}