@@ -317,7 +317,6 @@ SQL_API_RC SQL_API_FN GenerateInitialCredUserPassword
317317 char * localErrorMsg = NULL ;
318318 char oneNullByte [] = {'\0' };
319319
320-
321320 IAM_TRACE_ENTRY ("GenerateInitialCredUserPassword" );
322321
323322 if (newpasswordLen > 0 )
@@ -545,118 +544,6 @@ SQL_API_RC SQL_API_FN GenerateInitialCredAccessToken
545544 goto exit ;
546545}
547546
548- /*
549- * GenerateInitialCredApiKey
550- */
551- SQL_API_RC SQL_API_FN GenerateInitialCredApiKey
552- (
553- const char * apikey ,
554- db2int32 apikeyLen ,
555- const char * apikeyspace ,
556- db2int32 apikeyspaceLen ,
557- db2int32 apikeyspaceType ,
558- const char * dbname ,
559- db2int32 dbnameLen ,
560- gss_cred_id_t * pGSSCredHandle ,
561- void * * ppInitInfo ,
562- char * * errorMsg ,
563- db2int32 * errorMsgLen
564- )
565- {
566- int rc = DB2SEC_PLUGIN_OK ;
567- CRED_T * pCred ;
568- char * localErrorMsg = NULL ;
569- char oneNullByte [] = {'\0' };
570- const char * userid ;
571- db2int32 useridLen ;
572- IAM_TRACE_ENTRY ("GenerateInitialCredApiKey" );
573-
574- if (!pGSSCredHandle )
575- {
576- localErrorMsg = "GenerateInitialCredApiKey: pGSSCredHandle == NULL" ;
577- rc = DB2SEC_PLUGIN_UNKNOWNERROR ;
578- goto exit ;
579- }
580-
581- /* Check lengths */
582- if (apikeyLen > TOKEN_MAX_AUTH_TOKEN_LEN )
583- {
584- rc = DB2SEC_PLUGIN_BADPWD ;
585- localErrorMsg = "GenerateInitialCredApiKey: access token too long" ;
586- goto exit ;
587- }
588-
589- pCred = (CRED_T * )malloc (sizeof (CRED_T ));
590- if (pCred == NULL )
591- {
592- goto malloc_fail ;
593- }
594- memset (pCred , '\0' , sizeof (CRED_T ));
595-
596- /* Deal with NULL userids and passwords by using a one-byte
597- * string containing only a NULL. We flow this to the server
598- * and let it decide.
599- */
600-
601- pCred -> authtype = DB2SEC_AUTH_APIKEY ;
602-
603- //pCred->useridLen = 0;
604- //pCred->userid = NULL;
605- userid = oneNullByte ;
606- useridLen = 1 ;
607- pCred -> useridLen = useridLen ;
608- pCred -> userid = (char * )malloc (useridLen );
609- if (pCred -> userid == NULL )
610- {
611- goto malloc_fail ;
612- }
613- memcpy (pCred -> userid , userid , useridLen );
614-
615- pCred -> authtokenLen = apikeyLen ;
616- pCred -> authtoken = (char * )malloc (apikeyLen );
617- if (pCred -> authtoken == NULL )
618- {
619- goto malloc_fail ;
620- }
621- memcpy (pCred -> authtoken , apikey , apikeyLen );
622-
623- * pGSSCredHandle = (gss_cred_id_t )pCred ;
624-
625- exit :
626-
627- /* No init info */
628- if (ppInitInfo != NULL )
629- {
630- * ppInitInfo = NULL ;
631- }
632-
633- if (localErrorMsg != NULL )
634- {
635- * errorMsg = localErrorMsg ;
636- * errorMsgLen = strlen (localErrorMsg );
637- }
638- else
639- {
640- * errorMsg = NULL ;
641- * errorMsgLen = 0 ;
642- }
643- IAM_TRACE_EXIT ("GenerateInitialCredApiKey" ,rc );
644-
645- return (rc );
646-
647- malloc_fail :
648- if (pCred != NULL )
649- {
650- if (pCred -> authtoken != NULL ) free (pCred -> authtoken );
651- if (pCred -> userid != NULL ) free (pCred -> userid );
652- free (pCred );
653- }
654-
655- localErrorMsg = "GenerateInitialCredApiKey: malloc failed" ;
656- rc = DB2SEC_PLUGIN_NOMEM ;
657-
658- goto exit ;
659- }
660547
661548/******************************************************************************
662549*
@@ -689,7 +576,7 @@ SQL_API_RC SQL_API_FN ProcessServerPrincipalName
689576 int rc = DB2SEC_PLUGIN_OK ;
690577 NAME_T * pName ;
691578 IAM_TRACE_ENTRY ("ProcessServerPrincipalName" );
692-
579+
693580 /* No error messages */
694581 * errorMsg = NULL ;
695582 * errorMsgLen = 0 ;
@@ -861,7 +748,7 @@ OM_uint32 SQL_API_FN gss_init_sec_context
861748 char * errMsg = NULL ;
862749 int length ;
863750 IAM_TRACE_ENTRY ("gss_init_sec_context" );
864-
751+
865752 /* Check for unsupported options */
866753 if (context_handle == NULL )
867754 {
@@ -1140,7 +1027,6 @@ SQL_API_RC SQL_API_FN db2secClientAuthPluginInit
11401027 pFPs -> db2secGetDefaultLoginContext = GetDefaultLoginContext ;
11411028 pFPs -> db2secGenerateInitialCred = GenerateInitialCredUserPassword ;
11421029 pFPs -> db2secGenerateInitialCredAccessToken = GenerateInitialCredAccessToken ;
1143- pFPs -> db2secGenerateInitialCredApiKey = GenerateInitialCredApiKey ;
11441030 pFPs -> db2secProcessServerPrincipalName = ProcessServerPrincipalName ;
11451031 pFPs -> db2secFreeToken = FreeToken ;
11461032 pFPs -> db2secFreeInitInfo = FreeInitInfo ;
0 commit comments