Exemple #1
0
/* ________________________________________________________________________ */
int deluser_main(int argc, char **argv)
{
	/* int successful; */
	int failure;

	if (argc != 2) {
		usage(deluser_usage);
	} else {

		failure = del_line_matching(argv[1], PASSWD_FILE);
		/* if (!successful) { */
		if (failure) {
			error_msg_and_die("%s: User could not be removed from %s\n",
							  argv[1], PASSWD_FILE);
		}
#ifdef TLG_FEATURE_SHADOWPASSWDS
		failure = del_line_matching(argv[1], SHADOW_FILE);
		/* if (!successful) { */
		if (failure) {
			error_msg_and_die("%s: User could not be removed from %s\n",
							  argv[1], SHADOW_FILE);
		}
#endif							/* TLG_FEATURE_SHADOWPASSWDS */
		failure = del_line_matching(argv[1], GROUP_FILE);
		/* if (!successful) { */
		if (failure) {
			error_msg_and_die("%s: User could not be removed from %s\n",
							  argv[1], GROUP_FILE);
		}

	}
	return (EXIT_SUCCESS);
}
int deluser_main(int argc, char **argv)
{
	if (argc != 2
	 && (!ENABLE_FEATURE_DEL_USER_FROM_GROUP
	    || (applet_name[3] != 'g' || argc != 3))
	) {
		bb_show_usage();
	}

	if (geteuid())
		bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);

	if ((ENABLE_FEATURE_DEL_USER_FROM_GROUP && argc != 3)
	 || ENABLE_DELUSER
	 || (ENABLE_DELGROUP && ENABLE_DESKTOP)
	) {
		if (ENABLE_DELUSER
		 && (!ENABLE_DELGROUP || applet_name[3] == 'u')
		) {
			if (del_line_matching(argv, bb_path_passwd_file) < 0)
				return EXIT_FAILURE;
			if (ENABLE_FEATURE_SHADOWPASSWDS) {
				del_line_matching(argv, bb_path_shadow_file);
			}
		} else if (ENABLE_DESKTOP && ENABLE_DELGROUP && getpwnam(argv[1]))
			bb_error_msg_and_die("can't remove primary group of user %s", argv[1]);
	}
	if (del_line_matching(argv, bb_path_group_file) < 0)
		return EXIT_FAILURE;
	if (ENABLE_FEATURE_SHADOWPASSWDS) {
		del_line_matching(argv, bb_path_gshadow_file);
	}
	return EXIT_SUCCESS;
}
Exemple #3
0
int deluser_main(int argc, char **argv)
{
	/* int successful; */
	int failure;

	if (argc != 2) {
		bb_show_usage();
	} else {

		failure = del_line_matching(argv[1], bb_path_passwd_file);
		if (failure) {
			bb_error_msg_and_die(deluser_format, argv[1], bb_path_passwd_file);
		}
#ifdef CONFIG_FEATURE_SHADOWPASSWDS
		failure = del_line_matching(argv[1], bb_path_shadow_file);
		if (failure) {
			bb_error_msg_and_die(deluser_format, argv[1], bb_path_shadow_file);
		}
		failure = del_line_matching(argv[1], bb_path_gshadow_file);
		if (failure) {
			bb_error_msg_and_die(deluser_format, argv[1], bb_path_gshadow_file);
		}
#endif
		failure = del_line_matching(argv[1], bb_path_group_file);
		if (failure) {
			bb_error_msg_and_die(deluser_format, argv[1], bb_path_group_file);
		}

	}
	return (EXIT_SUCCESS);
}
Exemple #4
0
int deluser_main(int argc, char **argv)
{
	if (argc != 2)
		bb_show_usage();

	if (ENABLE_DELUSER
	 && (!ENABLE_DELGROUP || applet_name[3] == 'u')
	) {
		del_line_matching(argv[1], bb_path_passwd_file);
		if (ENABLE_FEATURE_SHADOWPASSWDS)
			del_line_matching(argv[1], bb_path_shadow_file);
	}
	del_line_matching(argv[1], bb_path_group_file);
	if (ENABLE_FEATURE_SHADOWPASSWDS)
		del_line_matching(argv[1], bb_path_gshadow_file);

	return EXIT_SUCCESS;
}
Exemple #5
0
int delgroup_main(int argc, char **argv)
{
	/* int successful; */
	int failure;

	if (argc != 2) {
		bb_show_usage();
	} else {

		failure = del_line_matching(argv[1], bb_path_group_file);
#ifdef CONFIG_FEATURE_SHADOWPASSWDS
		if (access(bb_path_gshadow_file, W_OK) == 0) {
			/* EDR the |= works if the error is not 0, so he had it wrong */
			failure |= del_line_matching(argv[1], bb_path_gshadow_file);
		}
#endif
		if (failure) {
			bb_error_msg_and_die("%s: Group could not be removed\n", argv[1]);
		}

	}
	return (EXIT_SUCCESS);
}
Exemple #6
0
/* ________________________________________________________________________ */
int delgroup_main(int argc, char **argv)
{
	/* int successful; */
	int failure;

	if (argc != 2) {
		usage(delgroup_usage);
	} else {

		failure = del_line_matching(argv[1], GROUP_FILE);
#ifdef TLG_FEATURE_SHADOWPASSWDS
		if (access(GSHADOW_FILE, W_OK) == 0) {
			/* EDR the |= works if the error is not 0, so he had it wrong */
			failure |= del_line_matching(argv[1], GSHADOW_FILE);
		}
#endif							/* TLG_FEATURE_SHADOWPASSWDS */
		/* if (!successful) { */
		if (failure) {
			error_msg_and_die("%s: Group could not be removed\n", argv[1]);
		}

	}
	return (EXIT_SUCCESS);
}