summaryrefslogtreecommitdiff
path: root/source3/utils/sharesec.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-12-07 17:32:32 -0800
committerJeremy Allison <jra@samba.org>2007-12-07 17:32:32 -0800
commit42cfffae80480eae4381902fff3f7c61f858a933 (patch)
tree2fc1bc486fa988a4f2854310bcf91943db1aa566 /source3/utils/sharesec.c
parent25288b0e4472c728fc5a3a70c6c3e1f621ffae5f (diff)
downloadsamba-42cfffae80480eae4381902fff3f7c61f858a933.tar.gz
samba-42cfffae80480eae4381902fff3f7c61f858a933.tar.bz2
samba-42cfffae80480eae4381902fff3f7c61f858a933.zip
Remove next_token - all uses must now be next_token_talloc.
No more temptations to use static length strings. Jeremy. (This used to be commit ec003f39369910dee852b7cafb883ddaa321c2de)
Diffstat (limited to 'source3/utils/sharesec.c')
-rw-r--r--source3/utils/sharesec.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c
index e03222b005..cd2c78f8f3 100644
--- a/source3/utils/sharesec.c
+++ b/source3/utils/sharesec.c
@@ -148,7 +148,7 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
{
char *p;
const char *cp;
- fstring tok;
+ char *tok;
unsigned int atype = 0;
unsigned int aflags = 0;
unsigned int amask = 0;
@@ -156,8 +156,10 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
SEC_ACCESS mask;
const struct perm_value *v;
char *str = SMB_STRDUP(orig_str);
+ TALLOC_CTX *frame = talloc_stackframe();
if (!str) {
+ TALLOC_FREE(frame);
return False;
}
@@ -166,6 +168,7 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
if (!p) {
printf("ACE '%s': missing ':'.\n", orig_str);
SAFE_FREE(str);
+ TALLOC_FREE(frame);
return False;
}
*p = '\0';
@@ -183,14 +186,16 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
printf("ACE '%s': failed to convert '%s' to SID\n",
orig_str, str);
SAFE_FREE(str);
+ TALLOC_FREE(frame);
return False;
}
cp = p;
- if (!next_token(&cp, tok, "/", sizeof(fstring))) {
+ if (!next_token_talloc(frame, &cp, &tok, "/")) {
printf("ACE '%s': failed to find '/' character.\n",
orig_str);
SAFE_FREE(str);
+ TALLOC_FREE(frame);
return False;
}
@@ -202,24 +207,27 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
printf("ACE '%s': missing 'ALLOWED' or 'DENIED' entry at '%s'\n",
orig_str, tok);
SAFE_FREE(str);
+ TALLOC_FREE(frame);
return False;
}
/* Only numeric form accepted for flags at present */
/* no flags on share permissions */
- if (!(next_token(&cp, tok, "/", sizeof(fstring)) &&
+ if (!(next_token_talloc(frame, &cp, &tok, "/") &&
sscanf(tok, "%i", &aflags) && aflags == 0)) {
printf("ACE '%s': bad integer flags entry at '%s'\n",
orig_str, tok);
SAFE_FREE(str);
+ TALLOC_FREE(frame);
return False;
}
- if (!next_token(&cp, tok, "/", sizeof(fstring))) {
+ if (!next_token_talloc(frame, &cp, &tok, "/")) {
printf("ACE '%s': missing / at '%s'\n",
orig_str, tok);
SAFE_FREE(str);
+ TALLOC_FREE(frame);
return False;
}
@@ -227,6 +235,7 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
if (sscanf(tok, "%i", &amask) != 1) {
printf("ACE '%s': bad hex number at '%s'\n",
orig_str, tok);
+ TALLOC_FREE(frame);
SAFE_FREE(str);
return False;
}
@@ -255,6 +264,7 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
if (!found) {
printf("ACE '%s': bad permission value at '%s'\n",
orig_str, p);
+ TALLOC_FREE(frame);
SAFE_FREE(str);
return False;
}
@@ -262,6 +272,7 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
}
if (*p) {
+ TALLOC_FREE(frame);
SAFE_FREE(str);
return False;
}
@@ -270,6 +281,7 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
mask = amask;
init_sec_ace(ace, &sid, atype, mask, aflags);
SAFE_FREE(str);
+ TALLOC_FREE(frame);
return True;
}