diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-01-10 10:52:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:37:23 -0500 |
commit | 1cd4339b9a2786aa26691ca4f02fa93ab0958b88 (patch) | |
tree | 9b09324617e38a651de0a761b3c591fa7deff74a /source4 | |
parent | 848e236516ccc15864f7c3d2e05a905f6a81678e (diff) | |
download | samba-1cd4339b9a2786aa26691ca4f02fa93ab0958b88.tar.gz samba-1cd4339b9a2786aa26691ca4f02fa93ab0958b88.tar.bz2 samba-1cd4339b9a2786aa26691ca4f02fa93ab0958b88.zip |
r20646: first preparations for cluster enablement. This changes "
uint32_t server_id
to
struct server_id server_id;
which allows a server ID to have an node number. The node number will
be zero in non-clustered case. This is the most basic hook needed for
clustering, and ctdb.
(This used to be commit 2365abaa991d57d68c6ebe9be608e01c907102eb)
Diffstat (limited to 'source4')
31 files changed, 159 insertions, 125 deletions
diff --git a/source4/auth/auth_winbind.c b/source4/auth/auth_winbind.c index 209f8dc858..0f31caa047 100644 --- a/source4/auth/auth_winbind.c +++ b/source4/auth/auth_winbind.c @@ -157,13 +157,13 @@ static NTSTATUS winbind_check_password(struct auth_method_context *ctx, struct auth_serversupplied_info **server_info) { NTSTATUS status; - uint32_t *winbind_servers; + struct server_id *winbind_servers; struct winbind_check_password_state *s; const struct auth_usersupplied_info *user_info_new; struct netr_IdentityInfo *identity_info; winbind_servers = irpc_servers_byname(ctx->auth_ctx->msg_ctx, "winbind_server"); - if ((winbind_servers == NULL) || (winbind_servers[0] == 0)) { + if ((winbind_servers == NULL) || (winbind_servers[0].id == 0)) { DEBUG(0, ("Winbind authentication for [%s]\\[%s] failed, " "no winbind_server running!\n", user_info->client.domain_name, user_info->client.account_name)); diff --git a/source4/lib/messaging/config.mk b/source4/lib/messaging/config.mk index c4c3e6b2f8..85a5791703 100644 --- a/source4/lib/messaging/config.mk +++ b/source4/lib/messaging/config.mk @@ -9,6 +9,7 @@ PUBLIC_DEPENDENCIES = \ DB_WRAP \ NDR_IRPC \ UNIX_PRIVS \ - UTIL_TDB + UTIL_TDB \ + CLUSTER # End SUBSYSTEM MESSAGING ################################################ diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h index 4e775bfe06..1d704ad943 100644 --- a/source4/lib/messaging/irpc.h +++ b/source4/lib/messaging/irpc.h @@ -26,7 +26,7 @@ an incoming irpc message */ struct irpc_message { - uint32_t from; + struct server_id from; void *private; struct irpc_header header; struct ndr_pull *ndr; @@ -77,22 +77,25 @@ struct irpc_request { }; typedef void (*msg_callback_t)(struct messaging_context *msg, void *private, - uint32_t msg_type, uint32_t server_id, DATA_BLOB *data); + uint32_t msg_type, + struct server_id server_id, DATA_BLOB *data); -struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id, +struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, + struct server_id server_id, struct event_context *ev); -NTSTATUS messaging_send(struct messaging_context *msg, uint32_t server, +NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server, uint32_t msg_type, DATA_BLOB *data); NTSTATUS messaging_register(struct messaging_context *msg, void *private, uint32_t msg_type, msg_callback_t fn); NTSTATUS messaging_register_tmp(struct messaging_context *msg, void *private, msg_callback_t fn, uint32_t *msg_type); -struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id, +struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, + struct server_id server_id, struct event_context *ev); struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx, struct event_context *ev); -NTSTATUS messaging_send_ptr(struct messaging_context *msg, uint32_t server, +NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id server, uint32_t msg_type, void *ptr); void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void *private); @@ -103,17 +106,17 @@ NTSTATUS irpc_register(struct messaging_context *msg_ctx, const struct dcerpc_interface_table *table, int call, irpc_function_t fn, void *private); struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, - uint32_t server_id, + struct server_id server_id, const struct dcerpc_interface_table *table, int callnum, void *r, TALLOC_CTX *ctx); NTSTATUS irpc_call_recv(struct irpc_request *irpc); NTSTATUS irpc_call(struct messaging_context *msg_ctx, - uint32_t server_id, + struct server_id server_id, const struct dcerpc_interface_table *table, int callnum, void *r, TALLOC_CTX *ctx); NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name); -uint32_t *irpc_servers_byname(struct messaging_context *msg_ctx, const char *name); +struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, const char *name); void irpc_remove_name(struct messaging_context *msg_ctx, const char *name); NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status); diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 09e04fda9b..691db2b961 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -33,12 +33,14 @@ #include "librpc/rpc/dcerpc.h" #include "lib/tdb/include/tdb.h" #include "lib/util/util_tdb.h" +#include "lib/util/util_tdb.h" +#include "cluster/cluster.h" /* change the message version with any incompatible changes in the protocol */ #define MESSAGING_VERSION 1 struct messaging_context { - uint32_t server_id; + struct server_id server_id; struct socket_context *sock; const char *base_path; const char *path; @@ -75,8 +77,8 @@ struct messaging_rec { struct messaging_header { uint32_t version; uint32_t msg_type; - uint32_t from; - uint32_t to; + struct server_id from; + struct server_id to; uint32_t length; } *header; @@ -85,17 +87,17 @@ struct messaging_rec { static void irpc_handler(struct messaging_context *, void *, - uint32_t, uint32_t, DATA_BLOB *); + uint32_t, struct server_id, DATA_BLOB *); /* A useful function for testing the message system. */ static void ping_message(struct messaging_context *msg, void *private, - uint32_t msg_type, uint32_t src, DATA_BLOB *data) + uint32_t msg_type, struct server_id src, DATA_BLOB *data) { - DEBUG(1,("INFO: Received PING message from server %u [%.*s]\n", - (uint_t)src, (int)data->length, + DEBUG(1,("INFO: Received PING message from server %u.%u [%.*s]\n", + (uint_t)src.node, (uint_t)src.id, (int)data->length, data->data?(const char *)data->data:"")); messaging_send(msg, src, MSG_PONG, data); } @@ -114,9 +116,10 @@ static NTSTATUS irpc_uptime(struct irpc_message *msg, /* return the path to a messaging socket */ -static char *messaging_path(struct messaging_context *msg, uint32_t server_id) +static char *messaging_path(struct messaging_context *msg, struct server_id server_id) { - return talloc_asprintf(msg, "%s/msg.%u", msg->base_path, (unsigned)server_id); + return talloc_asprintf(msg, "%s/msg.%u.%u", msg->base_path, + (unsigned)server_id.node, (unsigned)server_id.id); } /* @@ -192,7 +195,7 @@ static void messaging_send_handler(struct messaging_context *msg) } if (!NT_STATUS_IS_OK(status)) { DEBUG(1,("messaging: Lost message from %u to %u of type %u - %s\n", - rec->header->from, rec->header->to, rec->header->msg_type, + rec->header->from.id, rec->header->to.id, rec->header->msg_type, nt_errstr(status))); } DLIST_REMOVE(msg->pending, rec); @@ -365,7 +368,7 @@ void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void /* Send a message to a particular server */ -NTSTATUS messaging_send(struct messaging_context *msg, uint32_t server, +NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server, uint32_t msg_type, DATA_BLOB *data) { struct messaging_rec *rec; @@ -420,7 +423,7 @@ NTSTATUS messaging_send(struct messaging_context *msg, uint32_t server, /* Send a message to a particular server, with the message containing a single pointer */ -NTSTATUS messaging_send_ptr(struct messaging_context *msg, uint32_t server, +NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id server, uint32_t msg_type, void *ptr) { DATA_BLOB blob; @@ -447,7 +450,8 @@ static int messaging_destructor(struct messaging_context *msg) /* create the listening socket and setup the dispatcher */ -struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id, +struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, + struct server_id server_id, struct event_context *ev) { struct messaging_context *msg; @@ -522,7 +526,10 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx, struct event_context *ev) { - return messaging_init(mem_ctx, random() % 0x10000000, ev); + struct server_id id; + ZERO_STRUCT(id); + id.id = random() % 0x10000000; + return messaging_init(mem_ctx, id, ev); } /* a list of registered irpc server functions @@ -687,7 +694,7 @@ failed: handle an incoming irpc message */ static void irpc_handler(struct messaging_context *msg_ctx, void *private, - uint32_t msg_type, uint32_t src, DATA_BLOB *packet) + uint32_t msg_type, struct server_id src, DATA_BLOB *packet) { struct irpc_message *m; NTSTATUS status; @@ -745,7 +752,7 @@ static void irpc_timeout(struct event_context *ev, struct timed_event *te, make a irpc call - async send */ struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, - uint32_t server_id, + struct server_id server_id, const struct dcerpc_interface_table *table, int callnum, void *r, TALLOC_CTX *ctx) { @@ -829,7 +836,7 @@ NTSTATUS irpc_call_recv(struct irpc_request *irpc) perform a synchronous irpc request */ NTSTATUS irpc_call(struct messaging_context *msg_ctx, - uint32_t server_id, + struct server_id server_id, const struct dcerpc_interface_table *table, int callnum, void *r, TALLOC_CTX *mem_ctx) @@ -873,15 +880,15 @@ NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name) return NT_STATUS_LOCK_NOT_GRANTED; } rec = tdb_fetch_bystring(t->tdb, name); - count = rec.dsize / sizeof(uint32_t); - rec.dptr = (unsigned char *)realloc_p(rec.dptr, uint32_t, count+1); - rec.dsize += sizeof(uint32_t); + count = rec.dsize / sizeof(struct server_id); + rec.dptr = (unsigned char *)realloc_p(rec.dptr, struct server_id, count+1); + rec.dsize += sizeof(struct server_id); if (rec.dptr == NULL) { tdb_unlock_bystring(t->tdb, name); talloc_free(t); return NT_STATUS_NO_MEMORY; } - ((uint32_t *)rec.dptr)[count] = msg_ctx->server_id; + ((struct server_id *)rec.dptr)[count] = msg_ctx->server_id; if (tdb_store_bystring(t->tdb, name, rec, 0) != 0) { status = NT_STATUS_INTERNAL_ERROR; } @@ -898,12 +905,13 @@ NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name) /* return a list of server ids for a server name */ -uint32_t *irpc_servers_byname(struct messaging_context *msg_ctx, const char *name) +struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, + const char *name) { struct tdb_wrap *t; TDB_DATA rec; int count, i; - uint32_t *ret; + struct server_id *ret; t = irpc_namedb_open(msg_ctx); if (t == NULL) { @@ -920,17 +928,17 @@ uint32_t *irpc_servers_byname(struct messaging_context *msg_ctx, const char *nam talloc_free(t); return NULL; } - count = rec.dsize / sizeof(uint32_t); - ret = talloc_array(msg_ctx, uint32_t, count+1); + count = rec.dsize / sizeof(struct server_id); + ret = talloc_array(msg_ctx, struct server_id, count+1); if (ret == NULL) { tdb_unlock_bystring(t->tdb, name); talloc_free(t); return NULL; } for (i=0;i<count;i++) { - ret[i] = ((uint32_t *)rec.dptr)[i]; + ret[i] = ((struct server_id *)rec.dptr)[i]; } - ret[i] = 0; + ret[i] = cluster_id(0); free(rec.dptr); tdb_unlock_bystring(t->tdb, name); talloc_free(t); @@ -946,7 +954,7 @@ void irpc_remove_name(struct messaging_context *msg_ctx, const char *name) struct tdb_wrap *t; TDB_DATA rec; int count, i; - uint32_t *ids; + struct server_id *ids; str_list_remove(msg_ctx->names, name); @@ -960,19 +968,20 @@ void irpc_remove_name(struct messaging_context *msg_ctx, const char *name) return; } rec = tdb_fetch_bystring(t->tdb, name); - count = rec.dsize / sizeof(uint32_t); + count = rec.dsize / sizeof(struct server_id); if (count == 0) { tdb_unlock_bystring(t->tdb, name); talloc_free(t); return; } - ids = (uint32_t *)rec.dptr; + ids = (struct server_id *)rec.dptr; for (i=0;i<count;i++) { - if (ids[i] == msg_ctx->server_id) { + if (cluster_id_equal(&ids[i], &msg_ctx->server_id)) { if (i < count-1) { - memmove(ids+i, ids+i+1, count-(i+1)); + memmove(ids+i, ids+i+1, + sizeof(struct server_id) * (count-(i+1))); } - rec.dsize -= sizeof(uint32_t); + rec.dsize -= sizeof(struct server_id); break; } } diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c index 417b33f277..d8acf44ba0 100644 --- a/source4/libcli/finddcs.c +++ b/source4/libcli/finddcs.c @@ -112,7 +112,7 @@ static void finddcs_name_resolved(struct composite_context *ctx) struct finddcs_state *state = talloc_get_type(ctx->async.private_data, struct finddcs_state); struct irpc_request *ireq; - uint32_t *nbt_servers; + struct server_id *nbt_servers; const char *address; state->ctx->status = resolve_name_recv(ctx, state, &address); @@ -134,7 +134,7 @@ static void finddcs_name_resolved(struct composite_context *ctx) } nbt_servers = irpc_servers_byname(state->msg_ctx, "nbt_server"); - if ((nbt_servers == NULL) || (nbt_servers[0] == 0)) { + if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { fallback_node_status(state); return; } diff --git a/source4/librpc/idl/misc.idl b/source4/librpc/idl/misc.idl index 9d43a806b7..2b099a6164 100644 --- a/source4/librpc/idl/misc.idl +++ b/source4/librpc/idl/misc.idl @@ -44,5 +44,9 @@ interface misc SAMR_REJECT_COMPLEXITY = 5 } samr_RejectReason; - + /* id used to identify a endpoint, possibly in a cluster */ + typedef [public] struct { + uint32 id; + uint32 node; + } server_id; } diff --git a/source4/librpc/idl/notify.idl b/source4/librpc/idl/notify.idl index cf544f3a68..eecdd86d59 100644 --- a/source4/librpc/idl/notify.idl +++ b/source4/librpc/idl/notify.idl @@ -15,7 +15,7 @@ interface notify /* structure used in the notify database */ typedef [public] struct { - uint32 server; + server_id server; uint32 filter; /* filter to apply in this directory */ uint32 subdir_filter; /* filter to apply in child directories */ utf8string path; diff --git a/source4/librpc/idl/opendb.idl b/source4/librpc/idl/opendb.idl index 8d1c30761c..eaa626e89d 100644 --- a/source4/librpc/idl/opendb.idl +++ b/source4/librpc/idl/opendb.idl @@ -7,13 +7,15 @@ ntvfs/common/opendb.c */ +import "misc.idl"; + [ pointer_default(unique) ] interface opendb { typedef struct { - uint32 server; + server_id server; uint32 stream_id; uint32 share_access; uint32 access_mask; @@ -25,7 +27,7 @@ interface opendb } opendb_entry; typedef struct { - uint32 server; + server_id server; pointer notify_ptr; } opendb_pending; diff --git a/source4/main.mk b/source4/main.mk index ba8b5b8c6a..d685a0a0fc 100644 --- a/source4/main.mk +++ b/source4/main.mk @@ -7,6 +7,7 @@ include config.mk include dsdb/config.mk include gtk/config.mk include smbd/config.mk +include cluster/config.mk include smbd/process_model.mk include libnet/config.mk include auth/config.mk diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c index 2816c563b8..d7fb97415f 100644 --- a/source4/ntvfs/common/brlock.c +++ b/source4/ntvfs/common/brlock.c @@ -47,7 +47,7 @@ struct brl_context; lock is the same as another lock */ struct lock_context { - uint32_t server; + struct server_id server; uint16_t smbpid; struct brl_context *ctx; }; @@ -74,7 +74,7 @@ struct brl_handle { /* this struct is typicaly attached to tcon */ struct brl_context { struct tdb_wrap *w; - uint32_t server; + struct server_id server; struct messaging_context *messaging_ctx; }; @@ -83,7 +83,7 @@ struct brl_context { talloc_free(). We need the messaging_ctx to allow for pending lock notifications. */ -struct brl_context *brl_init(TALLOC_CTX *mem_ctx, uint32_t server, +struct brl_context *brl_init(TALLOC_CTX *mem_ctx, struct server_id server, struct messaging_context *messaging_ctx) { char *path; @@ -130,7 +130,7 @@ struct brl_handle *brl_create_handle(TALLOC_CTX *mem_ctx, struct ntvfs_handle *n */ static BOOL brl_same_context(struct lock_context *ctx1, struct lock_context *ctx2) { - return (ctx1->server == ctx2->server && + return (cluster_id_equal(&ctx1->server, &ctx2->server) && ctx1->smbpid == ctx2->smbpid && ctx1->ctx == ctx2->ctx); } @@ -249,7 +249,7 @@ static NTSTATUS brl_lock_failed(struct brl_handle *brlh, struct lock_struct *loc * if the current lock matches the last failed lock on the file handle * and starts at the same offset, then FILE_LOCK_CONFLICT should be returned */ - if (lock->context.server == brlh->last_lock.context.server && + if (cluster_id_equal(&lock->context.server, &brlh->last_lock.context.server) && lock->context.ctx == brlh->last_lock.context.ctx && lock->ntvfs == brlh->last_lock.ntvfs && lock->start == brlh->last_lock.start) { @@ -535,7 +535,7 @@ NTSTATUS brl_remove_pending(struct brl_context *brl, if (lock->lock_type >= PENDING_READ_LOCK && lock->notify_ptr == notify_ptr && - lock->context.server == brl->server) { + cluster_id_equal(&lock->context.server, &brl->server)) { /* found it - delete it */ if (count == 1) { if (tdb_delete(brl->w->tdb, kbuf) != 0) { @@ -648,7 +648,7 @@ NTSTATUS brl_close(struct brl_context *brl, struct lock_struct *lock = &locks[i]; if (lock->context.ctx == brl && - lock->context.server == brl->server && + cluster_id_equal(&lock->context.server, &brl->server) && lock->ntvfs == brlh->ntvfs) { /* found it - delete it */ if (count > 1 && i < count-1) { diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 19a60a51a9..13fd44abf0 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -37,7 +37,7 @@ struct notify_context { struct tdb_wrap *w; - uint32_t server; + struct server_id server; struct messaging_context *messaging_ctx; struct notify_list *list; struct notify_array *array; @@ -61,7 +61,7 @@ struct notify_list { static NTSTATUS notify_remove_all(struct notify_context *notify); static void notify_handler(struct messaging_context *msg_ctx, void *private, - uint32_t msg_type, uint32_t server_id, DATA_BLOB *data); + uint32_t msg_type, struct server_id server_id, DATA_BLOB *data); /* destroy the notify context @@ -78,7 +78,7 @@ static int notify_destructor(struct notify_context *notify) talloc_free(). We need the messaging_ctx to allow for notifications via internal messages */ -struct notify_context *notify_init(TALLOC_CTX *mem_ctx, uint32_t server, +struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, struct messaging_context *messaging_ctx, struct event_context *ev, struct share_config *scfg) @@ -241,7 +241,7 @@ static NTSTATUS notify_save(struct notify_context *notify) handle incoming notify messages */ static void notify_handler(struct messaging_context *msg_ctx, void *private, - uint32_t msg_type, uint32_t server_id, DATA_BLOB *data) + uint32_t msg_type, struct server_id server_id, DATA_BLOB *data) { struct notify_context *notify = talloc_get_type(private, struct notify_context); NTSTATUS status; @@ -460,7 +460,7 @@ NTSTATUS notify_remove(struct notify_context *notify, void *private) for (i=0;i<d->num_entries;i++) { if (private == d->entries[i].private && - notify->server == d->entries[i].server) { + cluster_id_equal(¬ify->server, &d->entries[i].server)) { break; } } @@ -508,7 +508,7 @@ static NTSTATUS notify_remove_all(struct notify_context *notify) for (depth=0;depth<notify->array->num_depths;depth++) { struct notify_depth *d = ¬ify->array->depth[depth]; for (i=0;i<d->num_entries;i++) { - if (notify->server == d->entries[i].server) { + if (cluster_id_equal(¬ify->server, &d->entries[i].server)) { if (i < d->num_entries-1) { memmove(&d->entries[i], &d->entries[i+1], sizeof(d->entries[i])*(d->num_entries-(i+1))); diff --git a/source4/ntvfs/common/opendb.c b/source4/ntvfs/common/opendb.c index c63a677847..e1766d670e 100644 --- a/source4/ntvfs/common/opendb.c +++ b/source4/ntvfs/common/opendb.c @@ -408,7 +408,7 @@ _PUBLIC_ NTSTATUS odb_close_file(struct odb_lock *lck, void *file_handle) /* find the entry, and delete it */ for (i=0;i<file.num_entries;i++) { if (file_handle == file.entries[i].file_handle && - odb->ntvfs_ctx->server_id == file.entries[i].server) { + cluster_id_equal(&odb->ntvfs_ctx->server_id, &file.entries[i].server)) { if (file.entries[i].delete_on_close) { file.delete_on_close = True; } @@ -455,7 +455,7 @@ _PUBLIC_ NTSTATUS odb_remove_pending(struct odb_lock *lck, void *private) /* find the entry, and delete it */ for (i=0;i<file.num_pending;i++) { if (private == file.pending[i].notify_ptr && - odb->ntvfs_ctx->server_id == file.pending[i].server) { + cluster_id_equal(&odb->ntvfs_ctx->server_id, &file.pending[i].server)) { if (i < file.num_pending-1) { memmove(file.pending+i, file.pending+i+1, (file.num_pending - (i+1)) * diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h index b48a5dac00..69e638e1a1 100644 --- a/source4/ntvfs/ntvfs.h +++ b/source4/ntvfs/ntvfs.h @@ -184,7 +184,7 @@ struct ntvfs_context { struct share_config *config; - uint32_t server_id; + struct server_id server_id; struct event_context *event_ctx; struct messaging_context *msg_ctx; diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 7e794b582f..599669360b 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -154,7 +154,7 @@ _PUBLIC_ BOOL ntvfs_interface_differs(const struct ntvfs_critical_sizes *const i NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, enum ntvfs_type type, enum protocol_types protocol, struct event_context *ev, struct messaging_context *msg, - uint32_t server_id, struct ntvfs_context **_ctx) + struct server_id server_id, struct ntvfs_context **_ctx) { const char **handlers = share_string_list_option(mem_ctx, scfg, SHARE_NTVFS_HANDLER); int i; diff --git a/source4/ntvfs/posix/pvfs_wait.c b/source4/ntvfs/posix/pvfs_wait.c index 41c5f4742e..6e8324183f 100644 --- a/source4/ntvfs/posix/pvfs_wait.c +++ b/source4/ntvfs/posix/pvfs_wait.c @@ -57,7 +57,7 @@ NTSTATUS pvfs_async_setup(struct ntvfs_module_context *ntvfs, receive a completion message for a wait */ static void pvfs_wait_dispatch(struct messaging_context *msg, void *private, uint32_t msg_type, - uint32_t src, DATA_BLOB *data) + struct server_id src, DATA_BLOB *data) { struct pvfs_wait *pwait = private; struct ntvfs_request *req; diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 08b68b2318..6233a2e088 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -292,7 +292,7 @@ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx, struct auth_session_info *session_info, struct event_context *event_ctx, struct messaging_context *msg_ctx, - uint32_t server_id, + struct server_id server_id, uint32_t state_flags, struct dcesrv_connection **_p) { @@ -344,7 +344,7 @@ _PUBLIC_ NTSTATUS dcesrv_endpoint_search_connect(struct dcesrv_context *dce_ctx, struct auth_session_info *session_info, struct event_context *event_ctx, struct messaging_context *msg_ctx, - uint32_t server_id, + struct server_id server_id, uint32_t state_flags, struct dcesrv_connection **dce_conn_p) { diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 2990d6e09f..a1f771339a 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -192,7 +192,7 @@ struct dcesrv_connection { struct messaging_context *msg_ctx; /* the server_id that will be used for this connection */ - uint32_t server_id; + struct server_id server_id; /* the transport level session key */ DATA_BLOB transport_session_key; diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index 76b5f0d695..4d4e12e855 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -32,13 +32,14 @@ #include "librpc/rpc/dcerpc_table.h" #include "auth/credentials/credentials.h" #include "librpc/rpc/dcerpc.h" +#include "cluster/cluster.h" /* state of a irpc 'connection' */ struct ejs_irpc_connection { const char *server_name; - uint32_t *dest_ids; + struct server_id *dest_ids; struct messaging_context *msg_ctx; }; @@ -78,7 +79,7 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv) /* create a messaging context, looping as we have no way to allocate temporary server ids automatically */ for (i=0;i<10000;i++) { - p->msg_ctx = messaging_init(p, EJS_ID_BASE + i, ev); + p->msg_ctx = messaging_init(p, cluster_id(EJS_ID_BASE + i), ev); if (p->msg_ctx) break; } if (p->msg_ctx == NULL) { @@ -88,7 +89,7 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv) } p->dest_ids = irpc_servers_byname(p->msg_ctx, p->server_name); - if (p->dest_ids == NULL || p->dest_ids[0] == 0) { + if (p->dest_ids == NULL || p->dest_ids[0].id == 0) { talloc_free(p); status = NT_STATUS_OBJECT_NAME_NOT_FOUND; } else { @@ -214,7 +215,7 @@ static int ejs_irpc_call(int eid, struct MprVar *io, goto done; } - for (count=0;p->dest_ids[count];count++) /* noop */ ; + for (count=0;p->dest_ids[count].id;count++) /* noop */ ; /* we need to make a call per server */ reqs = talloc_array(ejs, struct irpc_request *, count); diff --git a/source4/smb_server/smb/negprot.c b/source4/smb_server/smb/negprot.c index ea7e5797a1..04bae886b6 100644 --- a/source4/smb_server/smb/negprot.c +++ b/source4/smb_server/smb/negprot.c @@ -148,7 +148,7 @@ static void reply_lanman1(struct smbsrv_request *req, uint16_t choice) SSVAL(req->out.vwv, VWV(3), lp_maxmux()); SSVAL(req->out.vwv, VWV(4), 1); SSVAL(req->out.vwv, VWV(5), raw); - SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id); + SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id.id); srv_push_dos_date(req->smb_conn, req->out.vwv, VWV(8), t); SSVAL(req->out.vwv, VWV(10), req->smb_conn->negotiate.zone_offset/60); SIVAL(req->out.vwv, VWV(11), 0); /* reserved */ @@ -202,7 +202,7 @@ static void reply_lanman2(struct smbsrv_request *req, uint16_t choice) SSVAL(req->out.vwv, VWV(3), lp_maxmux()); SSVAL(req->out.vwv, VWV(4), 1); SSVAL(req->out.vwv, VWV(5), raw); - SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id); + SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id.id); srv_push_dos_date(req->smb_conn, req->out.vwv, VWV(8), t); SSVAL(req->out.vwv, VWV(10), req->smb_conn->negotiate.zone_offset/60); SIVAL(req->out.vwv, VWV(11), 0); @@ -334,7 +334,7 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) SSVAL(req->out.vwv+1, VWV(2), 1); /* num vcs */ SIVAL(req->out.vwv+1, VWV(3), req->smb_conn->negotiate.max_recv); SIVAL(req->out.vwv+1, VWV(5), 0x10000); /* raw size. full 64k */ - SIVAL(req->out.vwv+1, VWV(7), req->smb_conn->connection->server_id); /* session key */ + SIVAL(req->out.vwv+1, VWV(7), req->smb_conn->connection->server_id.id); /* session key */ SIVAL(req->out.vwv+1, VWV(9), capabilities); push_nttime(req->out.vwv+1, VWV(11), nttime); SSVALS(req->out.vwv+1,VWV(15), req->smb_conn->negotiate.zone_offset/60); diff --git a/source4/smbd/process_model.h b/source4/smbd/process_model.h index 27fac68bb9..a10f63f1c5 100644 --- a/source4/smbd/process_model.h +++ b/source4/smbd/process_model.h @@ -26,6 +26,7 @@ #define __PROCESS_MODEL_H__ #include "lib/socket/socket.h" +#include "smbd/service_task.h" /* modules can use the following to determine if the interface has changed * please increment the version number after each interface change @@ -46,12 +47,12 @@ struct model_ops { /* function to accept new connection */ void (*accept_connection)(struct event_context *, struct socket_context *, void (*)(struct event_context *, struct socket_context *, - uint32_t , void *), + struct server_id , void *), void *); /* function to create a task */ void (*new_task)(struct event_context *, - void (*)(struct event_context *, uint32_t, void *), + void (*)(struct event_context *, struct server_id, void *), void *); /* function to terminate a connection or task */ diff --git a/source4/smbd/process_single.c b/source4/smbd/process_single.c index 9604302199..221cfb7807 100644 --- a/source4/smbd/process_single.c +++ b/source4/smbd/process_single.c @@ -25,6 +25,7 @@ #include "includes.h" #include "smbd/process_model.h" #include "system/filesys.h" +#include "cluster/cluster.h" /* called when the process model is selected @@ -39,7 +40,7 @@ static void single_model_init(struct event_context *ev) static void single_accept_connection(struct event_context *ev, struct socket_context *sock, void (*new_conn)(struct event_context *, struct socket_context *, - uint32_t , void *), + struct server_id , void *), void *private) { NTSTATUS status; @@ -61,18 +62,18 @@ static void single_accept_connection(struct event_context *ev, talloc_steal(private, sock); - new_conn(ev, sock2, socket_get_fd(sock2), private); + new_conn(ev, sock2, cluster_id(socket_get_fd(sock2)), private); } /* called to startup a new task */ static void single_new_task(struct event_context *ev, - void (*new_task)(struct event_context *, uint32_t, void *), + void (*new_task)(struct event_context *, struct server_id, void *), void *private) { static uint32_t taskid = 0x10000000; - new_task(ev, taskid++, private); + new_task(ev, cluster_id(taskid++), private); } diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c index 0dc9274e21..074d988e1e 100644 --- a/source4/smbd/process_standard.c +++ b/source4/smbd/process_standard.c @@ -28,8 +28,8 @@ #include "lib/socket/socket.h" #include "smbd/process_model.h" #include "param/secrets.h" - #include "system/filesys.h" +#include "cluster/cluster.h" #ifdef HAVE_SETPROCTITLE #ifdef HAVE_SETPROCTITLE_H @@ -58,7 +58,7 @@ static void standard_model_init(struct event_context *ev) static void standard_accept_connection(struct event_context *ev, struct socket_context *sock, void (*new_conn)(struct event_context *, struct socket_context *, - uint32_t , void *), + struct server_id , void *), void *private) { NTSTATUS status; @@ -126,7 +126,7 @@ static void standard_accept_connection(struct event_context *ev, talloc_free(s); /* setup this new connection */ - new_conn(ev2, sock2, pid, private); + new_conn(ev2, sock2, cluster_id(pid), private); /* we can't return to the top level here, as that event context is gone, so we now process events in the new event context until there are no @@ -141,7 +141,7 @@ static void standard_accept_connection(struct event_context *ev, called to create a new server task */ static void standard_new_task(struct event_context *ev, - void (*new_task)(struct event_context *, uint32_t , void *), + void (*new_task)(struct event_context *, struct server_id , void *), void *private) { pid_t pid; @@ -179,7 +179,7 @@ static void standard_new_task(struct event_context *ev, setproctitle("task server_id[%d]", pid); /* setup this new connection */ - new_task(ev2, pid, private); + new_task(ev2, cluster_id(pid), private); /* we can't return to the top level here, as that event context is gone, so we now process events in the new event context until there are no diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c index 725a3b5080..f3f3a67e78 100644 --- a/source4/smbd/service_stream.c +++ b/source4/smbd/service_stream.c @@ -28,6 +28,7 @@ #include "smbd/service.h" #include "smbd/service_stream.h" #include "lib/messaging/irpc.h" +#include "cluster/cluster.h" /* the range of ports to try for dcerpc over tcp endpoints */ #define SERVER_TCP_LOW_PORT 1024 @@ -134,7 +135,7 @@ NTSTATUS stream_new_connection_merge(struct event_context *ev, srv_conn->private = private_data; srv_conn->model_ops = model_ops; srv_conn->socket = sock; - srv_conn->server_id = 0; + srv_conn->server_id = cluster_id(0); srv_conn->ops = stream_ops; srv_conn->msg_ctx = msg_ctx; srv_conn->event.ctx = ev; @@ -151,7 +152,7 @@ NTSTATUS stream_new_connection_merge(struct event_context *ev, */ static void stream_new_connection(struct event_context *ev, struct socket_context *sock, - uint32_t server_id, void *private) + struct server_id server_id, void *private) { struct stream_socket *stream_socket = talloc_get_type(private, struct stream_socket); struct stream_connection *srv_conn; @@ -191,10 +192,10 @@ static void stream_new_connection(struct event_context *ev, s = socket_get_my_addr(sock, ev); if (s && c) { const char *title; - title = talloc_asprintf(s, "conn[%s] c[%s:%u] s[%s:%u] server_id[%d]", + title = talloc_asprintf(s, "conn[%s] c[%s:%u] s[%s:%u] server_id[%s]", stream_socket->ops->name, c->addr, c->port, s->addr, s->port, - server_id); + cluster_id_string(s, server_id)); if (title) { stream_connection_set_title(srv_conn, title); } diff --git a/source4/smbd/service_stream.h b/source4/smbd/service_stream.h index 692e18bea5..03fdcf522e 100644 --- a/source4/smbd/service_stream.h +++ b/source4/smbd/service_stream.h @@ -37,7 +37,7 @@ struct stream_connection { const struct stream_server_ops *ops; const struct model_ops *model_ops; - uint32_t server_id; + struct server_id server_id; void *private; struct { diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c index 2963bac425..06bd328386 100644 --- a/source4/smbd/service_task.c +++ b/source4/smbd/service_task.c @@ -50,7 +50,8 @@ struct task_state { called by the process model code when the new task starts up. This then calls the server specific startup code */ -static void task_server_callback(struct event_context *event_ctx, uint32_t server_id, void *private) +static void task_server_callback(struct event_context *event_ctx, + struct server_id server_id, void *private) { struct task_state *state = talloc_get_type(private, struct task_state); struct task_server *task; diff --git a/source4/smbd/service_task.h b/source4/smbd/service_task.h index c0adf08fd0..f89b5e65f9 100644 --- a/source4/smbd/service_task.h +++ b/source4/smbd/service_task.h @@ -27,8 +27,10 @@ struct task_server { struct event_context *event_ctx; const struct model_ops *model_ops; struct messaging_context *msg_ctx; - uint32_t server_id; + struct server_id server_id; void *private; }; + + #endif /* __SERVICE_TASK_H__ */ diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c index 185e1fb4ae..299cf77625 100644 --- a/source4/torture/local/irpc.c +++ b/source4/torture/local/irpc.c @@ -92,7 +92,8 @@ static bool test_addone(struct torture_context *test, const void *_data, r.in.in_data = value; test_debug = True; - status = IRPC_CALL(data->msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r, test); + status = IRPC_CALL(data->msg_ctx1, cluster_id(MSG_ID2), + rpcecho, ECHO_ADDONE, &r, test); test_debug = False; torture_assert_ntstatus_ok(test, status, "AddOne failed"); @@ -120,8 +121,9 @@ static bool test_echodata(struct torture_context *tctx, r.in.in_data = (unsigned char *)talloc_strdup(mem_ctx, "0123456789"); r.in.len = strlen((char *)r.in.in_data); - status = IRPC_CALL(data->msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r, - mem_ctx); + status = IRPC_CALL(data->msg_ctx1, cluster_id(MSG_ID2), + rpcecho, ECHO_ECHODATA, &r, + mem_ctx); torture_assert_ntstatus_ok(tctx, status, "EchoData failed"); /* check the answer */ @@ -177,8 +179,9 @@ static bool test_speed(struct torture_context *tctx, while (timeval_elapsed(&tv) < timelimit) { struct irpc_request *irpc; - irpc = IRPC_CALL_SEND(data->msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, - &r, mem_ctx); + irpc = IRPC_CALL_SEND(data->msg_ctx1, cluster_id(MSG_ID2), + rpcecho, ECHO_ADDONE, + &r, mem_ctx); torture_assert(tctx, irpc != NULL, "AddOne send failed"); irpc->async.fn = irpc_callback; @@ -214,11 +217,15 @@ static BOOL irpc_setup(struct torture_context *tctx, void **_data) lp_set_cmdline("lock dir", "lockdir.tmp"); data->ev = event_context_init(tctx); - torture_assert(tctx, data->msg_ctx1 = messaging_init(tctx, MSG_ID1, data->ev), - "Failed to init first messaging context"); - - torture_assert(tctx, data->msg_ctx2 = messaging_init(tctx, MSG_ID2, data->ev), - "Failed to init second messaging context"); + torture_assert(tctx, data->msg_ctx1 = + messaging_init(tctx, + cluster_id(MSG_ID1), data->ev), + "Failed to init first messaging context"); + + torture_assert(tctx, data->msg_ctx2 = + messaging_init(tctx, + cluster_id(MSG_ID2), data->ev), + "Failed to init second messaging context"); /* register the server side function */ IRPC_REGISTER(data->msg_ctx1, rpcecho, ECHO_ADDONE, irpc_AddOne, NULL); diff --git a/source4/torture/local/messaging.c b/source4/torture/local/messaging.c index 27c343948b..ccf091cf62 100644 --- a/source4/torture/local/messaging.c +++ b/source4/torture/local/messaging.c @@ -29,7 +29,7 @@ static uint32_t msg_pong; static void ping_message(struct messaging_context *msg, void *private, - uint32_t msg_type, uint32_t src, DATA_BLOB *data) + uint32_t msg_type, struct server_id src, DATA_BLOB *data) { NTSTATUS status; status = messaging_send(msg, src, msg_pong, data); @@ -39,14 +39,14 @@ static void ping_message(struct messaging_context *msg, void *private, } static void pong_message(struct messaging_context *msg, void *private, - uint32_t msg_type, uint32_t src, DATA_BLOB *data) + uint32_t msg_type, struct server_id src, DATA_BLOB *data) { int *count = private; (*count)++; } static void exit_message(struct messaging_context *msg, void *private, - uint32_t msg_type, uint32_t src, DATA_BLOB *data) + uint32_t msg_type, struct server_id src, DATA_BLOB *data) { talloc_free(private); exit(0); @@ -71,14 +71,14 @@ static bool test_ping_speed(struct torture_context *tctx) ev = event_context_init(mem_ctx); - msg_server_ctx = messaging_init(mem_ctx, 1, ev); + msg_server_ctx = messaging_init(mem_ctx, cluster_id(1), ev); torture_assert(tctx, msg_server_ctx != NULL, "Failed to init ping messaging context"); messaging_register_tmp(msg_server_ctx, NULL, ping_message, &msg_ping); messaging_register_tmp(msg_server_ctx, mem_ctx, exit_message, &msg_exit); - msg_client_ctx = messaging_init(mem_ctx, 2, ev); + msg_client_ctx = messaging_init(mem_ctx, cluster_id(2), ev); torture_assert(tctx, msg_client_ctx != NULL, "msg_client_ctx messaging_init() failed"); @@ -94,8 +94,8 @@ static bool test_ping_speed(struct torture_context *tctx) data.data = discard_const_p(uint8_t, "testing"); data.length = strlen((const char *)data.data); - status1 = messaging_send(msg_client_ctx, 1, msg_ping, &data); - status2 = messaging_send(msg_client_ctx, 1, msg_ping, NULL); + status1 = messaging_send(msg_client_ctx, cluster_id(1), msg_ping, &data); + status2 = messaging_send(msg_client_ctx, cluster_id(1), msg_ping, NULL); torture_assert_ntstatus_ok(tctx, status1, "msg1 failed"); ping_count++; @@ -115,7 +115,7 @@ static bool test_ping_speed(struct torture_context *tctx) } torture_comment(tctx, "sending exit"); - messaging_send(msg_client_ctx, 1, msg_exit, NULL); + messaging_send(msg_client_ctx, cluster_id(1), msg_exit, NULL); torture_assert_int_equal(tctx, ping_count, pong_count, "ping test failed"); diff --git a/source4/winbind/wb_dom_info.c b/source4/winbind/wb_dom_info.c index 2ca29a9a8b..41334b420a 100644 --- a/source4/winbind/wb_dom_info.c +++ b/source4/winbind/wb_dom_info.c @@ -91,7 +91,7 @@ static void get_dom_info_recv_addrs(struct composite_context *ctx) struct get_dom_info_state *state = talloc_get_type(ctx->async.private_data, struct get_dom_info_state); - uint32_t *nbt_servers; + struct server_id *nbt_servers; struct irpc_request *ireq; state->ctx->status = resolve_name_recv(ctx, state->info, @@ -100,7 +100,7 @@ static void get_dom_info_recv_addrs(struct composite_context *ctx) nbt_servers = irpc_servers_byname(state->service->task->msg_ctx, "nbt_server"); - if ((nbt_servers == NULL) || (nbt_servers[0] == 0)) { + if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { composite_error(state->ctx, NT_STATUS_NO_LOGON_SERVERS); return; } diff --git a/source4/wrepl_server/wrepl_apply_records.c b/source4/wrepl_server/wrepl_apply_records.c index 6dff884444..f805d21dfe 100644 --- a/source4/wrepl_server/wrepl_apply_records.c +++ b/source4/wrepl_server/wrepl_apply_records.c @@ -904,7 +904,7 @@ static void r_do_late_release_demand_handler(struct irpc_request *ireq) static NTSTATUS r_do_late_release_demand(struct r_do_challenge_state *state) { struct irpc_request *ireq; - uint32_t *nbt_servers; + struct server_id *nbt_servers; struct nbtd_proxy_wins_release_demand r; uint32_t i; @@ -912,7 +912,7 @@ static NTSTATUS r_do_late_release_demand(struct r_do_challenge_state *state) nbt_name_string(state, &state->replica.name))); nbt_servers = irpc_servers_byname(state->msg_ctx, "nbt_server"); - if ((nbt_servers == NULL) || (nbt_servers[0] == 0)) { + if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { return NT_STATUS_INTERNAL_ERROR; } @@ -1032,7 +1032,7 @@ static NTSTATUS r_do_challenge(struct wreplsrv_partner *partner, { struct irpc_request *ireq; struct r_do_challenge_state *state; - uint32_t *nbt_servers; + struct server_id *nbt_servers; const char **addrs; uint32_t i; @@ -1052,7 +1052,7 @@ static NTSTATUS r_do_challenge(struct wreplsrv_partner *partner, talloc_steal(state, replica->addresses); nbt_servers = irpc_servers_byname(state->msg_ctx, "nbt_server"); - if ((nbt_servers == NULL) || (nbt_servers[0] == 0)) { + if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { return NT_STATUS_INTERNAL_ERROR; } @@ -1094,7 +1094,7 @@ static NTSTATUS r_do_release_demand(struct wreplsrv_partner *partner, { NTSTATUS status; struct irpc_request *ireq; - uint32_t *nbt_servers; + struct server_id *nbt_servers; const char **addrs; struct winsdb_addr **addresses; struct nbtd_proxy_wins_release_demand r; @@ -1114,7 +1114,7 @@ static NTSTATUS r_do_release_demand(struct wreplsrv_partner *partner, nbt_name_string(mem_ctx, &replica->name))); nbt_servers = irpc_servers_byname(partner->service->task->msg_ctx, "nbt_server"); - if ((nbt_servers == NULL) || (nbt_servers[0] == 0)) { + if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { return NT_STATUS_INTERNAL_ERROR; } diff --git a/source4/wrepl_server/wrepl_scavenging.c b/source4/wrepl_server/wrepl_scavenging.c index 5628728a76..e134e64c06 100644 --- a/source4/wrepl_server/wrepl_scavenging.c +++ b/source4/wrepl_server/wrepl_scavenging.c @@ -388,10 +388,10 @@ static NTSTATUS wreplsrv_scavenging_replica_active_records(struct wreplsrv_servi const char *now_timestr; struct irpc_request *ireq; struct verify_state *s; - uint32_t *nbt_servers; + struct server_id *nbt_servers; nbt_servers = irpc_servers_byname(service->task->msg_ctx, "nbt_server"); - if ((nbt_servers == NULL) || (nbt_servers[0] == 0)) { + if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) { return NT_STATUS_INTERNAL_ERROR; } |