Implement dbase_policydb_list
This patch implements dbase_policydb_list on top of count/iterate. It also changes the count() specification to unsigned int everywhere...I probably still shouldn't be casting unsigned int to size_t in list(), but at least it's better than casting signed int (and producing a warning).
list() tested and should work.
libsemanage/include/semanage/booleans_local.h +1 -1
@@ -36,7 +36,7 @@ extern int semanage_bool_exists_local(extern int semanage_bool_count_local (semanage_handle_t * handle, -int * response); +unsigned int * response); extern int semanage_bool_iterate_local( semanage_handle_t* handle,
libsemanage/include/semanage/booleans_policy.h +2 -2
@@ -17,7 +17,7 @@ extern int semanage_bool_exists(extern int semanage_bool_count (semanage_handle_t * handle, -int * response); +unsigned int * response); extern int semanage_bool_iterate( semanage_handle_t* handle,
@@ -28,6 +28,6 @@ extern int semanage_bool_iterate(extern int semanage_bool_list (semanage_handle_t * handle,semanage_bool_t *** records, -size_t * count); +size_t * size);#endif
libsemanage/include/semanage/interfaces_local.h +1 -1
@@ -36,7 +36,7 @@ extern int semanage_iface_exists_local(extern int semanage_iface_count_local (semanage_handle_t * handle, -int * response); +unsigned int * response); extern int semanage_iface_iterate_local( semanage_handle_t* handle,
libsemanage/include/semanage/interfaces_policy.h +1 -1
@@ -17,7 +17,7 @@ extern int semanage_iface_exists(extern int semanage_iface_count (semanage_handle_t * handle, -int * response); +unsigned int * response); extern int semanage_iface_iterate( semanage_handle_t* handle,
libsemanage/include/semanage/ports_local.h +1 -1
@@ -36,7 +36,7 @@ extern int semanage_port_exists_local(extern int semanage_port_count_local (semanage_handle_t * handle, -int * response); +unsigned int * response); extern int semanage_port_iterate_local( semanage_handle_t* handle,
libsemanage/include/semanage/ports_policy.h +1 -1
@@ -17,7 +17,7 @@ extern int semanage_port_exists(extern int semanage_port_count (semanage_handle_t * handle, -int * response); +unsigned int * response); extern int semanage_port_iterate( semanage_handle_t* handle,
libsemanage/include/semanage/seusers.h +1 -1
@@ -36,7 +36,7 @@ extern int semanage_seuser_exists(extern int semanage_seuser_count (semanage_handle_t * handle, -int * response); +unsigned int * response); extern int semanage_seuser_iterate( semanage_handle_t* handle,
libsemanage/include/semanage/users_local.h +1 -1
@@ -36,7 +36,7 @@ extern int semanage_user_exists_local(extern int semanage_user_count_local (semanage_handle_t * handle, -int * response); +unsigned int * response); extern int semanage_user_iterate_local( semanage_handle_t* handle,
libsemanage/include/semanage/users_policy.h +1 -1
@@ -17,7 +17,7 @@ extern int semanage_user_exists(extern int semanage_user_count (semanage_handle_t * handle, -int * response); +unsigned int * response); extern int semanage_user_iterate( semanage_handle_t* handle,
libsemanage/src/booleans_local.c +1 -1
@@ -79,7 +79,7 @@ int semanage_bool_exists_local(int semanage_bool_count_local (semanage_handle_t * handle, -int * response) { +unsigned int * response) {dbase_config_t * dconfig =semanage_bool_dbase_local (handle);return dconfig->dtable->count (handle, dconfig->dbase, response);
libsemanage/src/booleans_policy.c +1 -1
@@ -52,7 +52,7 @@ int semanage_bool_exists(int semanage_bool_count (semanage_handle_t * handle, -int * response) { +unsigned int * response) {dbase_config_t * dconfig =semanage_bool_dbase_policy (handle);return dconfig->dtable->count (handle, dconfig->dbase, response);
libsemanage/src/database_default.c +1 -1
@@ -107,7 +107,7 @@ static int dbase_default_exists (static int dbase_default_count (semanage_handle_t * handle,dbase_default_t * dbase, -int * response) { +unsigned int * response) { response =NULL ; dbase =NULL ;
libsemanage/src/database_file.c +1 -1
@@ -450,7 +450,7 @@ static int dbase_file_modify(static int dbase_file_count (semanage_handle_t * handle,dbase_file_t * dbase, -int * response) { +unsigned int * response) {if (enter_ro (handle, dbase) <0 ) goto err;
libsemanage/src/database.h +1 -1
@@ -95,7 +95,7 @@ typedef struct dbase_table {int (*count) (struct semanage_handle * handle,dbase_t * dbase, -int * response); +unsigned int * response);/* Execute the specified handler over * the records of this database. The handler
libsemanage/src/database_policydb.c +57 -6
88 lines not on this page · raw message
libsemanage/src/database_policydb.h +1 -1
@@ -46,7 +46,7 @@ typedef struct record_policydb_table {int (*count) (sepol_handle_t * handle,sepol_policydb_t * policydb, -int * response); +unsigned int * response);/* Check if a record exists */ int (*exists) (
libsemanage/src/interfaces_local.c +1 -1
@@ -79,7 +79,7 @@ int semanage_iface_exists_local(int semanage_iface_count_local (semanage_handle_t * handle, -int * response) { +unsigned int * response) {dbase_config_t * dconfig =semanage_iface_dbase_local (handle);return dconfig->dtable->count (handle, dconfig->dbase, response);
libsemanage/src/interfaces_policy.c +1 -1
@@ -52,7 +52,7 @@ int semanage_iface_exists(int semanage_iface_count (semanage_handle_t * handle, -int * response) { +unsigned int * response) {dbase_config_t * dconfig =semanage_iface_dbase_policy (handle);return dconfig->dtable->count (handle, dconfig->dbase, response);
libsemanage/src/ports_local.c +1 -1
@@ -79,7 +79,7 @@ int semanage_port_exists_local(int semanage_port_count_local (semanage_handle_t * handle, -int * response) { +unsigned int * response) {dbase_config_t * dconfig =semanage_port_dbase_local (handle);return dconfig->dtable->count (handle, dconfig->dbase, response);
libsemanage/src/ports_policy.c +1 -1
@@ -52,7 +52,7 @@ int semanage_port_exists(int semanage_port_count (semanage_handle_t * handle, -int * response) { +unsigned int * response) {dbase_config_t * dconfig =semanage_port_dbase_policy (handle);return dconfig->dtable->count (handle, dconfig->dbase, response);
libsemanage/src/seusers.c +1 -1
@@ -79,7 +79,7 @@ int semanage_seuser_exists(int semanage_seuser_count (semanage_handle_t * handle, -int * response) { +unsigned int * response) {dbase_config_t * dconfig =semanage_seuser_dbase (handle);return dconfig->dtable->count (handle, dconfig->dbase, response);
libsemanage/src/users_local.c +1 -1
@@ -80,7 +80,7 @@ int semanage_user_exists_local(int semanage_user_count_local (semanage_handle_t * handle, -int * response) { +unsigned int * response) {dbase_config_t * dconfig =semanage_user_dbase_local (handle);return dconfig->dtable->count (handle, dconfig->dbase, response);
libsemanage/src/users_policy.c +1 -1
@@ -52,7 +52,7 @@ int semanage_user_exists(int semanage_user_count (semanage_handle_t * handle, -int * response) { +unsigned int * response) {dbase_config_t * dconfig =semanage_user_dbase_policy (handle);return dconfig->dtable->count (handle, dconfig->dbase, response);
libsepol/include/sepol/booleans.h +1 -1
@@ -39,7 +39,7 @@ extern int sepol_bool_set (extern int sepol_bool_count (sepol_handle_t * handle,sepol_policydb_t * p, -int * response); +unsigned int * response);/* Check if the specified boolean exists */ extern int sepol_bool_exists(
libsepol/include/sepol/interfaces.h +1 -1
@@ -9,7 +9,7 @@extern int sepol_iface_count (sepol_handle_t * handle,sepol_policydb_t * p, -int * response); +unsigned int * response);/* Check if an interface exists */ extern int sepol_iface_exists(
libsepol/include/sepol/ports.h +1 -1
@@ -9,7 +9,7 @@extern int sepol_port_count (sepol_handle_t * handle,sepol_policydb_t * p, -int * response); +unsigned int * response);/* Check if a port exists */ extern int sepol_port_exists(
libsepol/include/sepol/users.h +1 -1
@@ -35,7 +35,7 @@ extern int sepol_user_modify(extern int sepol_user_count (sepol_handle_t * handle,sepol_policydb_t * p, -int * response); +unsigned int * response);/* Check if the specified user exists */ extern int sepol_user_exists(
libsepol/src/booleans.c +1 -1
@@ -110,7 +110,7 @@ int sepol_bool_set (int sepol_bool_count (sepol_handle_t * handle,sepol_policydb_t * p, -int * response) { +unsigned int * response) {policydb_t * policydb = &p->p; *response = policydb->p_bools.nprim;
libsepol/src/interfaces.c +2 -2
@@ -212,9 +212,9 @@ int sepol_iface_modify(extern int sepol_iface_count (sepol_handle_t * handle,sepol_policydb_t * p, -int * response) { +unsigned int * response) { -int count =0 ; +unsigned int count =0 ;ocontext_t *c, *head;policydb_t * policydb = &p->p;
libsepol/src/ports.c +2 -2
@@ -143,9 +143,9 @@ static int port_to_record (extern int sepol_port_count (sepol_handle_t * handle,sepol_policydb_t * p, -int * response) { +unsigned int * response) { -int count =0 ; +unsigned int count =0 ;ocontext_t *c, *head;policydb_t * policydb = &p->p;
libsepol/src/users.c +1 -1
@@ -316,7 +316,7 @@ int sepol_user_exists(int sepol_user_count (sepol_handle_t * handle,sepol_policydb_t * p, -int * response) { +unsigned int * response) {policydb_t * policydb = &p->p; *response = policydb->p_users.nprim;
Quoted 6 lines · Ivan Gyurdiev
This patch implements
dbase_policydb_liston top of count/iterate. It also changes thecount()specification to unsigned int everywhere...I probably still shouldn't be casting unsigned int tosize_tinlist(), but at least it's better than casting signed int (and producing a warning).
list()tested and should work.
Thanks, merged as of libsepol 1.9.33 and libsemanage 1.3.38.
Signature · 8 lines
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 [email protected] with the words "unsubscribe selinux" without quotes as the message.