summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-03-19 12:20:11 +1100
committerAndrew Bartlett <abartlet@samba.org>2009-04-14 12:53:56 +1000
commit3b3e21bd9ba701a97e752205263a7903619541c7 (patch)
tree3f0cdf8e4d5a550a323e73d229083d6329b3f236 /source3/utils
parent4786a493f70070dce6de4cbe488c9de1bdbb75ad (diff)
downloadsamba-3b3e21bd9ba701a97e752205263a7903619541c7.tar.gz
samba-3b3e21bd9ba701a97e752205263a7903619541c7.tar.bz2
samba-3b3e21bd9ba701a97e752205263a7903619541c7.zip
Convert Samba3 to use the common lib/util/charset API
This removes calls to push_*_allocate() and pull_*_allocate(), as well as convert_string_allocate, as they are not in the common API To allow transition to a common charcnv in future, provide Samba4-like strupper functions in source3/lib/charcnv.c (the actual implementation remains distinct, but the API is now shared) Andrew Bartlett
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_conf.c6
-rw-r--r--source3/utils/net_usershare.c12
-rw-r--r--source3/utils/ntlm_auth_diagnostics.c26
3 files changed, 22 insertions, 22 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index b65202ee69..3fa547baf4 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -766,7 +766,7 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
d_printf("error: out of memory!\n");
goto done;
}
- param = talloc_strdup_lower(mem_ctx, argv[1]);
+ param = strlower_talloc(mem_ctx, argv[1]);
if (param == NULL) {
d_printf("error: out of memory!\n");
goto done;
@@ -818,7 +818,7 @@ static int net_conf_getparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
d_printf("error: out of memory!\n");
goto done;
}
- param = talloc_strdup_lower(mem_ctx, argv[1]);
+ param = strlower_talloc(mem_ctx, argv[1]);
if (param == NULL) {
d_printf("error: out of memory!\n");
goto done;
@@ -868,7 +868,7 @@ static int net_conf_delparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
d_printf("error: out of memory!\n");
goto done;
}
- param = talloc_strdup_lower(mem_ctx, argv[1]);
+ param = strlower_talloc(mem_ctx, argv[1]);
if (param == NULL) {
d_printf("error: out of memory!\n");
goto done;
diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c
index ce8e82182e..7d3cb287a8 100644
--- a/source3/utils/net_usershare.c
+++ b/source3/utils/net_usershare.c
@@ -154,8 +154,8 @@ static int net_usershare_delete(struct net_context *c, int argc, const char **ar
return net_usershare_delete_usage(c, argc, argv);
}
- if ((sharename = strdup_lower(argv[0])) == NULL) {
- d_fprintf(stderr, "strdup failed\n");
+ if ((sharename = strlower_talloc(talloc_tos(), argv[0])) == NULL) {
+ d_fprintf(stderr, "strlower_talloc failed\n");
return -1;
}
@@ -624,22 +624,22 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
default:
return net_usershare_add_usage(c, argc, argv);
case 2:
- sharename = strdup_lower(argv[0]);
+ sharename = strlower_talloc(ctx, argv[0]);
us_path = argv[1];
break;
case 3:
- sharename = strdup_lower(argv[0]);
+ sharename = strlower_talloc(ctx, argv[0]);
us_path = argv[1];
us_comment = argv[2];
break;
case 4:
- sharename = strdup_lower(argv[0]);
+ sharename = strlower_talloc(ctx, argv[0]);
us_path = argv[1];
us_comment = argv[2];
arg_acl = argv[3];
break;
case 5:
- sharename = strdup_lower(argv[0]);
+ sharename = strlower_talloc(ctx, argv[0]);
us_path = argv[1];
us_comment = argv[2];
arg_acl = argv[3];
diff --git a/source3/utils/ntlm_auth_diagnostics.c b/source3/utils/ntlm_auth_diagnostics.c
index dcdc8e9a40..17801b2a80 100644
--- a/source3/utils/ntlm_auth_diagnostics.c
+++ b/source3/utils/ntlm_auth_diagnostics.c
@@ -458,31 +458,31 @@ static bool test_plaintext(enum ntlm_break break_which)
flags |= WBFLAG_PAM_LMKEY;
flags |= WBFLAG_PAM_USER_SESSION_KEY;
- if (!push_ucs2_allocate(&nt_response_ucs2, opt_password,
+ if (!push_ucs2_talloc(NULL, &nt_response_ucs2, opt_password,
&converted_size))
{
- DEBUG(0, ("push_ucs2_allocate failed!\n"));
+ DEBUG(0, ("push_ucs2_talloc failed!\n"));
exit(1);
}
nt_response.data = (unsigned char *)nt_response_ucs2;
nt_response.length = strlen_w(nt_response_ucs2)*sizeof(smb_ucs2_t);
- if ((password = strdup_upper(opt_password)) == NULL) {
- DEBUG(0, ("strdup_upper failed!\n"));
+ if ((password = strupper_talloc(NULL, opt_password)) == NULL) {
+ DEBUG(0, ("strupper_talloc() failed!\n"));
exit(1);
}
- if (!convert_string_allocate(NULL, CH_UNIX,
- CH_DOS, password,
- strlen(password)+1,
- &lm_response.data,
- &lm_response.length, True)) {
- DEBUG(0, ("convert_string_allocate failed!\n"));
+ if (!convert_string_talloc(NULL, CH_UNIX,
+ CH_DOS, password,
+ strlen(password)+1,
+ &lm_response.data,
+ &lm_response.length, True)) {
+ DEBUG(0, ("convert_string_talloc failed!\n"));
exit(1);
}
- SAFE_FREE(password);
+ TALLOC_FREE(password);
switch (break_which) {
case BREAK_NONE:
@@ -513,8 +513,8 @@ static bool test_plaintext(enum ntlm_break break_which)
user_session_key,
&error_string, NULL);
- SAFE_FREE(nt_response.data);
- SAFE_FREE(lm_response.data);
+ TALLOC_FREE(nt_response.data);
+ TALLOC_FREE(lm_response.data);
data_blob_free(&chall);
if (!NT_STATUS_IS_OK(nt_status)) {