pull up r18863 from trunk
authorTom Yu <tlyu@mit.edu>
Tue, 28 Nov 2006 23:02:22 +0000 (23:02 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 28 Nov 2006 23:02:22 +0000 (23:02 +0000)
 r18863@cathode-dark-space:  jaltman | 2006-11-22 13:11:16 -0500
 ticket: new
 subject: KFW 3.1 commits for Final Release
 tags: pullup

    KfW 3.1 final (NetIDMgr 1.1.8.0)

    nidmgr32.dll (1.1.8.0)

    - When detecting IP address changes, wait for things to settle down
      before setting of the IP address change notification.

    krb5cred.dll (1.1.8.0)

    - Fixed the Kerberos 5 configuration dialog which didn't handle
      setting the default realm properly.  Setting the default realm now
      sets the correct string in krb5.ini.

    - Changing the default realm now marks the relevant configuration node
      as dirty, and enabled the 'Apply' button.

    - Changing the 'renewable', 'forwardable' and 'addressless' checkboxes
      in the identity configuration panels now mark the relevant
      configuration nodes as dirty, and enables the 'Apply' button.

    - The location of the Kerberos 5 configuration file is now read-only
      in the Kerberos 5 configuration dialog.

    - Set the maximum number of characters for the edit controls in the
      configuration dialog.

    krb4cred.dll (1.1.8.0)

    - The location of the Kerberos 4 configuration files are now read-only
      in the Kerberos 4 configuration dialog.

    - Handles setting the ticket string.

    - Changing the ticket string now marks the relevant configuration node
      as dirty, and enables the 'Apply' button.

    - Fixed the plug-in initialization code to perform the initial ticket
      listing at the end of the initializaton process.

ticket: 4861
version_fixed: 1.4.5

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@18867 dc483132-0cff-0310-8789-dd5450dbe970

14 files changed:
src/windows/identity/config/Makefile.w2k
src/windows/identity/config/Makefile.w32
src/windows/identity/plugins/krb4/krb4configdlg.c
src/windows/identity/plugins/krb4/krb4funcs.c
src/windows/identity/plugins/krb4/krb4funcs.h
src/windows/identity/plugins/krb4/krb4plugin.c
src/windows/identity/plugins/krb4/krbconfig.csv
src/windows/identity/plugins/krb4/lang/en_us/langres.rc
src/windows/identity/plugins/krb5/krb5configdlg.c
src/windows/identity/plugins/krb5/krb5configid.c
src/windows/identity/plugins/krb5/krb5funcs.c
src/windows/identity/plugins/krb5/lang/en_us/langres.rc
src/windows/identity/plugins/krb5/langres.h
src/windows/identity/ui/addrchange.c

index c3c7f030f91050d802981f0fab54ee417be4fa21..b9902bd903d7e967e63299ef53e9f2c0b6e85ac1 100644 (file)
@@ -47,7 +47,7 @@ KHIMAIRA_WIN32_CONFIG=1
 # Version info\r
 NETIDMGR_VERSION_MAJOR=1\r
 NETIDMGR_VERSION_MINOR=1\r
-NETIDMGR_VERSION_PATCH=6\r
+NETIDMGR_VERSION_PATCH=8\r
 NETIDMGR_VERSION_AUX=0\r
 NETIDMGR_RELEASEDESC=\r
 \r
index e5bb18f9a946e538a117129729d5ded66fadae10..c6604268984df943cf52d2c9dadcb34c36de2f35 100644 (file)
@@ -47,7 +47,7 @@ KHIMAIRA_WIN32_CONFIG=1
 # Version info\r
 NETIDMGR_VERSION_MAJOR=1\r
 NETIDMGR_VERSION_MINOR=1\r
-NETIDMGR_VERSION_PATCH=6\r
+NETIDMGR_VERSION_PATCH=8\r
 NETIDMGR_VERSION_AUX=0\r
 NETIDMGR_RELEASEDESC=\r
 \r
index 6c2b02d43f4fdac1d6a88bf926d6c82df0168baf..94f111cee3a3cccc48368b830e7982fcb67a0828 100644 (file)
@@ -307,6 +307,12 @@ krb4_id_config_proc(HWND hwnd,
     return FALSE;\r
 }\r
 \r
+typedef struct tag_k4_config_dlg_data {\r
+    khui_config_node node;\r
+    char             krb_path[MAX_PATH];\r
+    char             krbrealm_path[MAX_PATH];\r
+    char             tkt_string[MAX_PATH];\r
+} k4_config_dlg_data;\r
 \r
 INT_PTR CALLBACK\r
 krb4_confg_proc(HWND hwnd,\r
@@ -314,6 +320,9 @@ krb4_confg_proc(HWND hwnd,
                 WPARAM wParam,\r
                 LPARAM lParam) {\r
 \r
+    static BOOL in_init = FALSE;\r
+    k4_config_dlg_data * d;\r
+\r
     switch(uMsg) {\r
     case WM_INITDIALOG:\r
         {\r
@@ -323,8 +332,21 @@ krb4_confg_proc(HWND hwnd,
             CHAR ticketName[MAX_PATH];\r
             char * pticketName;\r
             unsigned int krb_path_sz = sizeof(krb_path);\r
-            unsigned int krbrealm_path_sz = sizeof(krbrealm_path); \r
-    \r
+            unsigned int krbrealm_path_sz = sizeof(krbrealm_path);\r
+            khm_size cbsize;\r
+\r
+            d = PMALLOC(sizeof(*d));\r
+            ZeroMemory(d, sizeof(*d));\r
+\r
+#pragma warning(push)\r
+#pragma warning(disable: 4244)\r
+            SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR) d);\r
+#pragma warning(pop)\r
+\r
+            d->node = (khui_config_node) lParam;\r
+\r
+            in_init = TRUE;\r
+\r
             // Set KRB.CON \r
             memset(krb_path, '\0', sizeof(krb_path));\r
             if (!pkrb_get_krbconf2(krb_path, &krb_path_sz)) {\r
@@ -332,6 +354,7 @@ krb4_confg_proc(HWND hwnd,
             } else { // normal find\r
                 AnsiStrToUnicode(wbuf, sizeof(wbuf), krb_path);\r
                 SetDlgItemText(hwnd, IDC_CFG_CFGPATH, wbuf);\r
+                StringCbCopyA(d->krb_path, sizeof(d->krb_path), krb_path);\r
             }\r
 \r
             // Set KRBREALM.CON \r
@@ -341,26 +364,128 @@ krb4_confg_proc(HWND hwnd,
             } else {\r
                 AnsiStrToUnicode(wbuf, sizeof(wbuf), krbrealm_path);\r
                 SetDlgItemText(hwnd, IDC_CFG_RLMPATH, wbuf);\r
+                StringCbCopyA(d->krbrealm_path, sizeof(d->krbrealm_path),\r
+                              krbrealm_path);\r
             }\r
 \r
-            // Set TICKET.KRB file Editbox\r
-            *ticketName = 0;\r
-            pkrb_set_tkt_string(0);\r
+            cbsize = sizeof(wbuf);\r
+            if (KHM_SUCCEEDED(khc_read_string(csp_params, L"TktString",\r
+                                              wbuf, &cbsize)) &&\r
+                wbuf[0] != L'\0') {\r
+\r
+                UnicodeStrToAnsi(ticketName, sizeof(ticketName), wbuf);\r
+\r
+            } else {\r
+\r
+                // Set TICKET.KRB file Editbox\r
+                *ticketName = 0;\r
+                pkrb_set_tkt_string(0);\r
     \r
-            pticketName = ptkt_string(); \r
-            if (pticketName)\r
-                StringCbCopyA(ticketName, sizeof(ticketName), pticketName);\r
+                pticketName = ptkt_string(); \r
+                if (pticketName)\r
+                    StringCbCopyA(ticketName, sizeof(ticketName), pticketName);\r
+\r
+            }\r
        \r
             if (!*ticketName) {\r
                 // error\r
             } else {\r
                 AnsiStrToUnicode(wbuf, sizeof(wbuf), ticketName);\r
                 SetDlgItemText(hwnd, IDC_CFG_CACHE, wbuf);\r
+                StringCbCopyA(d->tkt_string, sizeof(d->tkt_string),\r
+                              ticketName);\r
             }\r
+\r
+            in_init = FALSE;\r
+\r
+        }\r
+        break;\r
+\r
+    case WM_COMMAND:\r
+        if (MAKEWPARAM(IDC_CFG_CACHE, EN_CHANGE)) {\r
+            char tkt_string[MAX_PATH];\r
+            wchar_t wtkt_string[MAX_PATH];\r
+\r
+            if (in_init) {\r
+                return TRUE;\r
+            }\r
+\r
+            d = (k4_config_dlg_data *) (LONG_PTR)\r
+                GetWindowLongPtr(hwnd, DWLP_USER);\r
+\r
+            if (d == NULL)\r
+                return TRUE;\r
+\r
+            tkt_string[0] = 0;\r
+            wtkt_string[0] = 0;\r
+\r
+            GetDlgItemText(hwnd, IDC_CFG_CACHE,\r
+                           wtkt_string, ARRAYLENGTH(wtkt_string));\r
+            UnicodeStrToAnsi(tkt_string, sizeof(tkt_string),\r
+                             wtkt_string);\r
+\r
+            if (_stricmp(tkt_string, d->tkt_string)) {\r
+                khui_cfg_set_flags(d->node,\r
+                                   KHUI_CNFLAG_MODIFIED,\r
+                                   KHUI_CNFLAG_MODIFIED);\r
+            } else {\r
+                khui_cfg_set_flags(d->node,\r
+                                   0,\r
+                                   KHUI_CNFLAG_MODIFIED);\r
+            }\r
+\r
+            return TRUE;\r
+        }\r
+        break;\r
+\r
+    case KHUI_WM_CFG_NOTIFY:\r
+        if (HIWORD(wParam) == WMCFG_APPLY) {\r
+            wchar_t wtkt_string[MAX_PATH];\r
+            char tkt_string[MAX_PATH];\r
+            int t;\r
+\r
+            d = (k4_config_dlg_data *) (LONG_PTR)\r
+                GetWindowLongPtr(hwnd, DWLP_USER);\r
+\r
+            if (d == NULL)\r
+                return TRUE;\r
+\r
+            t = GetDlgItemText(hwnd, IDC_CFG_CACHE,\r
+                               wtkt_string, ARRAYLENGTH(wtkt_string));\r
+            if (t == 0)\r
+                return TRUE;\r
+\r
+            UnicodeStrToAnsi(tkt_string, sizeof(tkt_string), wtkt_string);\r
+\r
+            if (_stricmp(tkt_string, d->tkt_string)) {\r
+\r
+                pkrb_set_tkt_string(tkt_string);\r
+\r
+                khc_write_string(csp_params, L"TktString", wtkt_string);\r
+\r
+                khui_cfg_set_flags(d->node,\r
+                                   KHUI_CNFLAG_APPLIED,\r
+                                   KHUI_CNFLAG_APPLIED |\r
+                                   KHUI_CNFLAG_MODIFIED);\r
+                khm_krb4_list_tickets();\r
+            } else {\r
+                khui_cfg_set_flags(d->node,\r
+                                   0,\r
+                                   KHUI_CNFLAG_MODIFIED);\r
+            }\r
+\r
+            return TRUE;\r
         }\r
         break;\r
 \r
     case WM_DESTROY:\r
+        d = (k4_config_dlg_data *) (LONG_PTR)\r
+            GetWindowLongPtr(hwnd, DWLP_USER);\r
+\r
+        if (d) {\r
+            PFREE(d);\r
+        }\r
+\r
         break;\r
     }\r
     return FALSE;\r
index 728d2db4a3f8e402e4fca133eeffab700001f7ab..306437a007f9ecc42ffdb04cd894469917836398 100644 (file)
@@ -553,6 +553,28 @@ make_postfix(const char * base,
     return ret;\r
 }\r
 \r
+void\r
+khm_krb4_set_def_tkt_string(void) {\r
+    wchar_t wtkt_string[MAX_PATH];\r
+    char tkt_string[MAX_PATH];\r
+    khm_size cb;\r
+\r
+    cb = sizeof(wtkt_string);\r
+\r
+    if (KHM_FAILED(khc_read_string(csp_params, L"TktString",\r
+                                   wtkt_string, &cb)) ||\r
+        wtkt_string[0] == L'\0') {\r
+\r
+        pkrb_set_tkt_string(0);\r
+\r
+    } else {\r
+\r
+        UnicodeStrToAnsi(tkt_string, sizeof(tkt_string),\r
+                         wtkt_string);\r
+        pkrb_set_tkt_string(tkt_string);        \r
+    }\r
+}\r
+\r
 \r
 static\r
 long\r
@@ -839,6 +861,8 @@ khm_krb4_kinit(char * aname,
         goto cleanup;\r
     }\r
 \r
+    khm_krb4_set_def_tkt_string();\r
+\r
     err_context = L"fetching ticket";  \r
     rc4 = (*pkrb_get_pw_in_tkt)(aname, inst, realm, "krbtgt", realm, \r
                                 lifetime, password);\r
index 8abb7ac33870a7ad6e7eb14180a7ecbeeccf7900..742d136264d438d3322af88a3e21deea2d84419e 100644 (file)
@@ -112,6 +112,9 @@ config_boolean_to_int(
     const char *s\r
     );\r
 \r
+void\r
+khm_krb4_set_def_tkt_string(void);\r
+\r
 wchar_t * khm_krb5_get_default_realm(void);\r
 wchar_t * khm_krb5_get_realm_list(void);\r
 \r
index c47f5c82873bcfbfd5a46f217c6a43a3b743faac..b4edd4192fca567d6d07342d2d06d8dffd06a6e4 100644 (file)
@@ -162,9 +162,6 @@ krb4_msg_system(khm_int32 msg_type, khm_int32 msg_subtype,
 \r
                 khui_cfg_release(idents);\r
 \r
-                krb4_initialized = TRUE;\r
-\r
-                khm_krb4_list_tickets();\r
             }\r
 \r
             /* Lookup common data types */\r
@@ -203,6 +200,12 @@ krb4_msg_system(khm_int32 msg_type, khm_int32 msg_subtype,
                                              &attr_id_krb5_flags))) {\r
                 rv = KHM_ERROR_UNKNOWN;\r
             }\r
+\r
+            krb4_initialized = TRUE;\r
+\r
+            khm_krb4_set_def_tkt_string();\r
+\r
+            khm_krb4_list_tickets();\r
 #endif\r
         }\r
         break;\r
index d77abbffafbe0ee6246ff96d352cfd3581739c8a..3d95b40b34fa87b454de43d0ddafaebc84cbae82 100644 (file)
@@ -12,5 +12,6 @@ Krb4Cred,KC_SPACE,0,"Kerberos IV Credentials Provider"
     DefaultLifetime,KC_INT32,36000,Default ticket lifetime\r
     MaxLifetime,KC_INT32,86400,Maximum lifetime\r
     MinLifetime,KC_INT32,60,Minimum lifetime\r
+    TktString,KC_STRING,,Ticket string.  Use default if NULL\r
   Parameters,KC_ENDSPACE,0,\r
 Krb4Cred,KC_ENDSPACE,0,\r
index d9114e5b6c807ff89776220012bc073579b5d75b..cd46a8d9fd8cc2e0e093c3adc5fb0c8fd53ba65a 100644 (file)
@@ -57,18 +57,12 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
 EXSTYLE WS_EX_CONTROLPARENT\r
 FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
 BEGIN\r
-    CONTROL         "Kerberos 4 Ticket Options",IDC_STATIC,"Static",\r
-                    SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP,7,7,286,11\r
-    CONTROL         "Obtain Kerberos 4 tickets",IDC_NCK4_OBTAIN,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,7,26,97,10\r
-    GROUPBOX        "Obtain Kerberos 4 tickets using",IDC_STATIC,7,43,286,72,\r
-                    WS_GROUP\r
-    CONTROL         "Automatically determine method",IDC_NCK4_AUTO,"Button",\r
-                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,23,58,119,10\r
-    CONTROL         "Kerberos 5 to 4 translation",IDC_NCK4_K524,"Button",\r
-                    BS_AUTORADIOBUTTON,23,76,101,10\r
-    CONTROL         "Password",IDC_NCK4_PWD,"Button",BS_AUTORADIOBUTTON,23,\r
-                    94,47,10\r
+    CONTROL         "Kerberos 4 Ticket Options",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP,7,7,286,11\r
+    CONTROL         "Obtain Kerberos 4 tickets",IDC_NCK4_OBTAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,26,97,10\r
+    GROUPBOX        "Obtain Kerberos 4 tickets using",IDC_STATIC,7,43,286,72,WS_GROUP\r
+    CONTROL         "Automatically determine method",IDC_NCK4_AUTO,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,23,58,119,10\r
+    CONTROL         "Kerberos 5 to 4 translation",IDC_NCK4_K524,"Button",BS_AUTORADIOBUTTON,23,76,101,10\r
+    CONTROL         "Password",IDC_NCK4_PWD,"Button",BS_AUTORADIOBUTTON,23,94,47,10\r
 END\r
 \r
 IDD_CFG_KRB4 DIALOGEX 0, 0, 255, 182\r
@@ -79,11 +73,11 @@ BEGIN
     LTEXT           "Ticket cache location",IDC_CFG_LBL_CACHE,7,10,67,8\r
     EDITTEXT        IDC_CFG_CACHE,83,7,165,14,ES_AUTOHSCROLL\r
     LTEXT           "Config file path",IDC_CFG_LBL_CFGFILE,7,30,50,8\r
-    EDITTEXT        IDC_CFG_CFGPATH,83,27,113,14,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "Browse...",IDC_CFG_CFGBROW,200,27,48,14\r
+    EDITTEXT        IDC_CFG_CFGPATH,83,27,165,14,ES_AUTOHSCROLL | ES_READONLY\r
+    PUSHBUTTON      "Browse...",IDC_CFG_CFGBROW,200,95,48,14,NOT WS_VISIBLE\r
     LTEXT           "Realm file path",IDC_CFG_LBL_RLMPATH,7,50,48,8\r
-    EDITTEXT        IDC_CFG_RLMPATH,83,47,113,14,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "Browse...",IDC_CFG_RLMBROW,200,47,48,14\r
+    EDITTEXT        IDC_CFG_RLMPATH,83,47,165,14,ES_AUTOHSCROLL | ES_READONLY\r
+    PUSHBUTTON      "Browse...",IDC_CFG_RLMBROW,200,127,48,14,NOT WS_VISIBLE\r
 END\r
 \r
 IDD_CFG_IDS_KRB4 DIALOGEX 0, 0, 235, 151\r
@@ -91,10 +85,8 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
 EXSTYLE WS_EX_CONTROLPARENT\r
 FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
 BEGIN\r
-    CONTROL         "Obtain Kerberos 4 tickets",IDC_CFG_GETTIX,"Button",\r
-                    BS_AUTOCHECKBOX | WS_TABSTOP,7,7,221,17\r
-    LTEXT           "Note that, if enabled, Kerberos 4 tickets will be acquired during initial credential acquisition and during credential renewals.\n\nHowever, currently Kerberos 4 tickets can only be obtained for the default identity.",\r
-                    IDC_STATIC,7,91,221,53,SS_SUNKEN\r
+    CONTROL         "Obtain Kerberos 4 tickets",IDC_CFG_GETTIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,221,17\r
+    LTEXT           "Note that, if enabled, Kerberos 4 tickets will be acquired during initial credential acquisition and during credential renewals.\n\nHowever, currently Kerberos 4 tickets can only be obtained for the default identity.",IDC_STATIC,7,91,221,53,SS_SUNKEN\r
 END\r
 \r
 IDD_CFG_ID_KRB4 DIALOGEX 0, 0, 235, 151\r
@@ -102,9 +94,8 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
 EXSTYLE WS_EX_CONTROLPARENT\r
 FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
 BEGIN\r
-    CONTROL         "Obtain Kerberos 4 tickets for this identity",\r
-                    IDC_CFG_GETTIX,"Button",BS_AUTOCHECKBOX | WS_DISABLED | \r
-                    WS_TABSTOP,7,7,147,10\r
+    CONTROL         "Obtain Kerberos 4 tickets for this identity",IDC_CFG_GETTIX,\r
+                    "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,7,147,10\r
 END\r
 \r
 \r
index 8caafe90433b0b3a4fb518bf2ae68e5cf1dd56a0..9c8af5dc4ef2305fefdf4ae957aa0e49602df694 100644 (file)
@@ -77,6 +77,11 @@ typedef struct tag_k5_config_data {
     khm_boolean   create_config_file; /* create config_file if missing? */
     khm_boolean   inc_realms;   /* include full realm list in new
                                    credentials dialog? */
+    wchar_t       loaded_config_file[MAX_PATH]; /* path to the
+                                                   configuration file
+                                                   that has been
+                                                   loaded into the
+                                                   realm editor. */
 
     /* [libdefaults] */
     khm_boolean   dns_lookup_kdc;
@@ -548,15 +553,6 @@ k5_write_config_data(k5_config_data * d) {
     if (!k5_is_profile_loaded())
         return;
 
-    if (d->flags & K5_CDFLAG_MOD_DEF_REALM) {
-        if (SUCCEEDED(StringCbLength(d->def_realm,
-                                     sizeof(d->def_realm), &s)) &&
-            s > 0) {
-            khm_krb5_set_default_realm(d->def_realm);
-        }
-        d->flags &= ~K5_CDFLAG_MOD_DEF_REALM;
-    }
-
     /* write the MSLSA import setting */
     if (d->flags & K5_CDFLAG_MOD_LSA_IMPORT) {
         khc_write_int32(csp_params, L"MsLsaImport", d->lsa_import);
@@ -569,7 +565,8 @@ k5_write_config_data(k5_config_data * d) {
     }
 
     if (!(d->flags & 
-          (K5_CDFLAG_MOD_CONF_FILE |
+          (K5_CDFLAG_MOD_DEF_REALM |
+           K5_CDFLAG_MOD_CONF_FILE |
            K5_CDFLAG_MOD_DNS_FALLBACK |
            K5_CDFLAG_MOD_DNS_LOOKUP_RLM |
            K5_CDFLAG_MOD_DNS_LOOKUP_KDC |
@@ -615,6 +612,27 @@ k5_write_config_data(k5_config_data * d) {
         const char * sec_libdefaults[] = { "libdefaults", NULL, NULL };
         khm_size r;
 
+        if (d->flags & K5_CDFLAG_MOD_DEF_REALM) {
+            if (SUCCEEDED(StringCbLength(d->def_realm,
+                                         sizeof(d->def_realm), &s)) &&
+                s > 0) {
+                char defrealm[K5_MAXCCH_REALM];
+
+                UnicodeStrToAnsi(defrealm, sizeof(defrealm), 
+                                 d->def_realm);
+
+                khm_krb5_set_default_realm(d->def_realm);
+
+                sec_libdefaults[1] = "default_realm";
+
+                pprofile_clear_relation(profile, sec_libdefaults);
+
+                rv = pprofile_add_relation(profile, sec_libdefaults,
+                                           defrealm);
+            }
+            d->flags &= ~K5_CDFLAG_MOD_DEF_REALM;
+        }
+
         if (d->flags & K5_CDFLAG_MOD_DNS_LOOKUP_KDC) {
 
             sec_libdefaults[1] = "dns_lookup_kdc";
@@ -628,7 +646,6 @@ k5_write_config_data(k5_config_data * d) {
             d->flags &= ~K5_CDFLAG_MOD_DNS_LOOKUP_KDC;
         }
 
-
         if (d->flags & K5_CDFLAG_MOD_DNS_LOOKUP_RLM) {
 
             sec_libdefaults[1] = "dns_lookup_realm";
@@ -995,8 +1012,13 @@ k5_config_dlgproc(HWND hwnd,
 
             SendMessage(hw, CB_SELECTSTRING, -1,
                         (LPARAM) d->def_realm);
+            SetDlgItemText(hwnd, IDC_CFG_DEFREALM, d->def_realm);
+            SendDlgItemMessage(hwnd, IDC_CFG_DEFREALM, CB_LIMITTEXT,
+                               ARRAYLENGTH(d->def_realm) - 1, 0);
 
             SetDlgItemText(hwnd, IDC_CFG_CFGFILE, d->config_file);
+            SendDlgItemMessage(hwnd, IDC_CFG_CFGFILE, EM_LIMITTEXT,
+                               ARRAYLENGTH(d->config_file) - 1, 0);
 
             /* hostname/domain */
             if (NetWkstaGetInfo(NULL, 100, (LPBYTE *) &winfo100) == NERR_Success) {
@@ -1046,6 +1068,9 @@ k5_config_dlgproc(HWND hwnd,
 
             d = &k5_config_dlg_data;
 
+            if (d == NULL)
+                return FALSE;
+
             if (wParam == MAKEWPARAM(IDC_CFG_IMPORT, CBN_SELCHANGE)) {
                 int idx;
                 int modified = FALSE;
@@ -1078,6 +1103,100 @@ k5_config_dlgproc(HWND hwnd,
                                    KHUI_CNFLAG_MODIFIED);
                 return TRUE;
             }
+
+            if (wParam == MAKEWPARAM(IDC_CFG_DEFREALM, CBN_EDITCHANGE)) {
+                wchar_t defrealm[K5_MAXCCH_REALM];
+                int t;
+
+                t = GetDlgItemText(hwnd, IDC_CFG_DEFREALM,
+                                   defrealm, ARRAYLENGTH(defrealm));
+                if (t == 0) {
+                    /* we failed to get the default realm from the
+                       control for some reason. */
+                    SetDlgItemText(hwnd, IDC_CFG_DEFREALM, L"");
+                    StringCbCopy(d->def_realm, sizeof(d->def_realm),
+                                 L"");
+                } else {
+                    StringCbCopy(d->def_realm, sizeof(d->def_realm),
+                                 defrealm);
+                }
+
+                d->flags |= K5_CDFLAG_MOD_DEF_REALM;
+
+                khui_cfg_set_flags(d->node_main,
+                                   KHUI_CNFLAG_MODIFIED,
+                                   KHUI_CNFLAG_MODIFIED);
+                return TRUE;
+            }
+
+            if (wParam == MAKEWPARAM(IDC_CFG_DEFREALM, CBN_SELCHANGE)) {
+                wchar_t defrealm[K5_MAXCCH_REALM];
+                LRESULT cursel, lr;
+
+                cursel = SendDlgItemMessage(hwnd, IDC_CFG_DEFREALM, CB_GETCURSEL,
+                                            0, 0);
+                if (cursel == CB_ERR)
+                    return TRUE;
+
+                lr = SendDlgItemMessage(hwnd, IDC_CFG_DEFREALM, CB_GETLBTEXTLEN,
+                                        cursel, 0);
+#ifdef DEBUG
+                assert(lr < ARRAYLENGTH(defrealm));
+#endif
+                if (lr >= ARRAYLENGTH(defrealm)) {
+                    /* we really shouldn't have any string here that
+                       exceeds that many characters.  But if we do, we
+                       ignore that since we don't consider it
+                       valid. */
+                    return TRUE;
+                }
+
+                lr = SendDlgItemMessage(hwnd, IDC_CFG_DEFREALM, CB_GETLBTEXT,
+                                        cursel, (LPARAM) defrealm);
+                if (lr == CB_ERR) {
+                    /* somehow we failed to copy the value anyway
+                       after all those checks.  */
+#ifdef DEBUG
+                    assert(FALSE);
+#endif
+                    return TRUE;
+                }
+
+                StringCbCopy(d->def_realm, sizeof(d->def_realm),
+                             defrealm);
+
+                d->flags |= K5_CDFLAG_MOD_DEF_REALM;
+
+                khui_cfg_set_flags(d->node_main,
+                                   KHUI_CNFLAG_MODIFIED,
+                                   KHUI_CNFLAG_MODIFIED);
+
+                return TRUE;
+            }
+
+#ifdef ALLOW_CHANGING_KRB5_CONFIG_FILE
+            if (wParam == MAKEWPARAM(IDC_CFG_CFGFILE, EN_CHANGE)) {
+                wchar_t cfgfile[MAX_PATH];
+                int t;
+
+                t = GetDlgItemText(hwnd, IDC_CFG_CFGFILE,
+                                   cfgfile, ARRAYLENGTH(cfgfile));
+
+                if (t == 0) {
+                    StringCbCopy(d->config_file, sizeof(d->config_file),
+                                 L"");
+                } else {
+                    StringCbCopy(d->config_file, sizeof(d->config_file),
+                                 cfgfile);
+                }
+
+                d->flags |= K5_CDFLAG_MOD_CONF_FILE;
+
+                khui_cfg_set_flags(d->node_main,
+                                   KHUI_CNFLAG_MODIFIED,
+                                   KHUI_CNFLAG_MODIFIED);
+            }
+#endif
         }
         break;
 
index 6e3a4517358c822e00c3a44adc24ec5e26a6fbf3..e09281906e59178b514203c1d57fef77ec5d9db5 100644 (file)
@@ -324,7 +324,8 @@ k5_id_tab_dlgproc(HWND hwnd,
         d = (k5_id_dlg_data *) (LONG_PTR)\r
             GetWindowLongPtr(hwnd, DWLP_USER);\r
 \r
-        if (HIWORD(wParam) == EN_CHANGE)\r
+        if (HIWORD(wParam) == EN_CHANGE ||\r
+            HIWORD(wParam) == BN_CLICKED)\r
             k5_id_check_mod(hwnd, d);\r
         break;\r
 \r
index 0ce676caf99530403995d2317f46a352354b8e90..85cad117575fd0e1c64b95548626397b3c4c8c57 100644 (file)
@@ -106,9 +106,9 @@ khm_convert524(krb5_context alt_ctx)
     increds.times.endtime = 0;\r
     increds.keyblock.enctype = ENCTYPE_DES_CBC_CRC;\r
     if ((code = pkrb5_get_credentials(ctx, 0,\r
-        cc,\r
-        &increds,\r
-        &v5creds))) \r
+                                      cc,\r
+                                      &increds,\r
+                                      &v5creds))) \r
     {\r
         goto cleanup;\r
     }\r
@@ -2108,6 +2108,27 @@ khm_krb5_get_temp_profile_file(LPSTR confname, UINT szConfname)
     return FALSE;\r
 }\r
 \r
+#ifdef NOT_QUITE_IMPLEMENTED_YET\r
+BOOL\r
+khm_krb5_set_profile_file(krb5_context ctx, LPSTR confname)\r
+{\r
+    char *conffiles[2];\r
+\r
+    if (confname == NULL ||\r
+        pkrb5_set_config_files == NULL ||\r
+        ctx == NULL)\r
+        return FALSE;\r
+\r
+    conffiles[0] = confname;\r
+    conffiles[1] = NULL;\r
+\r
+    if (pkrb5_set_config_files(ctx, conffiles))\r
+        return FALSE;\r
+    else\r
+        return TRUE;\r
+}\r
+#endif\r
+\r
 BOOL \r
 khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)\r
 {\r
index dde30e387bf0e2f5d45c72604d18f568bd3c2989..fca26a1eba0a5ee4d87d79080c0143c986ab7e5a 100644 (file)
@@ -115,19 +115,21 @@ BEGIN
 END\r
 \r
 IDD_CONFIG DIALOGEX 0, 0, 255, 182\r
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU\r
+STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU\r
+EXSTYLE WS_EX_CONTROLPARENT\r
 FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
 BEGIN\r
     LTEXT           "Default Realm",IDC_CFG_LBL_REALM,13,9,46,8\r
     COMBOBOX        IDC_CFG_DEFREALM,76,7,166,51,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Configure Realms ...",IDC_CFG_CFGREALMS,76,25,84,14,NOT WS_VISIBLE | WS_DISABLED\r
-    GROUPBOX        "Keberos Configuration File",IDC_CFG_CFGFILEGRP,7,45,241,61\r
-    LTEXT           "Location",IDC_CFG_LBL_CFGFILE,13,61,28,8\r
-    EDITTEXT        IDC_CFG_CFGFILE,76,58,119,14,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "Browse...",IDC_CFG_BROWSE,198,58,44,14\r
-    CONTROL         "Create file if missing",IDC_CFG_CREATECONFIG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,76,90,80,10\r
-    CONTROL         "Include realms in New Credentials realm list",IDC_CFG_INCREALMS,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,78,153,10\r
+    CONTROL         "Include all configured realms in New Credentials realm list",IDC_CFG_INCREALMS,\r
+                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,76,26,166,22\r
+    PUSHBUTTON      "Configure Realms ...",IDC_CFG_CFGREALMS,76,46,84,14,NOT WS_VISIBLE | WS_DISABLED\r
+    GROUPBOX        "Keberos Configuration File",IDC_CFG_CFGFILEGRP,7,59,241,47\r
+    LTEXT           "Location",IDC_CFG_LBL_CFGFILE,13,74,28,8\r
+    EDITTEXT        IDC_CFG_CFGFILE,76,71,166,14,ES_AUTOHSCROLL | ES_READONLY\r
+    PUSHBUTTON      "Browse...",IDC_CFG_BROWSE,145,89,44,14,NOT WS_VISIBLE\r
+    CONTROL         "Create file if missing",IDC_CFG_CREATECONFIG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,76,93,80,10\r
+    PUSHBUTTON      "Load into realm editor ...",IDC_CFG_BROWSE2,26,89,100,14,NOT WS_VISIBLE\r
     GROUPBOX        "Windows® Options",IDC_CFG_WINGRP,7,110,241,65\r
     LTEXT           "Hostname",IDC_CFG_LBL_HOSTNAME,13,123,33,8\r
     EDITTEXT        IDC_CFG_HOSTNAME,76,120,166,14,ES_AUTOHSCROLL | ES_READONLY\r
index da8a62ffda537575d99eaea51041fb077a02c093..9381b99eecea7130f48a0ec17245375c4ba8bcb3 100644 (file)
 #define IDC_CFG_BROWSE                  1039\r
 #define IDC_CFG_CFGFILEGRP              1040\r
 #define IDC_CFG_CFGREALMS               1041\r
+#define IDC_CFG_BROWSE2                 1042\r
 #define IDC_CFG_REALMS                  1044\r
 #define IDC_CFG_DOMAINGRP               1045\r
 #define IDC_CFG_SERVERSGRP              1046\r
index 8a671b3c9ac35f0c8b5efbc538e98c316975b3a2..3e5467ccc469c2dc1b00d92dedb2ae3a591594aa 100644 (file)
@@ -57,8 +57,8 @@ addr_change_thread(LPVOID dummy) {
         ret = WaitForMultipleObjects(2, h_waits, FALSE, INFINITE);\r
 \r
         if ( ret == WAIT_OBJECT_0 ) {\r
-            kmq_post_message(KMSG_CRED, KMSG_CRED_ADDR_CHANGE,\r
-                             0, 0);\r
+            Sleep(3000);        /* wait for things to settle down */\r
+            kmq_post_message(KMSG_CRED, KMSG_CRED_ADDR_CHANGE, 0, 0);\r
         } else {\r
             goto _end_thread;\r
         }\r