From: Ivan Gyurdiev <ivg2@cornell.edu>
To: selinux@tycho.nsa.gov
Subject: Re: [ SEMANAGE ] Fix record handlers, add status codes
Date: Tue, 20 Sep 2005 05:22:25 -0400 [thread overview]
Message-ID: <432FD4D1.5000604@cornell.edu> (raw)
In-Reply-To: <432FCF8F.8070909@cornell.edu>
[-- Attachment #1: Type: text/plain, Size: 235 bytes --]
The attached patch applies on top of the previous one, and fixes
several bugs. It also adds a header with status codes which I need...
the debug system should go into this header IMHO, once we decide
what the debug system should be.
[-- Attachment #2: libsemanage.fixup.diff --]
[-- Type: text/x-patch, Size: 4439 bytes --]
diff -Naur libsemanage.new/src/database_file.c libsemanage/src/database_file.c
--- libsemanage.new/src/database_file.c 2005-09-20 05:11:44.000000000 -0400
+++ libsemanage/src/database_file.c 2005-09-20 05:18:12.000000000 -0400
@@ -1,5 +1,6 @@
#include <stdlib.h>
#include <stddef.h>
+#include "debug.h"
#include "database.h"
#include "record_file.h"
#include "record_file_handlers.h"
@@ -23,12 +24,12 @@
dbase[DBASE_USERS]->rtable = &RTABLE_USER;
dbase[DBASE_PORTS]->rtable = &RTABLE_PORT;
- return 0;
+ return STATUS_SUCCESS;
err:
for (i--; i >= 0; i--)
free(dbase[i]);
- return -1;
+ return STATUS_ERR;
}
void dbase_close() {
@@ -60,7 +61,7 @@
/* config.merr_fatal = */
/* Stub */
- return -1;
+ return STATUS_SUCCESS;
}
int dbase_modify(
@@ -86,7 +87,7 @@
/* config.merr_fatal = */
/* Stub */
- return -1;
+ return STATUS_SUCCESS;
}
int dbase_del(
@@ -104,12 +105,12 @@
/* config.parse_arg = */
/* config.perr_fatal = */
config.modify = 1;
- config.handler = record_add;
+ config.handler = record_del;
config.handler_arg = &handler_arg;
/* config.merr_fatal = */
/* Stub */
- return -1;
+ return STATUS_SUCCESS;
}
int dbase_query(
@@ -129,12 +130,12 @@
/* config.parse_arg = */
/* config.perr_fatal = */
config.modify = 0;
- config.handler = record_add;
+ config.handler = record_query;
config.handler_arg = &handler_arg;
/* config.merr_fatal = */
/* Stub */
- return -1;
+ return STATUS_SUCCESS;
}
int dbase_exists(
@@ -159,7 +160,7 @@
/* config.merr_fatal = */
/* Stub */
- return -1;
+ return STATUS_SUCCESS;
}
int dbase_count(
@@ -182,7 +183,7 @@
/* config.merr_fatal = */
/* Stub */
- return -1;
+ return STATUS_SUCCESS;
}
int dbase_iterate(
@@ -209,7 +210,7 @@
/* config.merr_fatal = */
/* Stub */
- return -1;
+ return STATUS_SUCCESS;
}
int dbase_list(
@@ -232,5 +233,5 @@
keyset = NULL;
dataset = NULL;
count = NULL;
- return -1;
+ return STATUS_SUCCESS;
}
diff -Naur libsemanage.new/src/debug.h libsemanage/src/debug.h
--- libsemanage.new/src/debug.h 1969-12-31 19:00:00.000000000 -0500
+++ libsemanage/src/debug.h 2005-09-20 05:08:22.000000000 -0400
@@ -0,0 +1,10 @@
+#ifndef _SEPOL_INTERNAL_DEBUG_H_
+#define _SEPOL_INTERNAL_DEBUG_H_
+
+#define STATUS_SUCCESS 0
+#define STATUS_ERR -1
+#define STATUS_NODATA 1
+
+/* Define debug system in this header */
+
+#endif
diff -Naur libsemanage.new/src/record_file.c libsemanage/src/record_file.c
--- libsemanage.new/src/record_file.c 2005-09-19 15:31:28.000000000 -0400
+++ libsemanage/src/record_file.c 2005-09-20 05:14:24.000000000 -0400
@@ -1,8 +1,9 @@
+#include "debug.h"
#include "record_file.h"
int record_iterate_file(iterate_config_t* config) {
/* Stub */
config = NULL;
- return 0;
+ return STATUS_SUCCESS;
}
diff -Naur libsemanage.new/src/record_file_handlers.c libsemanage/src/record_file_handlers.c
--- libsemanage.new/src/record_file_handlers.c 2005-09-20 05:11:44.000000000 -0400
+++ libsemanage/src/record_file_handlers.c 2005-09-20 05:18:40.000000000 -0400
@@ -1,3 +1,4 @@
+#include "debug.h"
#include "record_file.h"
#include "record_file_handlers.h"
@@ -7,7 +8,7 @@
#define RECORD_DEFINED
#endif
-int record_query(record_t process_rec, record_t unused, void* varg) {
+int record_query(record_t process_rec, record_t* unused, void* varg) {
/* Stub */
process_rec = NULL;
@@ -16,7 +17,7 @@
return RECORD_HANDLER_SIGEXIT;
}
-int record_exists(record_t process_rec, record_t unused, void* varg) {
+int record_exists(record_t process_rec, record_t* unused, void* varg) {
/* Stub */
process_rec = NULL;
diff -Naur libsemanage.new/src/record_file_handlers.h libsemanage/src/record_file_handlers.h
--- libsemanage.new/src/record_file_handlers.h 2005-09-20 05:11:44.000000000 -0400
+++ libsemanage/src/record_file_handlers.h 2005-09-20 05:17:31.000000000 -0400
@@ -51,8 +51,8 @@
void* fn_arg;
} record_iterate_arg_t;
-extern int record_query(record_t rec, record_t unused, void* varg);
-extern int record_exists(record_t rec, record_t unused, void* varg);
+extern int record_query(record_t rec, record_t* unused, void* varg);
+extern int record_exists(record_t rec, record_t* unused, void* varg);
extern int record_add(record_t rec, record_t* new_rec, void* varg);
extern int record_modify (record_t rec, record_t* new_rec, void* varg);
extern int record_del(record_t rec, record_t* unused, void* varg);
next prev parent reply other threads:[~2005-09-20 9:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-20 8:59 [ SEMANAGE ] Stub record handlers Ivan Gyurdiev
2005-09-20 9:22 ` Ivan Gyurdiev [this message]
2005-09-21 14:42 ` [ SEMANAGE ] Fix record handlers, add status codes Stephen Smalley
2005-09-21 15:19 ` Ivan Gyurdiev
2005-09-21 15:36 ` Stephen Smalley
2005-09-21 14:41 ` [ SEMANAGE ] Stub record handlers Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=432FD4D1.5000604@cornell.edu \
--to=ivg2@cornell.edu \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.