summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-09-04 14:05:30 +1000
committerJeremy Allison <jra@samba.org>2010-09-14 14:48:48 -0700
commit9d44688681bc196baf1bccbdf84092ffc0510bb7 (patch)
tree3d8f26928981b5a24e2cc454382065cf36d5cdd9 /source3
parentce1e273a47105fcef71d054c0192b7985fd5b4f2 (diff)
downloadsamba-9d44688681bc196baf1bccbdf84092ffc0510bb7.tar.gz
samba-9d44688681bc196baf1bccbdf84092ffc0510bb7.tar.bz2
samba-9d44688681bc196baf1bccbdf84092ffc0510bb7.zip
s3-util_sid Accept S-1-5 as a SID
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_sid.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 58df0f2a48..9a2876baec 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -230,8 +230,12 @@ bool string_to_sid(struct dom_sid *sidout, const char *sidstr)
}
/* get identauth */
- if (!q || (*q != '-')) {
conv = (uint32_t) strtoul(q, &q, 10);
+ if (!q) {
+ goto format_error;
+ } else if (*q == '\0') {
+ /* Just id_auth, no subauths */
+ } else if (*q != '-') {
goto format_error;
}
/* identauth in decimal should be < 2^32 */
@@ -243,8 +247,12 @@ bool string_to_sid(struct dom_sid *sidout, const char *sidstr)
sidout->id_auth[4] = (conv & 0x0000ff00) >> 8;
sidout->id_auth[5] = (conv & 0x000000ff);
- q++;
sidout->num_auths = 0;
+ if (*q == '\0') {
+ return true;
+ }
+
+ q++;
while (true) {
char *end;