return error;
}
-struct smbXsrv_open_close_all_state {
- NTTIME now;
- NTSTATUS first_status;
- int errors;
-};
-
-static int smbXsrv_open_close_all_callback(struct db_record *local_rec,
- void *private_data);
-
-static NTSTATUS smbXsrv_open_close_all(struct smbXsrv_open_table *table,
- NTTIME now)
-{
- struct smbXsrv_open_close_all_state state;
- NTSTATUS status;
- int count = 0;
-
- ZERO_STRUCT(state);
-
- if (table == NULL) {
- return NT_STATUS_OK;
- }
-
- state.now = now;
-
- status = dbwrap_traverse(table->local.db_ctx,
- smbXsrv_open_close_all_callback,
- &state, &count);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("smbXsrv_open_close_all: "
- "dbwrap_traverse() failed: %s\n",
- nt_errstr(status)));
- return status;
- }
-
- if (!NT_STATUS_IS_OK(state.first_status)) {
- DEBUG(0, ("smbXsrv_open_close_all: "
- "count[%d] errors[%d] first[%s]\n",
- count, state.errors,
- nt_errstr(state.first_status)));
- return state.first_status;
- }
-
- return NT_STATUS_OK;
-}
-
-static int smbXsrv_open_close_all_callback(struct db_record *local_rec,
- void *private_data)
-{
- struct smbXsrv_open_close_all_state *state =
- (struct smbXsrv_open_close_all_state *)private_data;
- TDB_DATA val;
- void *ptr = NULL;
- struct smbXsrv_open *op = NULL;
- NTSTATUS status;
-
- val = dbwrap_record_get_value(local_rec);
- if (val.dsize != sizeof(ptr)) {
- status = NT_STATUS_INTERNAL_ERROR;
- if (NT_STATUS_IS_OK(state->first_status)) {
- state->first_status = status;
- }
- state->errors++;
- return 0;
- }
-
- memcpy(&ptr, val.dptr, val.dsize);
- op = talloc_get_type_abort(ptr, struct smbXsrv_open);
-
- op->db_rec = local_rec;
- status = smbXsrv_open_close(op, state->now);
- if (!NT_STATUS_IS_OK(status)) {
- if (NT_STATUS_IS_OK(state->first_status)) {
- state->first_status = status;
- }
- state->errors++;
- return 0;
- }
-
- return 0;
-}
-
NTSTATUS smb1srv_open_table_init(struct smbXsrv_connection *conn)
{
uint32_t max_opens;