platform/upstream/smack.git
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Fri, 10 Jan 2014 17:33:59 +0000 (19:33 +0200)]
Merge branch 'v1.0.x'

10 years agolibsmack: use 16 bits for smack access codes instead of sizeof(int) * 2
Rafal Krypa [Tue, 7 Jan 2014 15:25:32 +0000 (16:25 +0100)]
libsmack: use 16 bits for smack access codes instead of sizeof(int) * 2

There are 6 access bits to be stored in the access field. Special value -1
is used to distinguish set rules from change rules. Shrinking the filed to
8 bits still leaves space for one more future access bit.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agolibsmack: change logic for detecting long labels in smack_accesses
Rafal Krypa [Tue, 7 Jan 2014 15:21:32 +0000 (16:21 +0100)]
libsmack: change logic for detecting long labels in smack_accesses

Instead of storing label length in each smack_rule, have one integer in
smack_accesses to remember if long labels are used.
This saves few bytes per rule.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agoMerge remote-tracking branch 'rafal-krypa/issue73' into v1.0.x
Jarkko Sakkinen [Tue, 7 Jan 2014 07:10:54 +0000 (09:10 +0200)]
Merge remote-tracking branch 'rafal-krypa/issue73' into v1.0.x

10 years agoUpdate .gitignore files to ignore all build-time generated files
Rafal Krypa [Sun, 5 Jan 2014 23:13:47 +0000 (00:13 +0100)]
Update .gitignore files to ignore all build-time generated files

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agolibsmack: use common code for smack_accesses_apply() and smack_accesses_save().
Rafal Krypa [Thu, 2 Jan 2014 12:52:17 +0000 (13:52 +0100)]
libsmack: use common code for smack_accesses_apply() and smack_accesses_save().

Centralizing code that changes internal smack_accesses representation to
text. Internal function accesses_print() now generates output for applying
the rules to kernel and saving them to a file. This allows easier changes
to data structures used by libmskack and makes the code shorter.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agolibsmack: use common code for smack_accesses_add() and smack_accessess_add_modify()
Rafal Krypa [Tue, 31 Dec 2013 20:14:24 +0000 (21:14 +0100)]
libsmack: use common code for smack_accesses_add() and smack_accessess_add_modify()

These API functions were very similar and are now implemented as wrappers
to a single internal function. This allows easier changes to data structures
used by libmskack and makes the code shorter.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agoutils: use common code for apply_rules and apply_cipso
Rafal Krypa [Tue, 31 Dec 2013 20:11:35 +0000 (21:11 +0100)]
utils: use common code for apply_rules and apply_cipso

Code for apply_rules() has been rewritten to use opendir() and readdir(),
but apply_cipso() remained implemented with nftw().
This patch implements both applying functions with opendir() and readdir()
using a common internal function apply_path(). The common function can
handle both directory and single file,  so apply_rules_file() and
apply_cipso_file() are dropped.
The resulting code is 69 lines shorter and keeps directory traversal logic
in single place. It's side effect is applying CIPSO rules in one shot, just
like regular Smack rules.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agolibsmack: don't define __GNU_SOURCE in the code
Rafal Krypa [Tue, 31 Dec 2013 17:04:56 +0000 (18:04 +0100)]
libsmack: don't define __GNU_SOURCE in the code

__GNU_SOURCE is a glibc internal and should not be used directly.
It was already provided by AC_USE_SYSTEM_EXTENSIONS in configure.ac, so
it can be safely dropped.
Use more explicit AC_GNU_SOURCE in configure.ac instead (on Linux systems
they should be equivalent).

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agoutils: fix build warnings related to smack_smackfs_path()
Rafal Krypa [Tue, 31 Dec 2013 15:08:43 +0000 (16:08 +0100)]
utils: fix build warnings related to smack_smackfs_path()

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agoCompile for the C99 standard.
Rafal Krypa [Tue, 31 Dec 2013 15:07:55 +0000 (16:07 +0100)]
Compile for the C99 standard.

The code already uses C99 constructs, but appropriate compiler options
were not set.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agoautogen.sh: fix passing arguments to configure
Rafal Krypa [Tue, 31 Dec 2013 15:03:17 +0000 (16:03 +0100)]
autogen.sh: fix passing arguments to configure

Fixing error when arguments to autogen.sh contain white space, i.e.:
./autogen.sh CFLAGS='-Wall -Wextra'

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Fri, 20 Dec 2013 08:03:40 +0000 (10:03 +0200)]
Merge branch 'v1.0.x'

10 years agoMerge remote-tracking branch 'rafal-krypa/issue84' into v1.0.x
Jarkko Sakkinen [Fri, 20 Dec 2013 08:02:38 +0000 (10:02 +0200)]
Merge remote-tracking branch 'rafal-krypa/issue84' into v1.0.x

10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Fri, 20 Dec 2013 08:01:37 +0000 (10:01 +0200)]
Merge branch 'v1.0.x'

10 years agochsmack: updating to the branch master
José Bollo [Thu, 19 Dec 2013 12:00:09 +0000 (13:00 +0100)]
chsmack: updating to the branch master

The function smack_label_length is available as a library
function provided by libsmack. It is better to use it for
validating labels instead of redefining it in chsmack.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agoutils: drop build dependency on libattr, introduced by 5da1a22.
Rafal Krypa [Wed, 18 Dec 2013 23:01:38 +0000 (00:01 +0100)]
utils: drop build dependency on libattr, introduced by 5da1a22.

Use only glibc headers for xattr functions. Use ENODATA instead of ENOATTR.

10 years agolibsmack: fix label validation in smack_new_label_from_path
Jarkko Sakkinen [Wed, 18 Dec 2013 20:02:06 +0000 (22:02 +0200)]
libsmack: fix label validation in smack_new_label_from_path

Off-by-one length was returned from the function. This patch fixes
the regression by doing full validation for the SMACK label.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Wed, 18 Dec 2013 19:40:47 +0000 (21:40 +0200)]
Merge branch 'v1.0.x'

10 years agoAvoid memory allocation while opening smackfs files.
Rafal Krypa [Tue, 3 Dec 2013 14:58:57 +0000 (15:58 +0100)]
Avoid memory allocation while opening smackfs files.

Using openat() on pre-opened smackfs directory eliminates need to
construct absolute path to a smackfs file before opening it.

Other than it improves availability because file descriptor is kept
open to the mount point throughout the life-cycle of the process.
And it also improves security because as long as the file descriptor
is valid, files really come from SmackFS.

[jsakkine: updated commit message]

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Wed, 18 Dec 2013 19:09:25 +0000 (21:09 +0200)]
Merge branch 'v1.0.x'

10 years agoAdd dictionary for labels
Jan Cybulski [Tue, 3 Dec 2013 08:43:41 +0000 (09:43 +0100)]
Add dictionary for labels

Add dictionary for labels to avoid memory allocation
for the same label for multilple times.
Dictionary is common to all labels in a single rules set.
Each rule only keeps ids of labels in a dictionary
instead of whole label as a string.

Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
10 years agolibsmack: fix a bug in validation of labels
José Bollo [Tue, 17 Dec 2013 12:25:47 +0000 (13:25 +0100)]
libsmack: fix a bug in validation of labels

The function `get_label` didn't handle the characters below
' ' and above '~' correctly.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: update of the manual
José Bollo [Tue, 17 Dec 2013 10:49:44 +0000 (11:49 +0100)]
chsmack: update of the manual

This new version of the manual includes the options
the dereferencing symbolic links and for removing
smack's labels.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: refusing repeated labels
José Bollo [Tue, 10 Dec 2013 14:33:13 +0000 (15:33 +0100)]
chsmack: refusing repeated labels

Refusing to set many time a label is important for
security. If a label is set more than one time, wich
label is to use? Wich is the good?

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: add option to remove labels
José Bollo [Tue, 10 Dec 2013 14:29:14 +0000 (15:29 +0100)]
chsmack: add option to remove labels

Adding that option allow chsmack to remove the smack labels.
It is really important to have it.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: split option scan in two parts
José Bollo [Tue, 10 Dec 2013 14:22:15 +0000 (15:22 +0100)]
chsmack: split option scan in two parts

It prepares the futur option to remove smack labels.
It also separate the validation of the labels what can
improve the readability of the code.

Also add a check that the option transmute isn't repeated.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: using flags for labels
José Bollo [Tue, 10 Dec 2013 14:11:41 +0000 (15:11 +0100)]
chsmack: using flags for labels

That modification prepare the addition of the option
to remove Smack labels. It seems also best to be agnostic
on what are valid smack labels (and rely on libsmack in the
futur) that maybe one day could be empty strings!

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: checking transmute on directories
José Bollo [Tue, 10 Dec 2013 14:01:58 +0000 (15:01 +0100)]
chsmack: checking transmute on directories

The transmute flag is meaningfull only on directories.
The program now check that the transmute flag is set
only on directories.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: add dereference option
José Bollo [Tue, 10 Dec 2013 13:47:27 +0000 (14:47 +0100)]
chsmack: add dereference option

Add the options that allow to follow the symbolic
links instead of modifying it. There is no really
need but it may help.

The text of the short option is moved.
It prepares to scan options in two passes. It also
centralize the definition of options, avoiding to have
many lines between the definitions.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: exchanging order of nested blocks if/for
José Bollo [Tue, 10 Dec 2013 13:46:18 +0000 (14:46 +0100)]
chsmack: exchanging order of nested blocks if/for

Prepare to add the removing of labels and also reduce
the count of tests.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: use of 'smack_set_label_for_path'
José Bollo [Tue, 10 Dec 2013 13:43:32 +0000 (14:43 +0100)]
chsmack: use of 'smack_set_label_for_path'

To prepare to the future libsmack that will have a function
for writing Smack labels and to prepare to the handling of
symbolic links, the write of the labels is put in the
function 'smack_set_label_for_path'.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: use of 'smack_new_label_from_path'
José Bollo [Tue, 10 Dec 2013 13:37:31 +0000 (14:37 +0100)]
chsmack: use of 'smack_new_label_from_path'

The library libsmack offer a function for reading
Smack labels. It is better to use the function of the
library.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: validation of labels
José Bollo [Tue, 10 Dec 2013 13:26:40 +0000 (14:26 +0100)]
chsmack: validation of labels

To prepare to the future of libsmack (that will include the
validation function 'smack_label_length'), the validation
of the smack labels is separated from the main function.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: put usage string at head
José Bollo [Tue, 10 Dec 2013 13:13:23 +0000 (14:13 +0100)]
chsmack: put usage string at head

Setting it at head is a reading improvement for
developpers that can quickly show the usage of the
program. It also makes the main function more readable.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agochsmack: using linux constants for Smack's names
José Bollo [Tue, 10 Dec 2013 13:10:23 +0000 (14:10 +0100)]
chsmack: using linux constants for Smack's names

It is better to rely on the centralisation of names in a
single file: it can avoid errors.

The declarations of <linux/xattr.h> contains the definitions
of the names of the Smack's security attributes.

As Smack only runs on Linux and libsmack doesn't provides
a centralized version of the names of the security attributes
(because it were not needed), using the linux header seems
to be a good choice.

Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Tue, 10 Dec 2013 11:20:45 +0000 (13:20 +0200)]
Merge branch 'v1.0.x'

10 years agotests: starting point for stress testing
Jarkko Sakkinen [Tue, 10 Dec 2013 11:19:02 +0000 (13:19 +0200)]
tests: starting point for stress testing

This starting point for stress testing. Generates 200 files each
with 10000 random access rules. Does not yet support modify rules.
Next step would be probably making this more parametrized.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Tue, 10 Dec 2013 11:06:46 +0000 (13:06 +0200)]
Merge branch 'v1.0.x'

10 years agoFix return value of 'smack_new_label_from_path' v1.0.3.1
José Bollo [Tue, 10 Dec 2013 09:23:37 +0000 (10:23 +0100)]
Fix return value of 'smack_new_label_from_path'

Change-Id: Ic5412e9555a64a81bf1a871b30844d73dbed5758
Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
10 years agolibsmack: clean up redundant stuff
Jarkko Sakkinen [Thu, 5 Dec 2013 18:18:02 +0000 (20:18 +0200)]
libsmack: clean up redundant stuff

Cleaned up redundant constants and code. Grouped related constants
nearby each other.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
(cherry picked from commit d6f8c52011013f536b7171c2d1f3e9c5ecfaf2f9)

10 years agoRevert "libsmack: clean up redundant stuff"
Jarkko Sakkinen [Mon, 9 Dec 2013 13:08:23 +0000 (15:08 +0200)]
Revert "libsmack: clean up redundant stuff"

This reverts commit d6f8c52011013f536b7171c2d1f3e9c5ecfaf2f9.

10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Mon, 9 Dec 2013 13:07:07 +0000 (15:07 +0200)]
Merge branch 'v1.0.x'

10 years agoRevert "utils: use common code for apply_rules and apply_cipso"
Jarkko Sakkinen [Mon, 9 Dec 2013 13:05:27 +0000 (15:05 +0200)]
Revert "utils: use common code for apply_rules and apply_cipso"

This reverts commit 68e38ff3936597a3189d29f57a68dae5ac08db1e.

10 years agoBumped version to 1.0.3. v1.0.3
Jarkko Sakkinen [Thu, 5 Dec 2013 18:48:19 +0000 (20:48 +0200)]
Bumped version to 1.0.3.

10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Thu, 5 Dec 2013 18:41:58 +0000 (20:41 +0200)]
Merge branch 'v1.0.x'

10 years agoutils: use common code for apply_rules and apply_cipso
Rafal Krypa [Wed, 4 Dec 2013 15:58:53 +0000 (16:58 +0100)]
utils: use common code for apply_rules and apply_cipso

Code for apply_rules() has been rewritten to use opendir() and readdir(),
but apply_cipso() remained implemented with nftw().
This patch implements both applying functions with opendir() and readdir()
using a common internal function apply_dir().
The resulting code is 45 lines shorter and keeps directory traversal logic
in single place.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agolibsmack: clean up redundant stuff
Jarkko Sakkinen [Thu, 5 Dec 2013 18:18:02 +0000 (20:18 +0200)]
libsmack: clean up redundant stuff

Cleaned up redundant constants and code. Grouped related constants
nearby each other.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
(cherry picked from commit d6f8c52011013f536b7171c2d1f3e9c5ecfaf2f9)

10 years agolibsmack: clean up redundant stuff
Jarkko Sakkinen [Thu, 5 Dec 2013 18:18:02 +0000 (20:18 +0200)]
libsmack: clean up redundant stuff

Cleaned up redundant constants and code. Grouped related constants
nearby each other.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Thu, 5 Dec 2013 18:12:18 +0000 (20:12 +0200)]
Merge branch 'v1.0.x'

10 years agolibsmack: add support for new access mode for setting locks ("l")
Rafal Krypa [Mon, 22 Jul 2013 17:05:09 +0000 (19:05 +0200)]
libsmack: add support for new access mode for setting locks ("l")

This change should be backward compatible for kernels without l-mode support
as long as requested permissions don't contain this mode.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Thu, 5 Dec 2013 17:27:49 +0000 (19:27 +0200)]
Merge branch 'v1.0.x'

10 years agoutils: common.c: invalid fprintf()
Jarkko Sakkinen [Thu, 5 Dec 2013 17:26:01 +0000 (19:26 +0200)]
utils: common.c: invalid fprintf()

fprintf() has path parameter that was not utilized.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoutils: apply access rules to load/load2 in one shot
Jarkko Sakkinen [Thu, 28 Nov 2013 23:09:22 +0000 (01:09 +0200)]
utils: apply access rules to load/load2 in one shot

Open load/load2 only once. Inside the callback only collect rules
using smack_accessed_add_from_file(). Finally, apply access rules
in a single slot.

This was inspired by feedback from Rafal Krypa <r.krypa@samsung.com>.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Tue, 3 Dec 2013 16:29:34 +0000 (18:29 +0200)]
Merge branch 'v1.0.x'

10 years agoDo not silently ignore files when applying them in smackload/ctl v1.0.2
Jarkko Sakkinen [Tue, 3 Dec 2013 16:22:55 +0000 (18:22 +0200)]
Do not silently ignore files when applying them in smackload/ctl

Detect unknown file types and non-regular files and fail if they
are found with proper error reporting.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Mon, 2 Dec 2013 17:36:06 +0000 (19:36 +0200)]
Merge branch 'v1.0.x'

10 years agoMerge remote-tracking branch 'jsakkine/issue60' into v1.0.x
Jarkko Sakkinen [Mon, 2 Dec 2013 17:34:51 +0000 (19:34 +0200)]
Merge remote-tracking branch 'jsakkine/issue60' into v1.0.x

10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Mon, 2 Dec 2013 17:12:29 +0000 (19:12 +0200)]
Merge branch 'v1.0.x'

10 years agoMerge remote-tracking branch 'rafal-krypa/issue70' into v1.0.x
Jarkko Sakkinen [Mon, 2 Dec 2013 16:22:49 +0000 (18:22 +0200)]
Merge remote-tracking branch 'rafal-krypa/issue70' into v1.0.x

10 years agosmackctl: fix reporting "unknown action" (regression in ce452ab)
Rafal Krypa [Mon, 2 Dec 2013 14:04:37 +0000 (15:04 +0100)]
smackctl: fix reporting "unknown action" (regression in ce452ab)

Running "smackctl apply" and "smackctl clear" ended with error and
message about unknown action, although the action was known and
performed successfully.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agolibsmack: fix smack_cipso_apply() failing with more than one rule
Rafal Krypa [Mon, 2 Dec 2013 15:03:28 +0000 (16:03 +0100)]
libsmack: fix smack_cipso_apply() failing with more than one rule

Fixing regression in f47b9c90 that causes smack_cipso_apply() to fail due
to a typo.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
10 years agolibsmack: remove redundant check for clear flag form accesses_apply()
Jarkko Sakkinen [Sun, 1 Dec 2013 15:03:55 +0000 (17:03 +0200)]
libsmack: remove redundant check for clear flag form accesses_apply()

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agolibsmack: remove redundant strlen() call from accesses_apply()
Jarkko Sakkinen [Sun, 1 Dec 2013 15:01:42 +0000 (17:01 +0200)]
libsmack: remove redundant strlen() call from accesses_apply()

Return value of snprintf() should give the same length as strlen()
would given that string fits into buffer.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agolibsmack: check in accesses_apply() that rule has short labels
Jarkko Sakkinen [Sun, 1 Dec 2013 14:51:04 +0000 (16:51 +0200)]
libsmack: check in accesses_apply() that rule has short labels

Check rule has short labels when only 'load' is available.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Mon, 2 Dec 2013 06:39:34 +0000 (08:39 +0200)]
Merge branch 'v1.0.x'

10 years agoMerge remote-tracking branch 'rafal-krypa/issue68' into v1.0.x
Jarkko Sakkinen [Mon, 2 Dec 2013 06:33:00 +0000 (08:33 +0200)]
Merge remote-tracking branch 'rafal-krypa/issue68' into v1.0.x

10 years agolibsmack: early fail in accesses_apply() if modify rules are not supported
Jarkko Sakkinen [Sun, 1 Dec 2013 14:43:14 +0000 (16:43 +0200)]
libsmack: early fail in accesses_apply() if modify rules are not supported

In accesses_apply(), in the beginning of each iteration, check
that change_fd is a valid file descriptor if the current rule
is a modify rule. Return with -1 immediately if that is not the
case.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agolibsmack: parse whole access type string, not only first 5 bytes.
Rafal Krypa [Thu, 3 Jan 2013 09:34:34 +0000 (10:34 +0100)]
libsmack: parse whole access type string, not only first 5 bytes.

Previous version of this function parsed only first ACC_LEN (5)
characters of access_type. Now the whole string will be read.

This will prevent silent ignoring of access type characters in cases
like "-rwxat" or "rrwxat".

Re-applying because it was reverted by d2283792.

10 years agolibsmack: fixed segfault in get_label() (regression in 66483b)
Rafal Krypa [Fri, 29 Nov 2013 19:42:25 +0000 (20:42 +0100)]
libsmack: fixed segfault in get_label() (regression in 66483b)

Commit 66483b introduced segfault in API functions smack_revoke_subject()
and smack_set_label_for_self().
Fix the accidental NULL pointer dereference.

10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Thu, 28 Nov 2013 16:05:17 +0000 (18:05 +0200)]
Merge branch 'v1.0.x'

10 years agoMerge remote-tracking branch 'jsakkine/issue64' into v1.0.x
Jarkko Sakkinen [Thu, 28 Nov 2013 16:04:12 +0000 (18:04 +0200)]
Merge remote-tracking branch 'jsakkine/issue64' into v1.0.x

10 years agolibsmack: fixed apply_accesses() (regression in d2283792)
Jarkko Sakkinen [Thu, 28 Nov 2013 15:49:47 +0000 (17:49 +0200)]
libsmack: fixed apply_accesses() (regression in d2283792)

Took accesses_apply() from 8fd0167 and converted it mechanically
as possible to use the changed struct smack_rule. Now smackload
works succesfully for a single file too. Mistake I did in
d2283792 was that I unncessarily cleaned up accesses_apply()
at the same time as changing things. My bad.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoisgx: fix: clear flag for directory parameter in smackload/smackctl
Jarkko Sakkinen [Wed, 27 Nov 2013 22:03:06 +0000 (00:03 +0200)]
isgx: fix: clear flag for directory parameter in smackload/smackctl

Clear flag was not properly applied when directory is given
for smackload. This patch fixes the issue. I decided to move
into opendir/readdir approach because nftw() does not support
supplying any kind of state to the callback. The end result
looks also more manageable that we had before.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Wed, 27 Nov 2013 12:17:45 +0000 (14:17 +0200)]
Merge branch 'v1.0.x'

10 years agodebian: enable parallel build.
Rafal Krypa [Thu, 21 Nov 2013 12:42:24 +0000 (13:42 +0100)]
debian: enable parallel build.

Support `dpkg-buildpackage -j' by adding --parallel to dh invocations.

10 years agodebian: convert for multi-arch packages.
Rafal Krypa [Fri, 3 May 2013 12:04:51 +0000 (14:04 +0200)]
debian: convert for multi-arch packages.

10 years agodebian: add build dependency on doxygen.
Rafal Krypa [Fri, 22 Nov 2013 09:45:45 +0000 (10:45 +0100)]
debian: add build dependency on doxygen.

Make sure that devel manuals will be generated for libsmack-dev package.

10 years agoMerge branch 'v1.0.x'
Jarkko Sakkinen [Wed, 27 Nov 2013 12:07:06 +0000 (14:07 +0200)]
Merge branch 'v1.0.x'

10 years agolibsmack: revert access codes
Jarkko Sakkinen [Tue, 26 Nov 2013 19:02:05 +0000 (21:02 +0200)]
libsmack: revert access codes

Revert access codes as internal representation for access types
because they work much better when we have to merge rules.

Other aim of this patch is to clean up internal presentation.
After this change the whole access state can be represented
with only two integers.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoMerge remote-tracking branch 'smack-1.0.x/master'
Jarkko Sakkinen [Mon, 25 Nov 2013 14:07:17 +0000 (16:07 +0200)]
Merge remote-tracking branch 'smack-1.0.x/master'

10 years agoutils: more verbose error reporting when applying rules
Jarkko Sakkinen [Mon, 25 Nov 2013 13:08:20 +0000 (15:08 +0200)]
utils: more verbose error reporting when applying rules

Add more verbose error reporting when applying either access
rules or CIPSO. The key point is to be able to separate whether
error occured during reading or applying phase.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
10 years agoMerge remote-tracking branch 'smack-1.0.x/master'
Jarkko Sakkinen [Mon, 25 Nov 2013 14:00:45 +0000 (16:00 +0200)]
Merge remote-tracking branch 'smack-1.0.x/master'

10 years agoFix memory leak on smack_cipso
Zofia Abramowska [Fri, 22 Nov 2013 09:38:06 +0000 (10:38 +0100)]
Fix memory leak on smack_cipso

smack_cipso_free() didn't release main pointer, which was
inconsistent with header description and further usage in
apply_cipso_file().
(cherry picked from commit 6304f9a3f73312a7feb3b25fa593919744acb947)

10 years agoutils: fix CIPSO error messages in common.c
Jarkko Sakkinen [Thu, 21 Nov 2013 18:50:37 +0000 (20:50 +0200)]
utils: fix CIPSO error messages in common.c

When applying CIPSO fails use different error message than when
applying access rules. Additionally, fixed indentation for lines
printing error message that are over 80 characters long.
(cherry picked from commit 43b5e8da94acba1f790eb65b4256ba6013397dde)

10 years agoFix memory leak on smack_cipso
Zofia Abramowska [Fri, 22 Nov 2013 09:38:06 +0000 (10:38 +0100)]
Fix memory leak on smack_cipso

smack_cipso_free() didn't release main pointer, which was
inconsistent with header description and further usage in
apply_cipso_file().

10 years agoutils: fix CIPSO error messages in common.c
Jarkko Sakkinen [Thu, 21 Nov 2013 18:50:37 +0000 (20:50 +0200)]
utils: fix CIPSO error messages in common.c

When applying CIPSO fails use different error message than when
applying access rules. Additionally, fixed indentation for lines
printing error message that are over 80 characters long.

10 years agodoc: show version
Jarkko Sakkinen [Thu, 21 Nov 2013 15:36:35 +0000 (17:36 +0200)]
doc: show version

Fix documentation to show correct package version.
(cherry picked from commit 399e3a662c0ddb81cae94804a96416ae856e7507)

10 years agodoc: fix parallel build, broken by c5e2007.
Rafal Krypa [Thu, 21 Nov 2013 12:40:08 +0000 (13:40 +0100)]
doc: fix parallel build, broken by c5e2007.

Parallel make failed, because dependencies were not properly specified
for all auto generated man pages.
(cherry picked from commit d9e0abc8657dc1ee5aab391af4543a7cd1c9d757)

10 years agodebian: fix package build, broken by c5e2007.
Rafal Krypa [Thu, 21 Nov 2013 11:47:26 +0000 (12:47 +0100)]
debian: fix package build, broken by c5e2007.

Auto generated manpages are in different locations than static ones, so
libsmack-dev.manpages needs to be modified.
It now includes all generated section 3 manuals.
(cherry picked from commit b3b70c21b75cc5e92d7334406557a8f49d0b4714)

10 years agodoc: show version
Jarkko Sakkinen [Thu, 21 Nov 2013 15:36:35 +0000 (17:36 +0200)]
doc: show version

Fix documentation to show correct package version.

10 years agodoc: fix parallel build, broken by c5e2007.
Rafal Krypa [Thu, 21 Nov 2013 12:40:08 +0000 (13:40 +0100)]
doc: fix parallel build, broken by c5e2007.

Parallel make failed, because dependencies were not properly specified
for all auto generated man pages.

10 years agodebian: fix package build, broken by c5e2007.
Rafal Krypa [Thu, 21 Nov 2013 11:47:26 +0000 (12:47 +0100)]
debian: fix package build, broken by c5e2007.

Auto generated manpages are in different locations than static ones, so
libsmack-dev.manpages needs to be modified.
It now includes all generated section 3 manuals.

10 years agoGenerate API documentation by using Doxygen.
Jarkko Sakkinen [Tue, 19 Nov 2013 20:34:02 +0000 (22:34 +0200)]
Generate API documentation by using Doxygen.

Generate API documentation from smack.h by using Doxygen so that
documentation needs to be maintained only in one place.
(cherry picked from commit c5e200768a99451c559570b0a44673a8ecd5ee7f)

Conflicts:

doc/Makefile.am
doc/smack_have_access.3

10 years agoMerge remote-tracking branch 'jsakkine/issue45'
Jarkko Sakkinen [Thu, 21 Nov 2013 09:10:56 +0000 (11:10 +0200)]
Merge remote-tracking branch 'jsakkine/issue45'

10 years agoSolve problem with "make distcheck" breaking on systemd config files.
Rafal Krypa [Wed, 20 Nov 2013 11:47:26 +0000 (12:47 +0100)]
Solve problem with "make distcheck" breaking on systemd config files.

Dist packages created by "make dist" were built without smack.mount and
smack.service files. This caused the packages to fail to build.
Adding the files to EXTRA_DIST solves the problem.
(cherry picked from commit 73ec7d5be2c87bf13dbd45f2cb8433122b1bd08d)

10 years agoSolve problem with "make distcheck" breaking on systemd config files.
Rafal Krypa [Wed, 20 Nov 2013 11:47:26 +0000 (12:47 +0100)]
Solve problem with "make distcheck" breaking on systemd config files.

Dist packages created by "make dist" were built without smack.mount and
smack.service files. This caused the packages to fail to build.
Adding the files to EXTRA_DIST solves the problem.

10 years agoCopy labels using get_label()
Jarkko Sakkinen [Tue, 19 Nov 2013 13:07:17 +0000 (15:07 +0200)]
Copy labels using get_label()

Copy and validate labels in a single transaction:

- No trust for having '\0' in the src buffer when copying
  labels.
- Improves performance by combining length calculation, validation
  and copying.
(cherry picked from commit 16f84d57e2766f1ccfd59ae77fad407b6cc5ff81)

10 years agoHelper function get_label()
Jarkko Sakkinen [Tue, 19 Nov 2013 11:49:37 +0000 (13:49 +0200)]
Helper function get_label()

The helper function ssize_t get_label(char *dest, const char *src)
validates the given label and copies it to the dest buffer if
available.
(cherry picked from commit 09fdff9a456dec54a4c8548c9b9acbcbce48d59a)

10 years agoGenerate API documentation by using Doxygen.
Jarkko Sakkinen [Tue, 19 Nov 2013 20:34:02 +0000 (22:34 +0200)]
Generate API documentation by using Doxygen.

Generate API documentation from smack.h by using Doxygen so that
documentation needs to be maintained only in one place.