diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-03-04 10:44:22 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-03-04 22:07:24 +0100 |
commit | 349b9b72ec36194a1275eaa42ca145071256b623 (patch) | |
tree | 1727c1db47c347aae354f796bcbc3a13c00810c8 | |
parent | 746194cfc4e0c119e1947f79ffc7cb50d50b9f43 (diff) | |
download | samba-349b9b72ec36194a1275eaa42ca145071256b623.tar.gz samba-349b9b72ec36194a1275eaa42ca145071256b623.tar.bz2 samba-349b9b72ec36194a1275eaa42ca145071256b623.zip |
s4:dsdb - we don't need to check if a DN != NULL if we call "ldb_dn_validate"
"ldb_dn_validate" is NULL-safe and does the check implicitly.
Reviewed by: Tridge
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 2 | ||||
-rw-r--r-- | source4/lib/ldb/pyldb.c | 3 | ||||
-rw-r--r-- | source4/rpc_server/drsuapi/getncchanges.c | 6 |
3 files changed, 4 insertions, 7 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index fce4592895..7412d29267 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -147,7 +147,7 @@ static struct ldb_val objectCategory_always_dn(struct ldb_module *module, TALLOC const struct ldb_schema_attribute *a = ldb_schema_attribute_by_name(ldb, "objectCategory"); dn = ldb_dn_from_ldb_val(ctx, ldb, val); - if (dn && ldb_dn_validate(dn)) { + if (ldb_dn_validate(dn)) { talloc_free(dn); return val_copy(module, ctx, val); } diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index c1962e612f..d14487ba02 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -553,8 +553,7 @@ static PyObject *py_ldb_dn_new(PyTypeObject *type, PyObject *args, PyObject *kwa } ret = ldb_dn_new(mem_ctx, ldb_ctx, str); - - if (ret == NULL || !ldb_dn_validate(ret)) { + if (!ldb_dn_validate(ret)) { talloc_free(mem_ctx); PyErr_SetString(PyExc_ValueError, "unable to parse dn string"); return NULL; diff --git a/source4/rpc_server/drsuapi/getncchanges.c b/source4/rpc_server/drsuapi/getncchanges.c index b7431b6702..8ae536823d 100644 --- a/source4/rpc_server/drsuapi/getncchanges.c +++ b/source4/rpc_server/drsuapi/getncchanges.c @@ -621,8 +621,7 @@ static WERROR getncchanges_rid_alloc(struct drsuapi_bind_state *b_state, } req_dn = drs_ObjectIdentifier_to_dn(mem_ctx, ldb, req10->naming_context); - if (!req_dn || - !ldb_dn_validate(req_dn) || + if (!ldb_dn_validate(req_dn) || ldb_dn_compare(req_dn, rid_manager_dn) != 0) { /* that isn't the RID Manager DN */ DEBUG(0,(__location__ ": RID Alloc request for wrong DN %s\n", @@ -964,8 +963,7 @@ static WERROR getncchanges_change_master(struct drsuapi_bind_state *b_state, */ req_dn = drs_ObjectIdentifier_to_dn(mem_ctx, ldb, req10->naming_context); - if (!req_dn || - !ldb_dn_validate(req_dn)) { + if (!ldb_dn_validate(req_dn)) { /* that is not a valid dn */ DEBUG(0,(__location__ ": FSMO role transfer request for invalid DN %s\n", drs_ObjectIdentifier_to_string(mem_ctx, req10->naming_context))); |