1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-19 21:57:57 +03:00
Remove trailing spaces and try to fit 80 columns where possible
(This used to be commit edf6b77a1314d8f91839836855ae049393f73aca)
This commit is contained in:
Simo Sorce 2008-06-14 20:37:40 -04:00
parent 21943bf0af
commit 4d8804f26c

View File

@ -76,7 +76,8 @@ static int ltdb_err_map(enum TDB_ERROR tdb_code)
}
struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
struct ldb_handle *init_ltdb_handle(struct ltdb_private *ltdb,
struct ldb_module *module,
struct ldb_request *req)
{
struct ltdb_context *ac;
@ -131,8 +132,8 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn)
1) if the dn doesn't start with @ then uppercase the attribute
names and the attributes values of case insensitive attributes
2) if the dn starts with @ then leave it alone - the indexing code handles
the rest
2) if the dn starts with @ then leave it alone -
the indexing code handles the rest
*/
dn_folded = ldb_dn_get_casefold(dn);
@ -166,7 +167,8 @@ failed:
check special dn's have valid attributes
currently only @ATTRIBUTES is checked
*/
int ltdb_check_special_dn(struct ldb_module *module, const struct ldb_message *msg)
int ltdb_check_special_dn(struct ldb_module *module,
const struct ldb_message *msg)
{
int i, j;
@ -253,7 +255,8 @@ done:
}
static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message *msg)
static int ltdb_add_internal(struct ldb_module *module,
const struct ldb_message *msg)
{
int ret;
@ -269,7 +272,9 @@ static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message
ret = ltdb_store(module, msg, TDB_INSERT);
if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) {
ldb_asprintf_errstring(module->ldb, "Entry %s already exists", ldb_dn_get_linearized(msg->dn));
ldb_asprintf_errstring(module->ldb,
"Entry %s already exists",
ldb_dn_get_linearized(msg->dn));
return ret;
}
@ -293,10 +298,12 @@ static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message
*/
static int ltdb_add(struct ldb_module *module, struct ldb_request *req)
{
struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private);
struct ltdb_private *ltdb;
struct ltdb_context *ltdb_ac;
int tret, ret = LDB_SUCCESS;
ltdb = talloc_get_type(module->private_data, struct ltdb_private);
if (check_critical_controls(req->controls)) {
return LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION;
}
@ -397,10 +404,12 @@ done:
*/
static int ltdb_delete(struct ldb_module *module, struct ldb_request *req)
{
struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private);
struct ltdb_private *ltdb;
struct ltdb_context *ltdb_ac;
int tret, ret = LDB_SUCCESS;
ltdb = talloc_get_type(module->private_data, struct ltdb_private);
if (check_critical_controls(req->controls)) {
return LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION;
}
@ -432,9 +441,9 @@ done:
}
/*
find an element by attribute name. At the moment this does a linear search, it should
be re-coded to use a binary search once all places that modify records guarantee
sorted order
find an element by attribute name. At the moment this does a linear search,
it should be re-coded to use a binary search once all places that modify
records guarantee sorted order
return the index of the first matching element if found, otherwise -1
*/
@ -452,13 +461,14 @@ static int find_element(const struct ldb_message *msg, const char *name)
/*
add an element to an existing record. Assumes a elements array that we
can call re-alloc on, and assumed that we can re-use the data pointers from the
passed in additional values. Use with care!
can call re-alloc on, and assumed that we can re-use the data pointers from
the passed in additional values. Use with care!
returns 0 on success, -1 on failure (and sets errno)
*/
static int msg_add_element(struct ldb_context *ldb,
struct ldb_message *msg, struct ldb_message_element *el)
struct ldb_message *msg,
struct ldb_message_element *el)
{
struct ldb_message_element *e2;
unsigned int i;
@ -478,7 +488,8 @@ static int msg_add_element(struct ldb_context *ldb,
e2->flags = el->flags;
e2->values = NULL;
if (el->num_values != 0) {
e2->values = talloc_array(msg->elements, struct ldb_val, el->num_values);
e2->values = talloc_array(msg->elements,
struct ldb_val, el->num_values);
if (!e2->values) {
errno = ENOMEM;
return -1;
@ -512,7 +523,8 @@ static int msg_delete_attribute(struct ldb_module *module,
for (i=0;i<msg->num_elements;i++) {
if (ldb_attr_cmp(msg->elements[i].name, name) == 0) {
for (j=0;j<msg->elements[i].num_values;j++) {
ltdb_index_del_value(module, dn, &msg->elements[i], j);
ltdb_index_del_value(module, dn,
&msg->elements[i], j);
}
talloc_free(msg->elements[i].values);
if (msg->num_elements > (i+1)) {
@ -558,14 +570,17 @@ static int msg_delete_element(struct ldb_module *module,
a = ldb_schema_attribute_by_name(ldb, el->name);
for (i=0;i<el->num_values;i++) {
if (a->syntax->comparison_fn(ldb, ldb, &el->values[i], val) == 0) {
if (a->syntax->comparison_fn(ldb, ldb,
&el->values[i], val) == 0) {
if (i<el->num_values-1) {
memmove(&el->values[i], &el->values[i+1],
sizeof(el->values[i])*(el->num_values-(i+1)));
sizeof(el->values[i])*
(el->num_values-(i+1)));
}
el->num_values--;
if (el->num_values == 0) {
return msg_delete_attribute(module, ldb, msg, name);
return msg_delete_attribute(module, ldb,
msg, name);
}
return 0;
}
@ -582,7 +597,8 @@ static int msg_delete_element(struct ldb_module *module,
get away with it, but if we ever have really large attribute lists
then we'll need to look at this again
*/
int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg)
int ltdb_modify_internal(struct ldb_module *module,
const struct ldb_message *msg)
{
struct ldb_context *ldb = module->ldb;
struct ltdb_private *ltdb =
@ -734,7 +750,8 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
}
break;
default:
ldb_asprintf_errstring(module->ldb, "Invalid ldb_modify flags on %s: 0x%x",
ldb_asprintf_errstring(module->ldb,
"Invalid ldb_modify flags on %s: 0x%x",
msg->elements[i].name,
msg->elements[i].flags & LDB_FLAG_MOD_MASK);
ret = LDB_ERR_PROTOCOL_ERROR;
@ -742,7 +759,8 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
}
}
/* we've made all the mods - save the modified record back into the database */
/* we've made all the mods
* save the modified record back into the database */
ret = ltdb_store(module, msg2, TDB_MODIFY);
if (ret != LDB_SUCCESS) {
goto failed;
@ -768,10 +786,12 @@ failed:
*/
static int ltdb_modify(struct ldb_module *module, struct ldb_request *req)
{
struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private);
struct ltdb_private *ltdb;
struct ltdb_context *ltdb_ac;
int tret, ret = LDB_SUCCESS;
ltdb = talloc_get_type(module->private_data, struct ltdb_private);
if (check_critical_controls(req->controls)) {
return LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION;
}
@ -814,11 +834,13 @@ done:
*/
static int ltdb_rename(struct ldb_module *module, struct ldb_request *req)
{
struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private);
struct ltdb_private *ltdb;
struct ltdb_context *ltdb_ac;
struct ldb_message *msg;
int tret, ret = LDB_SUCCESS;
ltdb = talloc_get_type(module->private_data, struct ltdb_private);
if (check_critical_controls(req->controls)) {
return LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION;
}
@ -947,19 +969,22 @@ static int ltdb_wait(struct ldb_handle *handle, enum ldb_wait_type type)
static int ltdb_request(struct ldb_module *module, struct ldb_request *req)
{
/* check for oustanding critical controls and return an error if found */
/* check for oustanding critical controls
* and return an error if found */
if (check_critical_controls(req->controls)) {
return LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION;
}
/* search, add, modify, delete, rename are handled by their own, no other op supported */
/* search, add, modify, delete, rename are handled by their own,
* no other op supported */
return LDB_ERR_OPERATIONS_ERROR;
}
/*
return sequenceNumber from @BASEINFO
*/
static int ltdb_sequence_number(struct ldb_module *module, struct ldb_request *req)
static int ltdb_sequence_number(struct ldb_module *module,
struct ldb_request *req)
{
TALLOC_CTX *tmp_ctx;
struct ldb_message *msg = NULL;
@ -1042,7 +1067,8 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
/* parse the url */
if (strchr(url, ':')) {
if (strncmp(url, "tdb://", 6) != 0) {
ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid tdb URL '%s'", url);
ldb_debug(ldb, LDB_DEBUG_ERROR,
"Invalid tdb URL '%s'", url);
return -1;
}
path = url+6;
@ -1079,7 +1105,8 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
tdb_flags, open_flags,
ldb->create_perms, ldb);
if (!ltdb->tdb) {
ldb_debug(ldb, LDB_DEBUG_ERROR, "Unable to open tdb '%s'\n", path);
ldb_debug(ldb, LDB_DEBUG_ERROR,
"Unable to open tdb '%s'\n", path);
talloc_free(ltdb);
return -1;
}