* [ SEMANAGE ] Implement dbase_file_set, fix memleak
@ 2005-10-26 23:42 Ivan Gyurdiev
2005-10-27 8:37 ` Ivan Gyurdiev
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ivan Gyurdiev @ 2005-10-26 23:42 UTC (permalink / raw)
To: selinux; +Cc: Stephen Smalley, Joshua Brindle
[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]
Changes:
- implement dbase_file_set
- fix a memory leak in dbase_file_modify that I've been trying to find -
there are no more leaks that I know of
=============
I'll be really busy until the middle of next week - not sure if I can
get a many patches written.
A short TODO:
- interface: pass handle into sepol records, or implement status codes
- stub: implement interface parse/print
- stub: implement dbase_policydb_list
- fix: fix port key handling of modify() [ do not replace an entire
range on weak match (not exact) ]
- improvement: track when the policy is modified, and do not rebuild on
commit if it wasn't modified
- add error messages everywhere (and further propagate handle), and make
sure they're user-friendly
- uncomment if0-ed code, add new semanage interfaces to semanage.h, and
the map file
Not important at this time:
- stub: implement dbase_policydb_del (not currently used)
- stub: implement dbase_policydb_flush (not currently used)
- fix: users parser/genusers parser should not look for range substring
- that's ambiguous
- fix: seusers parser should allow multiline MLS context with whitespace
[-- Attachment #2: libsemanage.dbase_file_set.diff --]
[-- Type: text/x-patch, Size: 1308 bytes --]
diff -Naurp --exclude CVS --exclude ChangeLog --exclude direct_api.c --exclude semanage_store.c --exclude VERSION --exclude libsemanage.map --exclude 'module_record*' --exclude 'database_directory*' --exclude Makefile old/libsemanage/src/database_file.c new/libsemanage/src/database_file.c
--- old/libsemanage/src/database_file.c 2005-10-25 09:06:53.000000000 -0400
+++ new/libsemanage/src/database_file.c 2005-10-26 19:28:35.000000000 -0400
@@ -388,14 +388,26 @@ static int dbase_file_set(
record_key_t* key,
record_t* data) {
+ cache_entry_t* entry;
+ int status;
+
if (enter_rw(handle, dbase) < 0)
goto err;
- /* Stub */
- key = NULL;
- data = NULL;
+ status = dbase_file_cache_locate(handle, dbase, key, &entry);
+ if (status < 0)
+ goto err;
+ if (status == STATUS_NODATA) {
+ /* FIXME: handle error */
+ goto err;
+ }
+ else {
+ dbase->rtable->free(entry->data);
+ entry->data = data;
+ }
+
dbase->modified = 1;
- return STATUS_ERR;
+ return STATUS_SUCCESS;
err:
/* FIXME: handle error */
@@ -422,8 +434,10 @@ static int dbase_file_modify(
if (dbase_file_cache_add(dbase, data) < 0)
goto err;
}
- else
+ else {
+ dbase->rtable->free(entry->data);
entry->data = data;
+ }
dbase->modified = 1;
return STATUS_SUCCESS;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [ SEMANAGE ] Implement dbase_file_set, fix memleak
2005-10-26 23:42 [ SEMANAGE ] Implement dbase_file_set, fix memleak Ivan Gyurdiev
@ 2005-10-27 8:37 ` Ivan Gyurdiev
2005-10-27 13:49 ` Stephen Smalley
[not found] ` <4360E189.2010304@tresys.com>
2 siblings, 0 replies; 4+ messages in thread
From: Ivan Gyurdiev @ 2005-10-27 8:37 UTC (permalink / raw)
To: selinux; +Cc: Stephen Smalley, Joshua Brindle
>
> A short TODO:
> - interface: pass handle into sepol records, or implement status codes
> - stub: implement interface parse/print
> - stub: implement dbase_policydb_list
> - fix: fix port key handling of modify() [ do not replace an entire
> range on weak match (not exact) ]
> - improvement: track when the policy is modified, and do not rebuild
> on commit if it wasn't modified
> - add error messages everywhere (and further propagate handle), and
> make sure they're user-friendly
> - uncomment if0-ed code, add new semanage interfaces to semanage.h,
> and the map file
Another TODO:
============
- investigate whether database functions should be made reentrant,
exactly what kind of code can and cannot be executed in the iterate()
handler, and document that - things like: are modify() functions
allowed on the same database in iterate()? Other databases? queries()?
Out-of-transaction vs in-transaction behavior?
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [ SEMANAGE ] Implement dbase_file_set, fix memleak
2005-10-26 23:42 [ SEMANAGE ] Implement dbase_file_set, fix memleak Ivan Gyurdiev
2005-10-27 8:37 ` Ivan Gyurdiev
@ 2005-10-27 13:49 ` Stephen Smalley
[not found] ` <4360E189.2010304@tresys.com>
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Smalley @ 2005-10-27 13:49 UTC (permalink / raw)
To: Ivan Gyurdiev; +Cc: selinux, Joshua Brindle
On Wed, 2005-10-26 at 19:42 -0400, Ivan Gyurdiev wrote:
> Changes:
> - implement dbase_file_set
> - fix a memory leak in dbase_file_modify that I've been trying to find -
> there are no more leaks that I know of
Merged both patches (query APIs, dbase_file_set) as of libsemanage
1.3.36.
--
Stephen Smalley
National Security Agency
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <4360E189.2010304@tresys.com>]
end of thread, other threads:[~2005-10-27 15:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-26 23:42 [ SEMANAGE ] Implement dbase_file_set, fix memleak Ivan Gyurdiev
2005-10-27 8:37 ` Ivan Gyurdiev
2005-10-27 13:49 ` Stephen Smalley
[not found] ` <4360E189.2010304@tresys.com>
[not found] ` <4360E87D.6030504@cornell.edu>
[not found] ` <4360E94D.7040101@cornell.edu>
[not found] ` <4360EACD.80008@cornell.edu>
[not found] ` <4360EE32.9040706@cornell.edu>
2005-10-27 15:27 ` Ivan Gyurdiev
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.