From c7bd0d4a6fd2a4607028ac40da8969f685e7196f Mon Sep 17 00:00:00 2001 From: justing-bq <62349012+justing-bq@users.noreply.github.com> Date: Wed, 8 Mar 2023 13:12:08 -0800 Subject: [PATCH] Add AWS Authentication parameters to DSN UI (#115) --- installer/myodbc-installer.cc | 7 ++ setupgui/callbacks.cc | 44 ++++++++---- setupgui/setupgui.h | 15 ++-- .../windows/aws_connector_odbc_header.bmp | Bin 107406 -> 123030 bytes setupgui/windows/odbcdialogparams.cpp | 53 +++++++++++--- setupgui/windows/odbcdialogparams.rc | 67 +++++++++++------- setupgui/windows/resource.h | 7 ++ util/installer.cc | 46 ++++++++++-- util/installer.h | 16 +++++ 9 files changed, 198 insertions(+), 57 deletions(-) diff --git a/installer/myodbc-installer.cc b/installer/myodbc-installer.cc index 3106af1b3..04885d4f8 100644 --- a/installer/myodbc-installer.cc +++ b/installer/myodbc-installer.cc @@ -569,6 +569,13 @@ int list_datasource_details(DataSource *ds) if (ds->get_server_public_key) printf("\tGET_SERVER_PUBLIC_KEY\n"); if (ds->enable_dns_srv) printf("\tENABLE_DNS_SRV\n"); if (ds->multi_host) printf("\tMULTI_HOST\n"); + /* AWS Authentication */ + if (ds->auth_mode) printf("\tAUTH_MODE"); + if (ds->auth_region) printf("\tAUTH_REGION"); + if (ds->auth_host) printf("\tAUTH_HOST"); + if (ds->auth_port) printf("\tAUTH_PORT"); + if (ds->auth_expiration) printf("\tAUTH_EXPIRATION"); + if (ds->auth_secret_id) printf("\tAUTH_SECRET_ID"); /* Failover */ if (ds->enable_cluster_failover) printf("\tENABLE_CLUSTER_FAILOVER\n"); if (ds->allow_reader_connections) printf("\tALLOW_READER_CONNECTIONS\n"); diff --git a/setupgui/callbacks.cc b/setupgui/callbacks.cc index c76d5e14b..92ff10e63 100644 --- a/setupgui/callbacks.cc +++ b/setupgui/callbacks.cc @@ -304,7 +304,15 @@ void syncTabsData(HWND hwnd, DataSource *params) GET_STRING_TAB(AUTH_TAB, oci_config_file); GET_STRING_TAB(AUTH_TAB, oci_config_profile); - /* 3 - Failover */ + /* 3 - AWS Authentication */ + GET_COMBO_TAB(AWS_AUTH_TAB, auth_mode); + GET_STRING_TAB(AWS_AUTH_TAB, auth_region); + GET_STRING_TAB(AWS_AUTH_TAB, auth_host); + GET_UNSIGNED_TAB(AWS_AUTH_TAB, auth_port); + GET_UNSIGNED_TAB(AWS_AUTH_TAB, auth_expiration); + GET_STRING_TAB(AWS_AUTH_TAB, auth_secret_id); + + /* 4 - Failover */ GET_BOOL_TAB(FAILOVER_TAB, enable_cluster_failover); GET_BOOL_TAB(FAILOVER_TAB, allow_reader_connections); GET_BOOL_TAB(FAILOVER_TAB, gather_perf_metrics); @@ -323,7 +331,7 @@ void syncTabsData(HWND hwnd, DataSource *params) GET_UNSIGNED_TAB(FAILOVER_TAB, connect_timeout); GET_UNSIGNED_TAB(FAILOVER_TAB, network_timeout); - /* 4 - Monitoring */ + /* 5 - Monitoring */ GET_BOOL_TAB(MONITORING_TAB, enable_failure_detection); if (READ_BOOL_TAB(MONITORING_TAB, enable_failure_detection)) { @@ -335,7 +343,7 @@ void syncTabsData(HWND hwnd, DataSource *params) } - /* 5 - Metadata */ + /* 6 - Metadata */ GET_BOOL_TAB(METADATA_TAB, change_bigint_columns_to_int); GET_BOOL_TAB(METADATA_TAB, handle_binary_as_char); GET_BOOL_TAB(METADATA_TAB, return_table_names_for_SqlDescribeCol); @@ -343,7 +351,7 @@ void syncTabsData(HWND hwnd, DataSource *params) GET_BOOL_TAB(METADATA_TAB, no_schema); GET_BOOL_TAB(METADATA_TAB, limit_column_size); - /* 6 - Cursors/Results */ + /* 7 - Cursors/Results */ GET_BOOL_TAB(CURSORS_TAB, return_matching_rows); GET_BOOL_TAB(CURSORS_TAB, auto_increment_null_search); GET_BOOL_TAB(CURSORS_TAB, dynamic_cursor); @@ -361,10 +369,10 @@ void syncTabsData(HWND hwnd, DataSource *params) { params->cursor_prefetch_number= 0; } - /* 7 - debug*/ + /* 8 - debug*/ GET_BOOL_TAB(DEBUG_TAB,save_queries); - /* 8 - ssl related */ + /* 9 - ssl related */ GET_STRING_TAB(SSL_TAB, sslkey); GET_STRING_TAB(SSL_TAB, sslcert); GET_STRING_TAB(SSL_TAB, sslca); @@ -379,7 +387,7 @@ void syncTabsData(HWND hwnd, DataSource *params) GET_STRING_TAB(SSL_TAB, ssl_crl); GET_STRING_TAB(SSL_TAB, ssl_crlpath); - /* 9 - Misc*/ + /* 10 - Misc*/ GET_BOOL_TAB(MISC_TAB, safe); GET_BOOL_TAB(MISC_TAB, dont_use_set_locale); GET_BOOL_TAB(MISC_TAB, ignore_space_after_function_names); @@ -434,7 +442,15 @@ void syncTabs(HWND hwnd, DataSource *params) SET_STRING_TAB(AUTH_TAB, oci_config_file); SET_STRING_TAB(AUTH_TAB, oci_config_profile); - /* 3 - Failover */ + /* 3 - AWS Authentication */ + SET_COMBO_TAB(AWS_AUTH_TAB, auth_mode); + SET_STRING_TAB(AWS_AUTH_TAB, auth_region); + SET_STRING_TAB(AWS_AUTH_TAB, auth_host); + SET_UNSIGNED_TAB(AWS_AUTH_TAB, auth_port); + SET_UNSIGNED_TAB(AWS_AUTH_TAB, auth_expiration); + SET_STRING_TAB(AWS_AUTH_TAB, auth_secret_id); + + /* 4 - Failover */ SET_BOOL_TAB(FAILOVER_TAB, enable_cluster_failover); SET_BOOL_TAB(FAILOVER_TAB, allow_reader_connections); SET_BOOL_TAB(FAILOVER_TAB, gather_perf_metrics); @@ -485,7 +501,7 @@ void syncTabs(HWND hwnd, DataSource *params) SET_UNSIGNED_TAB(FAILOVER_TAB, network_timeout); } - /* 4 - Monitoring */ + /* 5 - Monitoring */ SET_BOOL_TAB(MONITORING_TAB, enable_failure_detection); if (READ_BOOL_TAB(MONITORING_TAB, enable_failure_detection)) { #ifdef _WIN32 @@ -502,7 +518,7 @@ void syncTabs(HWND hwnd, DataSource *params) SET_UNSIGNED_TAB(MONITORING_TAB, failure_detection_timeout); } - /* 5 - Metadata */ + /* 6 - Metadata */ SET_BOOL_TAB(METADATA_TAB, change_bigint_columns_to_int); SET_BOOL_TAB(METADATA_TAB, handle_binary_as_char); SET_BOOL_TAB(METADATA_TAB, return_table_names_for_SqlDescribeCol); @@ -510,7 +526,7 @@ void syncTabs(HWND hwnd, DataSource *params) SET_BOOL_TAB(METADATA_TAB, no_schema); SET_BOOL_TAB(METADATA_TAB, limit_column_size); - /* 6 - Cursors/Results */ + /* 7 - Cursors/Results */ SET_BOOL_TAB(CURSORS_TAB, return_matching_rows); SET_BOOL_TAB(CURSORS_TAB, auto_increment_null_search); SET_BOOL_TAB(CURSORS_TAB, dynamic_cursor); @@ -529,10 +545,10 @@ void syncTabs(HWND hwnd, DataSource *params) SET_UNSIGNED_TAB(CURSORS_TAB, cursor_prefetch_number); } - /* 7 - debug*/ + /* 8 - debug*/ SET_BOOL_TAB(DEBUG_TAB,save_queries); - /* 8 - ssl related */ + /* 9 - ssl related */ #ifdef _WIN32 if ( getTabCtrlTabPages(SSL_TAB-1) ) #endif @@ -570,7 +586,7 @@ void syncTabs(HWND hwnd, DataSource *params) SET_STRING_TAB(SSL_TAB, tls_versions); } - /* 9 - Misc*/ + /* 10 - Misc*/ SET_BOOL_TAB(MISC_TAB, safe); SET_BOOL_TAB(MISC_TAB, dont_use_set_locale); SET_BOOL_TAB(MISC_TAB, ignore_space_after_function_names); diff --git a/setupgui/setupgui.h b/setupgui/setupgui.h index 02e4b1a3d..d65c3fabc 100644 --- a/setupgui/setupgui.h +++ b/setupgui/setupgui.h @@ -37,13 +37,14 @@ #define CONNECTION_TAB 1 #define AUTH_TAB 2 -#define FAILOVER_TAB 3 -#define MONITORING_TAB 4 -#define METADATA_TAB 5 -#define CURSORS_TAB 6 -#define DEBUG_TAB 7 -#define SSL_TAB 8 -#define MISC_TAB 9 +#define AWS_AUTH_TAB 3 +#define FAILOVER_TAB 4 +#define MONITORING_TAB 5 +#define METADATA_TAB 6 +#define CURSORS_TAB 7 +#define DEBUG_TAB 8 +#define SSL_TAB 9 +#define MISC_TAB 10 #else # include diff --git a/setupgui/windows/aws_connector_odbc_header.bmp b/setupgui/windows/aws_connector_odbc_header.bmp index e1f8dad34684c34e1767fec72ad9ea66033acf5f..e1cd799cf10fc106be5bf66dcf71afc159d51cb5 100644 GIT binary patch delta 854 zcmaizTPQ?97{_@~{s==KGwJvkx*gXXZEm?>3h+eq{FUMOurhym!om%`SR|=p$h! zQ=u4{DN%f>sn)efv8u|`{|$;f2+J8hvr;o892B`5r0f|%V?=Fmn~&rrY67NCwC=F6aR}6GAVWe(fA0CP#f56-9yje_DIf}v3viE2H z_mL^G15%H%hFuC^hl4ZBs#n`~X{AqJjsi-fnNDU!2$K|vO&LtKN*V5XilQ~}rYbflP_N{^ rjsj?i0iyXt1H<=aShH}+MZ4AAu3JMkFw_~cf!rR}{NIZY{VBcy3#AV; delta 425 zcmbPskiG9Xo2rv<-(p4v5HJH`4Is8)VqmZb(u@oeK$3wWVlm@J)%ENf16t7VVW!RH zdNbKJbC}I%+dSVENSL_-iL*Y7*fyt!013tzATc|6Dcfd?Y#{4W5s;N%1!QqH0a?pB zfh>oKK-S$EK%#2F3bxHsD}cnV^;PT>1K2hj?O4P%F+gbZz5UbJP;HN5-fZ*~sQb(t zpvKHEK!WYh3byUbm>HL{ZFlBoT){Ryzl@P*`+FhAIc(dTrGNt4m6brk|CAW{r!Seq zC=Ik=dgl}%Cu=IB=yq`}#t^pc$%c%p*|xJ;f|M_F0I@wiK;#>L#&vAlCxtVfWSf4R z8={AQ`ky?Y4Yl!%b!^kEgn`WeX+XSYW3y0sv0Cobdnv diff --git a/setupgui/windows/odbcdialogparams.cpp b/setupgui/windows/odbcdialogparams.cpp index 935e419c6..87ac215e6 100644 --- a/setupgui/windows/odbcdialogparams.cpp +++ b/setupgui/windows/odbcdialogparams.cpp @@ -378,6 +378,7 @@ void btnDetails_Click (HWND hwnd) static PWSTR tabnames[] = { L"Connection", L"Authentication", + L"AWS Authentication", L"Cluster Failover", L"Monitoring", L"Metadata", @@ -396,6 +397,7 @@ void btnDetails_Click (HWND hwnd) MAKEINTRESOURCE(IDD_TAB7), MAKEINTRESOURCE(IDD_TAB8), MAKEINTRESOURCE(IDD_TAB9), + MAKEINTRESOURCE(IDD_TAB10), 0}; New_TabControl( &TabCtrl_1, // address of TabControl struct @@ -408,17 +410,26 @@ void btnDetails_Click (HWND hwnd) flag = true; + HWND auth_tab = TabCtrl_1.hTabPages[AWS_AUTH_TAB - 1]; + HWND auth_mode_dlg = GetDlgItem(auth_tab, IDC_EDIT_auth_mode); + + ComboBox_ResetContent(auth_mode_dlg); + + ComboBox_AddString(auth_mode_dlg, L""); + ComboBox_AddString(auth_mode_dlg, LSTR(AUTH_MODE_IAM)); + ComboBox_AddString(auth_mode_dlg, LSTR(AUTH_MODE_SECRETS_MANAGER)); + HWND ssl_tab = TabCtrl_1.hTabPages[SSL_TAB-1]; - HWND combo = GetDlgItem(ssl_tab, IDC_EDIT_sslmode); + HWND sslmode_dlg = GetDlgItem(ssl_tab, IDC_EDIT_sslmode); - ComboBox_ResetContent(combo); + ComboBox_ResetContent(sslmode_dlg); - ComboBox_AddString(combo, L""); - ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_DISABLED)); - ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_PREFERRED)); - ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_REQUIRED)); - ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_VERIFY_CA)); - ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_VERIFY_IDENTITY)); + ComboBox_AddString(sslmode_dlg, L""); + ComboBox_AddString(sslmode_dlg, LSTR(ODBC_SSL_MODE_DISABLED)); + ComboBox_AddString(sslmode_dlg, LSTR(ODBC_SSL_MODE_PREFERRED)); + ComboBox_AddString(sslmode_dlg, LSTR(ODBC_SSL_MODE_REQUIRED)); + ComboBox_AddString(sslmode_dlg, LSTR(ODBC_SSL_MODE_VERIFY_CA)); + ComboBox_AddString(sslmode_dlg, LSTR(ODBC_SSL_MODE_VERIFY_IDENTITY)); syncTabs(hwnd, pParams); } @@ -667,6 +678,32 @@ void FormMain_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) case IDC_RADIO_pipe: SwitchTcpOrPipe(hwnd, !!Button_GetCheck(GetDlgItem(hwnd, IDC_RADIO_pipe))); break; + case IDC_EDIT_auth_mode: + { + HWND authTab = TabCtrl_1.hTabPages[AWS_AUTH_TAB - 1]; + assert(authTab); + + HWND host = GetDlgItem(authTab, IDC_EDIT_auth_host); + HWND port = GetDlgItem(authTab, IDC_EDIT_auth_port); + HWND expiration = GetDlgItem(authTab, IDC_EDIT_auth_expiration); + HWND secret_id = GetDlgItem(authTab, IDC_EDIT_auth_secret_id); + assert(port); + assert(host); + assert(expiration); + assert(secret_id); + + wchar_t authMode[20]; + ComboBox_GetText(GetDlgItem(authTab, IDC_EDIT_auth_mode), authMode, sizeof(authMode)); + + BOOL usingIAM = wcscmp(authMode, L"IAM") == 0; + EnableWindow(port, usingIAM); + EnableWindow(host, usingIAM); + EnableWindow(expiration, usingIAM); + + BOOL usingSecretsManager = wcscmp(authMode, L"SECRETS MANAGER") == 0; + EnableWindow(secret_id, usingSecretsManager); + } + break; case IDC_CHECK_gather_perf_metrics: { HWND failoverTab = TabCtrl_1.hTabPages[FAILOVER_TAB-1]; diff --git a/setupgui/windows/odbcdialogparams.rc b/setupgui/windows/odbcdialogparams.rc index 4aaa33493..d401fdb41 100644 --- a/setupgui/windows/odbcdialogparams.rc +++ b/setupgui/windows/odbcdialogparams.rc @@ -95,38 +95,38 @@ END // Dialog // -IDD_DIALOG1 DIALOGEX 0, 0, 379, 450 +IDD_DIALOG1 DIALOGEX 0, 0, 430, 450 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - GROUPBOX "Connection Parameters",IDC_STATIC,18,53,348,148 + GROUPBOX "Connection Parameters",IDC_STATIC,18,53,396,148 RTEXT "Data Source &Name:",IDC_STATIC,23,68,67,8 - EDITTEXT IDC_EDIT_name,98,64,243,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_name,98,64,289,14,ES_AUTOHSCROLL RTEXT "D&escription:",IDC_STATIC,23,87,67,8 - EDITTEXT IDC_EDIT_description,98,83,243,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_description,98,83,289,14,ES_AUTOHSCROLL GROUPBOX "",IDC_STATIC,31,105,59,26,NOT WS_VISIBLE CONTROL "TCP/IP &Server:",IDC_RADIO_tcp,"Button",BS_AUTORADIOBUTTON | BS_RIGHT,32,105,60,13 CONTROL "Named &Pipe:",IDC_RADIO_pipe,"Button",BS_AUTORADIOBUTTON | BS_RIGHT,32,122,60,13 RTEXT "Server",IDC_STATIC,97,104,0,0 // Invisible, needed for accessibility - EDITTEXT IDC_EDIT_server,98,104,185,14,ES_AUTOHSCROLL - RTEXT "&Port:",IDC_STATIC,289,107,19,8 - EDITTEXT IDC_EDIT_port,312,104,29,14,ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_EDIT_server,98,104,231,14,ES_AUTOHSCROLL + RTEXT "&Port:",IDC_STATIC,335,107,19,8 + EDITTEXT IDC_EDIT_port,358,104,29,14,ES_AUTOHSCROLL | ES_NUMBER RTEXT "Named Pipe",IDC_STATIC,97,104,0,0 // Invisible, needed for accessibility - EDITTEXT IDC_EDIT_socket,98,123,185,14,WS_DISABLED,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_socket,98,123,289,14,WS_DISABLED,ES_AUTOHSCROLL RTEXT "&User:",IDC_STATIC,23,143,67,8 - EDITTEXT IDC_EDIT_uid,98,142,185,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_uid,98,142,289,14,ES_AUTOHSCROLL RTEXT "Pass&word:",IDC_STATIC,23,164,67,8 - EDITTEXT IDC_EDIT_pwd,98,161,185,14,ES_PASSWORD | ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_pwd,98,161,289,14,ES_PASSWORD | ES_AUTOHSCROLL RTEXT "Data&base:",IDC_STATIC,23,182,67,8 - COMBOBOX IDC_EDIT_database,98,180,185,42,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Test",IDC_BUTTON_TEST,299,179,41,14 - CONTROL "",IDC_TAB1,"SysTabControl32",WS_TABSTOP,17,214,349,234 // Change the size of this to fit more controls + COMBOBOX IDC_EDIT_database,98,180,231,42,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Test",IDC_BUTTON_TEST,345,179,41,14 + CONTROL "",IDC_TAB1,"SysTabControl32",WS_TABSTOP,17,214,399,234 // Change the size of this to fit more controls PUSHBUTTON "&Details >>",IDC_BUTTON_DETAILS,17,405,50,15 - DEFPUSHBUTTON "OK",IDOK,211,405,50,15 - PUSHBUTTON "&Cancel",IDCANCEL,265,405,50,15 - PUSHBUTTON "&Help",IDC_BUTTON_HELP,317,405,49,15 - CONTROL IDB_LOGO,IDC_STATIC,"Static",SS_BITMAP,0,0,379,39 + DEFPUSHBUTTON "OK",IDOK,257,405,50,15 + PUSHBUTTON "&Cancel",IDCANCEL,311,405,50,15 + PUSHBUTTON "&Help",IDC_BUTTON_HELP,365,405,49,15 + CONTROL IDB_LOGO,IDC_STATIC,"Static",SS_BITMAP,0,0,650,63 END IDD_TAB1 DIALOGEX 0, 0, 224, 231 @@ -188,7 +188,26 @@ BEGIN #endif END -IDD_TAB3 DIALOGEX 0, 0, 209, 281 +IDD_TAB3 DIALOGEX 0, 0, 209, 181 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + RTEXT "Authentication Mode:", IDC_STATIC, 0, 10, 80, 10 + COMBOBOX IDC_EDIT_auth_mode, 85, 10, 85, 10, + CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP + RTEXT "Auth Region:", IDC_STATIC, 0, 25, 80, 10 + EDITTEXT IDC_EDIT_auth_region, 85, 25, 85, 10, ES_AUTOHSCROLL + RTEXT "IAM Host:", IDC_STATIC, 0, 40, 80, 10 + EDITTEXT IDC_EDIT_auth_host, 85, 40, 85, 10, ES_AUTOHSCROLL + RTEXT "IAM Port:", IDC_STATIC, 0, 55, 80, 10 + EDITTEXT IDC_EDIT_auth_port, 85, 55, 85, 10, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "IAM Expire Time:", IDC_STATIC, 0, 70, 80, 10 + EDITTEXT IDC_EDIT_auth_expiration, 85, 70, 85, 10, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Secret ID:", IDC_STATIC, 0, 85, 80, 10 + EDITTEXT IDC_EDIT_auth_secret_id, 85, 85, 85, 10, ES_AUTOHSCROLL +END + +IDD_TAB4 DIALOGEX 0, 0, 209, 281 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -220,7 +239,7 @@ BEGIN EDITTEXT IDC_EDIT_network_timeout,132,193,64,12,ES_AUTOHSCROLL | ES_NUMBER END -IDD_TAB4 DIALOGEX 0, 0, 209, 181 +IDD_TAB5 DIALOGEX 0, 0, 209, 181 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -238,7 +257,7 @@ BEGIN EDITTEXT IDC_EDIT_monitor_disposal_time,132,85,64,12,ES_AUTOHSCROLL | ES_NUMBER| WS_DISABLED END -IDD_TAB5 DIALOGEX 0, 0, 209, 181 +IDD_TAB6 DIALOGEX 0, 0, 209, 181 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -257,7 +276,7 @@ BEGIN END -IDD_TAB6 DIALOGEX 0, 0, 209, 181 +IDD_TAB7 DIALOGEX 0, 0, 209, 181 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -284,7 +303,7 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,125,138,10 END -IDD_TAB7 DIALOGEX 0, 0, 209, 181 +IDD_TAB8 DIALOGEX 0, 0, 209, 181 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -292,7 +311,7 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,12,160,10 END -IDD_TAB8 DIALOGEX 0, 0, 509, 181 +IDD_TAB9 DIALOGEX 0, 0, 509, 181 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -329,7 +348,7 @@ BEGIN END -IDD_TAB9 DIALOGEX 0, 0, 209, 181 +IDD_TAB10 DIALOGEX 0, 0, 209, 181 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN diff --git a/setupgui/windows/resource.h b/setupgui/windows/resource.h index 258bdce33..6dec0867e 100644 --- a/setupgui/windows/resource.h +++ b/setupgui/windows/resource.h @@ -56,6 +56,7 @@ #define IDD_TAB7 138 #define IDD_TAB8 139 #define IDD_TAB9 140 +#define IDD_TAB10 141 #define IDC_LOGO 1000 #define IDC_EDIT_DRVNAME 1004 #define IDC_EDIT_DRVDESC 1005 @@ -177,6 +178,12 @@ #define IDC_EDIT_failure_detection_count 10103 #define IDC_EDIT_failure_detection_timeout 10104 #define IDC_EDIT_monitor_disposal_time 10105 +#define IDC_EDIT_auth_mode 11001 +#define IDC_EDIT_auth_region 11002 +#define IDC_EDIT_auth_host 11003 +#define IDC_EDIT_auth_port 11004 +#define IDC_EDIT_auth_expiration 11005 +#define IDC_EDIT_auth_secret_id 11006 #define IDC_BUTTON_TEST 11014 #define IDC_BUTTON_HELP 11015 #define IDC_STATIC -1 diff --git a/util/installer.cc b/util/installer.cc index 777ee264c..3aceadc98 100644 --- a/util/installer.cc +++ b/util/installer.cc @@ -234,6 +234,14 @@ static SQLWCHAR W_SSL_CRL[] = static SQLWCHAR W_SSL_CRLPATH[] = { 'S', 'S', 'L', '-', 'C', 'R', 'L', 'P', 'A', 'T', 'H', 0}; +/* AWS Authentication */ +static SQLWCHAR W_AUTH_MODE[] = { 'A', 'U', 'T', 'H', 'E', 'N', 'T', 'I', 'C', 'A', 'T', 'I', 'O', 'N', '_', 'M', 'O', 'D', 'E', 0}; +static SQLWCHAR W_AUTH_REGION[] = { 'I', 'A', 'M', '_', 'R', 'E', 'G', 'I', 'O', 'N', 0 }; +static SQLWCHAR W_AUTH_HOST[] = { 'I', 'A', 'M', '_', 'H', 'O', 'S', 'T', 0 }; +static SQLWCHAR W_AUTH_PORT[] = { 'I', 'A', 'M', '_', 'P', 'O', 'R', 'T', 0 }; +static SQLWCHAR W_AUTH_EXPIRATION[] = { 'E', 'X', 'P', 'I', 'R', 'A', 'T', 'I', 'O', 'N', '_', 'T', 'I', 'M', 'E', 0 }; +static SQLWCHAR W_AUTH_SECRET_ID[] = { 'S', 'E', 'C', 'R', 'E', 'T', '_', 'I', 'D', 0 }; + /* Failover */ static SQLWCHAR W_ENABLE_CLUSTER_FAILOVER[] = { 'E', 'N', 'A', 'B', 'L', 'E', '_', 'C', 'L', 'U', 'S', 'T', 'E', 'R', '_', 'F', 'A', 'I', 'L', 'O', 'V', 'E', 'R', 0 }; static SQLWCHAR W_ALLOW_READER_CONNECTIONS[] = { 'A', 'L', 'L', 'O', 'W', '_', 'R', 'E', 'A', 'D', 'E', 'R', '_', 'C', 'O', 'N', 'N', 'E', 'C', 'T', 'I', 'O', 'N', 'S', 0 }; @@ -746,6 +754,12 @@ DataSource *ds_new() ds->port = 3306; ds->has_port = false; ds->no_schema = 1; + ds->auth_mode = 0; + ds->auth_region = 0; + ds->auth_host = 0; + ds->auth_port = 0; + ds->auth_expiration = 0; + ds->auth_secret_id = 0; ds->enable_cluster_failover = true; ds->allow_reader_connections = false; ds->gather_perf_metrics = false; @@ -1134,8 +1148,21 @@ void ds_map_param(DataSource *ds, const SQLWCHAR *param, else if (!sqlwcharcasecmp(W_SSL_CRL, param)) *strdest = &ds->ssl_crl; else if (!sqlwcharcasecmp(W_SSL_CRLPATH, param)) - *strdest = &ds->ssl_crlpath; - /* Failover*/ + *strdest = &ds->ssl_crlpath; + /* AWS Authentication*/ + else if (!sqlwcharcasecmp(W_AUTH_MODE, param)) + *strdest = &ds->auth_mode; + else if (!sqlwcharcasecmp(W_AUTH_REGION, param)) + *strdest = &ds->auth_region; + else if (!sqlwcharcasecmp(W_AUTH_HOST, param)) + *strdest = &ds->auth_host; + else if (!sqlwcharcasecmp(W_AUTH_PORT, param)) + *intdest = &ds->auth_port; + else if (!sqlwcharcasecmp(W_AUTH_EXPIRATION, param)) + *intdest = &ds->auth_expiration; + else if (!sqlwcharcasecmp(W_AUTH_SECRET_ID, param)) + *strdest = &ds->auth_secret_id; + /* Failover */ else if (!sqlwcharcasecmp(W_ENABLE_CLUSTER_FAILOVER, param)) *booldest = &ds->enable_cluster_failover; else if (!sqlwcharcasecmp(W_ALLOW_READER_CONNECTIONS, param)) @@ -1162,7 +1189,6 @@ void ds_map_param(DataSource *ds, const SQLWCHAR *param, *intdest = &ds->connect_timeout; else if (!sqlwcharcasecmp(W_NETWORK_TIMEOUT, param)) *intdest = &ds->network_timeout; - /* Monitoring */ else if (!sqlwcharcasecmp(W_ENABLE_FAILURE_DETECTION, param)) *booldest = &ds->enable_failure_detection; @@ -1718,6 +1744,13 @@ int ds_add(DataSource *ds) if (ds_add_strprop(ds->name, W_TLS_VERSIONS, ds->tls_versions)) goto error; if (ds_add_strprop(ds->name, W_SSL_CRL, ds->ssl_crl)) goto error; if (ds_add_strprop(ds->name, W_SSL_CRLPATH, ds->ssl_crlpath)) goto error; + /* AWS Authentication */ + if (ds_add_strprop(ds->name, W_AUTH_MODE, ds->auth_mode)) goto error; + if (ds_add_strprop(ds->name, W_AUTH_REGION, ds->auth_region)) goto error; + if (ds_add_strprop(ds->name, W_AUTH_HOST, ds->auth_host)) goto error; + if (ds_add_intprop(ds->name, W_AUTH_PORT, ds->auth_port)) goto error; + if (ds_add_intprop(ds->name, W_AUTH_EXPIRATION, ds->auth_expiration)) goto error; + if (ds_add_strprop(ds->name, W_AUTH_SECRET_ID, ds->auth_secret_id)) goto error; /* Failover */ if (ds_add_intprop(ds->name, W_ENABLE_CLUSTER_FAILOVER, ds->enable_cluster_failover, true)) goto error; if (ds_add_intprop(ds->name, W_ALLOW_READER_CONNECTIONS, ds->allow_reader_connections)) goto error; @@ -1732,7 +1765,6 @@ int ds_add(DataSource *ds) if (ds_add_intprop(ds->name, W_FAILOVER_READER_CONNECT_TIMEOUT, ds->failover_reader_connect_timeout)) goto error; if (ds_add_intprop(ds->name, W_CONNECT_TIMEOUT, ds->connect_timeout)) goto error; if (ds_add_intprop(ds->name, W_NETWORK_TIMEOUT, ds->network_timeout)) goto error; - /* Monitoring */ if (ds_add_intprop(ds->name, W_ENABLE_FAILURE_DETECTION, ds->enable_failure_detection, true)) goto error; if (ds_add_intprop(ds->name, W_FAILURE_DETECTION_TIME, ds->failure_detection_time)) goto error; @@ -2066,6 +2098,12 @@ void ds_copy(DataSource *ds, DataSource *ds_source) { sqlwcharlen(ds_source->cluster_id)); } + ds->auth_mode = ds_source->auth_mode; + ds->auth_region = ds_source->auth_region; + ds->auth_host = ds_source->auth_host; + ds->auth_port = ds_source->auth_port; + ds->auth_expiration = ds_source->auth_expiration; + ds->auth_secret_id = ds_source->auth_secret_id; ds->enable_cluster_failover = ds_source->enable_cluster_failover; ds->allow_reader_connections = ds_source->allow_reader_connections; ds->gather_perf_metrics = ds_source->gather_perf_metrics; diff --git a/util/installer.h b/util/installer.h index 97f9591c6..aafe1114a 100644 --- a/util/installer.h +++ b/util/installer.h @@ -216,6 +216,19 @@ typedef struct DataSource { BOOL enable_dns_srv; BOOL multi_host; + /* AWS Authentication */ + SQLWCHAR *auth_mode; + SQLWCHAR *auth_region; + SQLWCHAR *auth_host; + unsigned int auth_port; + unsigned int auth_expiration; + SQLWCHAR *auth_secret_id; + + SQLCHAR *auth_mode8; + SQLCHAR* auth_region8; + SQLCHAR* auth_host8; + SQLCHAR* auth_secret_id8; + /* Failover */ BOOL enable_cluster_failover; BOOL allow_reader_connections; @@ -277,6 +290,9 @@ extern const SQLWCHAR W_DRIVER_PARAM[]; extern const SQLWCHAR W_DRIVER_NAME[]; extern const SQLWCHAR W_INVALID_ATTR_STR[]; +#define AUTH_MODE_IAM "IAM" +#define AUTH_MODE_SECRETS_MANAGER "SECRETS MANAGER" + /* * Deprecated connection parameters */