summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-07-06 05:51:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:48 -0500
commit3ed1e8ff3c351296adfa78a99c19cc7b0fd5d7e7 (patch)
tree6da0df4219f39e6d4dc0df57db101d2add66ffbc
parent5e3ca4a73376db847cd3ca55807f5b1fcdbc9148 (diff)
downloadsamba-3ed1e8ff3c351296adfa78a99c19cc7b0fd5d7e7.tar.gz
samba-3ed1e8ff3c351296adfa78a99c19cc7b0fd5d7e7.tar.bz2
samba-3ed1e8ff3c351296adfa78a99c19cc7b0fd5d7e7.zip
r16829: Fix a number of issues raised by the IBM checker, or gcc warnings.
In particular, this removes one use of the LDB_DN_NULL_FAILED macro, which was being used on more than DNs, had an embedded goto, and confused the IBM checker. In the password_hash code, ensure that sambaAttr is not, before checking the number of values. In GENSEC, note that this switch value can't occour. This seems to be the only way to quiet both the IBM checker and gcc, as well as cope with possibly invalid inputs. Andrew Bartlet (This used to be commit 3e58350ec2ab883795b1dd03ac46a3520cac67d0)
-rw-r--r--source4/auth/gensec/gensec.c5
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c2
-rw-r--r--source4/lib/ldb/common/ldb_dn.c19
3 files changed, 15 insertions, 11 deletions
diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c
index 429aa433d7..2d347b65b1 100644
--- a/source4/auth/gensec/gensec.c
+++ b/source4/auth/gensec/gensec.c
@@ -87,8 +87,9 @@ struct gensec_security_ops **gensec_use_kerberos_mechs(TALLOC_CTX *mem_ctx,
j++;
}
break;
- case CRED_AUTO_USE_KERBEROS:
- break;
+ default:
+ /* Can't happen or invalid parameter */
+ return NULL;
}
}
new_gensec_list[j] = NULL;
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 9d7c78487a..abb267d884 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -597,7 +597,7 @@ static int password_hash_add(struct ldb_module *module, struct ldb_request *req)
/* check sambaPassword is single valued here */
/* TODO: remove this when sambaPassword will be single valued in schema */
- if (sambaAttr->num_values > 1) {
+ if (sambaAttr && sambaAttr->num_values > 1) {
ldb_set_errstring(module->ldb,
talloc_asprintf(req,
"mupltiple values for sambaPassword not allowed!\n"));
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index a659f676c6..0d7a3c6141 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -578,32 +578,35 @@ struct ldb_dn *ldb_dn_casefold(struct ldb_context *ldb, const struct ldb_dn *edn
if (edn == NULL) return NULL;
cedn = ldb_dn_new(ldb);
- LDB_DN_NULL_FAILED(cedn);
+ return NULL;
cedn->comp_num = edn->comp_num;
cedn->components = talloc_array(cedn, struct ldb_dn_component, edn->comp_num);
- LDB_DN_NULL_FAILED(cedn->components);
+ if (!cedn->components) {
+ talloc_free(cedn);
+ return NULL;
+ }
for (i = 0; i < edn->comp_num; i++) {
struct ldb_dn_component dc;
const struct ldb_attrib_handler *h;
dc.name = ldb_attr_casefold(cedn, edn->components[i].name);
- LDB_DN_NULL_FAILED(dc.name);
+ if (!dc.name) {
+ talloc_free(cedn);
+ return NULL;
+ }
h = ldb_attrib_handler(ldb, dc.name);
if (h->canonicalise_fn(ldb, cedn, &(edn->components[i].value), &(dc.value)) != 0) {
- goto failed;
+ talloc_free(cedn);
+ return NULL;
}
cedn->components[i] = dc;
}
return cedn;
-
-failed:
- talloc_free(cedn);
- return NULL;
}
struct ldb_dn *ldb_dn_explode_casefold(struct ldb_context *ldb, const char *dn)