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/winbindd | |
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/winbindd')
-rw-r--r-- | source3/winbindd/idmap_ldap.c | 7 | ||||
-rw-r--r-- | source3/winbindd/winbindd_ads.c | 10 | ||||
-rw-r--r-- | source3/winbindd/winbindd_cache.c | 20 | ||||
-rw-r--r-- | source3/winbindd/winbindd_cm.c | 5 | ||||
-rw-r--r-- | source3/winbindd/winbindd_pam.c | 8 | ||||
-rw-r--r-- | source3/winbindd/winbindd_util.c | 4 |
6 files changed, 39 insertions, 15 deletions
diff --git a/source3/winbindd/idmap_ldap.c b/source3/winbindd/idmap_ldap.c index aeeb2e87d0..e72a0ab184 100644 --- a/source3/winbindd/idmap_ldap.c +++ b/source3/winbindd/idmap_ldap.c @@ -50,7 +50,12 @@ static char *idmap_fetch_secret(const char *backend, if (r < 0) return NULL; - strupper_m(tmp); /* make sure the key is case insensitive */ + /* make sure the key is case insensitive */ + if (!strupper_m(tmp)) { + SAFE_FREE(tmp); + return NULL; + } + ret = secrets_fetch_generic(tmp, identity); SAFE_FREE(tmp); diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c index 854e12c53b..4efd829cb9 100644 --- a/source3/winbindd/winbindd_ads.c +++ b/source3/winbindd/winbindd_ads.c @@ -99,7 +99,10 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain) return NULL; } ads->auth.realm = SMB_STRDUP( ads->server.realm ); - strupper_m( ads->auth.realm ); + if (!strupper_m( ads->auth.realm )) { + ads_destroy( &ads ); + return NULL; + } } else { struct winbindd_domain *our_domain = domain; @@ -114,7 +117,10 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain) if ( our_domain->alt_name[0] != '\0' ) { ads->auth.realm = SMB_STRDUP( our_domain->alt_name ); - strupper_m( ads->auth.realm ); + if (!strupper_m( ads->auth.realm )) { + ads_destroy( &ads ); + return NULL; + } } else ads->auth.realm = SMB_STRDUP( lp_realm() ); diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 66de29e061..cfa843424a 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -946,7 +946,7 @@ static void wcache_save_name_to_sid(struct winbindd_domain *domain, centry_put_uint32(centry, type); centry_put_sid(centry, sid); fstrcpy(uname, name); - strupper_m(uname); + (void)strupper_m(uname); centry_end(centry, "NS/%s/%s", domain_name, uname); DEBUG(10,("wcache_save_name_to_sid: %s\\%s -> %s (%s)\n", domain_name, uname, sid_string_dbg(sid), nt_errstr(status))); @@ -1064,7 +1064,7 @@ static void wcache_save_username_alias(struct winbindd_domain *domain, centry_put_string( centry, alias ); fstrcpy(uname, name); - strupper_m(uname); + (void)strupper_m(uname); centry_end(centry, "NSS/NA/%s", uname); DEBUG(10,("wcache_save_username_alias: %s -> %s\n", name, alias )); @@ -1085,7 +1085,7 @@ static void wcache_save_alias_username(struct winbindd_domain *domain, centry_put_string( centry, name ); fstrcpy(uname, alias); - strupper_m(uname); + (void)strupper_m(uname); centry_end(centry, "NSS/AN/%s", uname); DEBUG(10,("wcache_save_alias_username: %s -> %s\n", alias, name )); @@ -1113,7 +1113,10 @@ NTSTATUS resolve_username_to_alias( TALLOC_CTX *mem_ctx, if ( (upper_name = SMB_STRDUP(name)) == NULL ) return NT_STATUS_NO_MEMORY; - strupper_m(upper_name); + if (!strupper_m(upper_name)) { + SAFE_FREE(name); + return NT_STATUS_INVALID_PARAMETER; + } centry = wcache_fetch(cache, domain, "NSS/NA/%s", upper_name); @@ -1188,7 +1191,10 @@ NTSTATUS resolve_alias_to_username( TALLOC_CTX *mem_ctx, if ( (upper_name = SMB_STRDUP(alias)) == NULL ) return NT_STATUS_NO_MEMORY; - strupper_m(upper_name); + if (!strupper_m(upper_name)) { + SAFE_FREE(alias); + return NT_STATUS_INVALID_PARAMETER; + } centry = wcache_fetch(cache, domain, "NSS/AN/%s", upper_name); @@ -1859,7 +1865,9 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, /* Only save the reverse mapping if this was not a UPN */ if (!strchr(name, '@')) { - strupper_m(discard_const_p(char, domain_name)); + if (!strupper_m(discard_const_p(char, domain_name))) { + return NT_STATUS_INVALID_PARAMETER; + } strlower_m(discard_const_p(char, name)); wcache_save_sid_to_name(domain, status, sid, domain_name, name, *type); } diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 5a602422ae..c08530e819 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -767,7 +767,10 @@ static NTSTATUS get_trust_creds(const struct winbindd_domain *domain, return NT_STATUS_NO_MEMORY; } - strupper_m(*machine_krb5_principal); + if (!strupper_m(*machine_krb5_principal)) { + SAFE_FREE(machine_krb5_principal); + return NT_STATUS_INVALID_PARAMETER; + } } return NT_STATUS_OK; diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index a64cc5692c..48bb79bdcd 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -582,7 +582,9 @@ static NTSTATUS winbindd_raw_kerberos_login(TALLOC_CTX *mem_ctx, parse_domain_user(user, name_domain, name_user); realm = domain->alt_name; - strupper_m(realm); + if (!strupper_m(realm)) { + return NT_STATUS_INVALID_PARAMETER; + } principal_s = talloc_asprintf(mem_ctx, "%s@%s", name_user, realm); if (principal_s == NULL) { @@ -938,7 +940,9 @@ static NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain, } realm = domain->alt_name; - strupper_m(realm); + if (!strupper_m(realm)) { + return NT_STATUS_INVALID_PARAMETER; + } principal_s = talloc_asprintf(state->mem_ctx, "%s@%s", name_user, realm); if (principal_s == NULL) { diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 52ce1e3056..656735633b 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -877,9 +877,7 @@ bool parse_domain_user(const char *domuser, fstring domain, fstring user) domain[PTR_DIFF(p, domuser)] = 0; } - strupper_m(domain); - - return True; + return strupper_m(domain); } bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const char *domuser, |