Skip to content

Commit

Permalink
Introduced use_kerberos keyword to allow Kerberos authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Chudov committed Jul 30, 2021
1 parent 286b379 commit 912f036
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions smbc/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
* Copyright (C) 2021 BaseALT, Ltd. <[email protected]>
* Copyright (C) 2021 Igor Chudov <[email protected]>
* Authors:
* Tim Waugh <[email protected]>
* Tsukasa Hamano <[email protected]>
Expand Down Expand Up @@ -113,18 +115,20 @@ 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[] =
{
"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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 912f036

Please sign in to comment.