summaryrefslogtreecommitdiff
path: root/source3/lib/util_sid.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-12-30 19:21:25 +0000
committerSimo Sorce <idra@samba.org>2001-12-30 19:21:25 +0000
commit0608a60390db336bf179564aefdf16c43f1793ad (patch)
tree8ec4cc2b229552e37392cbaf7cc6b8f734469770 /source3/lib/util_sid.c
parentf6e6c678ad5338264496de43e9e1ab2fe4a28e64 (diff)
downloadsamba-0608a60390db336bf179564aefdf16c43f1793ad.tar.gz
samba-0608a60390db336bf179564aefdf16c43f1793ad.tar.bz2
samba-0608a60390db336bf179564aefdf16c43f1793ad.zip
util_sid.c - respect a const variabile (addedd strdup)
cli_reg.c - indentation pdb_ldap.c - some checks on init fns parameters pdb_tdb.c - some checks on init fns parameters + make sure we close the db on failure (This used to be commit 49f5cb7a3df6d673f86e6769319aa657e30d8380)
Diffstat (limited to 'source3/lib/util_sid.c')
-rw-r--r--source3/lib/util_sid.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 009cc7742a..d35e8a8ac9 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -375,20 +375,26 @@ const char *sid_string_static(DOM_SID *sid)
BOOL string_to_sid(DOM_SID *sidout, const char *sidstr)
{
pstring tok;
- const char *p = sidstr;
+ char *p;
/* BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 */
uint32 ia;
+
+ if (StrnCaseCmp( sidstr, "S-", 2)) {
+ DEBUG(0,("string_to_sid: Sid %s does not start with 'S-'.\n", sidstr));
+ return False;
+ }
memset((char *)sidout, '\0', sizeof(DOM_SID));
- if (StrnCaseCmp( sidstr, "S-", 2)) {
- DEBUG(0,("string_to_sid: Sid %s does not start with 'S-'.\n", sidstr));
+ p = strdup(sidstr + 2);
+ if (p == NULL) {
+ DEBUG(0, ("string_to_sid: out of memory!\n"));
return False;
}
- p += 2;
if (!next_token(&p, tok, "-", sizeof(tok))) {
DEBUG(0,("string_to_sid: Sid %s is not in a valid format.\n", sidstr));
+ SAFE_FREE(p);
return False;
}
@@ -397,6 +403,7 @@ BOOL string_to_sid(DOM_SID *sidout, const char *sidstr)
if (!next_token(&p, tok, "-", sizeof(tok))) {
DEBUG(0,("string_to_sid: Sid %s is not in a valid format.\n", sidstr));
+ SAFE_FREE(p);
return False;
}
@@ -422,6 +429,7 @@ BOOL string_to_sid(DOM_SID *sidout, const char *sidstr)
sid_append_rid(sidout, (uint32)strtoul(tok, NULL, 10));
}
+ SAFE_FREE(p);
return True;
}