Skip to contentSkip to conversation

cifs

DISCUSSION Jeff Layton 2 participants 2 messages Oct 12, 2012 – Oct 14, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Shirish,

I'm looking at implementing a plugin interface for the idmap code for cifs-utils:

    https://bugzilla.samba.org/show_bug.cgi?id=9203

While looking over the existing code, I ran across this. The kernel and setcifsacl use this struct for SIDs:

struct cifs_sid {
        uint8_t revision; /* revision level */
        uint8_t num_subauth;
        uint8_t authority[6];
        uint32_t sub_auth[5]; /* sub_auth[num_subauth] */
};

...however, the wbclient libs have this:

#ifndef WBC_MAXSUBAUTHS
#define WBC_MAXSUBAUTHS 15 /* max sub authorities in a SID */ #endif

struct wbcDomainSid {
        uint8_t   sid_rev_num;
        uint8_t   num_auths;
        uint8_t   id_auth[6];
        uint32_t  sub_auths[WBC_MAXSUBAUTHS];
};

Now, when the cifs.idmap program downcalls with a SID, it does this:

     rc = keyctl_instantiate(key, &sid, sizeof(struct wbcDomainSid), 0);

The kernel then copies that to a buffer and then copies that into a cifs_sid locally. It doesn't seem to care much about the sizes there so anything beyond sub_auths[4] is ignored.

Is that a problem? If not, why not?

Thanks,

Signature · 1 line
Jeff Layton <[email protected]>
#2 lore raw
In reply to a message not in the archive
Quoted 37 lines · Jeff Layton

Hi Shirish,

I'm looking at implementing a plugin interface for the idmap code for cifs-utils:

    https://bugzilla.samba.org/show_bug.cgi?id=9203

While looking over the existing code, I ran across this. The kernel and setcifsacl use this struct for SIDs:

struct cifs_sid {
        uint8_t revision; /* revision level */
        uint8_t num_subauth;
        uint8_t authority[6];
        uint32_t sub_auth[5]; /* sub_auth[num_subauth] */
};

...however, the wbclient libs have this:

#ifndef WBC_MAXSUBAUTHS
#define WBC_MAXSUBAUTHS 15 /* max sub authorities in a SID */ #endif

struct wbcDomainSid {
        uint8_t   sid_rev_num;
        uint8_t   num_auths;
        uint8_t   id_auth[6];
        uint32_t  sub_auths[WBC_MAXSUBAUTHS];
};

Now, when the cifs.idmap program downcalls with a SID, it does this:

     rc = keyctl_instantiate(key, &sid, sizeof(struct wbcDomainSid), 0);

The kernel then copies that to a buffer and then copies that into a cifs_sid locally. It doesn't seem to care much about the sizes there so anything beyond sub_auths[4] is ignored.

Quoted 5 lines

Is that a problem? If not, why not?

Thanks,
--
Jeff Layton <[email protected]>

Jeff, I have not encountered any SIDs that has more than five sub auth values. But I have mostly worked and tested this code with Windows 2003 Server.
Most of the System Groups and Built-in Accounts there have less than five sub auth values but some User Accounts have had five sub auth values.

It is possible that number of sub authorities does can exceed five. Where can we find an authoritative document that can state so? I think it would be alright to bump up the value from 5 to WBC_MAXSUBAUTHS but would be nice to know what can be the maximum value of sub authorities in a Security Descriptor.

Regards,

Shirish