diff --git a/smbc/context.c b/smbc/context.c index 3ce71a0..ae95ec3 100644 --- a/smbc/context.c +++ b/smbc/context.c @@ -3,6 +3,8 @@ * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2011, 2012, 2013 Red Hat, Inc * Copyright (C) 2010 Open Source Solution Technology Corporation * Copyright (C) 2010 Patrick Geltinger + * Copyright (C) 2021 BaseALT, Ltd. + * Copyright (C) 2021 Igor Chudov * Authors: * Tim Waugh * Tsukasa Hamano @@ -113,6 +115,7 @@ Context_init (Context *self, PyObject *args, PyObject *kwds) { PyObject *auth = NULL; int debug = 0; + int use_kerberos = 0; SMBCCTX *ctx; char *proto = NULL; static char *kwlist[] = @@ -120,11 +123,12 @@ Context_init (Context *self, PyObject *args, PyObject *kwds) "auth_fn", "debug", "proto", + "use_kerberos", NULL }; - if (!PyArg_ParseTupleAndKeywords (args, kwds, "|Ois", kwlist, - &auth, &debug, &proto)) + if (!PyArg_ParseTupleAndKeywords (args, kwds, "|Oisi", kwlist, + &auth, &debug, &proto, &use_kerberos)) { return -1; } @@ -152,6 +156,13 @@ Context_init (Context *self, PyObject *args, PyObject *kwds) return -1; } + /* Enable Kerberos authentication */ + if (use_kerberos) + { + smbc_setOptionUseKerberos(ctx, 1); + smbc_setOptionFallbackAfterKerberos(ctx, 1); + } + smbc_setDebug (ctx, debug); self->context = ctx;