~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to security/security.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
                                    effective, inheritable, permitted);
173
173
}
174
174
 
175
 
int security_capable(const struct cred *cred, int cap)
176
 
{
177
 
        return security_ops->capable(current, cred, cap, SECURITY_CAP_AUDIT);
178
 
}
179
 
 
180
 
int security_real_capable(struct task_struct *tsk, int cap)
181
 
{
182
 
        const struct cred *cred;
183
 
        int ret;
184
 
 
185
 
        cred = get_task_cred(tsk);
186
 
        ret = security_ops->capable(tsk, cred, cap, SECURITY_CAP_AUDIT);
187
 
        put_cred(cred);
188
 
        return ret;
189
 
}
190
 
 
191
 
int security_real_capable_noaudit(struct task_struct *tsk, int cap)
192
 
{
193
 
        const struct cred *cred;
194
 
        int ret;
195
 
 
196
 
        cred = get_task_cred(tsk);
197
 
        ret = security_ops->capable(tsk, cred, cap, SECURITY_CAP_NOAUDIT);
198
 
        put_cred(cred);
199
 
        return ret;
200
 
}
201
 
 
202
 
int security_sysctl(struct ctl_table *table, int op)
203
 
{
204
 
        return security_ops->sysctl(table, op);
 
175
int security_capable(struct user_namespace *ns, const struct cred *cred,
 
176
                     int cap)
 
177
{
 
178
        return security_ops->capable(current, cred, ns, cap,
 
179
                                     SECURITY_CAP_AUDIT);
 
180
}
 
181
 
 
182
int security_real_capable(struct task_struct *tsk, struct user_namespace *ns,
 
183
                          int cap)
 
184
{
 
185
        const struct cred *cred;
 
186
        int ret;
 
187
 
 
188
        cred = get_task_cred(tsk);
 
189
        ret = security_ops->capable(tsk, cred, ns, cap, SECURITY_CAP_AUDIT);
 
190
        put_cred(cred);
 
191
        return ret;
 
192
}
 
193
 
 
194
int security_real_capable_noaudit(struct task_struct *tsk,
 
195
                                  struct user_namespace *ns, int cap)
 
196
{
 
197
        const struct cred *cred;
 
198
        int ret;
 
199
 
 
200
        cred = get_task_cred(tsk);
 
201
        ret = security_ops->capable(tsk, cred, ns, cap, SECURITY_CAP_NOAUDIT);
 
202
        put_cred(cred);
 
203
        return ret;
205
204
}
206
205
 
207
206
int security_quotactl(int cmds, int type, int id, struct super_block *sb)
219
218
        return security_ops->syslog(type);
220
219
}
221
220
 
222
 
int security_settime(struct timespec *ts, struct timezone *tz)
 
221
int security_settime(const struct timespec *ts, const struct timezone *tz)
223
222
{
224
223
        return security_ops->settime(ts, tz);
225
224
}
289
288
}
290
289
EXPORT_SYMBOL(security_sb_copy_data);
291
290
 
 
291
int security_sb_remount(struct super_block *sb, void *data)
 
292
{
 
293
        return security_ops->sb_remount(sb, data);
 
294
}
 
295
 
292
296
int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
293
297
{
294
298
        return security_ops->sb_kern_mount(sb, flags, data);
353
357
}
354
358
 
355
359
int security_inode_init_security(struct inode *inode, struct inode *dir,
356
 
                                  char **name, void **value, size_t *len)
 
360
                                 const struct qstr *qstr, char **name,
 
361
                                 void **value, size_t *len)
357
362
{
358
363
        if (unlikely(IS_PRIVATE(inode)))
359
364
                return -EOPNOTSUPP;
360
 
        return security_ops->inode_init_security(inode, dir, name, value, len);
 
365
        return security_ops->inode_init_security(inode, dir, qstr, name, value,
 
366
                                                 len);
361
367
}
362
368
EXPORT_SYMBOL(security_inode_init_security);
363
369
 
547
553
{
548
554
        if (unlikely(IS_PRIVATE(inode)))
549
555
                return 0;
550
 
        return security_ops->inode_permission(inode, mask);
 
556
        return security_ops->inode_permission(inode, mask, 0);
551
557
}
552
558
EXPORT_SYMBOL(security_inode_permission);
553
559
 
555
561
{
556
562
        if (unlikely(IS_PRIVATE(inode)))
557
563
                return 0;
558
 
        if (flags)
559
 
                return -ECHILD;
560
 
        return security_ops->inode_permission(inode, MAY_EXEC);
 
564
        return security_ops->inode_permission(inode, MAY_EXEC, flags);
561
565
}
562
566
 
563
567
int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
1157
1161
 
1158
1162
void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
1159
1163
{
1160
 
        security_ops->sk_getsecid(sk, &fl->secid);
 
1164
        security_ops->sk_getsecid(sk, &fl->flowi_secid);
1161
1165
}
1162
1166
EXPORT_SYMBOL(security_sk_classify_flow);
1163
1167
 
1290
1294
}
1291
1295
 
1292
1296
int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
1293
 
                                       struct xfrm_policy *xp, struct flowi *fl)
 
1297
                                       struct xfrm_policy *xp,
 
1298
                                       const struct flowi *fl)
1294
1299
{
1295
1300
        return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
1296
1301
}
1302
1307
 
1303
1308
void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
1304
1309
{
1305
 
        int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0);
 
1310
        int rc = security_ops->xfrm_decode_session(skb, &fl->flowi_secid, 0);
1306
1311
 
1307
1312
        BUG_ON(rc);
1308
1313
}