diff options
author | Tim Prouty <tim.prouty@isilon.com> | 2008-04-29 14:36:24 -0700 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-05-20 22:40:13 +0200 |
commit | fb37f156009611af0dd454a0fb0829a09cd638ac (patch) | |
tree | e97403a13dd39b7ef485d36c6c7856045e6e4bf3 /source3/libads/ldap_printer.c | |
parent | 6ed27edbcd3ba1893636a8072c8d7a621437daf7 (diff) | |
download | samba-fb37f156009611af0dd454a0fb0829a09cd638ac.tar.gz samba-fb37f156009611af0dd454a0fb0829a09cd638ac.tar.bz2 samba-fb37f156009611af0dd454a0fb0829a09cd638ac.zip |
Cleanup size_t return values in callers of convert_string_allocate
This patch is the second iteration of an inside-out conversion to cleanup
functions in charcnv.c returning size_t == -1 to indicate failure.
(This used to be commit 6b189dabc562d86dcaa685419d0cb6ea276f100d)
Diffstat (limited to 'source3/libads/ldap_printer.c')
-rw-r--r-- | source3/libads/ldap_printer.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c index 41f23b06a7..9935e2311a 100644 --- a/source3/libads/ldap_printer.c +++ b/source3/libads/ldap_printer.c @@ -103,17 +103,23 @@ static bool map_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods, const REGISTRY_VALUE *value) { char *str_value = NULL; + size_t converted_size; ADS_STATUS status; if (value->type != REG_SZ) - return False; + return false; if (value->size && *((smb_ucs2_t *) value->data_p)) { - pull_ucs2_talloc(ctx, &str_value, (const smb_ucs2_t *) value->data_p); + if (!pull_ucs2_talloc(ctx, &str_value, + (const smb_ucs2_t *) value->data_p, + &converted_size)) + { + return false; + } status = ads_mod_str(ctx, mods, value->valuename, str_value); return ADS_ERR_OK(status); } - return True; + return true; } @@ -163,6 +169,7 @@ static bool map_multi_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods, const REGISTRY_VALUE *value) { char **str_values = NULL; + size_t converted_size; smb_ucs2_t *cur_str = (smb_ucs2_t *) value->data_p; uint32 size = 0, num_vals = 0, i=0; ADS_STATUS status; @@ -185,9 +192,11 @@ static bool map_multi_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods, (num_vals + 1) * sizeof(char *)); cur_str = (smb_ucs2_t *) value->data_p; - for (i=0; i < num_vals; i++) + for (i=0; i < num_vals; i++) { cur_str += pull_ucs2_talloc(ctx, &str_values[i], - cur_str); + cur_str, &converted_size) ? + converted_size : (size_t)-1; + } status = ads_mod_strlist(ctx, mods, value->valuename, (const char **) str_values); |