#include #include #include #include #include #include #include #include #include #include #include #include #ifdef WEBKIT_FOUND #include #endif #include "ubl-strings.h" #define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-usergroups" #define _(String) gettext(String) #define glade_path "/com/ublinux/ui/ubl-settings-usergroups.glade" #define glade_path_ubl_settings_usergroups_additional_settings "/com/ublinux/ui/ubl-settings-usergroups-additional-settings.glade" #define glade_path_ubl_settings_usergroups_group_creation "/com/ublinux/ui/ubl-settings-usergroups-group-creation.glade" #define glade_path_ubl_settings_usergroups_group "/com/ublinux/ui/ubl-settings-usergroups-group.glade" #define glade_path_ubl_settings_usergroups_password "/com/ublinux/ui/ubl-settings-usergroups-password.glade" #define glade_path_ubl_settings_usergroups_system "/com/ublinux/ui/ubl-settings-usergroups-system.glade" #define glade_path_ubl_settings_usergroups_user "/com/ublinux/ui/ubl-settings-usergroups-user.glade" #define banner_path "/com/ublinux/images/ubl-settings-usergroups-banner.png" #define CssPath "/com/ublinux/css/ubl-settings-usergroups.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-usergroups" #define clear_config_both_command "ubconfig remove TEMP_SECTION TEMP_PATAMETER" #define clear_config_global_command "ubconfig --target global remove TEMP_SECTION TEMP_PATAMETER" #define clear_config_local_command "ubconfig --target system remove TEMP_SECTION TEMP_PATAMETER" #define groups_path "/etc/group" #define users_path "/etc/passwd" #define shadow_path "/etc/shadow" #define uid_path "/etc/login.defs" #define password_limits_path "/etc/security/pwquiality.conf" #define hash_list_path "/usr/share/ubl-settings-usergroups/csv/hash_list.csv" #define shell_list_path "/usr/share/ubl-settings-usergroups/csv/shell_list.csv" #define USERADD(user) yon_char_unite("USERADD[",user,"]",NULL) #define GROUPADD(group) yon_char_unite("GROUPADD[",group,"]",NULL) #define USERSHADOW(user) yon_char_unite("USERSHADOW[",user,"]",NULL) #define USERADD_SYNC(user) yon_char_unite("USERADD_SYNC[",user,"]",NULL) #define USERSHADOW_SYNC(user) yon_char_unite("USERSHADOW_SYNC[",user,"]",NULL) #define password_hash_get_command(passwd) yon_char_append("mkpasswd2 ",passwd) typedef char* string; string version_application; char *local; typedef struct { // Standard config. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_config STRUCT { int socket_id; int load_socket_id; int save_socket_id; int lock_help; int lock_save_local; int lock_save_global; int lock_load_global; int load_mode; int always_open_documentation; // } Standard config. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_config STRUCT // Type custom parameters below: : config_str groups; int groups_size; config_str users; int users_size; GtkListStore *users_list; GtkListStore *groups_list; int MAXUID; int MINUID; int MAXGID; int MINGID; int password_min_length; } config; typedef struct { // Standard widgets. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_main_window STRUCT { GtkWidget *Window; GtkWidget *HeadLabel; GtkWidget *PlugBox; GtkWidget *HeadOverlay; GtkWidget *HeadImage; GtkWidget *HeadBox; GtkWidget *HeadTitleLabel; GtkWidget *HeadInfoLabel; GtkWidget *StatusBox; GtkWidget *StatusIcon; GtkWidget *StatusLabel; GtkWidget *SaveMenuItem; GtkWidget *SaveGlobalMenuItem; GtkWidget *SaveLocalMenuItem; GtkWidget *RightBox; GtkWidget *LoadGlobalMenuItem; GtkWidget *LoadLocalMenuItem; GtkWidget *LeftBox; GtkWidget *DocumentationMenuItem; GtkWidget *AboutMenuItem; GtkWidget *InterfaceBox; // } Standard widgets. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_main_window STRUCT // Type custom parameters below: GtkListStore *CacheAlgList; GtkListStore *GroupsList; GtkListStore *UsersList; GtkWidget *button1; GtkWidget *button2; GtkWidget *button3; GtkWidget *AddButton; GtkWidget *EditButton; GtkWidget *DeleteButton; GtkWidget *UpdateButton; GtkWidget *UsersTree; GtkWidget *GroupsTree; GtkWidget *MainNotebook; } main_window; typedef struct { GtkWidget *Window; GtkWidget *AlwaysOpenCheck; GtkWidget *CloseButton; GtkWidget *AcceptButton; } documentation_confirmation_window; typedef struct{ GtkWidget *Window; GtkWidget *StatusBox; GtkWidget *DefaultUserNameEntry; GtkWidget *DefaultUserAdministratorCheck; GtkWidget *DefaultPasswordCombo; GtkWidget *DefaultPasswordEntry; GtkWidget *DefaultPasswordButton; GtkWidget *RootPasswordCombo; GtkWidget *RootPasswordEntry; GtkWidget *RootPasswordButton; GtkWidget *PasswordHashCombo; GtkWidget *CancelButton; GtkWidget *AcceptButton; } ubl_settings_usergroups_additional_settings_window; typedef struct{ GtkWidget *CreateGroupWindow; GtkWidget *StatusBox; GtkWidget *userUIDAutoCheck; GtkWidget *userUIDEntry; GtkWidget *userLoginEntry; GtkWidget *userGroupsEntry; GtkWidget *UserAdditionalGroupsButton; GtkWidget *UserCancelButton; GtkWidget *UserOkButton; GtkWidget *AdditionalGroupsButton; GtkWidget *UnuniqueGIDCheck; GtkWidget *SystemGroupCheck; GtkWidget *PasswordCombo; GtkWidget *PasswordEntry; GtkWidget *ChangePasswordButton; GtkWidget *userTitleNameLabel; } ubl_settings_usergroups_group_creation_window; typedef struct{ GtkWidget *GroupsWindow; GtkWidget *GroupsTree; GtkListStore *list; GtkWidget *GroupsCancelButton; GtkWidget *GroupsOkButton; GtkWidget *HeaderLabel; GtkCellRenderer *StatusCell; } ubl_settings_usergroups_group_window; typedef struct{ GtkWidget *CreateGroupWindow; GtkWidget *StatusBox; GtkWidget *UserCancelButton; GtkWidget *UserOkButton; GtkWidget *PasswordEntry; GtkWidget *RepeatPasswordEntry; GtkWidget *PasswordHashEntry; GtkWidget *HashBox; GtkWidget *PasswordBox; } ubl_settings_usergroups_password_window; typedef struct{ GtkListStore *liststore1; GtkListStore *liststore2; GtkWidget *MonitorWindow; GtkWidget *ToggleAllButton; GtkWidget *UpdateButton; GtkWidget *SystemTree; int show_all; } ubl_settings_usergroups_system_window; typedef struct{ GtkWidget *CreateUserWindow; GtkWidget *StatusBox; GtkWidget *userUIDAutoCheck; GtkWidget *userUIDEntry; GtkWidget *userLoginEntry; GtkWidget *userPasswordCombo; GtkWidget *userPasswordEntry; GtkWidget *userPasswordButton; GtkWidget *userUserNameEntry; GtkWidget *userGroupsCheck; GtkWidget *userGroupsEntry; GtkWidget *UserGroupsButton; GtkWidget *userAdditionalGroupsEntry; GtkWidget *userAdditionalGroupsButton; GtkWidget *userPasswordChangedEntry; GtkWidget *userPasswordExpirationEntry; GtkWidget *userPasswordExpirationButton; GtkWidget *userPasswordChangeDelayMinimumSpin; GtkWidget *userPasswordChangeDelayMaximumSpin; GtkWidget *userWarningSpin; GtkWidget *userActivitySpin; GtkWidget *userForceChangeCheck; GtkWidget *userShellCombo; GtkWidget *userShellEntry; GtkWidget *userHomeCombo; GtkWidget *userHomeEntry; GtkWidget *userHomeButton; GtkWidget *userCreateSystemCheck; GtkWidget *userCreateUnuniqueCheck; GtkWidget *userDontCheckCheck; GtkWidget *userSyncSAMBACheck; GtkWidget *userDeactivatedCheck; GtkWidget *userExtraOptionsEntry; GtkWidget *UserCancelButton; GtkWidget *UserOkButton; GtkWidget *CalendarPopup; GtkWidget *ExpirationCalendar; GtkWidget *UseraddBootCheck; GtkWidget *UseraddShutdownCheck; GtkWidget *UsershadowBootCheck; GtkWidget *UsershadowShutdownCheck; GtkWidget *userTitleNameLabel; long expiration_unix; char *old_password; } ubl_settings_usergroups_user_window; ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(); void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *self, main_window *widgets); ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group_creation_new(); ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(); void on_standard_groups_open(GtkWidget *self, main_window *widgets); ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_new(); ubl_settings_usergroups_system_window *yon_ubl_settings_usergroups_system_new(); void on_settings_usergroups_system_open(GtkWidget *self, main_window *widgets); ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(); void on_password_accept(GtkWidget *self, dictionary *dict);