s4-pyjoin: fill in the dns name in the python replication method
[metze/samba/wip.git] / source4 / libnet / py_net.c
1 /*
2    Unix SMB/CIFS implementation.
3    Samba utility functions
4    Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008-2010
5    Copyright (C) Kamen Mazdrashki <kamen.mazdrashki@postpath.com> 2009
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include <Python.h>
22 #include "includes.h"
23 #include "libnet.h"
24 #include "auth/credentials/pycredentials.h"
25 #include "libcli/security/security.h"
26 #include "lib/events/events.h"
27 #include "param/param.h"
28 #include "param/pyparam.h"
29 #include "lib/ldb/pyldb.h"
30 #include "auth/gensec/gensec.h"
31 #include "librpc/rpc/pyrpc.h"
32 #include "librpc/rpc/pyrpc_util.h"
33 #include "lib/messaging/messaging.h"
34 #include "libcli/finddc.h"
35 #include "libcli/resolve/resolve.h"
36
37 typedef struct {
38         PyObject_HEAD
39         TALLOC_CTX *mem_ctx;
40         struct libnet_context *libnet_ctx;
41         struct tevent_context *ev;
42 } py_net_Object;
43
44 static PyObject *py_net_join(py_net_Object *self, PyObject *args, PyObject *kwargs)
45 {
46         struct libnet_Join r;
47         NTSTATUS status;
48         PyObject *result;
49         TALLOC_CTX *mem_ctx;
50         const char *kwnames[] = { "domain_name", "netbios_name", "join_type", "level", NULL };
51
52         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ssii:Join", discard_const_p(char *, kwnames), 
53                                          &r.in.domain_name, &r.in.netbios_name, 
54                                          &r.in.join_type, &r.in.level))
55                 return NULL;
56
57         mem_ctx = talloc_new(self->mem_ctx);
58
59         status = libnet_Join(self->libnet_ctx, mem_ctx, &r);
60         if (NT_STATUS_IS_ERR(status)) {
61                 PyErr_SetString(PyExc_RuntimeError, r.out.error_string?r.out.error_string:nt_errstr(status));
62                 talloc_free(mem_ctx);
63                 return NULL;
64         }
65
66         result = Py_BuildValue("sss", r.out.join_password,
67                                dom_sid_string(mem_ctx, r.out.domain_sid),
68                                r.out.domain_name);
69
70         talloc_free(mem_ctx);
71
72         return result;
73 }
74
75 static const char py_net_join_doc[] = "join(domain_name, netbios_name, join_type, level) -> (join_password, domain_sid, domain_name)\n\n" \
76 "Join the domain with the specified name.";
77
78 static PyObject *py_net_set_password(py_net_Object *self, PyObject *args, PyObject *kwargs)
79 {
80         union libnet_SetPassword r;
81         NTSTATUS status;
82         PyObject *py_creds;
83         TALLOC_CTX *mem_ctx;
84         struct tevent_context *ev;
85         const char *kwnames[] = { "account_name", "domain_name", "newpassword", "credentials", NULL };
86
87         r.generic.level = LIBNET_SET_PASSWORD_GENERIC;
88
89         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sssO:set_password", discard_const_p(char *, kwnames),
90                                          &r.generic.in.account_name, &r.generic.in.domain_name,
91                                          &r.generic.in.newpassword, &py_creds)) {
92                 return NULL;
93         }
94
95         /* FIXME: we really need to get a context from the caller or we may end
96          * up with 2 event contexts */
97         ev = s4_event_context_init(NULL);
98         mem_ctx = talloc_new(ev);
99
100         status = libnet_SetPassword(self->libnet_ctx, mem_ctx, &r);
101         if (NT_STATUS_IS_ERR(status)) {
102                 PyErr_SetString(PyExc_RuntimeError,
103                                 r.generic.out.error_string?r.generic.out.error_string:nt_errstr(status));
104                 talloc_free(mem_ctx);
105                 return NULL;
106         }
107
108         talloc_free(mem_ctx);
109
110         Py_RETURN_NONE;
111 }
112
113 static const char py_net_set_password_doc[] = "set_password(account_name, domain_name, newpassword) -> True\n\n" \
114 "Set password for a user. You must supply credential with enough rights to do this.\n\n" \
115 "Sample usage is:\n" \
116 "net.set_password(account_name=<account_name>,\n" \
117 "                domain_name=domain_name,\n" \
118 "                newpassword=new_pass)\n";
119
120
121 static PyObject *py_net_export_keytab(py_net_Object *self, PyObject *args, PyObject *kwargs)
122 {
123         struct libnet_export_keytab r;
124         TALLOC_CTX *mem_ctx;
125         const char *kwnames[] = { "keytab", NULL };
126         NTSTATUS status;
127
128         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:export_keytab", discard_const_p(char *, kwnames),
129                                          &r.in.keytab_name)) {
130                 return NULL;
131         }
132
133         mem_ctx = talloc_new(self->mem_ctx);
134
135         status = libnet_export_keytab(self->libnet_ctx, mem_ctx, &r);
136         if (NT_STATUS_IS_ERR(status)) {
137                 PyErr_SetString(PyExc_RuntimeError,
138                                 r.out.error_string?r.out.error_string:nt_errstr(status));
139                 talloc_free(mem_ctx);
140                 return NULL;
141         }
142
143         talloc_free(mem_ctx);
144
145         Py_RETURN_NONE;
146 }
147
148 static const char py_net_export_keytab_doc[] = "export_keytab(keytab, name)\n\n"
149 "Export the DC keytab to a keytab file.";
150
151 static PyObject *py_net_time(py_net_Object *self, PyObject *args, PyObject *kwargs)
152 {
153         const char *kwnames[] = { "server_name", NULL };
154         union libnet_RemoteTOD r;
155         NTSTATUS status;
156         TALLOC_CTX *mem_ctx;
157         char timestr[64];
158         PyObject *ret;
159         struct tm *tm;
160
161         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s",
162                 discard_const_p(char *, kwnames), &r.generic.in.server_name))
163                 return NULL;
164
165         r.generic.level                 = LIBNET_REMOTE_TOD_GENERIC;
166
167         mem_ctx = talloc_new(NULL);
168         if (mem_ctx == NULL) {
169                 PyErr_NoMemory();
170                 return NULL;
171         }
172
173         status = libnet_RemoteTOD(self->libnet_ctx, mem_ctx, &r);
174         if (!NT_STATUS_IS_OK(status)) {
175                 PyErr_SetString(PyExc_RuntimeError,
176                                 r.generic.out.error_string?r.generic.out.error_string:nt_errstr(status));
177                 talloc_free(mem_ctx);
178                 return NULL;
179         }
180
181         ZERO_STRUCT(timestr);
182         tm = localtime(&r.generic.out.time);
183         strftime(timestr, sizeof(timestr)-1, "%c %Z",tm);
184         
185         ret = PyString_FromString(timestr);
186
187         talloc_free(mem_ctx);
188
189         return ret;
190 }
191
192 static const char py_net_time_doc[] = "time(server_name) -> timestr\n"
193 "Retrieve the remote time on a server";
194
195 static PyObject *py_net_user_create(py_net_Object *self, PyObject *args, PyObject *kwargs)
196 {
197         const char *kwnames[] = { "username", NULL };
198         NTSTATUS status;
199         TALLOC_CTX *mem_ctx;
200         struct libnet_CreateUser r;
201
202         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", discard_const_p(char *, kwnames), 
203                                                                          &r.in.user_name))
204                 return NULL;
205
206         r.in.domain_name = cli_credentials_get_domain(self->libnet_ctx->cred);
207
208         mem_ctx = talloc_new(NULL);
209         if (mem_ctx == NULL) {
210                 PyErr_NoMemory();
211                 return NULL;
212         }
213
214         status = libnet_CreateUser(self->libnet_ctx, mem_ctx, &r);
215         if (!NT_STATUS_IS_OK(status)) {
216                 PyErr_SetString(PyExc_RuntimeError, r.out.error_string?r.out.error_string:nt_errstr(status));
217                 talloc_free(mem_ctx);
218                 return NULL;
219         }
220
221         talloc_free(mem_ctx);
222         
223         Py_RETURN_NONE;
224 }
225
226 static const char py_net_create_user_doc[] = "create_user(username)\n"
227 "Create a new user.";
228
229 static PyObject *py_net_user_delete(py_net_Object *self, PyObject *args, PyObject *kwargs)
230 {
231         const char *kwnames[] = { "username", NULL };
232         NTSTATUS status;
233         TALLOC_CTX *mem_ctx;
234         struct libnet_DeleteUser r;
235
236         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", discard_const_p(char *, kwnames), 
237                                                                          &r.in.user_name))
238                 return NULL;
239
240         r.in.domain_name = cli_credentials_get_domain(self->libnet_ctx->cred);
241
242         mem_ctx = talloc_new(NULL);
243         if (mem_ctx == NULL) {
244                 PyErr_NoMemory();
245                 return NULL;
246         }
247
248         status = libnet_DeleteUser(self->libnet_ctx, mem_ctx, &r);
249         if (!NT_STATUS_IS_OK(status)) {
250                 PyErr_SetString(PyExc_RuntimeError, r.out.error_string?r.out.error_string:nt_errstr(status));
251                 talloc_free(mem_ctx);
252                 return NULL;
253         }
254
255         talloc_free(mem_ctx);
256         
257         Py_RETURN_NONE;
258 }
259
260 static const char py_net_delete_user_doc[] = "delete_user(username)\n"
261 "Delete a user.";
262
263 static PyObject *py_dom_sid_FromSid(struct dom_sid *sid)
264 {
265         PyObject *mod_security, *dom_sid_Type;
266
267         mod_security = PyImport_ImportModule("samba.dcerpc.security");
268         if (mod_security == NULL)
269                 return NULL;
270
271         dom_sid_Type = PyObject_GetAttrString(mod_security, "dom_sid");
272         if (dom_sid_Type == NULL)
273                 return NULL;
274
275         return py_talloc_reference((PyTypeObject *)dom_sid_Type, sid);
276 }
277
278 static PyObject *py_net_vampire(py_net_Object *self, PyObject *args, PyObject *kwargs)
279 {
280         const char *kwnames[] = { "domain", "target_dir", NULL };
281         NTSTATUS status;
282         TALLOC_CTX *mem_ctx;
283         PyObject *ret;
284         struct libnet_Vampire r;
285
286         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|z", discard_const_p(char *, kwnames),
287                                          &r.in.domain_name, &r.in.targetdir)) {
288                 return NULL;
289         }
290
291         r.in.netbios_name  = lpcfg_netbios_name(self->libnet_ctx->lp_ctx);
292         r.out.error_string = NULL;
293
294         mem_ctx = talloc_new(NULL);
295         if (mem_ctx == NULL) {
296                 PyErr_NoMemory();
297                 return NULL;
298         }
299
300         status = libnet_Vampire(self->libnet_ctx, mem_ctx, &r);
301
302         if (!NT_STATUS_IS_OK(status)) {
303                 PyErr_SetString(PyExc_RuntimeError,
304                                 r.out.error_string ? r.out.error_string : nt_errstr(status));
305                 talloc_free(mem_ctx);
306                 return NULL;
307         }
308
309         ret = Py_BuildValue("(sO)", r.out.domain_name, py_dom_sid_FromSid(r.out.domain_sid));
310
311         talloc_free(mem_ctx);
312
313         return ret;
314 }
315
316 struct replicate_state {
317         void *vampire_state;
318         dcerpc_InterfaceObject *drs_pipe;
319         struct libnet_BecomeDC_StoreChunk chunk;
320         DATA_BLOB gensec_skey;
321         struct libnet_BecomeDC_Partition partition;
322         struct libnet_BecomeDC_Forest forest;
323         struct libnet_BecomeDC_DestDSA dest_dsa;
324 };
325
326 /*
327   setup for replicate_chunk() calls
328  */
329 static PyObject *py_net_replicate_init(py_net_Object *self, PyObject *args, PyObject *kwargs)
330 {
331         const char *kwnames[] = { "samdb", "lp", "drspipe", NULL };
332         PyObject *py_ldb, *py_lp, *py_drspipe;
333         struct ldb_context *samdb;
334         struct loadparm_context *lp;
335         struct replicate_state *s;
336         NTSTATUS status;
337
338         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO",
339                                          discard_const_p(char *, kwnames),
340                                          &py_ldb, &py_lp, &py_drspipe)) {
341                 return NULL;
342         }
343
344         s = talloc_zero(NULL, struct replicate_state);
345         if (!s) return NULL;
346
347         lp = lpcfg_from_py_object(s, py_lp);
348         if (lp == NULL) {
349                 PyErr_SetString(PyExc_TypeError, "Expected lp object");
350                 talloc_free(s);
351                 return NULL;
352         }
353
354         samdb = PyLdb_AsLdbContext(py_ldb);
355         if (samdb == NULL) {
356                 PyErr_SetString(PyExc_TypeError, "Expected ldb object");
357                 talloc_free(s);
358                 return NULL;
359         }
360
361         s->drs_pipe = (dcerpc_InterfaceObject *)(py_drspipe);
362
363         s->vampire_state = libnet_vampire_replicate_init(s, samdb, lp);
364         if (s->vampire_state == NULL) {
365                 PyErr_SetString(PyExc_TypeError, "Failed to initialise vampire_state");
366                 talloc_free(s);
367                 return NULL;
368         }
369
370         status = gensec_session_key(s->drs_pipe->pipe->conn->security_state.generic_state,
371                                     &s->gensec_skey);
372         if (!NT_STATUS_IS_OK(status)) {
373                 PyErr_Format(PyExc_RuntimeError, "Unable to get session key from drspipe: %s",
374                              nt_errstr(status));
375                 talloc_free(s);
376                 return NULL;
377         }
378
379         s->forest.dns_name = lpcfg_dnsdomain(lp);
380
381         s->chunk.gensec_skey = &s->gensec_skey;
382         s->chunk.partition = &s->partition;
383         s->chunk.forest = &s->forest;
384         s->chunk.dest_dsa = &s->dest_dsa;
385
386         return PyCObject_FromTallocPtr(s);
387 }
388
389
390 /*
391   process one replication chunk
392  */
393 static PyObject *py_net_replicate_chunk(py_net_Object *self, PyObject *args, PyObject *kwargs)
394 {
395         const char *kwnames[] = { "state", "level", "ctr", "schema", NULL };
396         PyObject *py_state, *py_ctr, *py_schema;
397         struct replicate_state *s;
398         unsigned level;
399         NTSTATUS (*chunk_handler)(void *private_data, const struct libnet_BecomeDC_StoreChunk *c);
400         NTSTATUS status;
401
402         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OIO|O",
403                                          discard_const_p(char *, kwnames),
404                                          &py_state, &level, &py_ctr, &py_schema)) {
405                 return NULL;
406         }
407
408         s = talloc_get_type(PyCObject_AsVoidPtr(py_state), struct replicate_state);
409         if (!s) {
410                 PyErr_SetString(PyExc_TypeError, "Expected replication_state");
411                 return NULL;
412         }
413
414         switch (level) {
415         case 1:
416                 if (!py_check_dcerpc_type(py_ctr, "samba.dcerpc.drsuapi", "DsGetNCChangesCtr1")) {
417                         return NULL;
418                 }
419                 s->chunk.ctr1                         = py_talloc_get_ptr(py_ctr);
420                 s->partition.nc                       = *s->chunk.ctr1->naming_context;
421                 s->partition.more_data                = s->chunk.ctr1->more_data;
422                 s->partition.source_dsa_guid          = s->chunk.ctr1->source_dsa_guid;
423                 s->partition.source_dsa_invocation_id = s->chunk.ctr1->source_dsa_invocation_id;
424                 s->partition.highwatermark            = s->chunk.ctr1->new_highwatermark;
425                 break;
426         case 6:
427                 if (!py_check_dcerpc_type(py_ctr, "samba.dcerpc.drsuapi", "DsGetNCChangesCtr6")) {
428                         return NULL;
429                 }
430                 s->chunk.ctr6                         = py_talloc_get_ptr(py_ctr);
431                 s->partition.nc                       = *s->chunk.ctr6->naming_context;
432                 s->partition.more_data                = s->chunk.ctr6->more_data;
433                 s->partition.source_dsa_guid          = s->chunk.ctr6->source_dsa_guid;
434                 s->partition.source_dsa_invocation_id = s->chunk.ctr6->source_dsa_invocation_id;
435                 s->partition.highwatermark            = s->chunk.ctr6->new_highwatermark;
436                 break;
437         default:
438                 PyErr_Format(PyExc_TypeError, "Bad level %u in replicate_chunk", level);
439                 return NULL;
440         }
441
442         chunk_handler = libnet_vampire_cb_store_chunk;
443         if (py_schema) {
444                 if (!PyBool_Check(py_schema)) {
445                         PyErr_SetString(PyExc_TypeError, "Expected boolean schema");
446                         return NULL;
447                 }
448                 if (py_schema == Py_True) {
449                         chunk_handler = libnet_vampire_cb_schema_chunk;
450                 }
451         }
452
453         s->chunk.ctr_level = level;
454
455         status = chunk_handler(s->vampire_state, &s->chunk);
456         if (!NT_STATUS_IS_OK(status)) {
457                 PyErr_Format(PyExc_TypeError, "Failed to process chunk: %s", nt_errstr(status));
458                 return NULL;
459         }
460
461         Py_RETURN_NONE;
462 }
463
464
465 /*
466   find a DC given a domain name and server type
467  */
468 static PyObject *py_net_finddc(py_net_Object *self, PyObject *args)
469 {
470         const char *domain_name;
471         unsigned server_type;
472         NTSTATUS status;
473         struct finddcs io;
474         TALLOC_CTX *mem_ctx;
475         PyObject *ret;
476
477         if (!PyArg_ParseTuple(args, "sI", &domain_name, &server_type)) {
478                 return NULL;
479         }
480
481         mem_ctx = talloc_new(self->mem_ctx);
482
483         ZERO_STRUCT(io);
484         io.in.domain_name = domain_name;
485         io.in.minimum_dc_flags = server_type;
486
487         status = finddcs_cldap(mem_ctx, &io,
488                                lpcfg_resolve_context(self->libnet_ctx->lp_ctx), self->ev);
489         if (NT_STATUS_IS_ERR(status)) {
490                 PyErr_SetString(PyExc_RuntimeError, nt_errstr(status));
491                 talloc_free(mem_ctx);
492                 return NULL;
493         }
494
495         ret = PyString_FromString(io.out.netlogon.data.nt5_ex.pdc_dns_name);
496
497         talloc_free(mem_ctx);
498         return ret;
499 }
500
501
502 static const char py_net_vampire_doc[] = "vampire(domain, target_dir=None)\n"
503                                          "Vampire a domain.";
504
505 static const char py_net_replicate_init_doc[] = "replicate_init(samdb, lp, drspipe)\n"
506                                          "Setup for replicate_chunk calls.";
507
508 static const char py_net_replicate_chunk_doc[] = "replicate_chunk(state, level, ctr, schema)\n"
509                                          "Process replication for one chunk";
510
511 static const char py_net_finddc_doc[] = "finddc(domain, server_type)\n"
512                                          "find a DC with the specified server_type bits. Return the DNS name";
513
514 static PyMethodDef net_obj_methods[] = {
515         {"join", (PyCFunction)py_net_join, METH_VARARGS|METH_KEYWORDS, py_net_join_doc},
516         {"set_password", (PyCFunction)py_net_set_password, METH_VARARGS|METH_KEYWORDS, py_net_set_password_doc},
517         {"export_keytab", (PyCFunction)py_net_export_keytab, METH_VARARGS|METH_KEYWORDS, py_net_export_keytab_doc},
518         {"time", (PyCFunction)py_net_time, METH_VARARGS|METH_KEYWORDS, py_net_time_doc},
519         {"create_user", (PyCFunction)py_net_user_create, METH_VARARGS|METH_KEYWORDS, py_net_create_user_doc},
520         {"delete_user", (PyCFunction)py_net_user_delete, METH_VARARGS|METH_KEYWORDS, py_net_delete_user_doc},
521         {"vampire", (PyCFunction)py_net_vampire, METH_VARARGS|METH_KEYWORDS, py_net_vampire_doc},
522         {"replicate_init", (PyCFunction)py_net_replicate_init, METH_VARARGS|METH_KEYWORDS, py_net_replicate_init_doc},
523         {"replicate_chunk", (PyCFunction)py_net_replicate_chunk, METH_VARARGS|METH_KEYWORDS, py_net_replicate_chunk_doc},
524         {"finddc", (PyCFunction)py_net_finddc, METH_VARARGS, py_net_finddc_doc},
525         { NULL }
526 };
527
528 static void py_net_dealloc(py_net_Object *self)
529 {
530         talloc_free(self->mem_ctx);
531 }
532
533 static PyObject *net_obj_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
534 {
535         PyObject *py_creds, *py_lp = Py_None;
536         const char *kwnames[] = { "creds", "lp", NULL };
537         py_net_Object *ret;
538         struct loadparm_context *lp;
539
540         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O", 
541                         discard_const_p(char *, kwnames), &py_creds, &py_lp))
542                 return NULL;
543
544         ret = PyObject_New(py_net_Object, type);
545         if (ret == NULL) {
546                 return NULL;
547         }
548
549         /* FIXME: we really need to get a context from the caller or we may end
550          * up with 2 event contexts */
551         ret->ev = s4_event_context_init(NULL);
552         ret->mem_ctx = talloc_new(ret->ev);
553
554         lp = lpcfg_from_py_object(ret->mem_ctx, py_lp);
555         if (lp == NULL) {
556                 Py_DECREF(ret);
557                 return NULL;
558         }
559
560         ret->libnet_ctx = libnet_context_init(ret->ev, lp);
561         if (ret->libnet_ctx == NULL) {
562                 PyErr_SetString(PyExc_RuntimeError, "Unable to initialize net");
563                 Py_DECREF(ret);
564                 return NULL;
565         }
566
567         ret->libnet_ctx->cred = cli_credentials_from_py_object(py_creds);
568         if (ret->libnet_ctx->cred == NULL) {
569                 PyErr_SetString(PyExc_TypeError, "Expected credentials object");
570                 Py_DECREF(ret);
571                 return NULL;
572         }
573
574         return (PyObject *)ret;
575 }
576
577
578 PyTypeObject py_net_Type = {
579         PyObject_HEAD_INIT(NULL) 0,
580         .tp_name = "net.Net",
581         .tp_basicsize = sizeof(py_net_Object),
582         .tp_dealloc = (destructor)py_net_dealloc,
583         .tp_methods = net_obj_methods,
584         .tp_new = net_obj_new,
585 };
586
587 void initnet(void)
588 {
589         PyObject *m;
590
591         if (PyType_Ready(&py_net_Type) < 0)
592                 return;
593
594         m = Py_InitModule3("net", NULL, NULL);
595         if (m == NULL)
596                 return;
597
598         Py_INCREF(&py_net_Type);
599         PyModule_AddObject(m, "Net", (PyObject *)&py_net_Type);
600         PyModule_AddObject(m, "LIBNET_JOINDOMAIN_AUTOMATIC", PyInt_FromLong(LIBNET_JOINDOMAIN_AUTOMATIC));
601         PyModule_AddObject(m, "LIBNET_JOINDOMAIN_SPECIFIED", PyInt_FromLong(LIBNET_JOINDOMAIN_SPECIFIED));
602         PyModule_AddObject(m, "LIBNET_JOIN_AUTOMATIC", PyInt_FromLong(LIBNET_JOIN_AUTOMATIC));
603         PyModule_AddObject(m, "LIBNET_JOIN_SPECIFIED", PyInt_FromLong(LIBNET_JOIN_SPECIFIED));
604 }