Skip to content

Commit b1ecdab

Browse files
committed
Normalize 'lifetime' argument name
All instances of the argument 'ttl' have been converted to 'lifetime' (including compound argument names with 'ttl', such as 'init_ttl', which became 'init_lifetime'). Additionally, instances of 'initiator_lifetime' and 'acceptor_lifetime' have been converted into 'init_lifetime' and 'accept_lifetime'.
1 parent d2341e0 commit b1ecdab

File tree

4 files changed

+49
-46
lines changed

4 files changed

+49
-46
lines changed

gssapi/raw/creds.pyx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ cdef class Creds:
8080
self.raw_creds = NULL
8181

8282

83-
def acquire_cred(Name name, ttl=None, mechs=None, usage='both'):
83+
def acquire_cred(Name name, lifetime=None, mechs=None, usage='both'):
8484
"""
8585
Get GSSAPI credentials for the given name and mechanisms.
8686
@@ -91,7 +91,8 @@ def acquire_cred(Name name, ttl=None, mechs=None, usage='both'):
9191
Args:
9292
name (Name): the name for which to acquire the credentials (or None
9393
for the "no name" functionality)
94-
ttl (int): the lifetime for the credentials (or None for indefinite)
94+
lifetime (int): the lifetime for the credentials (or None for
95+
indefinite)
9596
mechs ([MechType]): the desired mechanisms for which the credentials
9697
should work, or None for the default set
9798
usage (str): the usage type for the credentials: may be
@@ -112,7 +113,7 @@ def acquire_cred(Name name, ttl=None, mechs=None, usage='both'):
112113
else:
113114
desired_mechs = GSS_C_NO_OID_SET
114115

115-
cdef OM_uint32 input_ttl = c_py_ttl_to_c(ttl)
116+
cdef OM_uint32 input_ttl = c_py_ttl_to_c(lifetime)
116117

117118
cdef gss_name_t c_name
118119
if name is None:
@@ -173,7 +174,8 @@ def release_cred(Creds creds not None):
173174

174175

175176
def add_cred(Creds input_cred, Name name not None, OID mech not None,
176-
usage='initiate', initiator_ttl=None, acceptor_ttl=None):
177+
usage='initiate', init_lifetime=None,
178+
accept_lifetime=None):
177179
"""Add a credential element to a credential.
178180
179181
This method can be used to either compose two credentials (i.e., original
@@ -186,9 +188,9 @@ def add_cred(Creds input_cred, Name name not None, OID mech not None,
186188
mech (MechType): the desired security mechanism (required).
187189
usage (str): usage type for credentials. Possible values:
188190
'initiate' (default), 'accept', 'both' (failsafe).
189-
initiator_ttl (int): lifetime of credentials for use in initiating
191+
init_lifetime (int): lifetime of credentials for use in initiating
190192
security contexts (None for indefinite)
191-
acceptor_ttl (int): lifetime of credentials for use in accepting
193+
accept_lifetime (int): lifetime of credentials for use in accepting
192194
security contexts (None for indefinite)
193195
194196
Returns:
@@ -214,8 +216,8 @@ def add_cred(Creds input_cred, Name name not None, OID mech not None,
214216
else:
215217
raw_input_cred = GSS_C_NO_CREDENTIAL
216218

217-
cdef OM_uint32 input_initiator_ttl = c_py_ttl_to_c(initiator_ttl)
218-
cdef OM_uint32 input_acceptor_ttl = c_py_ttl_to_c(acceptor_ttl)
219+
cdef OM_uint32 input_initiator_ttl = c_py_ttl_to_c(init_lifetime)
220+
cdef OM_uint32 input_acceptor_ttl = c_py_ttl_to_c(accept_lifetime)
219221

220222
cdef gss_cred_id_t output_creds
221223
cdef gss_OID_set actual_mechs
@@ -241,16 +243,16 @@ def add_cred(Creds input_cred, Name name not None, OID mech not None,
241243
raise GSSError(maj_stat, min_stat)
242244

243245

244-
def inquire_cred(Creds creds not None, name=True, ttl=True,
245-
usage=True, mechs=True):
246+
def inquire_cred(Creds creds not None, name=True, lifetime=True, usage=True,
247+
mechs=True):
246248
"""Inspect credentials for information
247249
248250
This method inspects a :class:`Creds` object for information.
249251
250252
Args:
251253
creds (Creds): the credentials to inspect
252254
name (bool): get the Name associated with the credentials
253-
ttl (bool): get the TTL for the credentials
255+
lifetime (bool): get the TTL for the credentials
254256
usage (bool): get the usage type of the credentials
255257
mechs (bool): the mechanims used with the credentials
256258
@@ -270,7 +272,7 @@ def inquire_cred(Creds creds not None, name=True, ttl=True,
270272

271273
cdef OM_uint32 res_ttl
272274
cdef OM_uint32 *res_ttl_ptr = NULL
273-
if ttl:
275+
if lifetime:
274276
res_ttl_ptr = &res_ttl
275277

276278
cdef gss_cred_usage_t res_usage
@@ -305,7 +307,7 @@ def inquire_cred(Creds creds not None, name=True, ttl=True,
305307
py_usage = 'both'
306308

307309
py_ttl = None
308-
if ttl:
310+
if lifetime:
309311
py_ttl = c_c_ttl_to_py(res_ttl)
310312

311313
py_mechs = None
@@ -318,8 +320,8 @@ def inquire_cred(Creds creds not None, name=True, ttl=True,
318320

319321

320322
def inquire_cred_by_mech(Creds creds not None, OID mech not None,
321-
name=True, initiator_ttl=True,
322-
acceptor_ttl=True, usage=True):
323+
name=True, init_lifetime=True,
324+
accept_lifetime=True, usage=True):
323325
"""Inspect credentials for mechanism-specific
324326
325327
This method inspects a :class:`Creds` object for information
@@ -329,8 +331,8 @@ def inquire_cred_by_mech(Creds creds not None, OID mech not None,
329331
creds (Creds): the credentials to inspect
330332
mech (OID): the desired mechanism
331333
name (bool): get the Name associated with the credentials
332-
initiator_ttl (bool): get the initiator TTL for the credentials
333-
acceprot_ttl (bool): get the acceptor TTL for the credentials
334+
init_lifetime (bool): get the initiator TTL for the credentials
335+
accept_lifetime (bool): get the acceptor TTL for the credentials
334336
usage (bool): get the usage type of the credentials
335337
336338
Returns:
@@ -349,12 +351,12 @@ def inquire_cred_by_mech(Creds creds not None, OID mech not None,
349351

350352
cdef OM_uint32 res_initiator_ttl
351353
cdef OM_uint32 *res_initiator_ttl_ptr = NULL
352-
if initiator_ttl:
354+
if init_lifetime:
353355
res_initiator_ttl_ptr = &res_initiator_ttl
354356

355357
cdef OM_uint32 res_acceptor_ttl
356358
cdef OM_uint32 *res_acceptor_ttl_ptr = NULL
357-
if acceptor_ttl:
359+
if accept_lifetime:
358360
res_acceptor_ttl_ptr = &res_acceptor_ttl
359361

360362
cdef gss_cred_usage_t res_usage
@@ -376,11 +378,11 @@ def inquire_cred_by_mech(Creds creds not None, OID mech not None,
376378
rn = None
377379

378380
py_initiator_ttl = None
379-
if initiator_ttl:
381+
if init_lifetime:
380382
py_initiator_ttl = c_c_ttl_to_py(res_initiator_ttl)
381383

382384
py_acceptor_ttl = None
383-
if acceptor_ttl:
385+
if accept_lifetime:
384386
py_acceptor_ttl = c_c_ttl_to_py(res_acceptor_ttl)
385387

386388
py_usage = None

gssapi/raw/ext_cred_store.pyx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ cdef void c_free_key_value_set(gss_key_value_set_desc *kvset):
9494

9595
# TODO(directxman12): some of these probably need a "not null",
9696
# but that's not clear from the wiki page
97-
def acquire_cred_from(dict store, Name name, ttl=None,
97+
def acquire_cred_from(dict store, Name name, lifetime=None,
9898
mechs=None, usage='both'):
9999
"""Acquire credentials from the given store
100100
@@ -110,7 +110,7 @@ def acquire_cred_from(dict store, Name name, ttl=None,
110110
credential store from which to acquire the credentials
111111
name (Name): the name associated with the credentials,
112112
or None for the default name
113-
ttl (int): the desired lifetime of the credentials, or None
113+
lifetime (int): the desired lifetime of the credentials, or None
114114
for indefinite
115115
mechs (list): the desired mechanisms to be used with these
116116
credentials, or None for the default set
@@ -131,7 +131,7 @@ def acquire_cred_from(dict store, Name name, ttl=None,
131131
else:
132132
desired_mechs = GSS_C_NO_OID_SET
133133

134-
cdef OM_uint32 input_ttl = c_py_ttl_to_c(ttl)
134+
cdef OM_uint32 input_ttl = c_py_ttl_to_c(lifetime)
135135

136136
cdef gss_name_t c_name
137137
if name is None:
@@ -182,8 +182,8 @@ def acquire_cred_from(dict store, Name name, ttl=None,
182182

183183
def add_cred_from(dict store, Creds input_creds,
184184
Name name not None, OID mech not None,
185-
usage='both', initiator_ttl=None,
186-
acceptor_ttl=None):
185+
usage='both', init_lifetime=None,
186+
accept_lifetime=None):
187187
"""Acquire credentials to add to the current set from the given store
188188
189189
This method works like :func:`acquire_cred_from`, except that it
@@ -204,9 +204,9 @@ def add_cred_from(dict store, Creds input_creds,
204204
credentials
205205
usage (str): the usage for these credentials -- either 'both',
206206
'initiate', or 'accept'
207-
initiator_ttl): the desired initiate lifetime of the
207+
init_lifetime (int): the desired initiate lifetime of the
208208
credentials, or None for indefinite
209-
acceptor_ttl (int): the desired accept lifetime of the
209+
accept_lifetime (int): the desired accept lifetime of the
210210
credentials, or None for indefinite
211211
212212
Returns:
@@ -217,8 +217,8 @@ def add_cred_from(dict store, Creds input_creds,
217217
GSSError
218218
"""
219219

220-
cdef OM_uint32 input_initiator_ttl = c_py_ttl_to_c(initiator_ttl)
221-
cdef OM_uint32 input_acceptor_ttl = c_py_ttl_to_c(acceptor_ttl)
220+
cdef OM_uint32 input_initiator_ttl = c_py_ttl_to_c(init_lifetime)
221+
cdef OM_uint32 input_acceptor_ttl = c_py_ttl_to_c(accept_lifetime)
222222

223223
cdef gss_cred_usage_t c_usage
224224
if usage == 'initiate':

gssapi/raw/ext_s4u.pyx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ cdef extern from "gssapi/gssapi_ext.h":
3838

3939

4040
def acquire_cred_impersonate_name(Creds impersonator_cred not None,
41-
Name name not None, ttl=None, mechs=None,
42-
usage='initiate'):
41+
Name name not None, lifetime=None,
42+
mechs=None, usage='initiate'):
4343
"""
4444
Acquire credentials by impersonating another name.
4545
@@ -51,7 +51,8 @@ def acquire_cred_impersonate_name(Creds impersonator_cred not None,
5151
impersonator_cred (Cred): the credentials with permissions to
5252
impersonate the target name
5353
name (Name): the name to impersonate
54-
ttl (int): the lifetime for the credentials (or None for indefinite)
54+
lifetime (int): the lifetime for the credentials (or None for
55+
indefinite)
5556
mechs ([MechType]): the desired mechanisms for which the credentials
5657
should work (or None for the default set)
5758
usage (str): the usage type for the credentials: may be
@@ -72,7 +73,7 @@ def acquire_cred_impersonate_name(Creds impersonator_cred not None,
7273
else:
7374
desired_mechs = GSS_C_NO_OID_SET
7475

75-
cdef OM_uint32 input_ttl = c_py_ttl_to_c(ttl)
76+
cdef OM_uint32 input_ttl = c_py_ttl_to_c(lifetime)
7677
cdef gss_name_t c_name = name.raw_name
7778

7879
cdef gss_cred_usage_t c_usage
@@ -111,8 +112,8 @@ def acquire_cred_impersonate_name(Creds impersonator_cred not None,
111112
def add_cred_impersonate_name(Creds input_cred,
112113
Creds impersonator_cred not None,
113114
Name name not None, OID mech not None,
114-
usage='initiate', initiator_ttl=None,
115-
acceptor_ttl=None):
115+
usage='initiate', init_lifetime=None,
116+
accept_lifetime=None):
116117
"""
117118
Add a credential-element to a credential by impersonating another name.
118119
@@ -131,11 +132,11 @@ def add_cred_impersonate_name(Creds input_cred,
131132
singular and required, unlike acquireCredImpersonateName
132133
usage (str): the usage type for the credentials: may be
133134
'initiate', 'accept', or 'both'
134-
initiator_ttl (int): the lifetime for the credentials to remain valid
135-
when using them to initiate security contexts (or None for
135+
init_lifetime (int): the lifetime for the credentials to remain
136+
valid when using them to initiate security contexts (or None for
136137
indefinite)
137-
acceptor_ttl (int): the lifetime for the credentials to remain valid
138-
when using them to accept security contexts (or None for
138+
accept_lifetime (int): the lifetime for the credentials to remain
139+
valid when using them to accept security contexts (or None for
139140
indefinite)
140141
141142
Returns:
@@ -147,8 +148,8 @@ def add_cred_impersonate_name(Creds input_cred,
147148
GSSError
148149
"""
149150

150-
cdef OM_uint32 input_initiator_ttl = c_py_ttl_to_c(initiator_ttl)
151-
cdef OM_uint32 input_acceptor_ttl = c_py_ttl_to_c(acceptor_ttl)
151+
cdef OM_uint32 input_initiator_ttl = c_py_ttl_to_c(init_lifetime)
152+
cdef OM_uint32 input_acceptor_ttl = c_py_ttl_to_c(accept_lifetime)
152153
cdef gss_name_t c_name = name.raw_name
153154

154155
cdef gss_cred_usage_t c_usage

gssapi/raw/sec_contexts.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ cdef class SecurityContext:
112112
def init_sec_context(Name target_name not None, Creds cred=None,
113113
SecurityContext context=None,
114114
OID mech_type=None,
115-
flags=None, ttl=None,
115+
flags=None, lifetime=None,
116116
ChannelBindings channel_bindings=None,
117117
input_token=None):
118118
"""
@@ -137,8 +137,8 @@ def init_sec_context(Name target_name not None, Creds cred=None,
137137
flags ([RequirementFlag]): the flags to request for the security
138138
context, or None to use the default set: mutual_authentication and
139139
out_of_sequence_detection
140-
ttl (int): the request lifetime of the security context (a value of
141-
0 or None means indefinite)
140+
lifetime (int): the request lifetime of the security context (a value
141+
of 0 or None means indefinite)
142142
channel_bindings (ChannelBindings): The channel bindings (or None for
143143
no channel bindings)
144144
input_token (bytes): the token to use to update the security context,
@@ -174,7 +174,7 @@ def init_sec_context(Name target_name not None, Creds cred=None,
174174

175175
cdef gss_buffer_desc input_token_buffer = gss_buffer_desc(0, NULL)
176176

177-
cdef OM_uint32 input_ttl = c_py_ttl_to_c(ttl)
177+
cdef OM_uint32 input_ttl = c_py_ttl_to_c(lifetime)
178178

179179
cdef SecurityContext output_context = context
180180
if output_context is None:

0 commit comments

Comments
 (0)