|
|
|
@ -212,22 +212,22 @@ config_str philos_list_group(int* size, int flag_lim) {
|
|
|
|
|
unsigned short uid_min = philos_read_uid_min_max(file_source_login_min_max, str_uid_min);
|
|
|
|
|
unsigned short uid_max = philos_read_uid_min_max(file_source_login_min_max, str_uid_max);
|
|
|
|
|
config_str str_users = malloc(1);
|
|
|
|
|
while (1) {
|
|
|
|
|
errno = 0;
|
|
|
|
|
struct passwd* entry = getpwent();
|
|
|
|
|
if (!entry) {
|
|
|
|
|
if (errno) {
|
|
|
|
|
return str_users;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
char *cmd = "cat /etc/group";
|
|
|
|
|
int size_groups = 0;
|
|
|
|
|
size_t pw_gid = 0;
|
|
|
|
|
char **responce = yon_config_load(cmd, &size_groups);
|
|
|
|
|
for (int i = 0; i< size_groups; i++) {
|
|
|
|
|
char* str_data = yon_char_new(responce[i]);
|
|
|
|
|
char* str_group = yon_char_divide_search(str_data,":x:",-1);
|
|
|
|
|
char* num = yon_char_divide_search(str_data, ":", -1);
|
|
|
|
|
pw_gid = atoll(yon_char_divide_search(str_data, ":", -1));
|
|
|
|
|
if (flag_lim == 1) {
|
|
|
|
|
if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) {
|
|
|
|
|
str_users = yon_char_parsed_append(str_users, size, entry->pw_name);
|
|
|
|
|
if ((pw_gid >= uid_min && pw_gid < uid_max) || pw_gid == 0) {
|
|
|
|
|
str_users = yon_char_parsed_append(str_users, size, str_group);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
str_users = yon_char_parsed_append(str_users, size, entry->pw_name);
|
|
|
|
|
str_users = yon_char_parsed_append(str_users, size, str_group);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
endpwent();
|
|
|
|
|