s4:lib/messaging: terminate the irpc_servers_byname() result with server_id_set_disco...
authorStefan Metzmacher <metze@samba.org>
Fri, 4 Jan 2013 12:27:26 +0000 (13:27 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 9 Jan 2013 08:11:20 +0000 (09:11 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/lib/messaging/messaging.c
source4/lib/messaging/pymessaging.c

index 2df6f41e4caea6289cbf8aa1a3cce48b98d65a05..5966c29d5a7b921dad2fc76763b5f225255760e5 100644 (file)
@@ -982,7 +982,7 @@ struct server_id *irpc_servers_byname(struct imessaging_context *msg_ctx,
        for (i=0;i<count;i++) {
                ret[i] = ((struct server_id *)rec.dptr)[i];
        }
-       ret[i] = cluster_id(0, 0);
+       server_id_set_disconnected(&ret[i]);
        free(rec.dptr);
        tdb_unlock_bystring(t->tdb, name);
        talloc_free(t);
@@ -1419,7 +1419,7 @@ struct dcerpc_binding_handle *irpc_binding_handle_by_name(TALLOC_CTX *mem_ctx,
                errno = EADDRNOTAVAIL;
                return NULL;
        }
-       if (sids[0].pid == 0) {
+       if (server_id_is_disconnected(&sids[0])) {
                talloc_free(sids);
                errno = EADDRNOTAVAIL;
                return NULL;
index fca46e674956b90fe22a555c993b8b0758f43db3..cb79d72065f78a618af91824894a0aac459a02be 100644 (file)
@@ -247,7 +247,7 @@ static PyObject *py_irpc_servers_byname(PyObject *self, PyObject *args, PyObject
                return NULL;
        }
 
-       for (i = 0; ids[i].pid != 0; i++) {
+       for (i = 0; !server_id_is_disconnected(&ids[i]); i++) {
                /* Do nothing */
        }
 
@@ -257,7 +257,7 @@ static PyObject *py_irpc_servers_byname(PyObject *self, PyObject *args, PyObject
                PyErr_NoMemory();
                return NULL;
        }
-       for (i = 0; ids[i].pid; i++) {
+       for (i = 0; !server_id_is_disconnected(&ids[i]); i++) {
                PyObject *py_server_id;
                struct server_id *p_server_id = talloc(NULL, struct server_id);
                if (!p_server_id) {