-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced use_kerberos keyword to allow Kerberos authentication
- Loading branch information
Igor Chudov
committed
Jul 30, 2021
1 parent
286b379
commit 912f036
Showing
1 changed file
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]> | ||
|
@@ -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; | ||
} | ||
|
@@ -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; | ||
|