mirror of https://github.com/fairyglade/ly.git
savefile and group init fixes
Fixed truncated username Init user groups before PAM credentials
This commit is contained in:
parent
ed477e61e3
commit
4ae67ec1a0
22
src/login.c
22
src/login.c
|
@ -12,10 +12,12 @@
|
|||
#include <sys/types.h>
|
||||
#include <linux/limits.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
/* ncurses */
|
||||
#include <form.h>
|
||||
/* pam */
|
||||
|
@ -204,6 +206,26 @@ const char* de_command, enum deserv_t display_server)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Initialise user groups */
|
||||
/* Get pwd structure for the user to get his group id */
|
||||
struct passwd* pw = getpwnam(username);
|
||||
|
||||
if(!pw)
|
||||
{
|
||||
error_print(strerror(errno));
|
||||
pam_end(login_handle, pam_result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int grp_result = initgroups(username, pw->pw_gid);
|
||||
|
||||
if(grp_result == -1)
|
||||
{
|
||||
error_print(strerror(errno));
|
||||
pam_end(login_handle, pam_result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* pam_setcred and error handling */
|
||||
pam_result = pam_setcred(login_handle, PAM_ESTABLISH_CRED);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ void init_form(struct ncform* form, char** list, int max_de, int* de_id)
|
|||
{
|
||||
if(fgets(line, sizeof(line), file))
|
||||
{
|
||||
snprintf(user, sizeof(file), "%s", line);
|
||||
strcpy(user, line);
|
||||
}
|
||||
|
||||
if(fgets(line, sizeof(line), file))
|
||||
|
|
Loading…
Reference in New Issue