Re: [PATCH] libselinux: selabel_*() support for database objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(2010/03/10 5:08), Eamon Walsh wrote:
> On 03/08/2010 08:42 PM, KaiGai Kohei wrote:
> 
> diff --git a/libselinux/src/label_db.c b/libselinux/src/label_db.c
> new file mode 100644
> index 0000000..fa41b59
> --- /dev/null
> +++ b/libselinux/src/label_db.c
> @@ -0,0 +1,334 @@
> +/*
> + * Media contexts backend for DB objects
> + *
> + * Author: KaiGai Kohei<kaigai@xxxxxxxxxxxxx>
> 
> [snip]
> 
> +static int
> +process_line(const char *path, char *line_buf, unsigned int line_num,
> +	     catalog_t *catalog)
> +{
> +	spec_t	       *spec =&catalog->specs[catalog->nspec];
> +	char	       *type, *key, *context, *temp;
> +	int		items;
> +
> +	/* Cut off comments */
> +	temp = strchr(line_buf, '#');
> +	if (temp)
> +		*temp = '\0';
> +
> +	/*
> +	 * Every entry must have the following format
> +	 *<object class>  <object name>  <security context>
> +	 */
> +	type = key = context = temp = NULL;
> +	items = sscanf(line_buf, "%as %as %as %as",
> +		&type,&key,&context,&temp);
> 
> 
> What is the meaning of the fourth "temp" argument here. Aren't lines
> only supposed to have three entries? Please remove this if it is not needed.

If the line has four or more elements, we want to raise an error, rather than
ignoring it.
If here is not the fourth %as, sscanf() does not return 4, does it?

Thanks,
-- 
KaiGai Kohei <kaigai@xxxxxxxxxxxx>

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.

[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux