* newcredwnd.c - erase the password field on error
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 23 Aug 2006 02:18:00 +0000 (02:18 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 23 Aug 2006 02:18:00 +0000 (02:18 +0000)
          during new credential acquisition

ticket: 4172

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18497 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/identity/ui/newcredwnd.c

index a12942a15023aa7d327215b6f8c80d939cf90531..1c5d1941211e71935124122311eb6069bb14c56c 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  * Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2006 Secure Endpoints Inc.\r
  *\r
  * Permission is hereby granted, free of charge, to any person\r
  * obtaining a copy of this software and associated documentation\r
@@ -239,6 +240,30 @@ nc_notify_types(khui_new_creds * c, UINT uMsg,
     }\r
 }\r
 \r
+static void\r
+nc_clear_password_fields(khui_nc_wnd_data * d)\r
+{\r
+    khm_size i;\r
+    khm_boolean need_sync = FALSE;\r
+\r
+    khui_cw_lock_nc(d->nc);\r
+\r
+    for (i=0; i < d->nc->n_prompts; i++) {\r
+        if ((d->nc->prompts[i]->flags & KHUI_NCPROMPT_FLAG_HIDDEN) &&\r
+            d->nc->prompts[i]->hwnd_edit) {\r
+            SetWindowText(d->nc->prompts[i]->hwnd_edit,\r
+                          L"");\r
+            need_sync = TRUE;\r
+        }\r
+    }\r
+\r
+    khui_cw_unlock_nc(d->nc);\r
+\r
+    if (need_sync) {\r
+        khui_cw_sync_prompt_values(d->nc);\r
+    }\r
+}\r
+\r
 #define NC_MAXCCH_CREDTEXT 16384\r
 #define NC_MAXCB_CREDTEXT (NC_MAXCCH_CREDTEXT * sizeof(wchar_t))\r
 \r
@@ -271,7 +296,6 @@ nc_update_credtext(khui_nc_wnd_data * d)
         khm_size cbbuf;\r
         khm_int32 flags;\r
 \r
-\r
         LoadString(khm_hInstance, IDS_NC_CREDTEXT_ID_ONE, \r
                    main_fmt, (int) ARRAYLENGTH(main_fmt));\r
 \r
@@ -1674,6 +1698,8 @@ static LRESULT nc_handle_wm_nc_notify(HWND hwnd,
                 hw = GetDlgItem(d->dlg_bb, IDCANCEL);\r
                 EnableWindow(hw, TRUE);\r
 \r
+                nc_clear_password_fields(d);\r
+\r
                 return TRUE;\r
             }\r
 \r