Skip to content

Commit

Permalink
Xext/xselinux: Warning fixes
Browse files Browse the repository at this point in the history
There's a 'const char *' adventure here that I'm mostly ignoring; some
client information gets const poisoned. Worked around by adding a
couple of casts. Ick.

Added an _X_ATTRIBUTE_PRINTF to SELinuxLog.

Ignore a couple of unused return values.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard authored and nwnk committed Sep 24, 2015
1 parent 9ee05c8 commit 9af111f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Xext/xselinux_hooks.c
Expand Up @@ -147,7 +147,7 @@ SELinuxLabelClient(ClientPtr client)
strncpy(subj->command, cmdname, COMMAND_LEN - 1);

if (!cached)
free(cmdname); /* const char * */
free((void *) cmdname); /* const char * */
}

finish:
Expand Down Expand Up @@ -294,6 +294,9 @@ SELinuxAudit(void *auditdata,
audit->extension ? audit->extension : "");
}

static int
SELinuxLog(int type, const char *fmt, ...) _X_ATTRIBUTE_PRINTF(2, 3);

static int
SELinuxLog(int type, const char *fmt, ...)
{
Expand All @@ -316,6 +319,7 @@ SELinuxLog(int type, const char *fmt, ...)
va_start(ap, fmt);
vsnprintf(buf, MAX_AUDIT_MESSAGE_LENGTH, fmt, ap);
rc = audit_log_user_avc_message(audit_fd, aut, buf, NULL, NULL, NULL, 0);
(void) rc;
va_end(ap);
LogMessageVerb(X_WARNING, 0, "%s", buf);
return 0;
Expand Down Expand Up @@ -476,7 +480,7 @@ SELinuxExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
}

/* Perform the security check */
auditdata.extension = rec->ext->name;
auditdata.extension = (char *) rec->ext->name;
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_EXTENSION, rec->access_mode,
&auditdata);
if (rc != Success)
Expand Down

0 comments on commit 9af111f

Please sign in to comment.