- 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 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 --- 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 @@ @@ -7,12 +7,25 @@
#include <sepol/policydb.h> #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); \ path, buffer, lineno); \
continue; \ continue; \
} }
@@ -68,7 +81,7 @@ @@ -68,10 +81,11 @@
/* Adding a new user definition. */ /* Adding a new user definition. */
usrdatum = (user_datum_t *) malloc(sizeof(user_datum_t)); usrdatum = (user_datum_t *) malloc(sizeof(user_datum_t));
if (!id || !usrdatum) { 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); path, buffer, lineno);
errno = ENOMEM; errno = ENOMEM;
free(buffer); 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, rc = hashtab_insert(policydb->p_users.table,
id, (hashtab_datum_t) usrdatum); id, (hashtab_datum_t) usrdatum);
if (rc) { 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); path, buffer, lineno);
errno = ENOMEM; errno = ENOMEM;
free(buffer); free(buffer);
@@ -128,7 +141,7 @@ + fclose(fp);
return -1;
}
}
@@ -128,7 +143,7 @@
roldatum = hashtab_search(policydb->p_roles.table, q); roldatum = hashtab_search(policydb->p_roles.table, q);
if (!roldatum) { 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); path, q, buffer, lineno);
continue; continue;
} }
@@ -136,7 +149,7 @@ @@ -136,7 +151,7 @@
for (bit = ebitmap_startbit(&roldatum->dominates); bit < ebitmap_length(&roldatum->dominates); bit++) { for (bit = ebitmap_startbit(&roldatum->dominates); bit < ebitmap_length(&roldatum->dominates); bit++) {
if (ebitmap_get_bit(&roldatum->dominates, bit)) if (ebitmap_get_bit(&roldatum->dominates, bit))
if (ebitmap_set_bit(&usrdatum->roles, bit, 1)) { 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); path, buffer, lineno);
errno = ENOMEM; errno = ENOMEM;
free(buffer); free(buffer);
@@ -172,7 +185,7 @@ @@ -172,10 +187,11 @@
scontext = malloc(p - q); scontext = malloc(p - q);
if (!scontext) { 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); path, buffer, lineno);
errno = ENOMEM; errno = ENOMEM;
free(buffer); free(buffer);
@@ -191,7 +204,7 @@ + fclose(fp);
return -1;
}
r = scontext;
@@ -191,7 +207,7 @@
context_init(&context); context_init(&context);
rc = mls_context_to_sid(policydb, oldc, &r, &context); rc = mls_context_to_sid(policydb, oldc, &r, &context);
if (rc) { 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); path, scontext, buffer, lineno);
free(scontext); free(scontext);
continue; continue;
@@ -218,7 +231,7 @@ @@ -218,10 +234,11 @@
scontext = malloc(p - q); scontext = malloc(p - q);
if (!scontext) { 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); path, buffer, lineno);
errno = ENOMEM; errno = ENOMEM;
free(buffer); free(buffer);
@@ -237,7 +250,7 @@ + fclose(fp);
return -1;
}
r = scontext;
@@ -237,7 +254,7 @@
context_init(&context); context_init(&context);
rc = mls_context_to_sid(policydb, oldc, &r, &context); rc = mls_context_to_sid(policydb, oldc, &r, &context);
if (rc) { 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); path, scontext, buffer, lineno);
free(scontext); free(scontext);
continue; continue;
@@ -334,7 +347,7 @@ @@ -248,7 +265,7 @@
}
free(buffer);
-
+ fclose(fp);
return 0;
}
@@ -334,7 +351,7 @@
pf.data = data; pf.data = data;
pf.len = len; pf.len = len;
if (policydb_read(&policydb,&pf, 0)) { 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)); __FUNCTION__, strerror(errno));
return -1; return -1;
} }
@@ -342,7 +355,7 @@ @@ -342,7 +359,7 @@
/* Load base set of system users from the policy package. */ /* Load base set of system users from the policy package. */
snprintf(path, sizeof path, "%s/system.users", usersdir); snprintf(path, sizeof path, "%s/system.users", usersdir);
if (load_users(&policydb, path) < 0) { 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)); __FUNCTION__, strerror(errno));
return -1; return -1;
} }
@@ -350,7 +363,7 @@ @@ -350,7 +367,7 @@
/* Load locally defined users. */ /* Load locally defined users. */
snprintf(path, sizeof path, "%s/local.users", usersdir); snprintf(path, sizeof path, "%s/local.users", usersdir);
if (load_users(&policydb, path) < 0) { 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)); __FUNCTION__, strerror(errno));
return -1; return -1;
} }
@@ -374,7 +387,7 @@ @@ -374,7 +391,7 @@
pf.len = 0; pf.len = 0;
rc = policydb_write(&policydb, &pf); rc = policydb_write(&policydb, &pf);
if (rc) { if (rc) {
@ -210,7 +235,7 @@ diff --exclude-from=exclude -N -u -r nsalibsepol/src/genusers.c libsepol-1.3.6/s
strerror(errno)); strerror(errno));
return -1; return -1;
} }
@@ -383,7 +396,7 @@ @@ -383,7 +400,7 @@
pf.type = PF_USE_MEMORY; pf.type = PF_USE_MEMORY;
pf.data = malloc(pf.len); pf.data = malloc(pf.len);
if (!pf.data) { 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; return -1;
} }
@@ -394,7 +407,7 @@ @@ -394,7 +411,7 @@
/* Write out the new binary policy image. */ /* Write out the new binary policy image. */
rc = policydb_write(&policydb, &pf); rc = policydb_write(&policydb, &pf);
if (rc) { if (rc) {

View File

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