diff options
author | Jeremy Allison <jra@samba.org> | 2012-08-08 17:01:00 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2012-08-09 12:08:18 -0700 |
commit | b70f23c2b581c5d455362ab37f4846de9a910055 (patch) | |
tree | cf95e8d35a03d1e39d5926d2e03d7046d42cae64 /source3/utils | |
parent | ce21d0804012da27cec72abe896352d7f0e7e1e5 (diff) | |
download | samba-b70f23c2b581c5d455362ab37f4846de9a910055.tar.gz samba-b70f23c2b581c5d455362ab37f4846de9a910055.tar.bz2 samba-b70f23c2b581c5d455362ab37f4846de9a910055.zip |
Correctly check for errors in strlower_m() returns.
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_ads.c | 10 | ||||
-rw-r--r-- | source3/utils/net_rpc_join.c | 5 | ||||
-rw-r--r-- | source3/utils/net_usershare.c | 8 | ||||
-rw-r--r-- | source3/utils/pdbedit.c | 11 | ||||
-rw-r--r-- | source3/utils/smbpasswd.c | 6 |
5 files changed, 32 insertions, 8 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index b1eac52df2..b1d55f10b0 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -1256,7 +1256,9 @@ static NTSTATUS net_update_dns_ext(TALLOC_CTX *mem_ctx, ADS_STRUCT *ads, } else { name_to_fqdn( machine_name, lp_netbios_name() ); } - strlower_m( machine_name ); + if (!strlower_m( machine_name )) { + return NT_STATUS_INVALID_PARAMETER; + } if (num_addrs == 0 || iplist == NULL) { /* @@ -2192,7 +2194,11 @@ int net_ads_changetrustpw(struct net_context *c, int argc, const char **argv) } fstrcpy(my_name, lp_netbios_name()); - strlower_m(my_name); + if (!strlower_m(my_name)) { + ads_destroy(&ads); + return -1; + } + if (asprintf(&host_principal, "%s$@%s", my_name, ads->config.realm) == -1) { ads_destroy(&ads); return -1; diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index 50383fee6b..ed81aacac7 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -321,7 +321,10 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv) status = NT_STATUS_NO_MEMORY; goto done; } - strlower_m(acct_name); + if (!strlower_m(acct_name)) { + status = NT_STATUS_INVALID_PARAMETER; + goto done; + } init_lsa_String(&lsa_acct_name, acct_name); diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c index 153b45e7f8..382fe2f250 100644 --- a/source3/utils/net_usershare.c +++ b/source3/utils/net_usershare.c @@ -523,7 +523,9 @@ static int net_usershare_info(struct net_context *c, int argc, const char **argv return net_usershare_info_usage(c, argc, argv); } - strlower_m(wcard); + if (!strlower_m(wcard)) { + return -1; + } ctx = talloc_init("share_info"); ret = get_share_list(ctx, wcard, only_ours); @@ -1036,7 +1038,9 @@ static int net_usershare_list(struct net_context *c, int argc, return net_usershare_list_usage(c, argc, argv); } - strlower_m(wcard); + if (!strlower_m(wcard)) { + return -1; + } ctx = talloc_init("share_list"); ret = get_share_list(ctx, wcard, only_ours); diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index 06eed201f4..8a3551bf6b 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -655,7 +655,11 @@ static int set_machine_info(const char *machinename, return -1; } - strlower_m(name); + if (!strlower_m(name)) { + fprintf(stderr, "strlower_m %s failed\n", name); + TALLOC_FREE(sam_pwent); + return -1; + } ret = pdb_getsampwnam(sam_pwent, name); if (!ret) { @@ -853,7 +857,10 @@ static int new_machine(const char *machinename, char *machine_sid) return -1; } - strlower_m(name); + if (!strlower_m(name)) { + fprintf(stderr, "strlower_m %s failed\n", name); + return -1; + } flags = LOCAL_ADD_USER | LOCAL_TRUST_ACCOUNT | LOCAL_SET_PASSWORD; diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index f845147da4..66c80da618 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -370,7 +370,11 @@ static int process_root(int local_flags) if (local_flags & LOCAL_ADD_USER) { SAFE_FREE(new_passwd); new_passwd = smb_xstrdup(user_name); - strlower_m(new_passwd); + if (!strlower_m(new_passwd)) { + fprintf(stderr, "strlower_m %s failed\n", + new_passwd); + exit(1); + } } /* |