smackfs.c (7b3b6e42032e94a6132a85642e95106f5346650e) smackfs.c (b6dff3ec5e116e3af6f537d4caedcad6b9e5082a)
1/*
2 * Copyright (C) 2007 Casey Schaufler <casey@schaufler-ca.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, version 2.
7 *
8 * Authors:

--- 322 unchanged lines hidden (view full) ---

331static void smk_cipso_doi(void)
332{
333 int rc;
334 struct cipso_v4_doi *doip;
335 struct netlbl_audit audit_info;
336
337 audit_info.loginuid = audit_get_loginuid(current);
338 audit_info.sessionid = audit_get_sessionid(current);
1/*
2 * Copyright (C) 2007 Casey Schaufler <casey@schaufler-ca.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, version 2.
7 *
8 * Authors:

--- 322 unchanged lines hidden (view full) ---

331static void smk_cipso_doi(void)
332{
333 int rc;
334 struct cipso_v4_doi *doip;
335 struct netlbl_audit audit_info;
336
337 audit_info.loginuid = audit_get_loginuid(current);
338 audit_info.sessionid = audit_get_sessionid(current);
339 audit_info.secid = smack_to_secid(current->security);
339 audit_info.secid = smack_to_secid(current->cred->security);
340
341 rc = netlbl_cfg_map_del(NULL, &audit_info);
342 if (rc != 0)
343 printk(KERN_WARNING "%s:%d remove rc = %d\n",
344 __func__, __LINE__, rc);
345
346 doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL);
347 if (doip == NULL)

--- 18 unchanged lines hidden (view full) ---

366 */
367static void smk_unlbl_ambient(char *oldambient)
368{
369 int rc;
370 struct netlbl_audit audit_info;
371
372 audit_info.loginuid = audit_get_loginuid(current);
373 audit_info.sessionid = audit_get_sessionid(current);
340
341 rc = netlbl_cfg_map_del(NULL, &audit_info);
342 if (rc != 0)
343 printk(KERN_WARNING "%s:%d remove rc = %d\n",
344 __func__, __LINE__, rc);
345
346 doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL);
347 if (doip == NULL)

--- 18 unchanged lines hidden (view full) ---

366 */
367static void smk_unlbl_ambient(char *oldambient)
368{
369 int rc;
370 struct netlbl_audit audit_info;
371
372 audit_info.loginuid = audit_get_loginuid(current);
373 audit_info.sessionid = audit_get_sessionid(current);
374 audit_info.secid = smack_to_secid(current->security);
374 audit_info.secid = smack_to_secid(current->cred->security);
375
376 if (oldambient != NULL) {
377 rc = netlbl_cfg_map_del(oldambient, &audit_info);
378 if (rc != 0)
379 printk(KERN_WARNING "%s:%d remove rc = %d\n",
380 __func__, __LINE__, rc);
381 }
382

--- 455 unchanged lines hidden (view full) ---

838 * @ppos: where to start
839 *
840 * Returns number of bytes written or error code, as appropriate
841 */
842static ssize_t smk_write_onlycap(struct file *file, const char __user *buf,
843 size_t count, loff_t *ppos)
844{
845 char in[SMK_LABELLEN];
375
376 if (oldambient != NULL) {
377 rc = netlbl_cfg_map_del(oldambient, &audit_info);
378 if (rc != 0)
379 printk(KERN_WARNING "%s:%d remove rc = %d\n",
380 __func__, __LINE__, rc);
381 }
382

--- 455 unchanged lines hidden (view full) ---

838 * @ppos: where to start
839 *
840 * Returns number of bytes written or error code, as appropriate
841 */
842static ssize_t smk_write_onlycap(struct file *file, const char __user *buf,
843 size_t count, loff_t *ppos)
844{
845 char in[SMK_LABELLEN];
846 char *sp = current->security;
846 char *sp = current->cred->security;
847
848 if (!capable(CAP_MAC_ADMIN))
849 return -EPERM;
850
851 /*
852 * This can be done using smk_access() but is done
853 * explicitly for clarity. The smk_access() implementation
854 * would use smk_access(smack_onlycap, MAY_WRITE)

--- 241 unchanged lines hidden ---
847
848 if (!capable(CAP_MAC_ADMIN))
849 return -EPERM;
850
851 /*
852 * This can be done using smk_access() but is done
853 * explicitly for clarity. The smk_access() implementation
854 * would use smk_access(smack_onlycap, MAY_WRITE)

--- 241 unchanged lines hidden ---