diff options
author | Jeremy Allison <jra@samba.org> | 2012-08-08 15:35:28 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2012-08-09 12:06:54 -0700 |
commit | 526e875cec15761099438e17df3f56bc2bd5b761 (patch) | |
tree | 8ad776c58b3a25b8739b03cdaf330c295bc570b7 /source3/utils | |
parent | e1ec86a49ce1d7c3ebe99fc175ffad70a03c4a0b (diff) | |
download | samba-526e875cec15761099438e17df3f56bc2bd5b761.tar.gz samba-526e875cec15761099438e17df3f56bc2bd5b761.tar.bz2 samba-526e875cec15761099438e17df3f56bc2bd5b761.zip |
Check error returns from strupper_m() (in all reasonable places).
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_ads.c | 10 | ||||
-rw-r--r-- | source3/utils/net_idmap.c | 6 | ||||
-rw-r--r-- | source3/utils/net_registry_check.c | 10 | ||||
-rw-r--r-- | source3/utils/net_rpc.c | 38 | ||||
-rw-r--r-- | source3/utils/net_rpc_join.c | 5 | ||||
-rw-r--r-- | source3/utils/ntlm_auth.c | 4 | ||||
-rw-r--r-- | source3/utils/smbcontrol.c | 2 |
7 files changed, 58 insertions, 17 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index a4f1588e51..b1eac52df2 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -287,7 +287,10 @@ retry: *cp++ = '\0'; SAFE_FREE(ads->auth.realm); ads->auth.realm = smb_xstrdup(cp); - strupper_m(ads->auth.realm); + if (!strupper_m(ads->auth.realm)) { + ads_destroy(&ads); + return ADS_ERROR(LDAP_NO_MEMORY); + } } status = ads_connect(ads); @@ -1371,7 +1374,10 @@ static void _net_ads_join_dns_updates(TALLOC_CTX *ctx, struct libnet_JoinCtx *r) goto done; } - strupper_m(ads_dns->auth.realm); + if (!strupper_m(ads_dns->auth.realm)) { + d_fprintf(stderr, _("strupper_m %s failed\n"), ads_dns->auth.realm); + goto done; + } ret = ads_kinit_password(ads_dns); if (ret != 0) { diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c index f067071de1..ebc14e528d 100644 --- a/source3/utils/net_idmap.c +++ b/source3/utils/net_idmap.c @@ -492,7 +492,11 @@ static bool idmap_store_secret(const char *backend, if (r < 0) return false; - strupper_m(tmp); /* make sure the key is case insensitive */ + /* make sure the key is case insensitive */ + if (!strupper_m(tmp)) { + free(tmp); + return false; + } ret = secrets_store_generic(tmp, identity, secret); free(tmp); diff --git a/source3/utils/net_registry_check.c b/source3/utils/net_registry_check.c index 872aa5a371..45a01f20f5 100644 --- a/source3/utils/net_registry_check.c +++ b/source3/utils/net_registry_check.c @@ -419,7 +419,10 @@ static bool read_info(struct check_ctx *ctx, const char *key, TDB_DATA val) static bool is_all_upper(const char *str) { bool ret; char *tmp = talloc_strdup(talloc_tos(), str); - strupper_m(tmp); + if (!strupper_m(tmp)) { + talloc_free(tmp); + return false; + } ret = (strcmp(tmp, str) == 0); talloc_free(tmp); return ret; @@ -698,7 +701,10 @@ static bool normalize_path_internal(char* path, char sep) { } *optr = '\0'; - strupper_m(path); + if (!strupper_m(path)) { + talloc_free(discard_const(orig)); + return false; + } changed = (strcmp(orig, path) != 0); talloc_free(discard_const(orig)); return changed; diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 46c3c91779..ae5db99dd3 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -4750,7 +4750,11 @@ static bool get_user_tokens(struct net_context *c, int *num_tokens, } else { *p++ = '\0'; fstrcpy(domain, users[i]); - strupper_m(domain); + if (!strupper_m(domain)) { + DEBUG(1, ("strupper_m %s failed\n", domain)); + wbcFreeMemory(users); + return false; + } fstrcpy(user, p); } @@ -5794,7 +5798,10 @@ static NTSTATUS rpc_trustdom_add_internals(struct net_context *c, return NT_STATUS_NO_MEMORY; } - strupper_m(acct_name); + if (!strupper_m(acct_name)) { + SAFE_FREE(acct_name); + return NT_STATUS_INVALID_PARAMETER; + } init_lsa_String(&lsa_acct_name, acct_name); @@ -5978,7 +5985,10 @@ static NTSTATUS rpc_trustdom_del_internals(struct net_context *c, if (acct_name == NULL) return NT_STATUS_NO_MEMORY; - strupper_m(acct_name); + if (!strupper_m(acct_name)) { + TALLOC_FREE(acct_name); + return NT_STATUS_INVALID_PARAMETER; + } /* Get samr policy handle */ status = dcerpc_samr_Connect2(b, mem_ctx, @@ -6224,13 +6234,20 @@ static int rpc_trustdom_establish(struct net_context *c, int argc, } domain_name = smb_xstrdup(argv[0]); - strupper_m(domain_name); + if (!strupper_m(domain_name)) { + SAFE_FREE(domain_name); + return -1; + } /* account name used at first is our domain's name with '$' */ if (asprintf(&acct_name, "%s$", lp_workgroup()) == -1) { return -1; } - strupper_m(acct_name); + if (!strupper_m(acct_name)) { + SAFE_FREE(domain_name); + SAFE_FREE(acct_name); + return -1; + } /* * opt_workgroup will be used by connection functions further, @@ -6402,7 +6419,10 @@ static int rpc_trustdom_revoke(struct net_context *c, int argc, /* generate upper cased domain name */ domain_name = smb_xstrdup(argv[0]); - strupper_m(domain_name); + if (!strupper_m(domain_name)) { + SAFE_FREE(domain_name); + return -1; + } /* delete password of the trust */ if (!pdb_del_trusteddom_pw(domain_name)) { @@ -6971,7 +6991,11 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv) str[ascii_dom_name_len - 1] = '\0'; /* set opt_* variables to remote domain */ - strupper_m(str); + if (!strupper_m(str)) { + cli_shutdown(cli); + talloc_destroy(mem_ctx); + return -1; + } c->opt_workgroup = talloc_strdup(mem_ctx, str); c->opt_target_workgroup = c->opt_workgroup; diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index 2e3e240a3f..50383fee6b 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -509,7 +509,10 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv) /* Now store the secret in the secrets database */ - strupper_m(discard_const_p(char, domain)); + if (!strupper_m(discard_const_p(char, domain))) { + DEBUG(0, ("strupper_m %s failed\n", domain)); + goto done; + } if (!secrets_store_domain_sid(domain, domain_sid)) { DEBUG(0, ("error storing domain sid for %s\n", domain)); diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 103a1f6d16..7cf40b905d 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -365,9 +365,7 @@ static bool parse_ntlm_auth_domain_user(const char *domuser, fstring domain, fstrcpy(user, p+1); fstrcpy(domain, domuser); domain[PTR_DIFF(p, domuser)] = 0; - strupper_m(domain); - - return True; + return strupper_m(domain); } static bool get_require_membership_sid(void) { diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 54c5d62c97..c91c0f3d16 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -1204,7 +1204,7 @@ static void my_make_nmb_name( struct nmb_name *n, const char *name, int type) fstring unix_name; memset( (char *)n, '\0', sizeof(struct nmb_name) ); fstrcpy(unix_name, name); - strupper_m(unix_name); + (void)strupper_m(unix_name); push_ascii(n->name, unix_name, sizeof(n->name), STR_TERMINATE); n->name_type = (unsigned int)type & 0xFF; push_ascii(n->scope, lp_netbios_scope(), 64, STR_TERMINATE); |