{
struct smack_rule *rule = NULL;
- if (smack_label_length(subject) < 0 ||
- smack_label_length(object) < 0)
- return -1;
-
rule = calloc(sizeof(struct smack_rule), 1);
if (rule == NULL)
return -1;
- strncpy(rule->subject, subject, SMACK_LABEL_LEN);
- strncpy(rule->object, object, SMACK_LABEL_LEN);
+ if (get_label(rule->subject, subject) < 0 ||
+ get_label(rule->object, object) < 0) {
+ free(rule);
+ return -1;
+ }
+
parse_access_type(access_type, rule->access_type);
if (handle->first == NULL) {
{
struct smack_rule *rule = NULL;
- if (smack_label_length(subject) < 0 ||
- smack_label_length(object) < 0)
- return -1;
-
rule = calloc(sizeof(struct smack_rule), 1);
if (rule == NULL)
return -1;
- strncpy(rule->subject, subject, SMACK_LABEL_LEN);
- strncpy(rule->object, object, SMACK_LABEL_LEN);
+ if (get_label(rule->subject, subject) < 0 ||
+ get_label(rule->object, object) < 0) {
+ free(rule);
+ return -1;
+ }
+
parse_access_type(allow_access_type, rule->allow_access_type);
parse_access_type(deny_access_type, rule->deny_access_type);
rule->is_modify = 1;
label = strtok_r(buf, " \t\n", &ptr);
level = strtok_r(NULL, " \t\n", &ptr);
cat = strtok_r(NULL, " \t\n", &ptr);
- if (smack_label_length(label) < 0 || level == NULL)
- goto err_out;
- strncpy(mapping->label, label, SMACK_LABEL_LEN);
+ if (level == NULL || get_label(mapping->label, label) < 0)
+ goto err_out;
errno = 0;
val = strtol(level, NULL, 10);
int fd;
int ret;
- len = smack_label_length(label);
+ len = get_label(NULL, label);
if (len < 0)
return -1;
int len;
char path[PATH_MAX];
- len = smack_label_length(subject);
+ len = get_label(NULL, subject);
if (len < 0)
return -1;