- Fix handling of /etc/shells so genhomedircon will work

This commit is contained in:
Daniel J Walsh 2007-12-03 20:55:15 +00:00
parent 3d2cf39af1
commit f026dfbc02
2 changed files with 15 additions and 8 deletions

View File

@ -1,15 +1,22 @@
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libsemanage-2.0.14/src/genhomedircon.c
--- nsalibsemanage/src/genhomedircon.c 2007-10-05 13:09:53.000000000 -0400
+++ libsemanage-2.0.14/src/genhomedircon.c 2007-12-03 14:20:34.000000000 -0500
@@ -135,6 +135,7 @@
+++ libsemanage-2.0.14/src/genhomedircon.c 2007-12-03 15:47:19.000000000 -0500
@@ -130,11 +130,13 @@
char *temp = NULL;
semanage_list_t *list = NULL;
size_t buff_len = 0;
+ int len;
shells = fopen(PATH_SHELLS_FILE, "r");
if (!shells)
return default_shell_list();
while (getline(&temp, &buff_len, shells) >= 0) {
+ temp[strlen(temp)-1]=0;
- while (getline(&temp, &buff_len, shells) >= 0) {
+ while ((len = getline(&temp, &buff_len, shells)) > 0) {
+ if (temp[len-1] == '\n') temp[len-1] = 0;
if (strcmp(temp, PATH_NOLOGIN_SHELL)) {
if (semanage_list_push(&list, temp)) {
free(temp);
@@ -790,7 +791,7 @@
@@ -790,7 +792,7 @@
homedir_context_tpl = make_template(s, &HOME_DIR_PRED);
homeroot_context_tpl = make_template(s, &HOME_ROOT_PRED);
user_context_tpl = make_template(s, &USER_CONTEXT_PRED);
@ -18,7 +25,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libseman
retval = STATUS_ERR;
goto done;
}
@@ -828,16 +829,18 @@
@@ -828,16 +830,18 @@
ustr_sc_free(&temp);
}

View File

@ -3,7 +3,7 @@
Summary: SELinux binary policy manipulation library
Name: libsemanage
Version: 2.0.14
Release: 4%{?dist}
Release: 5%{?dist}
License: GPL
Group: System Environment/Libraries
Source: http://www.nsa.gov/selinux/archives/libsemanage-%{version}.tgz
@ -78,7 +78,7 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man3/*
%changelog
* Mon Dec 3 2007 Dan Walsh <dwalsh@redhat.com> - 2.0.14-4
* Mon Dec 3 2007 Dan Walsh <dwalsh@redhat.com> - 2.0.14-5
- Fix handling of /etc/shells so genhomedircon will work
* Thu Nov 29 2007 Dan Walsh <dwalsh@redhat.com> - 2.0.14-3