#23 Remove deprecation and other warning
Merged a year ago by abbra. Opened a year ago by salahx.
Unknown source warnings  into  master

file modified
+3 -5
@@ -242,8 +242,7 @@

  static dbus_bool_t

  check_one_ac_selinux(struct oddjob_acl *acl, const char *selinux_context)

  {

- 	char *ctx;

- 	const char *user, *role, *type, *range;

+ 	const char *ctx, *user, *role, *type, *range;

  	dbus_bool_t ret;

  	context_t context;

  
@@ -1357,7 +1356,7 @@

  			filename);

  	}

  

- 	xmlInitGlobals();

+ 	xmlInitParser();

  	doc = xmlParseFile(filename);

  	if (doc == NULL) {

  		fprintf(stderr, "Error parsing configuration from \"%s\".\n",
@@ -1380,7 +1379,6 @@

  	}

  

  	xmlFreeDoc(doc);

- 	xmlCleanupGlobals();

  

  	return parsed;

  }
@@ -1948,7 +1946,7 @@

  		/* Set up the SELinux execution context. */

  		if (globals.selinux_enabled) {

  			const char *client_secontext;

- 			security_context_t helper_context, exec_context;

+ 			char *helper_context, *exec_context;

  

  			client_secontext = oddjob_dbus_message_get_selinux_context(msg);

  			if (client_secontext == NULL) {

file modified
+15 -19
@@ -45,12 +45,7 @@

  #ifdef SELINUX_LABELS

  

  #include <selinux/selinux.h>

- 

- #ifndef HAVE_MATCHPATHCON_INIT

- static void

- matchpathcon_init(const char *path) {

- }

- #endif

+ #include <selinux/label.h>

  

  static dbus_bool_t

  oddjob_check_selinux_enabled(void)
@@ -58,9 +53,6 @@

  	static int selinux_enabled = -1;

  	if (selinux_enabled == -1) {

  		selinux_enabled = is_selinux_enabled();

- 		if (selinux_enabled == 1) {

- 			matchpathcon_init(NULL);

- 		}

  	}

  	return (selinux_enabled == 1);

  }
@@ -68,24 +60,28 @@

  void

  oddjob_set_selinux_file_creation_context(const char *path, mode_t mode)

  {

- 	security_context_t context;

+ 	struct selabel_handle *handle;

+ 	char *context;

  

  	if (!oddjob_check_selinux_enabled()) {

  		return;

  	}

  

- 	context = NULL;

- 	if (matchpathcon(path, mode, &context) == 0) {

- 		if (context != NULL) {

- 			if (strcmp(context, "<<none>>") == 0) {

- 				oddjob_unset_selinux_file_creation_context();

+ 	handle = selabel_open(SELABEL_CTX_FILE,NULL,0);

+ 	if (handle) {

+ 		if (selabel_lookup(handle,&context,path,mode) == 0) {

+ 			if (context != NULL) {

+ 				if (strcmp(context, "<<none>>") == 0) {

+ 					oddjob_unset_selinux_file_creation_context();

+ 				} else {

+ 					setfscreatecon(context);

+ 				}

+ 				freecon(context);

  			} else {

- 				setfscreatecon(context);

- 			}

- 			freecon(context);

- 		} else {

  			oddjob_unset_selinux_file_creation_context();

+ 			}

  		}

+ 		selabel_close(handle);

  	}

  }

  

This PR fixes up most warnings: A couple of deprecation warnings and a implicit const removal. There are still 5 warnings about write() return value being ignored, but in all 5 cases the program will immediately exit() anyway, so its just noise.

rebased onto cad3310

a year ago

Pull-Request has been merged by abbra

a year ago
Metadata