|
From: <kma...@us...> - 2007-02-01 21:29:34
|
Revision: 2217
http://svn.sourceforge.net/selinux/?rev=2217&view=rev
Author: kmacmillan
Date: 2007-02-01 13:29:28 -0800 (Thu, 01 Feb 2007)
Log Message:
-----------
Author: Stephen Smalley
Email: sd...@ty...
Subject: add central errno.h to libsepol
Date: Thu, 18 Jan 2007 10:31:45 -0500
On Tue, 2007-01-16 at 09:59 -0500, Karl MacMillan wrote:
> Stephen Smalley wrote:
> > On Mon, 2007-01-15 at 17:57 -0500, Karl MacMillan wrote:
> >> The attached patch adds a central errno.h to libsepol and converts
> >> several existing error numbers. This will unify the error numbers,
> >> remove duplication, and prevent overlapping error numbers (a source of
> >> potential bugs). Existing return values from functions exposed as part
> >> of the binary interface are not changed.
> >
> > I'm not enthusiastic about diverging the errno values from the system
> > values for e.g. ENOMEM and friends. I'd prefer to keep them the same,
> > and use some other part of the value space for any custom error values
> > defined by libsepol.
>
> I think that practically we are going to end up diverging from system
> errno values to some extent. For example, -EPERM is -1 and I think that
> trying to change every function that returns -1 for general error is
> going to be hard.
>
> The updated patch aligns them more closely, however.
>
> Also, I'm not sure about referring to this as
> > errno.h, as libsepol is _not_ setting errno to these values; it uses
> > these values as internal return values for conveying error information.
>
> Changed to errcodes.h.
>
> > The functions that do happen to explicitly set errno are using
> > traditional errno values.
>
> I explicitly did not change those return values.
>
> In addition to the changes noted above, I removed the license statements
> from the header files, which I took as the consensus from the other
> discussion in this thread. Updated patch attached.
>
> The attached patch adds a central header for error and return codes
> (errcodes.h) to libsepol and converts several existing error numbers.
> This will unify the error numbers, remove duplication, and prevent
> overlapping error numbers (a source of potential bugs). Existing return
> values from functions exposed as part of the binary interface are not
> changed.
>
> Signed-off-by: Karl MacMillan <kma...@me...>
>
> checkpolicy/policy_parse.y | 15 ++---
> libsepol/include/sepol/errcodes.h | 25 ++++++++
> libsepol/include/sepol/policydb/hashtab.h | 23 +++-----
> libsepol/include/sepol/policydb/link.h | 29 +---------
> libsepol/src/avtab.c | 18 +++---
> libsepol/src/expand.c | 7 +-
> libsepol/src/hashtab.c | 45 +++++++++++-----
> libsepol/src/link.c | 33 ++++++-----
> libsepol/src/policydb.c | 6 +-
> libsepol/src/private.h | 4 +
> policycoreutils/semodule_deps/semodule_deps.c | 9 +--
> 11 files changed, 122 insertions(+), 92 deletions(-)
Acked-by: Stephen Smalley <sd...@ty...>
(for trunk only, not stable)
--
Stephen Smalley
National Security Agency
Modified Paths:
--------------
trunk/checkpolicy/policy_parse.y
trunk/libsepol/ChangeLog
trunk/libsepol/include/sepol/policydb/hashtab.h
trunk/libsepol/include/sepol/policydb/link.h
trunk/libsepol/src/avtab.c
trunk/libsepol/src/expand.c
trunk/libsepol/src/hashtab.c
trunk/libsepol/src/link.c
trunk/libsepol/src/policydb.c
trunk/libsepol/src/private.h
trunk/policycoreutils/semodule_deps/semodule_deps.c
Added Paths:
-----------
trunk/libsepol/include/sepol/errcodes.h
Modified: trunk/checkpolicy/policy_parse.y
===================================================================
--- trunk/checkpolicy/policy_parse.y 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/checkpolicy/policy_parse.y 2007-02-01 21:29:28 UTC (rev 2217)
@@ -13,13 +13,14 @@
* Added conditional policy language extensions
*
* Updated: Joshua Brindle <jbr...@tr...>
- * Karl MacMillan <kma...@tr...>
+ * Karl MacMillan <kma...@me...>
* Jason Tang <jt...@tr...>
*
* Added support for binary policy modules
*
* Copyright (C) 2004-2005 Trusted Computer Solutions, Inc.
* Copyright (C) 2003 - 2005 Tresys Technology, LLC
+ * Copyright (C) 2007 Red Hat Inc.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.
@@ -1059,11 +1060,11 @@
ret = hashtab_insert(policydbp->p_commons.table,
(hashtab_key_t) id, (hashtab_datum_t) comdatum);
- if (ret == HASHTAB_PRESENT) {
+ if (ret == SEPOL_EEXIST) {
yyerror("duplicate common definition");
goto bad;
}
- if (ret == HASHTAB_OVERFLOW) {
+ if (ret == SEPOL_ENOMEM) {
yyerror("hash table overflow");
goto bad;
}
@@ -1091,14 +1092,14 @@
(hashtab_key_t) perm,
(hashtab_datum_t) perdatum);
- if (ret == HASHTAB_PRESENT) {
+ if (ret == SEPOL_EEXIST) {
sprintf(errormsg,
"duplicate permission %s in common %s", perm,
id);
yyerror(errormsg);
goto bad_perm;
}
- if (ret == HASHTAB_OVERFLOW) {
+ if (ret == SEPOL_ENOMEM) {
yyerror("hash table overflow");
goto bad_perm;
}
@@ -1220,12 +1221,12 @@
(hashtab_key_t) id,
(hashtab_datum_t) perdatum);
- if (ret == HASHTAB_PRESENT) {
+ if (ret == SEPOL_EEXIST) {
sprintf(errormsg, "duplicate permission %s", id);
yyerror(errormsg);
goto bad;
}
- if (ret == HASHTAB_OVERFLOW) {
+ if (ret == SEPOL_ENOMEM) {
yyerror("hash table overflow");
goto bad;
}
Modified: trunk/libsepol/ChangeLog
===================================================================
--- trunk/libsepol/ChangeLog 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/libsepol/ChangeLog 2007-02-01 21:29:28 UTC (rev 2217)
@@ -1,3 +1,5 @@
+ * Merged patch to add errcodes.h to libsepol by Karl MacMillan.
+
1.16.0 2007-01-18
* Updated version for stable branch.
Added: trunk/libsepol/include/sepol/errcodes.h
===================================================================
--- trunk/libsepol/include/sepol/errcodes.h (rev 0)
+++ trunk/libsepol/include/sepol/errcodes.h 2007-02-01 21:29:28 UTC (rev 2217)
@@ -0,0 +1,25 @@
+/* Author: Karl MacMillan <kma...@me...> */
+
+#ifndef __sepol_errno_h__
+#define __sepol_errno_h__
+
+#include <errno.h>
+
+#define SEPOL_OK 0
+
+/* These first error codes are defined for compatibility with
+ * previous version of libsepol. In the future, custome error
+ * codes that don't map to system error codes should be defined
+ * outside of the range of system error codes.
+ */
+#define SEPOL_ERR -1
+#define SEPOL_ENOTSUP -2 /* feature not supported in module language */
+#define SEPOL_EREQ -3 /* requirements not met */
+
+/* Error codes that map to system error codes */
+#define SEPOL_ENOMEM -ENOMEM
+#define SEPOL_ERANGE -ERANGE
+#define SEPOL_EEXIST -EEXIST
+#define SEPOL_ENOENT -ENOENT
+
+#endif
Modified: trunk/libsepol/include/sepol/policydb/hashtab.h
===================================================================
--- trunk/libsepol/include/sepol/policydb/hashtab.h 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/libsepol/include/sepol/policydb/hashtab.h 2007-02-01 21:29:28 UTC (rev 2217)
@@ -14,8 +14,9 @@
#ifndef _SEPOL_POLICYDB_HASHTAB_H_
#define _SEPOL_POLICYDB_HASHTAB_H_
+#include <sepol/errcodes.h>
+
#include <stdint.h>
-#include <errno.h>
#include <stdio.h>
typedef char *hashtab_key_t; /* generic key type */
@@ -39,12 +40,6 @@
typedef hashtab_val_t *hashtab_t;
-/* Define status codes for hash table functions */
-#define HASHTAB_SUCCESS 0
-#define HASHTAB_OVERFLOW -ENOMEM
-#define HASHTAB_PRESENT -EEXIST
-#define HASHTAB_MISSING -ENOENT
-
/*
Creates a new hash table with the specified characteristics.
@@ -61,9 +56,9 @@
/*
Inserts the specified (key, datum) pair into the specified hash table.
- Returns HASHTAB_OVERFLOW if insufficient space is available or
- HASHTAB_PRESENT if there is already an entry with the same key or
- HASHTAB_SUCCESS otherwise.
+ Returns SEPOL_ENOMEM if insufficient space is available or
+ SEPOL_EEXIST if there is already an entry with the same key or
+ SEPOL_OK otherwise.
*/
extern int hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
@@ -72,8 +67,8 @@
Applies the specified destroy function to (key,datum,args) for
the entry.
- Returns HASHTAB_MISSING if no entry has the specified key or
- HASHTAB_SUCCESS otherwise.
+ Returns SEPOL_ENOENT if no entry has the specified key or
+ SEPOL_OK otherwise.
*/
extern int hashtab_remove(hashtab_t h, hashtab_key_t k,
void (*destroy) (hashtab_key_t k,
@@ -86,8 +81,8 @@
then the specified destroy function is applied to (key,datum,args)
for the entry prior to replacing the entry's contents.
- Returns HASHTAB_OVERFLOW if insufficient space is available or
- HASHTAB_SUCCESS otherwise.
+ Returns SEPOL_ENOMEM if insufficient space is available or
+ SEPOL_OK otherwise.
*/
extern int hashtab_replace(hashtab_t h, hashtab_key_t k, hashtab_datum_t d,
void (*destroy) (hashtab_key_t k,
Modified: trunk/libsepol/include/sepol/policydb/link.h
===================================================================
--- trunk/libsepol/include/sepol/policydb/link.h 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/libsepol/include/sepol/policydb/link.h 2007-02-01 21:29:28 UTC (rev 2217)
@@ -1,39 +1,18 @@
/* Authors: Jason Tang <jt...@tr...>
* Joshua Brindle <jbr...@tr...>
- * Karl MacMillan <kma...@tr...>
- *
- * A set of utility functions that aid policy decision when dealing
- * with hierarchal items.
- *
- * Copyright (C) 2005 Tresys Technology, LLC
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * Karl MacMillan <kma...@me...>
*/
#ifndef _SEPOL_POLICYDB_LINK_H
#define _SEPOL_POLICYDB_LINK_H
#include <sepol/handle.h>
+#include <sepol/errcodes.h>
#include <sepol/policydb/policydb.h>
-#include <stddef.h>
-/* error codes */
-#define SEPOL_LINK_ERROR 1 /* general error */
-#define SEPOL_LINK_NOTSUP 2 /* feature not supported in module language */
-#define SEPOL_LINK_REQNOTMET 3 /* requirements not met */
+#include <stddef.h>
+
extern int link_modules(sepol_handle_t * handle,
policydb_t * b, policydb_t ** mods, int len,
int verbose);
Modified: trunk/libsepol/src/avtab.c
===================================================================
--- trunk/libsepol/src/avtab.c 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/libsepol/src/avtab.c 2007-02-01 21:29:28 UTC (rev 2217)
@@ -1,7 +1,8 @@
/* Author : Stephen Smalley, <sd...@ep...> */
-/* Updated: Frank Mayer <ma...@tr...> and Karl MacMillan <kma...@tr...>
+/* Updated: Frank Mayer <ma...@tr...>
+ * and Karl MacMillan <kma...@me...>
*
* Added conditional policy language extensions
*
@@ -9,8 +10,10 @@
*
* Code cleanup
*
+ * Updated: Karl MacMillan <kma...@me...>
+ *
* Copyright (C) 2003 Tresys Technology, LLC
- * Copyright (C) 2003 Red Hat, Inc.
+ * Copyright (C) 2003,2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -36,6 +39,7 @@
#include <stdlib.h>
#include <sepol/policydb/avtab.h>
#include <sepol/policydb/policydb.h>
+#include <sepol/errcodes.h>
#include "debug.h"
#include "private.h"
@@ -77,7 +81,7 @@
key->specified & ~(AVTAB_ENABLED | AVTAB_ENABLED_OLD);
if (!h)
- return -ENOMEM;
+ return SEPOL_ENOMEM;
hvalue = AVTAB_HASH(key);
for (prev = NULL, cur = h->htable[hvalue];
@@ -86,7 +90,7 @@
key->target_type == cur->key.target_type &&
key->target_class == cur->key.target_class &&
(specified & cur->key.specified))
- return -EEXIST;
+ return SEPOL_EEXIST;
if (key->source_type < cur->key.source_type)
break;
if (key->source_type == cur->key.source_type &&
@@ -100,7 +104,7 @@
newnode = avtab_insert_node(h, hvalue, prev, key, datum);
if (!newnode)
- return -ENOMEM;
+ return SEPOL_ENOMEM;
return 0;
}
@@ -470,9 +474,9 @@
for (i = 0; i < nel; i++) {
rc = avtab_read_item(fp, vers, a, avtab_insertf, NULL);
if (rc) {
- if (rc == -ENOMEM)
+ if (rc == SEPOL_ENOMEM)
ERR(fp->handle, "out of memory");
- if (rc == -EEXIST)
+ if (rc == SEPOL_EEXIST)
ERR(fp->handle, "duplicate entry");
ERR(fp->handle, "failed on entry %d of %u", i, nel);
goto bad;
Modified: trunk/libsepol/src/expand.c
===================================================================
--- trunk/libsepol/src/expand.c 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/libsepol/src/expand.c 2007-02-01 21:29:28 UTC (rev 2217)
@@ -1,8 +1,9 @@
-/* Authors: Karl MacMillan <kma...@tr...>
+/* Authors: Karl MacMillan <kma...@me...>
* Jason Tang <jt...@tr...>
* Joshua Brindle <jbr...@tr...>
*
* Copyright (C) 2004-2005 Tresys Technology, LLC
+ * Copyright (C) 2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -84,7 +85,7 @@
if (!new_type) {
ERR(state->handle, "Out of memory!");
free(new_id);
- return -ENOMEM;
+ return SEPOL_ENOMEM;
}
memset(new_type, 0, sizeof(type_datum_t));
@@ -467,7 +468,7 @@
if (!new_alias) {
ERR(state->handle, "Out of memory!");
free(new_id);
- return -ENOMEM;
+ return SEPOL_ENOMEM;
}
memset(new_alias, 0, sizeof(type_datum_t));
if (alias->flavor == TYPE_TYPE)
Modified: trunk/libsepol/src/hashtab.c
===================================================================
--- trunk/libsepol/src/hashtab.c 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/libsepol/src/hashtab.c 2007-02-01 21:29:28 UTC (rev 2217)
@@ -1,6 +1,27 @@
/* Author : Stephen Smalley, <sd...@ep...> */
+/*
+ * Updated : Karl MacMillan <kma...@me...>
+ *
+ * Copyright (C) 2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
/* FLASK */
/*
@@ -48,7 +69,7 @@
hashtab_ptr_t prev, cur, newnode;
if (!h)
- return HASHTAB_OVERFLOW;
+ return SEPOL_ENOMEM;
hvalue = h->hash_value(h, key);
prev = NULL;
@@ -59,11 +80,11 @@
}
if (cur && (h->keycmp(h, key, cur->key) == 0))
- return HASHTAB_PRESENT;
+ return SEPOL_EEXIST;
newnode = (hashtab_ptr_t) malloc(sizeof(hashtab_node_t));
if (newnode == NULL)
- return HASHTAB_OVERFLOW;
+ return SEPOL_ENOMEM;
memset(newnode, 0, sizeof(struct hashtab_node));
newnode->key = key;
newnode->datum = datum;
@@ -76,7 +97,7 @@
}
h->nel++;
- return HASHTAB_SUCCESS;
+ return SEPOL_OK;
}
int hashtab_remove(hashtab_t h, hashtab_key_t key,
@@ -87,7 +108,7 @@
hashtab_ptr_t cur, last;
if (!h)
- return HASHTAB_MISSING;
+ return SEPOL_ENOENT;
hvalue = h->hash_value(h, key);
last = NULL;
@@ -98,7 +119,7 @@
}
if (cur == NULL || (h->keycmp(h, key, cur->key) != 0))
- return HASHTAB_MISSING;
+ return SEPOL_ENOENT;
if (last == NULL)
h->htable[hvalue] = cur->next;
@@ -109,7 +130,7 @@
destroy(cur->key, cur->datum, args);
free(cur);
h->nel--;
- return HASHTAB_SUCCESS;
+ return SEPOL_OK;
}
int hashtab_replace(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum,
@@ -120,7 +141,7 @@
hashtab_ptr_t prev, cur, newnode;
if (!h)
- return HASHTAB_OVERFLOW;
+ return SEPOL_ENOMEM;
hvalue = h->hash_value(h, key);
prev = NULL;
@@ -138,7 +159,7 @@
} else {
newnode = (hashtab_ptr_t) malloc(sizeof(hashtab_node_t));
if (newnode == NULL)
- return HASHTAB_OVERFLOW;
+ return SEPOL_ENOMEM;
memset(newnode, 0, sizeof(struct hashtab_node));
newnode->key = key;
newnode->datum = datum;
@@ -151,7 +172,7 @@
}
}
- return HASHTAB_SUCCESS;
+ return SEPOL_OK;
}
hashtab_datum_t hashtab_search(hashtab_t h, const hashtab_key_t key)
@@ -206,7 +227,7 @@
hashtab_ptr_t cur;
if (!h)
- return HASHTAB_SUCCESS;
+ return SEPOL_OK;
for (i = 0; i < h->size; i++) {
cur = h->htable[i];
@@ -217,7 +238,7 @@
cur = cur->next;
}
}
- return HASHTAB_SUCCESS;
+ return SEPOL_OK;
}
void hashtab_map_remove_on_error(hashtab_t h,
Modified: trunk/libsepol/src/link.c
===================================================================
--- trunk/libsepol/src/link.c 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/libsepol/src/link.c 2007-02-01 21:29:28 UTC (rev 2217)
@@ -1,8 +1,9 @@
-/* Authors: Karl MacMillan <kma...@tr...>
+/* Authors: Karl MacMillan <kma...@me...>
* Joshua Brindle <jbr...@tr...>
* Jason Tang <jt...@tr...>
*
* Copyright (C) 2004-2005 Tresys Technology, LLC
+ * Copyright (C) 2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -148,14 +149,14 @@
new_id = strdup(perm_id);
if (new_id == NULL) {
ERR(state->handle, "Memory error");
- ret = -SEPOL_LINK_ERROR;
+ ret = SEPOL_ERR;
goto err;
}
new_perm =
(perm_datum_t *) calloc(1, sizeof(perm_datum_t));
if (new_perm == NULL) {
ERR(state->handle, "Memory error");
- ret = -SEPOL_LINK_ERROR;
+ ret = SEPOL_ERR;
goto err;
}
ret = hashtab_insert(dest_class->permissions.table,
@@ -174,7 +175,7 @@
"Module %s depends on permission %s in class %s, not satisfied",
state->cur_mod_name, perm_id,
state->dest_class_name);
- return -SEPOL_LINK_REQNOTMET;
+ return SEPOL_EREQ;
}
}
@@ -227,7 +228,7 @@
hashtab_search(state->cur->policy->p_classes_scope.table,
id);
if (scope == NULL) {
- ret = -SEPOL_LINK_ERROR;
+ ret = SEPOL_ERR;
goto err;
}
if (scope->scope == SCOPE_DECL) {
@@ -235,7 +236,7 @@
ERR(state->handle,
"%s: Modules may not yet declare new classes.",
state->cur_mod_name);
- ret = -SEPOL_LINK_NOTSUP;
+ ret = SEPOL_ENOTSUP;
goto err;
} else {
/* It would be nice to error early here because the requirement is
@@ -252,18 +253,18 @@
(class_datum_t *) calloc(1, sizeof(class_datum_t));
if (new_class == NULL) {
ERR(state->handle, "Memory error\n");
- ret = -SEPOL_LINK_ERROR;
+ ret = SEPOL_ERR;
goto err;
}
if (symtab_init
(&new_class->permissions, PERM_SYMTAB_SIZE)) {
- ret = -SEPOL_LINK_ERROR;
+ ret = SEPOL_ERR;
goto err;
}
new_id = strdup(id);
if (new_id == NULL) {
ERR(state->handle, "Memory error\n");
- ret = -SEPOL_LINK_ERROR;
+ ret = SEPOL_ERR;
goto err;
}
ret = hashtab_insert(state->base->p_classes.table,
@@ -589,13 +590,13 @@
scope =
hashtab_search(state->cur->policy->p_sens_scope.table, id);
if (!scope)
- return -SEPOL_LINK_ERROR;
+ return SEPOL_ERR;
if (scope->scope == SCOPE_DECL) {
/* disallow declarations in modules */
ERR(state->handle,
"%s: Modules may not declare new sensitivities.",
state->cur_mod_name);
- return -SEPOL_LINK_NOTSUP;
+ return SEPOL_ENOTSUP;
}
}
@@ -620,13 +621,13 @@
scope =
hashtab_search(state->cur->policy->p_cat_scope.table, id);
if (!scope)
- return -SEPOL_LINK_ERROR;
+ return SEPOL_ERR;
if (scope->scope == SCOPE_DECL) {
/* disallow declarations in modules */
ERR(state->handle,
"%s: Modules may not declare new categories.",
state->cur_mod_name);
- return -SEPOL_LINK_NOTSUP;
+ return SEPOL_ENOTSUP;
}
}
@@ -1916,7 +1917,7 @@
}
rc = is_decl_requires_met(state, decl, &req);
if (rc < 0) {
- ret = -SEPOL_LINK_ERROR;
+ ret = SEPOL_ERR;
goto out;
} else if (rc == 0) {
decl->enabled = 0;
@@ -1925,7 +1926,7 @@
if (!(block->flags & AVRULE_OPTIONAL)) {
print_missing_requirements(state, block,
&req);
- ret = -SEPOL_LINK_REQNOTMET;
+ ret = SEPOL_EREQ;
goto out;
}
}
@@ -2209,7 +2210,7 @@
}
if (enable_avrules(&state, state.base)) {
- retval = -SEPOL_LINK_REQNOTMET;
+ retval = SEPOL_EREQ;
goto cleanup;
}
Modified: trunk/libsepol/src/policydb.c
===================================================================
--- trunk/libsepol/src/policydb.c 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/libsepol/src/policydb.c 2007-02-01 21:29:28 UTC (rev 2217)
@@ -17,7 +17,7 @@
*
* Copyright (C) 2004-2005 Trusted Computer Solutions, Inc.
* Copyright (C) 2003 - 2005 Tresys Technology, LLC
- * Copyright (C) 2003 - 2004 Red Hat, Inc.
+ * Copyright (C) 2003 - 2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1176,9 +1176,9 @@
* (i.e. aliases) */
if (value)
*value = ++pol->symtab[sym].nprim;
- } else if (rc == HASHTAB_PRESENT && scope == SCOPE_REQ) {
+ } else if (rc == SEPOL_EEXIST && scope == SCOPE_REQ) {
retval = 1; /* symbol not added -- need to free() later */
- } else if (rc == HASHTAB_PRESENT && scope == SCOPE_DECL) {
+ } else if (rc == SEPOL_EEXIST && scope == SCOPE_DECL) {
if (sym == SYM_ROLES || sym == SYM_USERS) {
/* allow multiple declarations for these two */
retval = 1;
Modified: trunk/libsepol/src/private.h
===================================================================
--- trunk/libsepol/src/private.h 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/libsepol/src/private.h 2007-02-01 21:29:28 UTC (rev 2217)
@@ -2,9 +2,11 @@
/* Endian conversion for reading and writing binary policies */
+#include <sepol/policydb/policydb.h>
+
#include <byteswap.h>
#include <endian.h>
-#include <sepol/policydb/policydb.h>
+#include <errno.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define cpu_to_le16(x) (x)
Modified: trunk/policycoreutils/semodule_deps/semodule_deps.c
===================================================================
--- trunk/policycoreutils/semodule_deps/semodule_deps.c 2007-02-01 21:21:17 UTC (rev 2216)
+++ trunk/policycoreutils/semodule_deps/semodule_deps.c 2007-02-01 21:29:28 UTC (rev 2217)
@@ -1,7 +1,7 @@
/* Authors: Karl MacMillan <kma...@me...>
*
* Copyright (C) 2006 Tresys Technology, LLC
- * Copyright (C) 2006 Red Hat, Inc.
+ * Copyright (C) 2006-2007 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,6 +16,7 @@
* of avrule_blocks - even in an ABI safe way - seems undesirable.
*/
#include <sepol/module.h>
+#include <sepol/errno.h>
#include <sepol/policydb/policydb.h>
#include <getopt.h>
@@ -201,15 +202,15 @@
hashtab_insert(mods,
mod_name,
reqs);
- if (ret != HASHTAB_SUCCESS)
+ if (ret != SEPOL_OK)
return ret;
}
ret =
hashtab_insert(reqs, req_name,
NULL);
if (!
- (ret == HASHTAB_PRESENT
- || ret == HASHTAB_SUCCESS))
+ (ret == SEPOL_EEXIST
+ || ret == SEPOL_OK))
return -1;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|