merge 1.27.10 changes

This commit is contained in:
Chris PeBenito 2005-10-18 15:32:36 +00:00
parent c3812748c3
commit 5a3b360db7
3 changed files with 21 additions and 15 deletions

View File

@ -1,3 +1,7 @@
1.27.10 2005-10-17
* Changed getseuserbyname to ignore empty lines and to handle
no matching entry in the same manner as no seusers file.
1.27.9 2005-10-13
* Changed selinux_mkload_policy to try downgrading the
latest policy version available to the kernel-supported version.

View File

@ -1 +1 @@
1.27.9
1.27.10

View File

@ -26,9 +26,9 @@ static int process_seusers(const char *buffer,
start = newbuf;
while (isspace(*start))
start++;
if (*start == '#') {
if (*start == '#' || *start == 0) {
free(newbuf);
return -1; /* Comment, skip over */
return -1; /* Comment or empty line, skip over */
}
end = strchr(start, ':');
if (!end)
@ -98,16 +98,8 @@ int getseuserbyname(const char *name, char **r_seuser, char **r_level) {
char *defaultlevel=NULL;
cfg = fopen(selinux_usersconf_path(), "r");
if (!cfg) {
if (require_seusers)
return -1;
/* Fall back to the Linux username and no level. */
*r_seuser = strdup(name);
if (!(*r_seuser))
return -1;
*r_level = NULL;
return 0;
}
if (!cfg)
goto nomatch;
while (getline(&buffer, &size, cfg) > 0) {
++lineno;
@ -138,6 +130,7 @@ int getseuserbyname(const char *name, char **r_seuser, char **r_level) {
if (buffer)
free(buffer);
fclose(cfg);
if (seuser) {
free(username);
free(defaultseuser);
@ -152,6 +145,15 @@ int getseuserbyname(const char *name, char **r_seuser, char **r_level) {
*r_level = defaultlevel;
return 0;
}
return -1;
nomatch:
if (require_seusers)
return -1;
/* Fall back to the Linux username and no level. */
*r_seuser = strdup(name);
if (!(*r_seuser))
return -1;
*r_level = NULL;
return 0;
}