- Make sure local_files file pointer is closed

- Stop outputing error messages
This commit is contained in:
Daniel J Walsh 2005-02-25 19:52:36 +00:00
parent 20144787f3
commit 9b7e5fec36
2 changed files with 43 additions and 17 deletions

View File

@ -74,7 +74,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genbools.c libsepol-1.3.6/s
}
diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/src/genusers.c
--- nsalibsepol/src/genusers.c 2005-02-25 09:44:03.000000000 -0500
+++ libsepol-1.3.6/src/genusers.c 2005-02-25 09:59:11.000000000 -0500
+++ libsepol-1.3.6/src/genusers.c 2005-02-25 14:44:19.680658712 -0500
@@ -7,12 +7,25 @@
#include <sepol/policydb.h>
@ -102,7 +102,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
path, buffer, lineno); \
continue; \
}
@@ -68,7 +81,7 @@
@@ -68,10 +81,11 @@
/* Adding a new user definition. */
usrdatum = (user_datum_t *) malloc(sizeof(user_datum_t));
if (!id || !usrdatum) {
@ -111,7 +111,11 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
path, buffer, lineno);
errno = ENOMEM;
free(buffer);
@@ -81,7 +94,7 @@
+ fclose(fp);
return -1;
}
memset(usrdatum, 0, sizeof(user_datum_t));
@@ -81,10 +95,11 @@
rc = hashtab_insert(policydb->p_users.table,
id, (hashtab_datum_t) usrdatum);
if (rc) {
@ -120,7 +124,11 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
path, buffer, lineno);
errno = ENOMEM;
free(buffer);
@@ -128,7 +141,7 @@
+ fclose(fp);
return -1;
}
}
@@ -128,7 +143,7 @@
roldatum = hashtab_search(policydb->p_roles.table, q);
if (!roldatum) {
@ -129,7 +137,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
path, q, buffer, lineno);
continue;
}
@@ -136,7 +149,7 @@
@@ -136,7 +151,7 @@
for (bit = ebitmap_startbit(&roldatum->dominates); bit < ebitmap_length(&roldatum->dominates); bit++) {
if (ebitmap_get_bit(&roldatum->dominates, bit))
if (ebitmap_set_bit(&usrdatum->roles, bit, 1)) {
@ -138,7 +146,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
path, buffer, lineno);
errno = ENOMEM;
free(buffer);
@@ -172,7 +185,7 @@
@@ -172,10 +187,11 @@
scontext = malloc(p - q);
if (!scontext) {
@ -147,7 +155,11 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
path, buffer, lineno);
errno = ENOMEM;
free(buffer);
@@ -191,7 +204,7 @@
+ fclose(fp);
return -1;
}
r = scontext;
@@ -191,7 +207,7 @@
context_init(&context);
rc = mls_context_to_sid(policydb, oldc, &r, &context);
if (rc) {
@ -156,7 +168,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
path, scontext, buffer, lineno);
free(scontext);
continue;
@@ -218,7 +231,7 @@
@@ -218,10 +234,11 @@
scontext = malloc(p - q);
if (!scontext) {
@ -165,7 +177,11 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
path, buffer, lineno);
errno = ENOMEM;
free(buffer);
@@ -237,7 +250,7 @@
+ fclose(fp);
return -1;
}
r = scontext;
@@ -237,7 +254,7 @@
context_init(&context);
rc = mls_context_to_sid(policydb, oldc, &r, &context);
if (rc) {
@ -174,7 +190,16 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
path, scontext, buffer, lineno);
free(scontext);
continue;
@@ -334,7 +347,7 @@
@@ -248,7 +265,7 @@
}
free(buffer);
-
+ fclose(fp);
return 0;
}
@@ -334,7 +351,7 @@
pf.data = data;
pf.len = len;
if (policydb_read(&policydb,&pf, 0)) {
@ -183,7 +208,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
__FUNCTION__, strerror(errno));
return -1;
}
@@ -342,7 +355,7 @@
@@ -342,7 +359,7 @@
/* Load base set of system users from the policy package. */
snprintf(path, sizeof path, "%s/system.users", usersdir);
if (load_users(&policydb, path) < 0) {
@ -192,7 +217,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
__FUNCTION__, strerror(errno));
return -1;
}
@@ -350,7 +363,7 @@
@@ -350,7 +367,7 @@
/* Load locally defined users. */
snprintf(path, sizeof path, "%s/local.users", usersdir);
if (load_users(&policydb, path) < 0) {
@ -201,7 +226,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
__FUNCTION__, strerror(errno));
return -1;
}
@@ -374,7 +387,7 @@
@@ -374,7 +391,7 @@
pf.len = 0;
rc = policydb_write(&policydb, &pf);
if (rc) {
@ -210,7 +235,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
strerror(errno));
return -1;
}
@@ -383,7 +396,7 @@
@@ -383,7 +400,7 @@
pf.type = PF_USE_MEMORY;
pf.data = malloc(pf.len);
if (!pf.data) {
@ -219,7 +244,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
return -1;
}
@@ -394,7 +407,7 @@
@@ -394,7 +411,7 @@
/* Write out the new binary policy image. */
rc = policydb_write(&policydb, &pf);
if (rc) {

View File

@ -1,7 +1,7 @@
Summary: SELinux binary policy manipulation library
Name: libsepol
Version: 1.3.6
Release: 2
Release: 3
License: GPL
Group: System Environment/Libraries
Source: http://www.nsa.gov/selinux/archives/libsepol-%{version}.tgz
@ -73,7 +73,8 @@ rm -rf ${RPM_BUILD_ROOT}
/%{_lib}/libsepol.so.1
%changelog
* Fri Feb 18 2005 Dan Walsh <dwalsh@redhat.com> 1.3.6-2
* Fri Feb 18 2005 Dan Walsh <dwalsh@redhat.com> 1.3.6-3
- Make sure local_files file pointer is closed
- Stop outputing error messages
* Thu Feb 17 2005 Dan Walsh <dwalsh@redhat.com> 1.3.6-1