diff mbox series

[1/2] Convert owner and group SID offsets to LE format

Message ID 20200106163119.9083-1-boris.v.protopopov@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] Convert owner and group SID offsets to LE format | expand

Commit Message

Boris Protopopov Jan. 6, 2020, 4:31 p.m. UTC
Convert owner and group SID offsets to LE format
when writing to ntsd

Signed-off-by: Boris Protopopov <boris.v.protopopov@gmail.com>
---
 setcifsacl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Pavel Shilovsky Jan. 22, 2020, 12:25 a.m. UTC | #1
пн, 6 янв. 2020 г. в 08:31, Boris Protopopov <boris.v.protopopov@gmail.com>:
>
> Convert owner and group SID offsets to LE format
> when writing to ntsd
>
> Signed-off-by: Boris Protopopov <boris.v.protopopov@gmail.com>
> ---
>  setcifsacl.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/setcifsacl.c b/setcifsacl.c
> index f3d0189..9a301e2 100644
> --- a/setcifsacl.c
> +++ b/setcifsacl.c
> @@ -114,12 +114,14 @@ copy_sec_desc(const struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
>         if (dacloffset <= osidsoffset) {
>                 /* owners placed at end of ACL */
>                 nowner_sid_ptr = (struct cifs_sid *)((char *)pnntsd + dacloffset + size);
> -               pnntsd->osidoffset = dacloffset + size;
> +               osidsoffset = dacloffset + size;
> +               pnntsd->osidoffset = htole32(osidsoffset);
>                 size = copy_cifs_sid(nowner_sid_ptr, owner_sid_ptr);
>                 bufsize += size;
>                 /* put group SID after owner SID */
>                 ngroup_sid_ptr = (struct cifs_sid *)((char *)nowner_sid_ptr + size);
> -               pnntsd->gsidoffset = pnntsd->osidoffset + size;
> +               gsidsoffset = osidsoffset + size;
> +               pnntsd->gsidoffset = htole32(gsidsoffset);
>         } else {
>                 /*
>                  * Most servers put the owner information at the beginning,
> --
> 2.14.5
>

Merged into "next". Thanks!

--
Best regards,
Pavel Shilovsky
diff mbox series

Patch

diff --git a/setcifsacl.c b/setcifsacl.c
index f3d0189..9a301e2 100644
--- a/setcifsacl.c
+++ b/setcifsacl.c
@@ -114,12 +114,14 @@  copy_sec_desc(const struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
 	if (dacloffset <= osidsoffset) {
 		/* owners placed at end of ACL */
 		nowner_sid_ptr = (struct cifs_sid *)((char *)pnntsd + dacloffset + size);
-		pnntsd->osidoffset = dacloffset + size;
+		osidsoffset = dacloffset + size;
+		pnntsd->osidoffset = htole32(osidsoffset);
 		size = copy_cifs_sid(nowner_sid_ptr, owner_sid_ptr);
 		bufsize += size;
 		/* put group SID after owner SID */
 		ngroup_sid_ptr = (struct cifs_sid *)((char *)nowner_sid_ptr + size);
-		pnntsd->gsidoffset = pnntsd->osidoffset + size;
+		gsidsoffset = osidsoffset + size;
+		pnntsd->gsidoffset = htole32(gsidsoffset);
 	} else {
 		/*
 		 * Most servers put the owner information at the beginning,