Changeset: efbfa8437dc8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/efbfa8437dc8
Branch: clientinfo
Log Message:

merged with default


diffs (235 lines):

diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h
--- a/clients/odbc/winsetup/resource.h
+++ b/clients/odbc/winsetup/resource.h
@@ -40,7 +40,6 @@
 #define IDC_EDIT_CLIENTKEY              2024
 #define IDC_EDIT_CLIENTCERT             2025
 
-//#define IDC_BUTTON_CANCEL               2031
 #define IDC_BUTTON_TEST                 2031
 #define IDC_BUTTON_HELP                 2032
 
diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c
--- a/clients/odbc/winsetup/setup.c
+++ b/clients/odbc/winsetup/setup.c
@@ -93,17 +93,17 @@ struct data {
        char *uid;
        char *pwd;
        char *host;
-       char *port;
+       char *port;             /* positive integer */
        char *database;
        char *schema;
-       char *logintimeout;
-       char *replytimeout;
-       char *replysize;
-       char *autocommit;
-       char *timezone;
+       char *logintimeout;     /* empty, 0 or positive integer (millisecs) */
+       char *replytimeout;     /* empty, 0 or positive integer (millisecs)  */
+       char *replysize;        /* empty, 0 or positive integer */
+       char *autocommit;       /* only on or off allowed */
+       char *timezone;         /* empty, 0 or signed integer (minutes) */
        char *logfile;
        // TLS settings
-       char *use_tls;
+       char *use_tls;          /* only on or off allowed */
        char *servercert;
        char *servercerthash;
        char *clientkey;
@@ -181,7 +181,7 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
                        if (datap->request != ODBC_ADD_DSN || datap->dsn == 
NULL || *datap->dsn == 0) {
                                GetDlgItemText(hwndDlg, IDC_EDIT_DSN, buf, 
sizeof(buf));
                                if (!SQLValidDSN(buf)) {
-                                       MessageBox(hwndDlg, "Invalid Datasource 
Name", NULL, MB_ICONERROR);
+                                       MessageBox(hwndDlg, "Invalid or missing 
Data Source Name", NULL, MB_ICONERROR);
                                        return TRUE;
                                }
                                if (datap->dsn)
@@ -264,6 +264,12 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
                case IDCANCEL:
                        EndDialog(hwndDlg, LOWORD(wParam));
                        return TRUE;
+               case IDC_BUTTON_TEST:
+                       MessageBox(hwndDlg, "Test Connection not yet 
implemented", NULL, MB_ICONERROR);
+                       return TRUE;
+               case IDC_BUTTON_HELP:
+                       MessageBox(hwndDlg, "Help not yet implemented", NULL, 
MB_ICONERROR);
+                       return TRUE;
                }
        default:
                ODBCLOG("DialogProc 0x%x 0x%x 0x%x\n", uMsg, (unsigned) wParam, 
(unsigned) lParam);
@@ -277,7 +283,7 @@ ConfigDSN(HWND parent, WORD request, LPC
 {
        struct data data;
        char *dsn = NULL;
-       BOOL rc;
+       BOOL rc = TRUE;  /* we're optimistic: default return value */
 
        ODBCLOG("ConfigDSN %d %s %s 0x%" PRIxPTR "\n", request, driver ? driver 
: "(null)", attributes ? attributes : "(null)", (uintptr_t) &data);
 
@@ -419,9 +425,6 @@ ConfigDSN(HWND parent, WORD request, LPC
                data.clientkey ? data.clientkey : "(null)",
                data.clientcert ? data.clientcert : "(null)");
 
-       /* we're optimistic: default return value */
-       rc = TRUE;
-
        if (parent) {
                switch (DialogBoxParam(instance,
                                       MAKEINTRESOURCE(IDD_SETUP_DIALOG),
@@ -443,7 +446,7 @@ ConfigDSN(HWND parent, WORD request, LPC
                if (!SQLValidDSN(data.dsn)) {
                        rc = FALSE;
                        if (parent)
-                               MessageBox(parent, "Invalid Datasource Name", 
NULL, MB_ICONERROR);
+                               MessageBox(parent, "Invalid or missing Data 
Source Name", NULL, MB_ICONERROR);
                        SQLPostInstallerError(ODBC_ERROR_INVALID_NAME, "Invalid 
driver name");
                        goto finish;
                }
@@ -455,14 +458,14 @@ ConfigDSN(HWND parent, WORD request, LPC
                        if (drv && *drv) {
                                free(drv);
                                if (parent &&
-                                   MessageBox(parent, "Replace existing 
Datasource Name?", NULL, MB_OKCANCEL | MB_ICONQUESTION) != IDOK) {
+                                   MessageBox(parent, "Replace existing Data 
Source Name?", NULL, MB_OKCANCEL | MB_ICONQUESTION) != IDOK) {
                                        goto finish;
                                }
                                ODBCLOG("ConfigDSN removing dsn %s\n", 
data.dsn);
                                if (!SQLRemoveDSNFromIni(data.dsn)) {
                                        rc = FALSE;
-                                       MessageBox(parent, "Failed to remove 
old Datasource Name", NULL, MB_ICONERROR);
-                                       
SQLPostInstallerError(ODBC_ERROR_REQUEST_FAILED, "Failed to remove old 
Datasource Name");
+                                       MessageBox(parent, "Failed to remove 
old Data Source Name", NULL, MB_ICONERROR);
+                                       
SQLPostInstallerError(ODBC_ERROR_REQUEST_FAILED, "Failed to remove old Data 
Source Name");
                                        goto finish;
                                }
                        } else if (drv)
@@ -471,18 +474,38 @@ ConfigDSN(HWND parent, WORD request, LPC
                if (dsn && !SQLRemoveDSNFromIni(dsn)) {
                        rc = FALSE;
                        if (parent)
-                               MessageBox(parent, "Failed to remove old 
Datasource Name", NULL, MB_ICONERROR);
-                       SQLPostInstallerError(ODBC_ERROR_REQUEST_FAILED, 
"Failed to remove old Datasource Name");
+                               MessageBox(parent, "Failed to remove old Data 
Source Name", NULL, MB_ICONERROR);
+                       SQLPostInstallerError(ODBC_ERROR_REQUEST_FAILED, 
"Failed to remove old Data Source Name");
                        goto finish;
                }
                if (!SQLWriteDSNToIni(data.dsn, driver)) {
                        rc = FALSE;
                        if (parent)
-                               MessageBox(parent, "Failed to add new 
Datasource Name", NULL, MB_ICONERROR);
-                       SQLPostInstallerError(ODBC_ERROR_REQUEST_FAILED, 
"Failed to add new Datasource Name");
+                               MessageBox(parent, "Failed to add new Data 
Source Name", NULL, MB_ICONERROR);
+                       SQLPostInstallerError(ODBC_ERROR_REQUEST_FAILED, 
"Failed to add new Data Source Name");
                        goto finish;
                }
        }
+       /* some data validation on entered strings */
+       if (data.autocommit) {
+               if (strcmp("on", data.autocommit) != 0
+                && strcmp("off", data.autocommit) != 0) {
+                       rc = FALSE;
+                       if (parent)
+                               MessageBox(parent, "Autocommit may only be set 
to on or off.", NULL, MB_ICONERROR);
+                       goto finish;
+               }
+       }
+       if (data.use_tls) {
+               if (strcmp("on", data.use_tls) != 0
+                && strcmp("off", data.use_tls) != 0) {
+                       rc = FALSE;
+                       if (parent)
+                               MessageBox(parent, "TLS Encrypt may only be set 
to on or off.", NULL, MB_ICONERROR);
+                       goto finish;
+               }
+       }
+
        ODBCLOG("ConfigDSN writing values: DSN=%s UID=%s PWD=%s Host=%s Port=%s 
Database=%s Schema=%s LoginTimeout=%s ReplyTimeout=%s ReplySize=%s 
AutoCommit=%s TimeZone=%s LogFile=%s TLSs=%s Cert=%s CertHash=%s ClientKey=%s 
ClientCert=%s\n",
                data.dsn ? data.dsn : "(null)",
                data.uid ? data.uid : "(null)",
@@ -572,6 +595,7 @@ ConfigDSN(HWND parent, WORD request, LPC
                free(data.clientkey);
        if (data.clientcert)
                free(data.clientcert);
+
        ODBCLOG("ConfigDSN returning %s\n", rc ? "TRUE" : "FALSE");
        return rc;
 }
diff --git a/clients/odbc/winsetup/setup.rc b/clients/odbc/winsetup/setup.rc
--- a/clients/odbc/winsetup/setup.rc
+++ b/clients/odbc/winsetup/setup.rc
@@ -109,13 +109,13 @@ STYLE DS_MODALFRAME | WS_CAPTION
 CAPTION "MonetDB ODBC Data Source Setup"
 FONT 8, "MS Shell Dlg", 0, 0, 0x0
 BEGIN
-    EDITTEXT        IDC_EDIT_DSN,80,40,128,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_DESC,80,56,128,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_UID,80,72,128,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_PWD,80,88,128,14,ES_AUTOHSCROLL | ES_PASSWORD
-    EDITTEXT        IDC_EDIT_HOST,80,104,128,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_DSN,80,40,134,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_DESC,80,56,134,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_UID,80,72,134,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_PWD,80,88,134,14,ES_AUTOHSCROLL | ES_PASSWORD
+    EDITTEXT        IDC_EDIT_HOST,80,104,134,14,ES_AUTOHSCROLL
     EDITTEXT        IDC_EDIT_PORT,80,120,32,14,ES_AUTOHSCROLL | ES_NUMBER
-    EDITTEXT        IDC_EDIT_DATABASE,80,136,128,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_DATABASE,80,136,134,14,ES_AUTOHSCROLL
     LTEXT           "Data Source Name:",IDC_STATIC,7,42,63,8
     LTEXT           "Description:",IDC_STATIC,7,58,63,8
     LTEXT           "User Name:",IDC_STATIC,7,74,63,8
@@ -123,32 +123,35 @@ BEGIN
     LTEXT           "Host:",IDC_STATIC,7,106,63,8
     LTEXT           "Port:",IDC_STATIC,7,122,63,8
     LTEXT           "Database:",IDC_STATIC,7,138,63,8
-    GROUPBOX        "Advanced settings",IDC_STATIC,7,154,214,132
+    GROUPBOX        "Advanced Settings",IDC_STATIC,7,154,214,130
     LTEXT           "Schema:",IDC_STATIC,12,170,63,8
     LTEXT           "Login Timeout:",IDC_STATIC,12,186,63,8
+    LTEXT           "milliseconds",IDC_STATIC,130,186,63,8
     LTEXT           "Reply Timeout:",IDC_STATIC,12,202,63,8
+    LTEXT           "milliseconds",IDC_STATIC,130,202,63,8
     LTEXT           "Reply Size:",IDC_STATIC,12,218,63,8
     LTEXT           "Autocommit on/off:",IDC_STATIC,12,234,63,8
     LTEXT           "Time Zone:",IDC_STATIC,12,250,63,8
+    LTEXT           "minutes East of UTC",IDC_STATIC,150,250,63,8
     LTEXT           "Log File:",IDC_STATIC,12,266,63,8
-    EDITTEXT        IDC_EDIT_SCHEMA,80,168,128,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_LOGINTIMEOUT,80,184,32,14,ES_AUTOHSCROLL | 
ES_NUMBER
-    EDITTEXT        IDC_EDIT_REPLYTIMEOUT,80,200,32,14,ES_AUTOHSCROLL | 
ES_NUMBER
-    EDITTEXT        IDC_EDIT_REPLYSIZE,80,216,32,14,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_EDIT_SCHEMA,80,168,134,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_LOGINTIMEOUT,80,184,44,14,ES_AUTOHSCROLL | 
ES_NUMBER
+    EDITTEXT        IDC_EDIT_REPLYTIMEOUT,80,200,44,14,ES_AUTOHSCROLL | 
ES_NUMBER
+    EDITTEXT        IDC_EDIT_REPLYSIZE,80,216,44,14,ES_AUTOHSCROLL | ES_NUMBER
     EDITTEXT        IDC_EDIT_AUTOCOMMIT,80,232,24,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_TIMEZONE,80,248,128,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_LOGFILE,80,264,128,14,ES_AUTOHSCROLL
-    GROUPBOX        "Secure Connection",IDC_STATIC,7,288,214,100
-    LTEXT           "TLS Encrypt on/off:",IDC_STATIC,12,304,66,8
-    LTEXT           "Server Certificate:",IDC_STATIC,12,320,66,8
-    LTEXT           "Server Cert. Hash:",IDC_STATIC,12,336,70,8
-    LTEXT           "Client Key:",IDC_STATIC,12,352,63,8
-    LTEXT           "Client Certificate:",IDC_STATIC,12,368,66,8
-    EDITTEXT        IDC_EDIT_USETLS,80,302,24,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_SERVERCERT,80,318,128,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_SERVERCERTHASH,80,334,128,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_CLIENTKEY,80,350,128,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_CLIENTCERT,80,366,128,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_TIMEZONE,80,248,64,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_LOGFILE,80,264,134,14,ES_AUTOHSCROLL
+    GROUPBOX        "Secure Connection",IDC_STATIC,7,292,214,98
+    LTEXT           "TLS Encrypt on/off:",IDC_STATIC,12,308,66,8
+    LTEXT           "Server Certificate:",IDC_STATIC,12,324,66,8
+    LTEXT           "Server Cert. Hash:",IDC_STATIC,12,340,63,8
+    LTEXT           "Client Key:",IDC_STATIC,12,356,63,8
+    LTEXT           "Client Certificate:",IDC_STATIC,12,372,66,8
+    EDITTEXT        IDC_EDIT_USETLS,80,306,24,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_SERVERCERT,80,322,134,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_SERVERCERTHASH,80,338,134,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_CLIENTKEY,80,354,134,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_CLIENTCERT,80,370,134,14,ES_AUTOHSCROLL
     DEFPUSHBUTTON   "OK",IDOK,7,397,50,14
     PUSHBUTTON      "Cancel",IDCANCEL,62,397,50,14
     PUSHBUTTON      "Test",IDC_BUTTON_TEST,117,397,50,14
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to