summaryrefslogtreecommitdiff
path: root/source3/nsswitch/wbinfo.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/nsswitch/wbinfo.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/nsswitch/wbinfo.c')
-rw-r--r--source3/nsswitch/wbinfo.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index 488a080287..481f51779f 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -374,20 +374,23 @@ static bool wbinfo_list_domains(bool list_all_domains)
if (response.extra_data.data) {
const char *extra_data = (char *)response.extra_data.data;
- fstring name;
+ char *name;
char *p;
+ TALLOC_CTX *frame = talloc_stackframe();
- while(next_token(&extra_data, name, "\n", sizeof(fstring))) {
+ while(next_token_talloc(frame,&extra_data,&name,"\n")) {
p = strchr(name, '\\');
if (p == 0) {
d_fprintf(stderr, "Got invalid response: %s\n",
extra_data);
+ TALLOC_FREE(frame);
+ SAFE_FREE(response.extra_data.data);
return False;
}
*p = 0;
d_printf("%s\n", name);
}
-
+ TALLOC_FREE(frame);
SAFE_FREE(response.extra_data.data);
}
@@ -713,7 +716,7 @@ static bool wbinfo_lookuprids(char *domain, char *arg)
int num_rids;
uint32 *rids;
const char *p;
- char ridstr[32];
+ char *ridstr;
const char **names;
enum lsa_SidType *types;
const char *domain_name;
@@ -752,7 +755,7 @@ static bool wbinfo_lookuprids(char *domain, char *arg)
rids = NULL;
p = arg;
- while (next_token(&p, ridstr, " ,\n", sizeof(ridstr))) {
+ while (next_token_talloc(mem_ctx, &p, &ridstr, " ,\n")) {
uint32 rid = strtoul(ridstr, NULL, 10);
ADD_TO_ARRAY(mem_ctx, uint32, rid, &rids, &num_rids);
}
@@ -1072,13 +1075,14 @@ static bool print_domain_users(const char *domain)
struct winbindd_request request;
struct winbindd_response response;
const char *extra_data;
- fstring name;
+ char *name;
+ TALLOC_CTX *frame = NULL;
/* Send request to winbind daemon */
ZERO_STRUCT(request);
ZERO_STRUCT(response);
-
+
if (domain) {
/* '.' is the special sign for our own domain */
if ( strequal(domain, ".") )
@@ -1098,9 +1102,11 @@ static bool print_domain_users(const char *domain)
extra_data = (const char *)response.extra_data.data;
- while(next_token(&extra_data, name, ",", sizeof(fstring)))
+ frame = talloc_stackframe();
+ while(next_token_talloc(frame,&extra_data,&name, ","))
d_printf("%s\n", name);
-
+ TALLOC_FREE(frame);
+
SAFE_FREE(response.extra_data.data);
return True;
@@ -1113,7 +1119,8 @@ static bool print_domain_groups(const char *domain)
struct winbindd_request request;
struct winbindd_response response;
const char *extra_data;
- fstring name;
+ TALLOC_CTX *frame = NULL;
+ char *name;
ZERO_STRUCT(request);
ZERO_STRUCT(response);
@@ -1136,11 +1143,13 @@ static bool print_domain_groups(const char *domain)
extra_data = (const char *)response.extra_data.data;
- while(next_token(&extra_data, name, ",", sizeof(fstring)))
+ frame = talloc_stackframe();
+ while(next_token_talloc(frame,&extra_data,&name, ","))
d_printf("%s\n", name);
+ TALLOC_FREE(frame);
SAFE_FREE(response.extra_data.data);
-
+
return True;
}