diff options
author | Jeremy Allison <jra@samba.org> | 2007-12-07 17:32:32 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-12-07 17:32:32 -0800 |
commit | 42cfffae80480eae4381902fff3f7c61f858a933 (patch) | |
tree | 2fc1bc486fa988a4f2854310bcf91943db1aa566 /source3/utils/net_rpc.c | |
parent | 25288b0e4472c728fc5a3a70c6c3e1f621ffae5f (diff) | |
download | samba-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/net_rpc.c')
-rw-r--r-- | source3/utils/net_rpc.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index b41142a087..3f78d6ced8 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -4359,9 +4359,10 @@ static bool get_user_tokens(int *num_tokens, struct user_token **user_tokens) struct winbindd_request request; struct winbindd_response response; const char *extra_data; - fstring name; + char *name; int i; struct user_token *result; + TALLOC_CTX *frame = NULL; if (lp_winbind_use_default_domain() && (opt_target_workgroup == NULL)) { @@ -4374,7 +4375,7 @@ static bool get_user_tokens(int *num_tokens, struct user_token **user_tokens) ZERO_STRUCT(request); ZERO_STRUCT(response); - + if (winbindd_request_response(WINBINDD_LIST_USERS, &request, &response) != NSS_STATUS_SUCCESS) return False; @@ -4387,7 +4388,8 @@ static bool get_user_tokens(int *num_tokens, struct user_token **user_tokens) extra_data = (const char *)response.extra_data.data; *num_tokens = 0; - while(next_token(&extra_data, name, ",", sizeof(fstring))) { + frame = talloc_stackframe(); + while(next_token_talloc(frame, &extra_data, &name, ",")) { *num_tokens += 1; } @@ -4395,14 +4397,14 @@ static bool get_user_tokens(int *num_tokens, struct user_token **user_tokens) if (result == NULL) { DEBUG(1, ("Could not malloc sid array\n")); + TALLOC_FREE(frame); return False; } extra_data = (const char *)response.extra_data.data; i=0; - while(next_token(&extra_data, name, ",", sizeof(fstring))) { - + while(next_token_talloc(frame, &extra_data, &name, ",")) { fstring domain, user; char *p; @@ -4425,7 +4427,7 @@ static bool get_user_tokens(int *num_tokens, struct user_token **user_tokens) get_user_sids(domain, user, &(result[i].token)); i+=1; } - + TALLOC_FREE(frame); SAFE_FREE(response.extra_data.data); *user_tokens = result; |