27
27
#include "cifs_unicode.h"
28
28
29
29
/* security id for everyone/world system group */
30
- static const struct cifs_sid sid_everyone = {
30
+ static const struct smb_sid sid_everyone = {
31
31
1 , 1 , {0 , 0 , 0 , 0 , 0 , 1 }, {0 } };
32
32
/* security id for Authenticated Users system group */
33
- static const struct cifs_sid sid_authusers = {
33
+ static const struct smb_sid sid_authusers = {
34
34
1 , 1 , {0 , 0 , 0 , 0 , 0 , 5 }, {cpu_to_le32 (11 )} };
35
35
36
36
/* S-1-22-1 Unmapped Unix users */
37
- static const struct cifs_sid sid_unix_users = {1 , 1 , {0 , 0 , 0 , 0 , 0 , 22 },
37
+ static const struct smb_sid sid_unix_users = {1 , 1 , {0 , 0 , 0 , 0 , 0 , 22 },
38
38
{cpu_to_le32 (1 ), 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } };
39
39
40
40
/* S-1-22-2 Unmapped Unix groups */
41
- static const struct cifs_sid sid_unix_groups = { 1 , 1 , {0 , 0 , 0 , 0 , 0 , 22 },
41
+ static const struct smb_sid sid_unix_groups = { 1 , 1 , {0 , 0 , 0 , 0 , 0 , 22 },
42
42
{cpu_to_le32 (2 ), 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } };
43
43
44
44
/*
@@ -48,17 +48,17 @@ static const struct cifs_sid sid_unix_groups = { 1, 1, {0, 0, 0, 0, 0, 22},
48
48
/* S-1-5-88 MS NFS and Apple style UID/GID/mode */
49
49
50
50
/* S-1-5-88-1 Unix uid */
51
- static const struct cifs_sid sid_unix_NFS_users = { 1 , 2 , {0 , 0 , 0 , 0 , 0 , 5 },
51
+ static const struct smb_sid sid_unix_NFS_users = { 1 , 2 , {0 , 0 , 0 , 0 , 0 , 5 },
52
52
{cpu_to_le32 (88 ),
53
53
cpu_to_le32 (1 ), 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } };
54
54
55
55
/* S-1-5-88-2 Unix gid */
56
- static const struct cifs_sid sid_unix_NFS_groups = { 1 , 2 , {0 , 0 , 0 , 0 , 0 , 5 },
56
+ static const struct smb_sid sid_unix_NFS_groups = { 1 , 2 , {0 , 0 , 0 , 0 , 0 , 5 },
57
57
{cpu_to_le32 (88 ),
58
58
cpu_to_le32 (2 ), 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } };
59
59
60
60
/* S-1-5-88-3 Unix mode */
61
- static const struct cifs_sid sid_unix_NFS_mode = { 1 , 2 , {0 , 0 , 0 , 0 , 0 , 5 },
61
+ static const struct smb_sid sid_unix_NFS_mode = { 1 , 2 , {0 , 0 , 0 , 0 , 0 , 5 },
62
62
{cpu_to_le32 (88 ),
63
63
cpu_to_le32 (3 ), 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } };
64
64
@@ -106,7 +106,7 @@ static struct key_type cifs_idmap_key_type = {
106
106
};
107
107
108
108
static char *
109
- sid_to_key_str (struct cifs_sid * sidptr , unsigned int type )
109
+ sid_to_key_str (struct smb_sid * sidptr , unsigned int type )
110
110
{
111
111
int i , len ;
112
112
unsigned int saval ;
@@ -158,7 +158,7 @@ sid_to_key_str(struct cifs_sid *sidptr, unsigned int type)
158
158
* the same returns zero, if they do not match returns non-zero.
159
159
*/
160
160
static int
161
- compare_sids (const struct cifs_sid * ctsid , const struct cifs_sid * cwsid )
161
+ compare_sids (const struct smb_sid * ctsid , const struct smb_sid * cwsid )
162
162
{
163
163
int i ;
164
164
int num_subauth , num_sat , num_saw ;
@@ -204,11 +204,11 @@ compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
204
204
}
205
205
206
206
static bool
207
- is_well_known_sid (const struct cifs_sid * psid , uint32_t * puid , bool is_group )
207
+ is_well_known_sid (const struct smb_sid * psid , uint32_t * puid , bool is_group )
208
208
{
209
209
int i ;
210
210
int num_subauth ;
211
- const struct cifs_sid * pwell_known_sid ;
211
+ const struct smb_sid * pwell_known_sid ;
212
212
213
213
if (!psid || (puid == NULL ))
214
214
return false;
@@ -260,7 +260,7 @@ is_well_known_sid(const struct cifs_sid *psid, uint32_t *puid, bool is_group)
260
260
}
261
261
262
262
static __u16
263
- cifs_copy_sid (struct cifs_sid * dst , const struct cifs_sid * src )
263
+ cifs_copy_sid (struct smb_sid * dst , const struct smb_sid * src )
264
264
{
265
265
int i ;
266
266
__u16 size = 1 + 1 + 6 ;
@@ -277,11 +277,11 @@ cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src)
277
277
}
278
278
279
279
static int
280
- id_to_sid (unsigned int cid , uint sidtype , struct cifs_sid * ssid )
280
+ id_to_sid (unsigned int cid , uint sidtype , struct smb_sid * ssid )
281
281
{
282
282
int rc ;
283
283
struct key * sidkey ;
284
- struct cifs_sid * ksid ;
284
+ struct smb_sid * ksid ;
285
285
unsigned int ksid_size ;
286
286
char desc [3 + 10 + 1 ]; /* 3 byte prefix + 10 bytes for value + NULL */
287
287
const struct cred * saved_cred ;
@@ -312,8 +312,8 @@ id_to_sid(unsigned int cid, uint sidtype, struct cifs_sid *ssid)
312
312
* it could be.
313
313
*/
314
314
ksid = sidkey -> datalen <= sizeof (sidkey -> payload ) ?
315
- (struct cifs_sid * )& sidkey -> payload :
316
- (struct cifs_sid * )sidkey -> payload .data [0 ];
315
+ (struct smb_sid * )& sidkey -> payload :
316
+ (struct smb_sid * )sidkey -> payload .data [0 ];
317
317
318
318
ksid_size = CIFS_SID_BASE_SIZE + (ksid -> num_subauth * sizeof (__le32 ));
319
319
if (ksid_size > sidkey -> datalen ) {
@@ -336,7 +336,7 @@ id_to_sid(unsigned int cid, uint sidtype, struct cifs_sid *ssid)
336
336
}
337
337
338
338
int
339
- sid_to_id (struct cifs_sb_info * cifs_sb , struct cifs_sid * psid ,
339
+ sid_to_id (struct cifs_sb_info * cifs_sb , struct smb_sid * psid ,
340
340
struct cifs_fattr * fattr , uint sidtype )
341
341
{
342
342
int rc = 0 ;
@@ -518,40 +518,40 @@ exit_cifs_idmap(void)
518
518
static __u32 copy_sec_desc (const struct smb_ntsd * pntsd ,
519
519
struct smb_ntsd * pnntsd ,
520
520
__u32 sidsoffset ,
521
- struct cifs_sid * pownersid ,
522
- struct cifs_sid * pgrpsid )
521
+ struct smb_sid * pownersid ,
522
+ struct smb_sid * pgrpsid )
523
523
{
524
- struct cifs_sid * owner_sid_ptr , * group_sid_ptr ;
525
- struct cifs_sid * nowner_sid_ptr , * ngroup_sid_ptr ;
524
+ struct smb_sid * owner_sid_ptr , * group_sid_ptr ;
525
+ struct smb_sid * nowner_sid_ptr , * ngroup_sid_ptr ;
526
526
527
527
/* copy security descriptor control portion */
528
528
pnntsd -> revision = pntsd -> revision ;
529
529
pnntsd -> type = pntsd -> type ;
530
530
pnntsd -> dacloffset = cpu_to_le32 (sizeof (struct smb_ntsd ));
531
531
pnntsd -> sacloffset = 0 ;
532
532
pnntsd -> osidoffset = cpu_to_le32 (sidsoffset );
533
- pnntsd -> gsidoffset = cpu_to_le32 (sidsoffset + sizeof (struct cifs_sid ));
533
+ pnntsd -> gsidoffset = cpu_to_le32 (sidsoffset + sizeof (struct smb_sid ));
534
534
535
535
/* copy owner sid */
536
536
if (pownersid )
537
537
owner_sid_ptr = pownersid ;
538
538
else
539
- owner_sid_ptr = (struct cifs_sid * )((char * )pntsd +
539
+ owner_sid_ptr = (struct smb_sid * )((char * )pntsd +
540
540
le32_to_cpu (pntsd -> osidoffset ));
541
- nowner_sid_ptr = (struct cifs_sid * )((char * )pnntsd + sidsoffset );
541
+ nowner_sid_ptr = (struct smb_sid * )((char * )pnntsd + sidsoffset );
542
542
cifs_copy_sid (nowner_sid_ptr , owner_sid_ptr );
543
543
544
544
/* copy group sid */
545
545
if (pgrpsid )
546
546
group_sid_ptr = pgrpsid ;
547
547
else
548
- group_sid_ptr = (struct cifs_sid * )((char * )pntsd +
548
+ group_sid_ptr = (struct smb_sid * )((char * )pntsd +
549
549
le32_to_cpu (pntsd -> gsidoffset ));
550
- ngroup_sid_ptr = (struct cifs_sid * )((char * )pnntsd + sidsoffset +
551
- sizeof (struct cifs_sid ));
550
+ ngroup_sid_ptr = (struct smb_sid * )((char * )pnntsd + sidsoffset +
551
+ sizeof (struct smb_sid ));
552
552
cifs_copy_sid (ngroup_sid_ptr , group_sid_ptr );
553
553
554
- return sidsoffset + (2 * sizeof (struct cifs_sid ));
554
+ return sidsoffset + (2 * sizeof (struct smb_sid ));
555
555
}
556
556
557
557
@@ -666,7 +666,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use,
666
666
return ;
667
667
}
668
668
669
- static __u16 cifs_copy_ace (struct cifs_ace * dst , struct cifs_ace * src , struct cifs_sid * psid )
669
+ static __u16 cifs_copy_ace (struct cifs_ace * dst , struct cifs_ace * src , struct smb_sid * psid )
670
670
{
671
671
__u16 size = 1 + 1 + 2 + 4 ;
672
672
@@ -686,7 +686,7 @@ static __u16 cifs_copy_ace(struct cifs_ace *dst, struct cifs_ace *src, struct ci
686
686
}
687
687
688
688
static __u16 fill_ace_for_sid (struct cifs_ace * pntace ,
689
- const struct cifs_sid * psid , __u64 nmode ,
689
+ const struct smb_sid * psid , __u64 nmode ,
690
690
umode_t bits , __u8 access_type ,
691
691
bool allow_delete_child )
692
692
{
@@ -759,7 +759,7 @@ static void dump_ace(struct cifs_ace *pace, char *end_of_acl)
759
759
#endif
760
760
761
761
static void parse_dacl (struct cifs_acl * pdacl , char * end_of_acl ,
762
- struct cifs_sid * pownersid , struct cifs_sid * pgrpsid ,
762
+ struct smb_sid * pownersid , struct smb_sid * pgrpsid ,
763
763
struct cifs_fattr * fattr , bool mode_from_special_sid )
764
764
{
765
765
int i ;
@@ -930,8 +930,8 @@ unsigned int setup_special_user_owner_ACE(struct cifs_ace *pntace)
930
930
}
931
931
932
932
static void populate_new_aces (char * nacl_base ,
933
- struct cifs_sid * pownersid ,
934
- struct cifs_sid * pgrpsid ,
933
+ struct smb_sid * pownersid ,
934
+ struct smb_sid * pgrpsid ,
935
935
__u64 * pnmode , u32 * pnum_aces , u16 * pnsize ,
936
936
bool modefromsid )
937
937
{
@@ -967,7 +967,7 @@ static void populate_new_aces(char *nacl_base,
967
967
* updated in the inode.
968
968
*/
969
969
970
- if (!memcmp (pownersid , pgrpsid , sizeof (struct cifs_sid ))) {
970
+ if (!memcmp (pownersid , pgrpsid , sizeof (struct smb_sid ))) {
971
971
/*
972
972
* Case when owner and group SIDs are the same.
973
973
* Set the more restrictive of the two modes.
@@ -1035,8 +1035,8 @@ static void populate_new_aces(char *nacl_base,
1035
1035
}
1036
1036
1037
1037
static __u16 replace_sids_and_copy_aces (struct cifs_acl * pdacl , struct cifs_acl * pndacl ,
1038
- struct cifs_sid * pownersid , struct cifs_sid * pgrpsid ,
1039
- struct cifs_sid * pnownersid , struct cifs_sid * pngrpsid )
1038
+ struct smb_sid * pownersid , struct smb_sid * pgrpsid ,
1039
+ struct smb_sid * pnownersid , struct smb_sid * pngrpsid )
1040
1040
{
1041
1041
int i ;
1042
1042
u16 size = 0 ;
@@ -1075,7 +1075,7 @@ static __u16 replace_sids_and_copy_aces(struct cifs_acl *pdacl, struct cifs_acl
1075
1075
}
1076
1076
1077
1077
static int set_chmod_dacl (struct cifs_acl * pdacl , struct cifs_acl * pndacl ,
1078
- struct cifs_sid * pownersid , struct cifs_sid * pgrpsid ,
1078
+ struct smb_sid * pownersid , struct smb_sid * pgrpsid ,
1079
1079
__u64 * pnmode , bool mode_from_sid )
1080
1080
{
1081
1081
int i ;
@@ -1156,7 +1156,7 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl,
1156
1156
return 0 ;
1157
1157
}
1158
1158
1159
- static int parse_sid (struct cifs_sid * psid , char * end_of_acl )
1159
+ static int parse_sid (struct smb_sid * psid , char * end_of_acl )
1160
1160
{
1161
1161
/* BB need to add parm so we can store the SID BB */
1162
1162
@@ -1195,17 +1195,17 @@ static int parse_sec_desc(struct cifs_sb_info *cifs_sb,
1195
1195
bool get_mode_from_special_sid )
1196
1196
{
1197
1197
int rc = 0 ;
1198
- struct cifs_sid * owner_sid_ptr , * group_sid_ptr ;
1198
+ struct smb_sid * owner_sid_ptr , * group_sid_ptr ;
1199
1199
struct cifs_acl * dacl_ptr ; /* no need for SACL ptr */
1200
1200
char * end_of_acl = ((char * )pntsd ) + acl_len ;
1201
1201
__u32 dacloffset ;
1202
1202
1203
1203
if (pntsd == NULL )
1204
1204
return - EIO ;
1205
1205
1206
- owner_sid_ptr = (struct cifs_sid * )((char * )pntsd +
1206
+ owner_sid_ptr = (struct smb_sid * )((char * )pntsd +
1207
1207
le32_to_cpu (pntsd -> osidoffset ));
1208
- group_sid_ptr = (struct cifs_sid * )((char * )pntsd +
1208
+ group_sid_ptr = (struct smb_sid * )((char * )pntsd +
1209
1209
le32_to_cpu (pntsd -> gsidoffset ));
1210
1210
dacloffset = le32_to_cpu (pntsd -> dacloffset );
1211
1211
dacl_ptr = (struct cifs_acl * )((char * )pntsd + dacloffset );
@@ -1257,8 +1257,8 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,
1257
1257
__u32 dacloffset ;
1258
1258
__u32 ndacloffset ;
1259
1259
__u32 sidsoffset ;
1260
- struct cifs_sid * owner_sid_ptr , * group_sid_ptr ;
1261
- struct cifs_sid * nowner_sid_ptr = NULL , * ngroup_sid_ptr = NULL ;
1260
+ struct smb_sid * owner_sid_ptr , * group_sid_ptr ;
1261
+ struct smb_sid * nowner_sid_ptr = NULL , * ngroup_sid_ptr = NULL ;
1262
1262
struct cifs_acl * dacl_ptr = NULL ; /* no need for SACL ptr */
1263
1263
struct cifs_acl * ndacl_ptr = NULL ; /* no need for SACL ptr */
1264
1264
char * end_of_acl = ((char * )pntsd ) + secdesclen ;
@@ -1273,9 +1273,9 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,
1273
1273
}
1274
1274
}
1275
1275
1276
- owner_sid_ptr = (struct cifs_sid * )((char * )pntsd +
1276
+ owner_sid_ptr = (struct smb_sid * )((char * )pntsd +
1277
1277
le32_to_cpu (pntsd -> osidoffset ));
1278
- group_sid_ptr = (struct cifs_sid * )((char * )pntsd +
1278
+ group_sid_ptr = (struct smb_sid * )((char * )pntsd +
1279
1279
le32_to_cpu (pntsd -> gsidoffset ));
1280
1280
1281
1281
if (pnmode && * pnmode != NO_CHANGE_64 ) { /* chmod */
@@ -1305,7 +1305,7 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,
1305
1305
1306
1306
if (uid_valid (uid )) { /* chown */
1307
1307
uid_t id ;
1308
- nowner_sid_ptr = kzalloc (sizeof (struct cifs_sid ),
1308
+ nowner_sid_ptr = kzalloc (sizeof (struct smb_sid ),
1309
1309
GFP_KERNEL );
1310
1310
if (!nowner_sid_ptr ) {
1311
1311
rc = - ENOMEM ;
@@ -1334,7 +1334,7 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,
1334
1334
}
1335
1335
if (gid_valid (gid )) { /* chgrp */
1336
1336
gid_t id ;
1337
- ngroup_sid_ptr = kzalloc (sizeof (struct cifs_sid ),
1337
+ ngroup_sid_ptr = kzalloc (sizeof (struct smb_sid ),
1338
1338
GFP_KERNEL );
1339
1339
if (!ngroup_sid_ptr ) {
1340
1340
rc = - ENOMEM ;
@@ -1630,7 +1630,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
1630
1630
nsecdesclen += 5 * sizeof (struct cifs_ace );
1631
1631
} else { /* chown */
1632
1632
/* When ownership changes, changes new owner sid length could be different */
1633
- nsecdesclen = sizeof (struct smb_ntsd ) + (sizeof (struct cifs_sid ) * 2 );
1633
+ nsecdesclen = sizeof (struct smb_ntsd ) + (sizeof (struct smb_sid ) * 2 );
1634
1634
dacloffset = le32_to_cpu (pntsd -> dacloffset );
1635
1635
if (dacloffset ) {
1636
1636
dacl_ptr = (struct cifs_acl * )((char * )pntsd + dacloffset );
0 commit comments