mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
follow symlinks to find the true passwd file before updating.
This commit is contained in:
parent
459a2ba1ef
commit
53bd4015aa
@ -52,6 +52,10 @@ int update_passwd(const char *filename, const char *username,
|
|||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int ret = -1; /* failure */
|
int ret = -1; /* failure */
|
||||||
|
|
||||||
|
filename = xmalloc_readlink_follow(filename);
|
||||||
|
if (filename == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
check_selinux_update_passwd(username);
|
check_selinux_update_passwd(username);
|
||||||
|
|
||||||
/* New passwd file, "/etc/passwd+" for now */
|
/* New passwd file, "/etc/passwd+" for now */
|
||||||
@ -143,6 +147,7 @@ int update_passwd(const char *filename, const char *username,
|
|||||||
|
|
||||||
free_mem:
|
free_mem:
|
||||||
free(fnamesfx);
|
free(fnamesfx);
|
||||||
free((char*)username);
|
free((char *)filename);
|
||||||
|
free((char *)username);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user