(
self,
Context: CONTEXT,
input_token=None,
target_name: Optional[str] = None,
req_flags: Optional[GSS_C_FLAGS] = None,
chan_bindings: GssChannelBindings = GSS_C_NO_CHANNEL_BINDINGS,
)
| 961 | Context.other_mechtypes = [] |
| 962 | |
| 963 | def GSS_Init_sec_context( |
| 964 | self, |
| 965 | Context: CONTEXT, |
| 966 | input_token=None, |
| 967 | target_name: Optional[str] = None, |
| 968 | req_flags: Optional[GSS_C_FLAGS] = None, |
| 969 | chan_bindings: GssChannelBindings = GSS_C_NO_CHANNEL_BINDINGS, |
| 970 | ): |
| 971 | if Context is None: |
| 972 | # New Context |
| 973 | Context = SPNEGOSSP.CONTEXT( |
| 974 | list(self.ssps), |
| 975 | req_flags=req_flags, |
| 976 | ) |
| 977 | |
| 978 | input_token_inner = None |
| 979 | negState = None |
| 980 | |
| 981 | # Extract values from GSSAPI token, if present |
| 982 | if input_token is not None: |
| 983 | if isinstance(input_token, GSSAPI_BLOB): |
| 984 | input_token = input_token.innerToken |
| 985 | if isinstance(input_token, SPNEGO_negToken): |
| 986 | input_token = input_token.token |
| 987 | if isinstance(input_token, SPNEGO_negTokenInit): |
| 988 | # We are handling a NegTokenInit2 request ! |
| 989 | # Populate context with values from the server's request |
| 990 | Context.other_mechtypes = input_token.mechTypes |
| 991 | elif isinstance(input_token, SPNEGO_negTokenResp): |
| 992 | # Extract token and state from the client request |
| 993 | if input_token.responseToken is not None: |
| 994 | input_token_inner = input_token.responseToken.value |
| 995 | if input_token.negState is not None: |
| 996 | negState = input_token.negState |
| 997 | else: |
| 998 | # The blob is a raw token. We aren't using SPNEGO here. |
| 999 | Context.raw = True |
| 1000 | input_token_inner = input_token |
| 1001 | self.GuessOtherMechtypes(Context, input_token) |
| 1002 | |
| 1003 | # Perform SSP negotiation |
| 1004 | if Context.ssp is None: |
| 1005 | try: |
| 1006 | Context.negotiate_ssp() |
| 1007 | except ValueError as ex: |
| 1008 | # Couldn't find common SSP |
| 1009 | log_runtime.warning("SPNEGOSSP: %s" % ex) |
| 1010 | return Context, None, GSS_S_BAD_MECH |
| 1011 | |
| 1012 | # Call inner-SSP |
| 1013 | Context.ssp_context, output_token_inner, status = ( |
| 1014 | Context.ssp.GSS_Init_sec_context( |
| 1015 | Context.ssp_context, |
| 1016 | input_token=input_token_inner, |
| 1017 | target_name=target_name, |
| 1018 | req_flags=Context.req_flags, |
| 1019 | chan_bindings=chan_bindings, |
| 1020 | ) |
nothing calls this directly
no test coverage detected