@@ -192,20 +192,21 @@ int smk_access(struct smack_known *subject_known, char *object_label,
192192}
193193
194194/**
195- * smk_curacc - determine if current has a specific access to an object
195+ * smk_tskacc - determine if a task has a specific access to an object
196+ * @tsp: a pointer to the subject task
196197 * @obj_label: a pointer to the object's Smack label
197198 * @mode: the access requested, in "MAY" format
198199 * @a : common audit data
199200 *
200- * This function checks the current subject label/object label pair
201+ * This function checks the subject task's label/object label pair
201202 * in the access rule list and returns 0 if the access is permitted,
202- * non zero otherwise. It allows that current may have the capability
203+ * non zero otherwise. It allows that the task may have the capability
203204 * to override the rules.
204205 */
205- int smk_curacc (char * obj_label , u32 mode , struct smk_audit_info * a )
206+ int smk_tskacc (struct task_smack * subject , char * obj_label ,
207+ u32 mode , struct smk_audit_info * a )
206208{
207- struct task_smack * tsp = current_security ();
208- struct smack_known * skp = smk_of_task (tsp );
209+ struct smack_known * skp = smk_of_task (subject );
209210 int may ;
210211 int rc ;
211212
@@ -219,7 +220,7 @@ int smk_curacc(char *obj_label, u32 mode, struct smk_audit_info *a)
219220 * it can further restrict access.
220221 */
221222 may = smk_access_entry (skp -> smk_known , obj_label ,
222- & tsp -> smk_rules );
223+ & subject -> smk_rules );
223224 if (may < 0 )
224225 goto out_audit ;
225226 if ((mode & may ) == mode )
@@ -241,6 +242,24 @@ int smk_curacc(char *obj_label, u32 mode, struct smk_audit_info *a)
241242 return rc ;
242243}
243244
245+ /**
246+ * smk_curacc - determine if current has a specific access to an object
247+ * @obj_label: a pointer to the object's Smack label
248+ * @mode: the access requested, in "MAY" format
249+ * @a : common audit data
250+ *
251+ * This function checks the current subject label/object label pair
252+ * in the access rule list and returns 0 if the access is permitted,
253+ * non zero otherwise. It allows that current may have the capability
254+ * to override the rules.
255+ */
256+ int smk_curacc (char * obj_label , u32 mode , struct smk_audit_info * a )
257+ {
258+ struct task_smack * tsp = current_security ();
259+
260+ return smk_tskacc (tsp , obj_label , mode , a );
261+ }
262+
244263#ifdef CONFIG_AUDIT
245264/**
246265 * smack_str_from_perm : helper to transalate an int to a
@@ -285,7 +304,10 @@ static void smack_log_callback(struct audit_buffer *ab, void *a)
285304 audit_log_untrustedstring (ab , sad -> subject );
286305 audit_log_format (ab , " object=" );
287306 audit_log_untrustedstring (ab , sad -> object );
288- audit_log_format (ab , " requested=%s" , sad -> request );
307+ if (sad -> request [0 ] == '\0' )
308+ audit_log_format (ab , " labels_differ" );
309+ else
310+ audit_log_format (ab , " requested=%s" , sad -> request );
289311}
290312
291313/**
0 commit comments